網頁

2010年5月20日 星期四

Ubuntu - ADSL Access

對象: 需帳密的ADSL (浮動IP)
方法:
sudo pppoeconf
進入PPPOE設定程式。
  1. 偵測你哪一張網路卡連接到ISP。他會列出所有偵測到的網路介面並詢問你他是否已找到所有網路介面
  2. 問你是否想用「noauth」、「defaultroute」選項,沒有特殊需求的話,直接答「yes」即可。
  3. 鍵入ADSL用戶名稱
  4. 鍵入ADSL密碼
  5. 問你是否使用 ISP 提供的 DNS 伺服器,沒有特殊需求的話,直接答「yes」即可。
  6. 是否要把 MSS 限制不大於1452位元組,沒有特殊需求的話,直接答「yes」即可。
  7. 問你是否想每次啟動 Ubuntu 時自動連線網路
  8. 最後會問你是否想現在即時連線上網


CSMA - Carrier Sense Multiple Access

It is difficult to detect collision in the wireless environment.
The wireless nodes must detect actively.


Therefore there are two methods to prevent collisions:

1. Before sending data, wait a period of time to listen medium state if no one exploit and then wait a random time to send data (still no one use). Because different random time, it will decrease collision possibility.

2. Before sending data, send RTS(request to send) to target and wait for CTS(clear to send). If receiving CTS, start to send data. (RTS and CTS will clear the channel)
RTS and CTS are small frame and won't cause high transfer cost. (ex. IEEE 802.11)

In other word, RTS/CTS exploit the signals to notify other nodes that there are someone sending data, so others need to wait a second.

2010年5月19日 星期三

Device Driver

Device driver
/dev : a list of device node (sudo file system)
type
major number
minor number

2 special device  nodes
dev - null
dev - zero

dev_t dev =MKDEV(major, minor)
register_chrdev


/proc/devices: list of devices

File Operations
struct file_operations scull_fops
open - initialization

2010年5月13日 星期四

[轉錄] SCREEN

使用 screen

