1.
為了提升I/O efficiency,memory和disk之間的I/O transfers是以block做單位。每個block由一個或多個sectors組成。根據disk drive的不同,sector size在32 bytes到4096 bytes之間變動,一般是512 bytes。
2.
File system由許多層架構組成。依序是:
application programs
logical file system
file-organization module(將logical block address轉換成physical block address給basic file system使用)
basic file system
I/O control
3.
File system的組成:
A boot control block(per volume)提供資訊讓OS能從這個volume開機。
A volume control block(per volume)包含這個volume的細節,例如說在partition中的blocks數量,blocks大小,a free-block count和free-block pointers,和a free-FCB count and FCB pointers。
FCB(File Control Block): 在UNIX中稱為inode,包含file的資訊,例如ownership,permissions,和location of the file contents。
A directory structure(per file system)用來組織files。
A per-file FCB包含file的細節。
4.
Directory implementation的方法:
Linear List: 一個linear list紀錄file name並且有pointer指向data blocks。
Hash Table: 使用file name計算出file name在linear list之中的位置。Hash table的問題是他是fixed size的,如果hash table不夠用了,必須修改hash function才能增加位置數量。
5.
6.
Allocation Methods:
Contiguous Allocation: 每個檔案在disk上面都佔據連續的blocks,這樣process在access下一個block的時候照理來說不需要head movement(head是指讀寫頭嗎?)
Linked Allocation: 每個檔案都佔據分散的blocks,directory紀錄第一個和最後一個block的pointer,每個block則會記錄往下一個block的pointer。
Indexed Allocation: 每個檔案都有一個index block,裡面是一系列的block address,紀錄組成檔案所有的block位置。
當建立檔案時,會從free-space manager那邊獲得空的block。
7.
Free-Space Management:
Bit Vector: 用一系列的bit map來表達block是否為free。如果是free block則bit為1。這個approach在搜尋第一個free block或者是n個連續的free block時很有效率。但是除非整個vector都放在main memory中,否則bit vectors是沒有效率的。在disk空間變大的同時,bit vector也會變大。
Linked List: 紀錄第一個free block,每個free block則會紀錄指向下一個free block的pointer。但是這會讓traversing the list變得很沒效率,因為每次我們都要讀取每個block。不過traversing是個較少執行的動作,OS通常都只需要一個free block來進行分配。
Grouping: 第一個block儲存了接下來n free blocks的address,直到最後一個block又儲存了其他n free blocks的address。這個方法可以快速找到大量的free blocks。
Counting: 紀錄每一個contiguous free blocks的開始位址,還有它的長度。因為free blocks通常是連在一起的。
8.
9.
10.
11.
12.
在某些系統中transaction會將data和meta-data寫入新的blocks中,當寫入完畢時,指標會指向新的資料所在地,而舊的pointers和blocks則會留下來變成snapshot。
13.
Meta-data包含了所有file system structure,但不包含files的真正內容。
14.
The file-allocation table(FAT)是MS-DOS所使用的應用linked callocation的file system。
15.
16.
A contiguous chunk of disk blocks is known as an extent.
17.
18.
the buffer cache中儲存的是最近使用過的block,因為他們可能很快又會被使用。
19.
20.
Log-structured file system中,所有對於metadata的更動都會儲存在log中,這些set of operations被稱為transaction。當系統故障時,log file中可能包含一些OS所commit的transaction,但他們實際上還沒有執行到file system中。
21.
Unified buffer cache包含了memory-mapped I/O和ordinary I/O相同的pages。(什麼是memory-mapped I/O?)
(Memory-mapped I/O即是將I/O的port或memory mapping至memory address之上,然後就以存取記憶體的方式存取I/O)
22.
The in-memory information用來管理file-system並且增進caching的performance。這些資料在mount time時讀取,在file-system operations時更新,並且在dismount時discard。他包含了:
An in-memory mount table包含了每個mounted volume的資訊。
An in-memory directory-structure cache包含了最近存取過的directories的directory information。
The system-wide open-file table包含了每個打開的檔案的copy of the FCB。
The per-process open-file table包含了一個pointer指向the system-wide open-file table中的一個entry。
23.
要建立new file,an application program會呼叫the logical file systems。The logical file system知道the directory structures的format。首先他會allocate a new FCB(或者是如果file-system在file-system creation time時建立所有FCBs,則從the set of free FCBs中allocate一個FCB),接著將合適的directory讀進memory中,將新的file name和FCB更新至其中,最後將其寫回disk。
24.
Cooked file system代表其中有file system,而raw disk則是不適用任何file system。他可以用來UNIX swap space,因為其不需要file system。
25.
在file-system interface之下,是virtual file system(VFS) interface layer。這個layer有兩個重要的功能: 1. VSF interface提供許多file-system-generic operations使用,他們的implementations或許不同,allow transparent access to different types of file systems。2. 他提供了透過網路表示file的機制。VFS是基於一個file-representation structure,vnode所建立。其包含了一些designator for a network-wide unique file,如要support network file systems則檔案必須要有network-wide uniqueness。Kernel會對每個active node建立一個vnode(file或是directory)
26.
Linear list的搜尋速度很慢。因為directory information使用上很頻繁,這可能會影響到使用者的觀感。許多OS會實作一個software cache來記錄最近使用的directory information。也可能使用sorted list來進行binary search來降低平均搜尋時間。
27.
A hash table implementation使用linear list來儲存directory entries,他同時也使用hash data structure來透過file name來計算linear list中的file location。但hash有可能會發生collision,也就是多個file name會map到同一個位置,必須特別處理。
28.
Linked allocation主要的問題是只有sequential-access files才能有效率的使用。另一個問題是pointers需要空間。另一個問題是可靠性較低,因為pointers有可能會lost或damaged。
29.
The counting approach to free space management,見上面。
30.
沒有unified buffer cache的話,memory-mapped I/O會使用page cache,而ordinary I/O則會使用buffer cache。Buffer cache所cache的和page cache也是一樣的東西。這被稱為double caching。Unified buffer cache則是讓memory-mapped I/O和ordinary I/O使用同一個buffer cache。
為了提升I/O efficiency,memory和disk之間的I/O transfers是以block做單位。每個block由一個或多個sectors組成。根據disk drive的不同,sector size在32 bytes到4096 bytes之間變動,一般是512 bytes。
2.
File system由許多層架構組成。依序是:
application programs
logical file system
file-organization module(將logical block address轉換成physical block address給basic file system使用)
basic file system
I/O control
3.
File system的組成:
A boot control block(per volume)提供資訊讓OS能從這個volume開機。
A volume control block(per volume)包含這個volume的細節,例如說在partition中的blocks數量,blocks大小,a free-block count和free-block pointers,和a free-FCB count and FCB pointers。
FCB(File Control Block): 在UNIX中稱為inode,包含file的資訊,例如ownership,permissions,和location of the file contents。
A directory structure(per file system)用來組織files。
A per-file FCB包含file的細節。
4.
Directory implementation的方法:
Linear List: 一個linear list紀錄file name並且有pointer指向data blocks。
Hash Table: 使用file name計算出file name在linear list之中的位置。Hash table的問題是他是fixed size的,如果hash table不夠用了,必須修改hash function才能增加位置數量。
5.
6.
Allocation Methods:
Contiguous Allocation: 每個檔案在disk上面都佔據連續的blocks,這樣process在access下一個block的時候照理來說不需要head movement(head是指讀寫頭嗎?)
Linked Allocation: 每個檔案都佔據分散的blocks,directory紀錄第一個和最後一個block的pointer,每個block則會記錄往下一個block的pointer。
Indexed Allocation: 每個檔案都有一個index block,裡面是一系列的block address,紀錄組成檔案所有的block位置。
當建立檔案時,會從free-space manager那邊獲得空的block。
7.
Free-Space Management:
Bit Vector: 用一系列的bit map來表達block是否為free。如果是free block則bit為1。這個approach在搜尋第一個free block或者是n個連續的free block時很有效率。但是除非整個vector都放在main memory中,否則bit vectors是沒有效率的。在disk空間變大的同時,bit vector也會變大。
Linked List: 紀錄第一個free block,每個free block則會紀錄指向下一個free block的pointer。但是這會讓traversing the list變得很沒效率,因為每次我們都要讀取每個block。不過traversing是個較少執行的動作,OS通常都只需要一個free block來進行分配。
Grouping: 第一個block儲存了接下來n free blocks的address,直到最後一個block又儲存了其他n free blocks的address。這個方法可以快速找到大量的free blocks。
Counting: 紀錄每一個contiguous free blocks的開始位址,還有它的長度。因為free blocks通常是連在一起的。
8.
9.
10.
11.
12.
在某些系統中transaction會將data和meta-data寫入新的blocks中,當寫入完畢時,指標會指向新的資料所在地,而舊的pointers和blocks則會留下來變成snapshot。
13.
Meta-data包含了所有file system structure,但不包含files的真正內容。
14.
The file-allocation table(FAT)是MS-DOS所使用的應用linked callocation的file system。
15.
16.
A contiguous chunk of disk blocks is known as an extent.
17.
18.
the buffer cache中儲存的是最近使用過的block,因為他們可能很快又會被使用。
19.
20.
Log-structured file system中,所有對於metadata的更動都會儲存在log中,這些set of operations被稱為transaction。當系統故障時,log file中可能包含一些OS所commit的transaction,但他們實際上還沒有執行到file system中。
21.
Unified buffer cache包含了memory-mapped I/O和ordinary I/O相同的pages。(什麼是memory-mapped I/O?)
(Memory-mapped I/O即是將I/O的port或memory mapping至memory address之上,然後就以存取記憶體的方式存取I/O)
22.
The in-memory information用來管理file-system並且增進caching的performance。這些資料在mount time時讀取,在file-system operations時更新,並且在dismount時discard。他包含了:
An in-memory mount table包含了每個mounted volume的資訊。
An in-memory directory-structure cache包含了最近存取過的directories的directory information。
The system-wide open-file table包含了每個打開的檔案的copy of the FCB。
The per-process open-file table包含了一個pointer指向the system-wide open-file table中的一個entry。
23.
要建立new file,an application program會呼叫the logical file systems。The logical file system知道the directory structures的format。首先他會allocate a new FCB(或者是如果file-system在file-system creation time時建立所有FCBs,則從the set of free FCBs中allocate一個FCB),接著將合適的directory讀進memory中,將新的file name和FCB更新至其中,最後將其寫回disk。
24.
Cooked file system代表其中有file system,而raw disk則是不適用任何file system。他可以用來UNIX swap space,因為其不需要file system。
25.
在file-system interface之下,是virtual file system(VFS) interface layer。這個layer有兩個重要的功能: 1. VSF interface提供許多file-system-generic operations使用,他們的implementations或許不同,allow transparent access to different types of file systems。2. 他提供了透過網路表示file的機制。VFS是基於一個file-representation structure,vnode所建立。其包含了一些designator for a network-wide unique file,如要support network file systems則檔案必須要有network-wide uniqueness。Kernel會對每個active node建立一個vnode(file或是directory)
26.
Linear list的搜尋速度很慢。因為directory information使用上很頻繁,這可能會影響到使用者的觀感。許多OS會實作一個software cache來記錄最近使用的directory information。也可能使用sorted list來進行binary search來降低平均搜尋時間。
27.
A hash table implementation使用linear list來儲存directory entries,他同時也使用hash data structure來透過file name來計算linear list中的file location。但hash有可能會發生collision,也就是多個file name會map到同一個位置,必須特別處理。
28.
Linked allocation主要的問題是只有sequential-access files才能有效率的使用。另一個問題是pointers需要空間。另一個問題是可靠性較低,因為pointers有可能會lost或damaged。
29.
The counting approach to free space management,見上面。
30.
沒有unified buffer cache的話,memory-mapped I/O會使用page cache,而ordinary I/O則會使用buffer cache。Buffer cache所cache的和page cache也是一樣的東西。這被稱為double caching。Unified buffer cache則是讓memory-mapped I/O和ordinary I/O使用同一個buffer cache。
留言
張貼留言