Tải bản đầy đủ (.pdf) (13 trang)

Advanced Operating Systems: Lecture 30 - Mr. Farhan Zaidi

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (611.32 KB, 13 trang )

CS703 ­ Advanced 
Operating Systems
By Mr. Farhan Zaidi


Lecture No. 
30


Consistency problem?


The Big File System Promise: persistence

it will hold your data until you explicitly delete it
 (and sometimes even beyond that: backup/restore)
What’s hard about this? Crashes
 If your data is in main memory, a crash destroys it.
 Performance tension: need to cache everything. But if so,
then crash = lose everything.
 More fundamental: interesting ops = multiple block
modifications, but can only atomically modify disk a sector
at a time.





Indexed Allocation




Need index table
Random access


Indexed Allocation: 
Brings all pointers together into the 
index block.

index table


UNIX: All disks are divided into five parts …


Boot block




Superblock




contains descriptors (i-nodes) for each file on the disk; all i-nodes
are the same size; head of freelist is in the superblock

File contents area





specifies boundaries of next 3 areas, and contains head of
freelists of i-nodes and file blocks

i-node area




can boot the system by loading from this block

fixed-size blocks; head of freelist is in the superblock

Swap area


holds processes that have been swapped out of memory


The “block list” portion of the i­node 
(Unix Version 7)


Each i-node contains 13 block pointers
 first 10 are “direct pointers” (pointers to 512B blocks of file
data)
 then, single, double, and triple indirect pointers




0
1






10
11
12










A later version of Bell Labs Unix utilized 12 direct pointers rather
than 10



Berkeley Unix went to 1KB block sizes





What’s the effect on the maximum file size?
 256x256x256x1K = 17 GB

Suppose you went 4KB blocks?


1Kx1Kx1Kx4K = 4TB


i­node Format










User number
Group number
Protection bits
Times (file last read, file last written, inode last written)
File code: specifies if the i-node represents a directory, an
ordinary user file, or a “special file” (typically an I/O device)
Size: length of file in bytes

Block list: locates contents of file (in the file contents area)
Link count: number of directories referencing this i-node





Creating synonyms: Hard and soft links


More than one dir entry can refer to a given file


to make: “ln foo bar” creates a
synonym (‘bar’) for ‘foo’
Soft links:




Unix stores count of pointers (“hard links”) to inode



foo

bar
ref = 2
...


also point to a file (or dir), but object can be deleted from
underneath it (or never even exist).



×