1 Pertemuan 22 Implementasi Sistem File Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5
2 Learning Outcomes Pada akhir pertemuan ini, diharapkan mahasiswa akan mampu : menunjukkan implementasi sistem file (C3)
3 Outline Materi Contiguous Allocation Linked list allocation Linked list allocation using Table I-Nodes Implementasi directory Disk space management
4 File System Implementation A possible file system layout
5 Implementing Files (1) (a) Contiguous allocation of disk space for 7 files (b) State of the disk after files D and E have been removed + simplicity: only remember disk address & number of blocks in the file read performance – fragmentation
6 Implementing Files (2) Storing a file as a linked list of disk blocks + minimal fragmentation – random access is slow
7 Implementing Files (3) Linked list allocation using a file allocation table (FAT) in RAM + minimal fragmentation, random access is easier – entire table must be in memory all the time
8 Implementing Files (4) An example i-node + in memory when the file is open – disk address may insufficient use the last address as the address of more disk block addresses
9 Implementing Directories The directory entries provide information needed to find the disk blocks The information may be: the disk address of the entire file (contiguous) the number of first block (linked list) The number of I-node
10 Implementing Directories (1) (a) A simple directory (for MS-DOS/Windows) fixed size entries disk addresses and attributes in directory entry (b) Directory in which each entry just refers to an i-node (for UNIX)
11 Implementing Directories (2) Two ways of handling long file names in directory –(a) In-line –(b) In a heap
12 Shared Files (1) File system containing a shared file – consistency problem in update disk blocks are listed in the data structure/I-node instead of directories OR use symbolic linking which contains the file’s path name
13 Shared Files (2) (a) Situation prior to linking (b) After the link is created (c)After the original owner removes the file
14 Disk Space Management (1) Dark line (left hand scale) gives data rate of a disk Dotted line (right hand scale) gives disk space efficiency All files 2KB Block size
15 Disk Space Management (2) (a) Storing the free list on a linked list (b) A bit map
16 Disk Space Management (3) Quotas for keeping track of each user’s disk use
17 File System Reliability Backups Strategies for dumping disk to a tape –Physical dump From block 0 until last –Logical dump Dump all files and directories changed since given base date
18 File System Reliability (1) -- Logical dump A file system to be dumped –squares are directories, circles are files –shaded items, modified since last dump –each directory & file labeled by i-node number File that has not changed
19 File System Reliability (2) Bit maps used by the logical dumping algorithm (a)Dump changed files and all directories, then (b)Dump changed files and directories above them (c)+ (d) (b)
20 File System Reliability (3) File system states (a) consistent (b) missing block (c) duplicate block in free list (d) duplicate data block
21 File System Performance (1) The block cache data structures
22 File System Performance (2) I-nodes placed at the start of the disk Disk divided into cylinder groups –each with its own blocks and i-nodes
23 Log-Structured File Systems With CPUs faster, memory larger –disk caches can also be larger –increasing number of read requests can come from cache –thus, most disk accesses will be writes LFS Strategy structures entire disk as a log –have all writes initially buffered in memory –periodically write these to the end of the disk log –when file opened, locate i-node, then find blocks