Presentation is loading. Please wait.

Presentation is loading. Please wait.

F ILE M ANAGEMENT Prepared By: Dr. Vipul Vekariya.

Similar presentations


Presentation on theme: "F ILE M ANAGEMENT Prepared By: Dr. Vipul Vekariya."— Presentation transcript:

1 F ILE M ANAGEMENT Prepared By: Dr. Vipul Vekariya

2 2 L ONG - TERM I NFORMATION S TORAGE 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

3 F ILES Files are the central element to most applications The File System is one of the most important part of the OS to a user Desirable properties of files: Long-term existence Sharable between processes Structure File management system consists of system utility programs that run as privileged applications Concerned with secondary storage

4 F ILE M ANAGEMENT S YSTEMS Provides services to users and applications in the use of files The way a user or application accesses files Programmer does not need to develop file management software. Four terms are in common use when discussing files: Field Record File Database

5 O BJECTIVES FOR A F ILE M ANAGEMENT S YSTEM Meet the data management needs of the user Guarantee that the data in the file are valid Optimize performance Provide I/O support for a variety of storage device types Minimize lost or destroyed data Provide a standardized set of I/O interface routines to user processes Provide I/O support for multiple users (if needed)

6 6 F ILE N AMING Typical file extensions.

7 7 F ILE S TRUCTURE Three kinds of files byte sequence record sequence tree

8 8 F ILE A CCESS 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

9 9 F ILE A TTRIBUTES Possible file attributes

10 10 F ILE O PERATIONS 1. Create 2. Delete 3. Open 4. Close 5. Read 6. Write 7. Append 8. Seek 9. Get attributes 10. Set Attributes 11. Rename

11 11 D IRECTORIES S INGLE -L EVEL D IRECTORY S YSTEMS A single level directory system contains 4 files owned by 3 different people, A, B, and C

12 12 T WO - LEVEL D IRECTORY S YSTEMS Letters indicate owners of the directories and files

13 13 H IERARCHICAL D IRECTORY S YSTEMS A hierarchical directory system

14 14 A UNIX directory tree P ATH N AMES

15 15 D IRECTORY O PERATIONS 1. Create 2. Delete 3. Opendir 4. Closedir 5. Readdir 6. Rename 7. Link 8. Unlink

16 S ECONDARY S TORAGE M ANAGEMENT On secondary storage, a file consists of a collection of blocks. The Operating System is responsible for allocating blocks to files Two related issues Space must be allocated to files Must keep track of the space available for allocation

17 17 F ILE S YSTEM I MPLEMENTATION A possible file system layout

18 F ILE A LLOCATION M ETHOD Three methods are in common use: contiguous, chained, and Indexed Node ( I Node)

19 C ONTIGUOUS A LLOCATION Single set of blocks is allocated to a file at the time of creation Only a single entry in the file allocation table Starting block and length of the file External fragmentation will occur Need to perform compaction

20 20 I MPLEMENTING F ILES (a) Contiguous allocation of disk space for 7 files (b) State of the disk after files D and E have been removed

21 C ONTIGUOUS F ILE A LLOCATION

22 E XTERNAL FRAGMENTATION

23 C HAINED A LLOCATION Allocation on basis of individual block Each block contains a pointer to the next block in the chain Only single entry in the file allocation table Starting block and length of file No external fragmentation Best for sequential files

24 C HAINED A LLOCATION

25 I NDEXED A LLOCATION (I N ODE ) File allocation table contains a separate one-level index for each file The index has one entry for each portion allocated to the file The file allocation table contains block number for the index

26 I NDEXED A LLOCATION M ETHOD Allocation may be either Fixed size blocks or Variable sized blocks Allocating by blocks eliminates external fragmentation Variable sized blocks improves locality

27 I NDEXED ALLOCATION WITH B LOCK P ORTIONS

28 I NDEXED A LLOCATION WITH V ARIABLE L ENGTH P ORTIONS


Download ppt "F ILE M ANAGEMENT Prepared By: Dr. Vipul Vekariya."

Similar presentations


Ads by Google