Mass Storage Structure
OVERVIEW
Magnetic disks provide bulk of secondary storage of computer system TIMES.
Hard disk is most popular.
Some magnetic disks could be removable.
Disk attached to computer through I/O busses (USB, SCSI, EIDE, SATA….)
Drives rotate at 60 to 250 times per second.
Disks has platters.
They are ranging from .85” to 14”.
Capacity ranges from 30GB to 3TB per drive, even bigger.
OVERVIEW
 Performance
 Transfer Rate : 6Gb/Sec
 Effective Transfer Rate: 1Gb/Sec
 Seek time : 3ms to 12ms.
 Average seek time calculated based on 1/3 of tracks.
 Latency based on spindle speed.
 Average Latency=1/2 latency.
OVERVIEW
 Performance
 Access Latency=Average Access Time=Average Seek Time+Average Latency
 Average I/O Time=Average Access Time+(Amount to transfer/transfer
rate)+Controller Overhead.
DISK STRUCTURE
DISK STRUCTURE
DISK SCHEDULING
Purpose of Disk Scheduling
The main purpose of disk scheduling algorithm is to select a disk request from the queue of
IO requests and decide the schedule when this request will be processed.
Goals of Disk Scheduling
Fairness
High throughout
Minimal traveling head time
DISK SCHEDULING
Algorithms
FCFS scheduling algorithm
SSTF (shortest seek time first) algorithm
SCAN scheduling
C-SCAN scheduling
LOOK Scheduling
C-LOOK scheduling
DISK SCHEDULING
FCFS scheduling algorithm
It is the simplest Disk Scheduling algorithm.
It services the IO requests in the order in which they arrive.
There is no starvation in this algorithm, every request is serviced.
Disadvantages
The scheme does not optimize the seek time.
The request may come from different processes therefore there is the possibility of
inappropriate movement of the head.
DISK SCHEDULING
FCFS scheduling algorithm
Consider the following disk request sequence for a disk with 100 tracks 45, 21, 67, 90, 4, 50,
89, 52, 61, 87, 25. Head pointer starting at 50 and moving in left direction. Find the number
of head movements in cylinders using FCFS scheduling.
Solution:
Number of cylinders moved by the head
= (50-45)+(45-21)+(67-21)+(90-67)+(90-4)+(50-4)+(89-50)+(61-52)+(87-61)+(87-25)
= 5 + 24 + 46 + 23 + 86 + 46 + 49 + 9 + 26 + 62
= 376
DISK SCHEDULING
SSTF (shortest seek time first) algorithm
Selects the request with minimum seek time from the current head position.
SSTF scheduling is a form of SJF scheduling, starvation may exist.
It reduces the total seek time as compared to FCFS.
Advantages
Average response time decreases.
Throughput increases.
Disadvantages
Overhead to calculate seek time in advance.
Can cause starvation for a request if it has higher seek time as compared to incoming request.
Frequent switching direction slows the working of algorithm.
It is not the most optimal algorithm.
Example:
45, 21, 67, 90, 4, 89, 52, 61, 87, 25. Head pointer starting at 50.
Number of cylinders = 5 + 7 + 9 + 6 + 20 + 2 + 1 + 65 + 4 + 17 = 136
DISK SCHEDULING
SCAN Algorithm
SCAN algorithm sometimes is called the elevator algorithm.
Disk arm starts at one end of the disk, and moves toward the other end.
Service requests during the movement until it gets to the other end.
Then, the head movement is reversed and servicing continues.
Advantages
High Throughput.
Low variance of response time.
Average response time
Disadvantages
Long waiting time for requests for locations just visited by disk arm.
Example:
98, 137, 122, 183, 14, 133, 65, 78. Head pointer starting at 54 and moving in left direction.
Number of Cylinders = 40 + 14 + 65 + 13 + 20 + 24 + 11 + 4 + 46 = 237
DISK SCHEDULING
C-SCAN Algorithm
Circular-SCAN is designed to provides a more uniform wait time.
Head moves from one end to the other, servicing requests while going.
When the head reaches the end, it immediately returns to the beginning.
-without servicing any requests on the return trip then it turns back and start
moving in that direction servicing the remaining requests..
Advantages
Provides more uniform wait time.
Example:
98, 137, 122, 183, 14, 133, 65, 78. Head pointer starting at 54 and moving in left direction.
No. of cylinders crossed = 40 + 14 + 199 + 16 + 46 + 4 + 11 + 24 + 20 + 13 = 387
DISK SCHEDULING
LOOK Algorithm
It is like SCAN scheduling Algorithm to some extant except the difference that, in this
scheduling algorithm, the arm of the disk stops moving inwards (or outwards) when no
more request in that direction exists. This algorithm tries to overcome the overhead of
SCAN algorithm which forces disk arm to move in one direction till the end regardless of
knowing if any request exists in the direction or not.
Example
Consider the following disk request sequence for a disk with 100 tracks
98, 137, 122, 183, 14, 133, 65, 78. Head pointer starting at 54 and moving left direction.
Number of cylinders crossed = 40 + 51 + 13 + +20 + 24 + 11 + 4 + 46 = 209
DISK SCHEDULING
C-LOOK Algorithm
C Look Algorithm is similar to C-SCAN algorithm to some extent. In this algorithm, the arm of
the disk moves outwards servicing requests until it reaches the highest request cylinder,
then it jumps to the lowest request cylinder without servicing any request then it again start
moving outwards servicing the remaining requests.
It is different from C SCAN algorithm in the sense that, C SCAN force the disk arm to move
till the last cylinder regardless of knowing whether any request is to be serviced on that
cylinder or not.
Example
Consider the following disk request sequence for a disk with 100 tracks
98, 137, 122, 183, 14, 133, 65, 78
Head pointer starting at 54 and moving in left direction.
Number of cylinders crossed = 11 + 13 + 20 + 24 + 11 + 4 + 46 + 169 = 298
FILE SYSTEM
A file is a named collection of related information that is recorded on secondary storage
such as magnetic disks, magnetic tapes and optical disks.
The file may have attributes like name, creator, date, type, permissions , protection etc.
Name . It is the only information which is in human-readable form.
Identifier. The file is identified by a unique tag(number) within file system.
Type. It is needed for systems that support different types of files.
Location. Pointer to file location on device.
Size. The current size of the file.
Protection. This controls and assigns the power of reading, writing, executing.
Time, date, and user identification. This is the data for protection, security, and usage
monitoring.
File Type
File type refers to the ability of the operating system to identify different types of file such as
text files source files and binary files etc.
File Type Extension Function
Executable exe, com, bin
Read to run machine
language program
Object obj, o
Compiled, machine
language not linked
Source Code C, java, pas, asm, a
Source code in various
languages
Batch bat, sh
Commands to the
command interpreter
Text txt, doc Textual data, documents
Word Processor wp, tex, rrf, doc
Various word processor
formats
Multimedia mpeg, mov, rm
For containing
audio/video information
FILE ACCESS MECHANISM
It refers to the manner in which way records of file can be accessed.
Sequential access
Direct/Random access
Indexed sequential access
Sequential Access
A sequential access is that in which the records are accessed in some sequence. The
information in the file can be accesses on after another.
This access method is the most primitive one. Most of the operating systems access the
file sequentially.
Example: Compilers usually access files in this fashion.
Direct /Random Access
Accessing the records directly.
Each record has its own address on the file with by the help of which it can be directly
accessed for reading or writing.
The records need not be in any sequence within the file and they need not be in adjacent
locations on the storage medium.
The Direct Access is mostly required in the case of
database systems. In most of the cases, we need
filtered information from the database. The
sequential access can be very slow and inefficient in
such cases.
Indexed Sequential Access
If a file can be sorted then an index can be assigned to group of certain records.
A particular record can be accessed by its index.
The index is nothing but the address of a record in the file.
An index is created for each file which contains pointers to various blocks.
Index is searched sequentially and its pointer is used to access the file directly.
Advantages:
Searching in a large database became very quick and easy.
File Directories
Collection of files is a file directory. The directory contains information about the files,
including attributes, location and ownership.
Information contained in a device directory are:
1. Name
2. Type
3. Address
4. Current length
5. Maximum length
6. Date last accessed
7. Date last updated
8. Owner id
9. Protection information
Operation performed on directory are:
Search for a file
Create a file
Delete a file
List a directory
Rename a file
Traverse the file system
Advantages of maintaining directories are:
Efficiency: A file can be located more quickly.
Naming: It becomes convenient for users as two users can have same name for different files
or may have different name for same file.
Grouping: Logical grouping of files can be done by properties e.g. all java programs, all
games etc.
Single Level Directory
The entire system will contain only one directory which is supposed to mention all the files
present in the file system.
The directory contains one entry per each file present on the file system.
This type of directories can be used for a simple system.
Advantages
Implementation is very simple.
If the sizes of the files are very small then the searching becomes faster.
File creation, searching, deletion is very simple since we have only one directory.
Disadvantages
We cannot have two files with the same name.
The directory may be very big therefore searching for a file may take so much time.
Protection cannot be implemented for multiple users.
There are no ways to group same kind of files.
Choosing the unique name for every file is a bit complex .
Two Level Directory
In this separate directories for each user is maintained.
There is one master directory which contains separate directories dedicated to each user.
For each user, there is a different directory present at the second level, containing group of
user's file.
The system doesn't let a user to enter in the other user's directory without permission.
Characteristics of two level directory system
Each files has a path name as /User-name/directory-name/
Different users can have the same file name.
Searching becomes more efficient as only one user's list needs to be traversed.
The same kind of files cannot be grouped into a single directory for a particular user.
Tree-structured directory
In Tree structured directory system, any directory entry can either be a file or sub directory.
Tree structured directory system overcomes the drawbacks of two level directory system.
The similar kind of files can now be grouped in one directory.
Each user has its own directory and it cannot enter in the other user's directory.
Searching is more efficient in this directory structure. The concept of current working
directory is used. A file can be accessed by two types of path, either relative or absolute.
Absolute path is the path of the file with respect to the root directory of the system while
relative path is the path with respect to the current working directory of the system.
Acyclic -Graph structured directory
The tree structured directory system doesn't allow the same file to exist in multiple
directories therefore sharing is major concern in tree structured directory system.
We can provide sharing by making the directory an acyclic graph. In this system, two or
more directory entry can point to the same file or sub directory. That file or sub directory
is shared between the two directory entries.
We can have multiple paths for a same file.
Links can either be symbolic (logical) or hard link (physical).
File Allocation Methods
Files are allocated disk spaces by operating system.
Contiguous Allocation
Linked Allocation
Indexed Allocation
Contiguous Allocation
Each file occupies a contiguous address space on disk.
Assigned disk address is in linear order.
Easy to implement.
External fragmentation is a major issue with this type of allocation technique.
Linked Allocation
Each file carries a list of links to disk blocks.
Directory contains link / pointer to first block of a file.
No external fragmentation
Effectively used in sequential access file.
Inefficient in case of direct access file.
Advantages:
™File size does not have to be specified. ™
No external fragmentation.
Disadvantages:
™It does sequential access efficiently and is not for direct access ™.
Each block contains a pointer, wasting space .
™Blocks scatter everywhere and a large number of disk seeks may be necessary .
™Reliability: what if a pointer is lost or damaged?
Indexed Allocation
•Provides solutions to problems of contiguous and linked allocation.
•A index block is created having all pointers to files.
•Each file has its own index block which stores the addresses of disk space occupied by the
file.
•Directory contains the addresses of index blocks of files.
•Each file has an index block that is an array of disk block addresses. ‰
•The i-th entry in the index block points to the i-th block of the file. ‰
•A file’s directory entry contains a pointer to its index.
•Hence, the index block of an indexed allocation plays the same role as the page table.
•‰Index allocation supports both sequential and direct access without external fragmentation.
Free Space Management
How do we keep track free blocks on a disk?
‰A free-list is maintained.
When a new block is requested, we search this list to find one. ‰
The following are commonly used techniques:
™Bit Vector ™
Linked List
™Linked List + Grouping
™Linked List+Address+Count
Bitmap
This technique is used to implement the free space management.
When the free space is implemented as the bitmap or bit vector then each block of the disk
is represented by a bit.
When the block is free its bit is set to 1 and when the block is allocated the bit is set to 0.
The main advantage of the bitmap is it is relatively simple and efficient in finding the first
free block and also the consecutive free block in the disk.
Advantages:
This technique is relatively simple.
This technique is very efficient to find the free space on the disk.
Disadvantages:
This technique requires a special hardware support to find the first 1 in a word it is not 0.
This technique is not useful for the larger disks.
Linked List
This is another technique for free space management. In this linked list of all the free block is
maintained. In this, there is a head pointer which points the first free block of the list which
is kept in a special location on the disk. This block contains the pointer to the next block
and the next block contain the pointer of another next and this process is repeated. By using
this disk it is not easy to search the free list. This technique is not sufficient to traverse the list
because we have to read each disk block that requires I/O time. So traversing in the free list is
not a frequent action.
Advantages:
Whenever a file is to be allocated a free block, the operating system can simply allocate the
first block in free space list and move the head pointer to the next free block in the list.
Disadvantages:
Searching the free space list will be very time consuming; each block will have to be read
from the disk, which is read very slowly as compared to the main memory.
Not Efficient for faster access.
Grouping
This approach stores the address of the free blocks in the first free block. The first free block
stores the address of some, say n free blocks. Out of these n blocks, the first n-1 blocks are
actually free and the last block contains the address of next free n blocks.
An advantage of this approach is that the addresses of a group of free disk blocks can be
found easily.
Counting
This approach stores the address of the first free disk block and a number n of free contiguous
disk blocks that follow the first block.
Every entry in the list would contain:
Address of first free disk block
A number n
For example, in Figure-1, the first entry of the free space list would be: ([Address of Block 5],
2), because 2 contiguous free blocks follow block 5.