[出自 http://tavi.debian.org.tw/index.php?page=screen ]

在命令列下打 screen 就會進入 screen 的天地:

% screen

注意,所有 screen 的指令都是以 Ctrl 鍵加上 a 鍵開始的,在之後以 C-a 代表,C-a c 代表按住 Ctrl 鍵不放再按 a 鍵,然後放開按 c 鍵;而 C-a C-c 代表按住 Ctrl 鍵不放再按 a 鍵,然後放開後再按住 Ctrl 鍵不放按 c 鍵。

開啟,關閉,切換

C-a c 或 C-a C-c 開啟新的視窗,並同時切換到這個新的視窗

C-a n 或 C-a C-n 或 C-a (space) 切換到下一個視窗(0->1 1->2 ...)

C-a p 或 C-a C-p 切換到上一個視窗(1->0 2->1 ...)

C-a C-a 切換到上一個顯示過的視窗(不是照順序切換)

C-a 0 切換到第 0 個視窗

C-a (1..9) 切換到第 (1..9) 個視窗

C-a w 或 C-a C-w 會列出目前所開啟的視窗

0$ tcsh 1$ tcsh 2*$ tcsh 3$ tcsh

有星號 "*" 的表示目前顯示中的視窗,之後的 tcsh 代表這個視窗的 title ,預設是以開啟時的 shell 名稱

C-a K 關閉所有的視窗並退出 screen

C-a ' 或 C-a " 會出現 "Switch to window:" 字樣,輸入號碼後就可切到該視窗

單一視窗使用中的指令

C-a C 清除目前的視窗內容

C-a d 或 C-a C-d 脫離(detach)目前的 screen ,並放到背景執行(不管開了幾個視窗),下面會再提到

C-a D D 強力脫離,除了放到背景執行外,並自動 logout

C-a C-g 視覺化鈴聲(visual bell)的切換,可以在畫面上顯示訊息代表一般的嗶聲

C-a H 紀錄目前視窗所有顯示過的東西(檔名為 screenlog.n n 為視窗號碼)

C-a i 或 C-a C-i 顯示目前視窗的資訊

(11,24)/(80,24)+1000 +(+)flow -ins -org +wrap +app -log -mon +r G0 [BBBB]

C-a l 或 C-a C-l 重繪視窗,如果有字顯示亂掉了可以用這個指令

C-a m 或 C-a C-m 或 C-a (enter) 可以顯示最近一次顯示過的訊息

C-a t 或 C-a C-t 顯示系統的時間及主機名稱還有負載

C-a v 顯示版本資訊

C-a x 或 C-a C-x 如果你要暫時離開目前位置又不想先 logout ,那可以用這個來鎖住 screen

C-a ? 線上求助畫面

複製/卷軸 模式

按下 C-a [ 就可以進入 複製/卷軸 模式(只有在目前視窗才算,其他視窗照常)基本上跟 vi 很像:

h, j, k, l 分別為向左,向下,向上,向右移動一格(或是一行)

0 移到該行最左邊

^ 與 $ 分別移到該行最左邊及最右邊的非空白字元

w 以字為單位往前移動並移到字首

b 以字為單位往後移動並移到字首

e 以字為單位往前移動並移到字尾

C-b 向上捲一頁

C-f 向下捲一頁

C-u 向上捲半頁

C-u 向下捲半頁

/ 與 ? 向下或向上尋找字串

(space) 第一次按下到第二次按下的區域會被複製到暫存區內

(ESC) 離開 複製/卷軸 模式

接著按下 C-a ] 便可以把剛剛存到暫存區內的內容複製出來。

善用 screen

前面提到當按了 C-a d 脫離了 screen 後,會回到沒有執行 screen 時的狀態,但是同時在之前 screen 裡每個視窗內在跑的 process (不管是前景或背景執行的)仍然繼續執行,即使 logout 也不會有影響。所以你可能接著離開身邊的電腦,然後跑出去喝個水,或者另外找個舒服的地方坐下來再接著剛剛的工作。

好,當你重新登入(login)之後,要怎麼接回剛剛的 screen 呢?重打 screen 只會讓電腦另外又開個 screen 給你,你所要做的事就是加些參數:

screen -ls 顯示目前個人所有的 screen

% screen -ls

There are screens on:

1188.ttyp4.SungSung? (Attached)

76920.ttypq.SungSung? (Detached)

2 Sockets in /tmp/screens/S-AlanSung?.

上面的 Attached 表示你現在連接的 screen ,而 Detached 則表示沒有連接的,最後則是共有多少個 screen 數量

screen -r 就是重新回到(resume)screen 裡,如果你只有開一個 screen ,那只要簡單地打

% screen -r

就沒問題了,但是像上面那個,如果你有了兩個以上的 screen ,這樣就有問題了

% screen -r

There are several screens on:

1188.ttyp4.SungSung? (Detached)

76920.ttypq.SungSung? (Detached)

Type "screen [-d] -r [pid.]tty.host" to resume one of them.

如它的訊息所述,你可以加上它的 process id 或是使用的 tty 加上主機名來決定要接回那一個 screen 。假設在這裡我們要接回 process id 為 1188 的那一個,就打

% screen -r 1188



% screen -r ttyp4



% screen -r ttyp4.SungSung?



% screen -r 1188.ttyp4.SungSung?

都可以

screen -d 假設現在自己的電腦突然當機,或是網路突然斷了一時連不上去,等到好了之後,想要接回來原來的 screen 卻發現

% screen -r

There is a screen on:

1188.ttyp4.SungSung? (Attached)

There is no screen to be resumed.

這時候 -d 這個參數就派上用場了,讓你可以控制某個 screen 脫離(detach),接著再加上 -r 把這個 screen 接手回來

% screen -d

[1188.ttyp4.SungSung? detached.]

% screen -r

或直接

% screen -d -r

screen -wipe 有時候不小心跳電了,這時候重開機後當然也不會有 screen 留著,但是由於 screen 會有紀錄所有的 screen ,因為雖然舊的沒有了,可是還是有紀錄在,因此這個指令就是把廢棄不用的 screen 給"擦拭乾淨"(wipe)

There are screens on:

69103.ttyp5.SungSung? (Removed)

529.ttyp0.SungSung? (Detached)

1 socket wiped out.

1 Socket in /tmp/screens/S-AlanSung?.

會用了上面所介紹的功能,你可以現在進入 bbs ,進入聊天室跟人聊天或是在上面發表文章到一半,發現計中要關門了,你可以從容的 detach ,回家之後再連回來 attach ,繼續剛剛的話題或發表文章,而對方可能根本沒發覺。只要你連線的主機不當機,那電話線或網路再怎麼不穏都不必怕斷線。

如果你需要更多詳細的資料,可以善用線上手冊(manual pages)或是 info 這個指令

% man screen

% info screen

2010年5月12日 星期三

VSPM

Linux Highlight (1)

lsmod (list modules)- observe how many modules included in kernel now
         -- display content: module name, size, and used by
 
insmod (insert modules) - mount modules to the kernel
rmmod (remove modules) - unmount modules from the kernel


TODO

HW/SW Co-Design Note

Synthesis 合成  Allocation + Binding + Scheduling

排程(scheduling)、連結(binding)、與分配(allocation)
                          (運算對資源的指定)    (貼標籤)

Problem : what is the goal? (計算)
Architecture : system arch. (表示component 與其連接)
Specification : Possible Mapping

partitioning - optimization
computation < --------------MAPPING--------------- > component

Bi-partitioning :     SW       +          HW
                         processor +       ASIC

Partitioning (Level of Abstraction)
functional - system level - system parameter unknown
structural - RTL level , netlist level

[Reference]
http://www.nioswiki.com/