9
PRINCIPLES OF OPERATING SYSTEM

File System Implementation

Embed Size (px)

DESCRIPTION

Principles of Operating System

Citation preview

Page 1: File System Implementation

PRINCIPLES OF

OPERATING SYSTEM

Page 2: File System Implementation

FILE SYSTEM IMPLEMENTATI

ONComputers store data on disks using files, which are structuredin specific ways in order to allow for faster access, higher reliability, and to make better use out of the drive's available space.

The specific way in which files are stored on a disk is called a file system, and enables files to have names and attributes.

It also allows them to be stored in a hierarchy of directories or folders arranged in a directory tree.

Page 3: File System Implementation

Directory implementatio

nLinear list of file names with pointer to the data blocks.

Simple to program Time consuming- linear search for file names required, whenever a new file is created or an existing file is deleted.

A sorted list allows binary search, thereby reducing time consumption, but this complicates creation and deletion processes.

Page 4: File System Implementation

To Overcome this problem, many operating systems implement a software cache to store the most recently used directory information from the disk.

Hash table - another data structure.

linear list stores the directory entries, but a hash data structure is also used. the hash table takes a value computed from the file name and returns a pointer to the file name in the linear list. greatly decreases directory search time. insertion and deletion are easy.

Collisions – situation in which two file names hash to the same location.

Page 5: File System Implementation

Overcome collisions

Chained overflow hash table – • each hash entry is a linked list instead of an individual value• collisions can be avoided by adding a new entry to the linked list.

Page 6: File System Implementation

ALLOCATION METHODS

An allocation method refers to how disk blocks are allocated for files.

The main problem is to allocate space to files so that disk space is utilized effectively and files can be

accessed quickly.

Page 7: File System Implementation

Three types :1.Contiguous allocation2.Linked allocation3.Indexed allocation

CONTIGUOUS ALLOCATION Each file occupy a set of contiguous

blocks on that disk.

Assuming only one job is accessing the disk, accessing block ‘k+1’ after block ‘k’ normally requires no head movement. Thus the number of disk seeks required for accessing contiguously allocated files is minimal.

Contiguous allocation of a file is defined by the disk address and length of the first block

Page 8: File System Implementation

The directory entry for each file indicates the address of the starting block and the length of the area allocated for the file.

Easy Accessing – only starting location (block #) and length (number for blocks) are required.

Files cannot grow.

Page 9: File System Implementation

That’sAll