CH 5.0ok
CH 5.0ok
0 : File Management
Learning Outcomes
5.0 Understand File Management in Operating System
5.1 Describe three type of file structure / directory structure
a. Single - Level Directory
b. Two level directory
c. Tree – structured directory
5.2 Various method of storing files
a. Contiguous allocation
b. Link list allocation (disk blocks)
c. Link list allocation using index (table in main memory)
d. Index-node
Internal File Structure
• Files can be structured in any of several ways. Three
common possibilities are three kinds of files. (a) Byte
sequence. (b) Record sequence. (c) Tree.
– Stream of Bytes. The file is an unstructured sequence of
bytes. In effect, the operating system does not know or care
what is in the file. All it sees are bytes. Both UNIX and
Windows use this approach.
– Records. The first step up in structure is a sequence of fixed-
length records, each with some internal structure.
– Tree of Records. The third kind of file structure is a file
consists of a tree of records, not necessarily all the same
length, each containing a key field in a fixed position in the
record.
Internal File Structure
10
16 25
• Free –space – management system: keep track free disk space. The
system maintain a free – space list.
• The free – space list records all free disk block(those not allocated to
some file or directory)
• To create a file, we search a free – space list for required amount of
space and allocate that space to the new file.
• If space is allocated, it will removed from free- space list.
• When a file is deleted, its disk space is added to the free – space list.
• Free – space allocation method influence:
– Efficiency of use of disk space
– Performance of file system
– Reliability of secondary storage
Free Space Management System
• Free – space list is implemented as bit map or bit
vector
• If block is free it represent in bit 1
• If block is allocated it represent in bit 0
• Eg: Consider a disk has 30 blocks
– Where blocks 2,3,4,5,8,9,10,11,12,13,17,18,25,26 and
27 are free, and the rest of the blocks are allocated.
– What is bit vector for disk above ?
– Bit vector : 0011110011111100011000000111000
Free Space Management System
A disk has 35 blocks in which no. blocks 5, 7, 9, 12,
13, 24, 28, 29, 31, and 34 have been allocated to
specific files.