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

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

Post on 19-Dec-2015

236 views

Category:

Documents


0 download

TRANSCRIPT

1

Pertemuan 21Sistem File

Matakuliah : T0316/sistem Operasi

Tahun : 2005

Versi/Revisi : 5

2

Learning Outcomes

Pada akhir pertemuan ini, diharapkan mahasiswa

akan mampu :• menjelaskan konsep sistem file (C2)

3

Outline Materi

• Penamaan file• Struktur file• Tipe File• Pengaksesan file• Operasi file• Direktori

4

Long-term Information Storage

1. Must store large amounts of data

2. Information stored must survive the termination of the process using it

3. Multiple processes must be able to access the information concurrently

5

File Naming

Typical file extensions

6

File Structure

• Three kinds of files– byte sequence– record sequence– tree

7

File Types

Regular file ASCII/binary

Directories

Character special file

Block special file

8

File Types (binary files)

(a) An executable file (b) An archive

Header

Text

Data

Relocation bits

Symbol table

Collection of library procedures (modules) compiled but not linked

9

File Access

• Sequential access– read all bytes/records from the beginning– cannot jump around, could rewind or back up– convenient when medium was mag tape

• Random access– bytes/records read in any order– essential for data base systems– read can be …

• move file marker (seek), then read or …• read and then move file marker

10

File Attributes

Possible file attributes

11

File Operations

1. Create

2. Delete

3. Open

4. Close

5. Read

6. Write

7. Append

8. Seek

9. Get attributes

10.Set Attributes

11.Rename

12

An Example Program Using File System Calls (1/2)

Eg. copyfile abc xyz

13

An Example Program Using File System Calls (2/2)

14

Memory-Mapped Files

(a) Segmented process before mapping files into its address space

(b) Process after mapping existing file abc into one segment

creating new segment for xyz

+ eliminates I/O – hard to know exact length of output files, consistency for shared files, file may larger than segment

15

DirectoriesSingle-Level Directory Systems

• A single level directory system– contains 4 files– owned by 3 different people, A, B, and C

16

Two-level Directory Systems

Letters indicate owners of the directories and files

17

Hierarchical Directory Systems

A hierarchical directory system

18

A UNIX directory tree

Path Names

•Absolute vs relative path name

19

Directory Operations

1. Create

2. Delete

3. Opendir

4. Closedir

5. Readdir

6. Rename

7. Link

8. Unlink