1 pertemuan 22 implementasi sistem file matakuliah: t0316/sistem operasi tahun: 2005 versi/revisi: 5

23
1 Pertemuan 22 Implementasi Sistem File Matakuliah : T0316/sistem Operasi Tahun : 2005 Versi/Revisi : 5

Upload: anne-mckinney

Post on 21-Jan-2016

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Pertemuan 22 Implementasi Sistem File Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

1

Pertemuan 22Implementasi Sistem File

Matakuliah : T0316/sistem Operasi

Tahun : 2005

Versi/Revisi : 5

Page 2: 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)

Page 3: 1 Pertemuan 22 Implementasi Sistem File Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

3

Outline Materi

• Contiguous Allocation• Linked list allocation• Linked list allocation using Table• I-Nodes• Implementasi directory• Disk space management

Page 4: 1 Pertemuan 22 Implementasi Sistem File Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

4

File System Implementation

A possible file system layout

Page 5: 1 Pertemuan 22 Implementasi Sistem File Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

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

Page 6: 1 Pertemuan 22 Implementasi Sistem File Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

6

Implementing Files (2)

Storing a file as a linked list of disk blocks

+ minimal fragmentation

– random access is slow

Page 7: 1 Pertemuan 22 Implementasi Sistem File Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

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

Page 8: 1 Pertemuan 22 Implementasi Sistem File Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

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

Page 9: 1 Pertemuan 22 Implementasi Sistem File Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

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

Page 10: 1 Pertemuan 22 Implementasi Sistem File Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

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)

Page 11: 1 Pertemuan 22 Implementasi Sistem File Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

11

Implementing Directories (2)

• Two ways of handling long file names in directory– (a) In-line– (b) In a heap

Page 12: 1 Pertemuan 22 Implementasi Sistem File Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

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

Page 13: 1 Pertemuan 22 Implementasi Sistem File Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

13

Shared Files (2)

(a) Situation prior to linking

(b) After the link is created

(c)After the original owner removes the file

Page 14: 1 Pertemuan 22 Implementasi Sistem File Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

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

Page 15: 1 Pertemuan 22 Implementasi Sistem File Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

15

Disk Space Management (2)

(a) Storing the free list on a linked list(b) A bit map

Page 16: 1 Pertemuan 22 Implementasi Sistem File Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

16

Disk Space Management (3)

Quotas for keeping track of each user’s disk use

Page 17: 1 Pertemuan 22 Implementasi Sistem File Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

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

Page 18: 1 Pertemuan 22 Implementasi Sistem File Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

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 hasnot changed

Page 19: 1 Pertemuan 22 Implementasi Sistem File Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

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)

Page 20: 1 Pertemuan 22 Implementasi Sistem File Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

20

File System Reliability (3)

• File system states(a) consistent(b) missing block(c) duplicate block in free list(d) duplicate data block

Page 21: 1 Pertemuan 22 Implementasi Sistem File Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

21

File System Performance (1)

The block cache data structures

Page 22: 1 Pertemuan 22 Implementasi Sistem File Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

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

Page 23: 1 Pertemuan 22 Implementasi Sistem File Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5

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