Mass storage structure

  • 1.
  • 2.
    OVERVIEW Magnetic disks providebulk of secondary storage of computer system TIMES. Hard disk is most popular. Some magnetic disks could be removable. Disk attached to computer through I/O busses (USB, SCSI, EIDE, SATA….) Drives rotate at 60 to 250 times per second. Disks has platters. They are ranging from .85” to 14”. Capacity ranges from 30GB to 3TB per drive, even bigger.
  • 3.
    OVERVIEW  Performance  TransferRate : 6Gb/Sec  Effective Transfer Rate: 1Gb/Sec  Seek time : 3ms to 12ms.  Average seek time calculated based on 1/3 of tracks.  Latency based on spindle speed.  Average Latency=1/2 latency.
  • 4.
    OVERVIEW  Performance  AccessLatency=Average Access Time=Average Seek Time+Average Latency  Average I/O Time=Average Access Time+(Amount to transfer/transfer rate)+Controller Overhead.
  • 5.
  • 6.
  • 7.
    DISK SCHEDULING Purpose ofDisk Scheduling The main purpose of disk scheduling algorithm is to select a disk request from the queue of IO requests and decide the schedule when this request will be processed. Goals of Disk Scheduling Fairness High throughout Minimal traveling head time
  • 8.
    DISK SCHEDULING Algorithms FCFS schedulingalgorithm SSTF (shortest seek time first) algorithm SCAN scheduling C-SCAN scheduling LOOK Scheduling C-LOOK scheduling
  • 9.
    DISK SCHEDULING FCFS schedulingalgorithm It is the simplest Disk Scheduling algorithm. It services the IO requests in the order in which they arrive. There is no starvation in this algorithm, every request is serviced. Disadvantages The scheme does not optimize the seek time. The request may come from different processes therefore there is the possibility of inappropriate movement of the head.
  • 10.
    DISK SCHEDULING FCFS schedulingalgorithm Consider the following disk request sequence for a disk with 100 tracks 45, 21, 67, 90, 4, 50, 89, 52, 61, 87, 25. Head pointer starting at 50 and moving in left direction. Find the number of head movements in cylinders using FCFS scheduling. Solution: Number of cylinders moved by the head = (50-45)+(45-21)+(67-21)+(90-67)+(90-4)+(50-4)+(89-50)+(61-52)+(87-61)+(87-25) = 5 + 24 + 46 + 23 + 86 + 46 + 49 + 9 + 26 + 62 = 376
  • 13.
    DISK SCHEDULING SSTF (shortestseek time first) algorithm Selects the request with minimum seek time from the current head position. SSTF scheduling is a form of SJF scheduling, starvation may exist. It reduces the total seek time as compared to FCFS. Advantages Average response time decreases. Throughput increases. Disadvantages Overhead to calculate seek time in advance. Can cause starvation for a request if it has higher seek time as compared to incoming request. Frequent switching direction slows the working of algorithm. It is not the most optimal algorithm. Example: 45, 21, 67, 90, 4, 89, 52, 61, 87, 25. Head pointer starting at 50.
  • 14.
    Number of cylinders= 5 + 7 + 9 + 6 + 20 + 2 + 1 + 65 + 4 + 17 = 136
  • 16.
    DISK SCHEDULING SCAN Algorithm SCANalgorithm sometimes is called the elevator algorithm. Disk arm starts at one end of the disk, and moves toward the other end. Service requests during the movement until it gets to the other end. Then, the head movement is reversed and servicing continues. Advantages High Throughput. Low variance of response time. Average response time Disadvantages Long waiting time for requests for locations just visited by disk arm. Example: 98, 137, 122, 183, 14, 133, 65, 78. Head pointer starting at 54 and moving in left direction.
  • 17.
    Number of Cylinders= 40 + 14 + 65 + 13 + 20 + 24 + 11 + 4 + 46 = 237
  • 19.
    DISK SCHEDULING C-SCAN Algorithm Circular-SCANis designed to provides a more uniform wait time. Head moves from one end to the other, servicing requests while going. When the head reaches the end, it immediately returns to the beginning. -without servicing any requests on the return trip then it turns back and start moving in that direction servicing the remaining requests.. Advantages Provides more uniform wait time. Example: 98, 137, 122, 183, 14, 133, 65, 78. Head pointer starting at 54 and moving in left direction.
  • 20.
    No. of cylinderscrossed = 40 + 14 + 199 + 16 + 46 + 4 + 11 + 24 + 20 + 13 = 387
  • 22.
    DISK SCHEDULING LOOK Algorithm Itis like SCAN scheduling Algorithm to some extant except the difference that, in this scheduling algorithm, the arm of the disk stops moving inwards (or outwards) when no more request in that direction exists. This algorithm tries to overcome the overhead of SCAN algorithm which forces disk arm to move in one direction till the end regardless of knowing if any request exists in the direction or not. Example Consider the following disk request sequence for a disk with 100 tracks 98, 137, 122, 183, 14, 133, 65, 78. Head pointer starting at 54 and moving left direction.
  • 23.
    Number of cylinderscrossed = 40 + 51 + 13 + +20 + 24 + 11 + 4 + 46 = 209
  • 24.
    DISK SCHEDULING C-LOOK Algorithm CLook Algorithm is similar to C-SCAN algorithm to some extent. In this algorithm, the arm of the disk moves outwards servicing requests until it reaches the highest request cylinder, then it jumps to the lowest request cylinder without servicing any request then it again start moving outwards servicing the remaining requests. It is different from C SCAN algorithm in the sense that, C SCAN force the disk arm to move till the last cylinder regardless of knowing whether any request is to be serviced on that cylinder or not. Example Consider the following disk request sequence for a disk with 100 tracks 98, 137, 122, 183, 14, 133, 65, 78 Head pointer starting at 54 and moving in left direction.
  • 25.
    Number of cylinderscrossed = 11 + 13 + 20 + 24 + 11 + 4 + 46 + 169 = 298
  • 26.
  • 27.
    A file isa named collection of related information that is recorded on secondary storage such as magnetic disks, magnetic tapes and optical disks. The file may have attributes like name, creator, date, type, permissions , protection etc. Name . It is the only information which is in human-readable form. Identifier. The file is identified by a unique tag(number) within file system. Type. It is needed for systems that support different types of files. Location. Pointer to file location on device. Size. The current size of the file. Protection. This controls and assigns the power of reading, writing, executing. Time, date, and user identification. This is the data for protection, security, and usage monitoring. File Type File type refers to the ability of the operating system to identify different types of file such as text files source files and binary files etc.
  • 28.
    File Type ExtensionFunction Executable exe, com, bin Read to run machine language program Object obj, o Compiled, machine language not linked Source Code C, java, pas, asm, a Source code in various languages Batch bat, sh Commands to the command interpreter Text txt, doc Textual data, documents Word Processor wp, tex, rrf, doc Various word processor formats Multimedia mpeg, mov, rm For containing audio/video information
  • 29.
    FILE ACCESS MECHANISM Itrefers to the manner in which way records of file can be accessed. Sequential access Direct/Random access Indexed sequential access Sequential Access A sequential access is that in which the records are accessed in some sequence. The information in the file can be accesses on after another. This access method is the most primitive one. Most of the operating systems access the file sequentially. Example: Compilers usually access files in this fashion.
  • 30.
    Direct /Random Access Accessingthe records directly. Each record has its own address on the file with by the help of which it can be directly accessed for reading or writing. The records need not be in any sequence within the file and they need not be in adjacent locations on the storage medium. The Direct Access is mostly required in the case of database systems. In most of the cases, we need filtered information from the database. The sequential access can be very slow and inefficient in such cases.
  • 31.
    Indexed Sequential Access Ifa file can be sorted then an index can be assigned to group of certain records. A particular record can be accessed by its index. The index is nothing but the address of a record in the file. An index is created for each file which contains pointers to various blocks. Index is searched sequentially and its pointer is used to access the file directly. Advantages: Searching in a large database became very quick and easy.
  • 32.
    File Directories Collection offiles is a file directory. The directory contains information about the files, including attributes, location and ownership. Information contained in a device directory are: 1. Name 2. Type 3. Address 4. Current length 5. Maximum length 6. Date last accessed 7. Date last updated 8. Owner id 9. Protection information
  • 33.
    Operation performed ondirectory are: Search for a file Create a file Delete a file List a directory Rename a file Traverse the file system Advantages of maintaining directories are: Efficiency: A file can be located more quickly. Naming: It becomes convenient for users as two users can have same name for different files or may have different name for same file. Grouping: Logical grouping of files can be done by properties e.g. all java programs, all games etc.
  • 34.
    Single Level Directory Theentire system will contain only one directory which is supposed to mention all the files present in the file system. The directory contains one entry per each file present on the file system. This type of directories can be used for a simple system.
  • 35.
    Advantages Implementation is verysimple. If the sizes of the files are very small then the searching becomes faster. File creation, searching, deletion is very simple since we have only one directory. Disadvantages We cannot have two files with the same name. The directory may be very big therefore searching for a file may take so much time. Protection cannot be implemented for multiple users. There are no ways to group same kind of files. Choosing the unique name for every file is a bit complex .
  • 36.
    Two Level Directory Inthis separate directories for each user is maintained. There is one master directory which contains separate directories dedicated to each user. For each user, there is a different directory present at the second level, containing group of user's file. The system doesn't let a user to enter in the other user's directory without permission.
  • 37.
    Characteristics of twolevel directory system Each files has a path name as /User-name/directory-name/ Different users can have the same file name. Searching becomes more efficient as only one user's list needs to be traversed. The same kind of files cannot be grouped into a single directory for a particular user.
  • 38.
    Tree-structured directory In Treestructured directory system, any directory entry can either be a file or sub directory. Tree structured directory system overcomes the drawbacks of two level directory system. The similar kind of files can now be grouped in one directory. Each user has its own directory and it cannot enter in the other user's directory. Searching is more efficient in this directory structure. The concept of current working directory is used. A file can be accessed by two types of path, either relative or absolute. Absolute path is the path of the file with respect to the root directory of the system while relative path is the path with respect to the current working directory of the system.
  • 40.
    Acyclic -Graph structureddirectory The tree structured directory system doesn't allow the same file to exist in multiple directories therefore sharing is major concern in tree structured directory system. We can provide sharing by making the directory an acyclic graph. In this system, two or more directory entry can point to the same file or sub directory. That file or sub directory is shared between the two directory entries. We can have multiple paths for a same file. Links can either be symbolic (logical) or hard link (physical).
  • 42.
    File Allocation Methods Filesare allocated disk spaces by operating system. Contiguous Allocation Linked Allocation Indexed Allocation Contiguous Allocation Each file occupies a contiguous address space on disk. Assigned disk address is in linear order. Easy to implement. External fragmentation is a major issue with this type of allocation technique.
  • 44.
    Linked Allocation Each filecarries a list of links to disk blocks. Directory contains link / pointer to first block of a file. No external fragmentation Effectively used in sequential access file. Inefficient in case of direct access file.
  • 45.
    Advantages: ™File size doesnot have to be specified. ™ No external fragmentation. Disadvantages: ™It does sequential access efficiently and is not for direct access ™. Each block contains a pointer, wasting space . ™Blocks scatter everywhere and a large number of disk seeks may be necessary . ™Reliability: what if a pointer is lost or damaged?
  • 46.
    Indexed Allocation •Provides solutionsto problems of contiguous and linked allocation. •A index block is created having all pointers to files. •Each file has its own index block which stores the addresses of disk space occupied by the file. •Directory contains the addresses of index blocks of files. •Each file has an index block that is an array of disk block addresses. ‰ •The i-th entry in the index block points to the i-th block of the file. ‰ •A file’s directory entry contains a pointer to its index. •Hence, the index block of an indexed allocation plays the same role as the page table. •‰Index allocation supports both sequential and direct access without external fragmentation.
  • 48.
    Free Space Management Howdo we keep track free blocks on a disk? ‰A free-list is maintained. When a new block is requested, we search this list to find one. ‰ The following are commonly used techniques: ™Bit Vector ™ Linked List ™Linked List + Grouping ™Linked List+Address+Count
  • 49.
    Bitmap This technique isused to implement the free space management. When the free space is implemented as the bitmap or bit vector then each block of the disk is represented by a bit. When the block is free its bit is set to 1 and when the block is allocated the bit is set to 0. The main advantage of the bitmap is it is relatively simple and efficient in finding the first free block and also the consecutive free block in the disk.
  • 50.
    Advantages: This technique isrelatively simple. This technique is very efficient to find the free space on the disk. Disadvantages: This technique requires a special hardware support to find the first 1 in a word it is not 0. This technique is not useful for the larger disks.
  • 51.
    Linked List This isanother technique for free space management. In this linked list of all the free block is maintained. In this, there is a head pointer which points the first free block of the list which is kept in a special location on the disk. This block contains the pointer to the next block and the next block contain the pointer of another next and this process is repeated. By using this disk it is not easy to search the free list. This technique is not sufficient to traverse the list because we have to read each disk block that requires I/O time. So traversing in the free list is not a frequent action.
  • 52.
    Advantages: Whenever a fileis to be allocated a free block, the operating system can simply allocate the first block in free space list and move the head pointer to the next free block in the list. Disadvantages: Searching the free space list will be very time consuming; each block will have to be read from the disk, which is read very slowly as compared to the main memory. Not Efficient for faster access.
  • 53.
    Grouping This approach storesthe address of the free blocks in the first free block. The first free block stores the address of some, say n free blocks. Out of these n blocks, the first n-1 blocks are actually free and the last block contains the address of next free n blocks. An advantage of this approach is that the addresses of a group of free disk blocks can be found easily.
  • 54.
    Counting This approach storesthe address of the first free disk block and a number n of free contiguous disk blocks that follow the first block. Every entry in the list would contain: Address of first free disk block A number n For example, in Figure-1, the first entry of the free space list would be: ([Address of Block 5], 2), because 2 contiguous free blocks follow block 5.