Presentation is loading. Please wait.

Presentation is loading. Please wait.

Operating Systems (CS 340 D)

Similar presentations


Presentation on theme: "Operating Systems (CS 340 D)"— Presentation transcript:

1 Operating Systems (CS 340 D)
Princess Nora University Faculty of Computer & Information Systems Computer science Department Operating Systems (CS 340 D)

2 File System Implementation

3 Chapter 12: File System Implementation
Allocation Methods Free Space Management

4 OBJECTIVES: Introduction to file system structure. To discuss block allocation and free-block algorithms

5 File-System Structure

6 File systems Disks: File systems
A disk can access directly any block of information it contains. Thus, it is simple to access any file either sequentially or randomly, File systems file system resides permanently on secondary storage,

7 File systems A file system poses two different design problems: The first problem is defining how the file system should look to the user. This task involves defining a file and its attributes, the operations allowed on a file, and the directory structure for organizing files. The second problem is creating algorithms and data structures to map the logical file system onto the physical secondary-storage devices

8 File-System Structure
File structure Logical storage unit Collection of related information File system resides on secondary storage (disks) Provided user interface to storage, mapping logical file system to physical Provides efficient and convenient access to disk by allowing data to be stored, located retrieved easily File control block–storage structure consisting of information about a file Device driver controls the physical device

9 File-System Implementation

10 File-System Implementation
Several on-disk and in-memory structures are used to implement a file system. On-disk structures : Boot control block: (per volume) - contains info. needed by system to boot OS from that volume If the disk does not contain an OS, this block can be empty. Volume control block (superblock /master file table): (per volume)- contains volume details such as total # of blocks, # of free blocks, block size, free block pointers . Directory structure: (per file system) - is used to organize the files. File Control Block (FCB): (per file)- contains many details about the file

11 Allocation Methods

12 Allocation Methods Contiguous allocation Linked allocation
An allocation method refers to how disk blocks are allocated for files: Contiguous allocation Linked allocation Indexed allocation *

13 1-Contiguous Allocation

14 Contiguous Allocation
Basic Idea: Each file occupies a set of contiguous blocks on the disk The directory entry for each file indicates : address of the starting block length of the area allocated for this file

15 Contiguous Allocation (cont.)
Pros. (++): Simple Good performance-the number of disk head seeks required for accessing contiguously allocated files is minimal It support sequential and direct access efficiently Cons. (--): Dynamic storage-allocation problem (how to satisfy a request of size n from a list of free holes). First fit and best fit are the most common strategies used External fragmentation One solution is compaction (/defragmentation) which is time consuming File is difficult to grow Size declaration problem :How does the creator know the size of the file to be created?

16 Contiguous Allocation (cont.)
Many newer file systems use a modified contiguous- allocation scheme: a contiguous chunk of space is allocated initially; then, if that amount proves not to be large enough, another chunk of contiguous space, known as an extent, is added (i.e. A file consists of one or more extents) The location of a file’s blocks is then recorded as: a location a block count a link to the first block of the next extent This scheme is used to improve performance

17 2-Linked Allocation

18 Linked Allocation Basic Idea:
Each file is a linked list of disk blocks: blocks may be scattered anywhere on the disk The directory contains a pointer to the first and last blocks of the file. pointer block = *

19 Linked Allocation Pros. (++): Cons. (--):
Simple – need only starting address No external fragmentation A file can grow - no need for disk compaction no size declaration problem It is efficient for sequential access Cons. (--): It is inefficient for direct access low performance-It may required multiple disk head seeks to access single file’s blocks because the block is scattered A space is required for the pointers. Low reliability: what happen if a pointer damaged or lost?? *

20 3-Indexed Allocation

21 Indexed Allocation Method
Basic Idea: Each file has its own index block which is an array of disk-block addresses The directory contains the address of the index block. To find and read the ith block, we use the pointer in the ith index- block entry. *

22 Indexed Allocation (cont.)
Pros. (++): Efficient for direct access No external fragmentation Cons. (--): It needs index table….(wasted space) low performance-It may required multiple disk head seeks to access single file’s blocks because the block is scattered wasted space is more than pointers’ space used in linked allocation method Same as performance problem of linked allocation method

23 Thank you The End


Download ppt "Operating Systems (CS 340 D)"

Similar presentations


Ads by Google