Disk Management: Operating System Class Notes

Updated: Aug 18

Mobiprep has created last-minute notes for all topics of operating system to help you with the revision of concepts for your university examinations. So let’s get started with the lecture notes on Operating System (OS).

  1. Introduction of Operating System

  2. Process

  3. Scheduling

  4. Threads

  5. Memory Management

  6. File Management

  7. Synchronization

  8. Disk Management

  9. IO Management

  10. Protection And Security

Our team has curated a list of the most important questions asked in universities such as DU, DTU, VIT, SRM, IP, Pune University, Manipal University, and many more. The questions are created from the previous year's question papers of colleges and universities.

  1. What are the properties of a Hard magnetic disk?

  2. What is Rotation latency and transfer time?

  3. Give a description on disc structure?

  4. What is bit map?

  5. What are various allocation methods in a disc?

  6. Explain Disc Scheduling?

  7. What is SCAN, C-SCAN, C-LOOK?

  8. Define seek time and latency time.

  9. Write notes about disk management and swap-space management.

  10. What is RAID? Explain its various levels.

  11. What is nested raid?


Disk Management


Question- 1) What are the properties of a Hard magnetic disk?

Answer: The following are the properties of a magnetic hard disk:

  1. A magnetic hard disk uses magnetization to read and write data.

  2. The information is stored in the form of a magnetic field below the surface of the spinning disk.

  3. Each disk platter is covered with a magnetic material, so that the data can be written in the form of a magnetic field on its surface.

  4. The magnetic hard disks are non-volatile. Hence, they are used for permanent storage of data.

  5. Many circular disks are stacked on top of one another to form the magnetic hard disk. Each circular disk can store 10MB to 10GB of data.


 

Question- 2) What is Rotation latency and transfer time?

Answer:

Rotation Latency

The rotation latency is the time taken by the read/write head to seek the requested sector in the disk from the current location.

EXAMPLE:

Consider that the read/write head is currently in sector 2. If the required data is in sector 5, then the read/write head has to be moved to sector 5 to read the data. The time taken for the read/write head to reach sector 5 from sector 2 is called rotational latency.

Transfer Time

Transfer time is the time taken to transfer the data from the disk to the main memory. The data transfer time depends on the rotational speed of the disks in the secondary memory.

Transfer time = data to be transferred/data transfer rate

Transfer rate refers to the amount of data transferred per unit time.


 

Question- 3) Give a description on disc structure?

Answer: The magnetic hard disk usually contains circular disks stacked on top of one another. A hard disk contains approximately 100 to 200 disks. These circular disks are called platters. The platters are mounted on a spindle. The spindle holds the disk in position and helps the disks to rotate. As the disks are stacked on top of one another, the hard disk looks like a cylinder.

Each platter is divided into many concentric rings called tracks. The tracks are further divided into sectors. Traditionally, a sector contains 512 bytes of storage. Though the outer tracks are larger in size than the inner tracks, both the inner and the outer tracks have the same number of sectors. But, the sectors in the inner tracks are denser than the sectors in the outer tracks.

The read/write head is used to read the data from a particular sector of the disk. Each disk platter has a separate read/write head. These read/write heads are controlled by the arm assembly. To read or write data into the disk, the read/write arm is positioned over that specific sector.


disc structure in operating system

 

Question- 4) What is bit map?

Answer: The mapping of integers to bits is called a bit map. In a bitmap, the secondary memory is divided into blocks. Each block is associated with a bit in the bitmap. The bitmap is used to keep track of secondary memory easily. The bitmap depends on the size of the memory.

If a block is occupied, its corresponding bit value is 1. If the block is empty, the corresponding bit value is 0.


bit map in operating system

 

Question- 5) What are various allocation methods in a disc?

Answer: The following are the three major disk allocation methods:

  1. Contiguous allocation

  2. Linked allocation

  3. Indexed allocation

Contiguous allocation

In contiguous allocation, the files occupy contiguous memory locations in the disk. For contiguous allocation, the starting address and the length of the file are required. Using these two data, the blocks which are occupied by the file can be found out. It is a simple and fast method of disk allocation.

Contiguous allocation results in both internal and external fragmentation. It leads to wastage of memory. It is inefficient in terms of memory usage.


Contiguous allocation in operating system

Linked allocation

In linked allocation, the file need not be allocated contiguous locations in the memory. Instead, the pointer to the next memory location occupied by the file is used. Each block contains a pointer to the next memory location.

Linked allocation does not cause external fragmentation. The memory is used efficiently. But, extra memory is used for storing the pointers.


Linked allocation in operating system

Indexed allocation

In indexed allocation, each file has an index. The index consists of pointers to the memory locations occupied by the file.


Indexed allocation in operating system

 

Question- 6) Explain Disc Scheduling?

Answer: The I/O requests are used to access the disk. If multiple I/O requests occur at the same time seeking disk access, the operating system schedules the request in such a way that the disk utilization is efficient. Different scheduling algorithms are used to schedule the I/O requests. These algorithms are explained below.

a. FCFS

  1. FCFS – First Come First Served

  2. The requests are served based on their arrival time.

  3. The request which arrives first is served first

  4. It is the simplest disk scheduling algorithm.

b. SSTF

  1. SSTF – Shortest Seek Time First

  2. The request with the shortest seek time is served first.

  3. If the request is nearer to the current position of the disk arm, it is processed first.

  4. It increases the throughput of the system.

c. SCAN

  1. It is also called the elevator algorithm.

  2. Here, the disk arm moves in a specific direction till it reaches the end of the disk. The requests are served on its path.

  3. After reaching the end of the disk, the direction of the arm is reversed, and the requests are served on the path.

d. C-SCAN

  1. The disk arm moves towards the end of the disk.

  2. After reaching the end of the disk, it reverses its direction. Now, the arm services the request on its way.

e. LOOK

  1. It is similar to SCAN. But, instead of going to the end of the disk, it goes to the last request to be serviced. Then, it reverses its direction.

  2. The requests are serviced on the way.

f. C-LOOK

  1. It is similar to C-SCAN. But, instead of going to the end of the disk, it goes to the last request to be serviced.

  2. The requests are serviced only after the reversal of direction of the arm.

EXAMPLE

Consider a disk queue with requests for I/O to blocks on cylinders 98, 183, 41, 122, 14, 124, 65, 67. The head is initially at cylinder number 53. The cylinders are numbered from 0 to 199.

FCFS


FCFS example in operating system

Total head movements incurred while servicing these requests

= (98 – 53) + (183 – 98) + (183 – 41) + (122 – 41) + (122 – 14) + (124 – 14) + (124 – 65) + (67 – 65)

= 45 + 85 + 142 + 81 + 108 + 110 + 59 + 2

= 632


SSTF


SSTF example in operating system

Total head movements incurred while servicing these requests

= (65 – 53) + (67 – 65) + (67 – 41) + (41 – 14) + (98 – 14) + (122 – 98) + (124 – 122) + (183 – 124)

= 12 + 2 + 26 + 27 + 84 + 24 + 2 + 59

= 236


SCAN


SCAN example in operating system

Total head movements incurred while servicing these requests

= (199 – 53) + (199 – 14)

= 146 + 185

= 331


C-SCAN


C-SCAN example in operating system

Total head movements incurred while servicing these requests

= (65 – 53) + (67 – 65) + (98 – 67) + (122 – 98) + (124 – 122) + (183 – 124) + (199 – 183) + (199 – 0) + (14 – 0) + (41 – 14)

= 12 + 2 + 31 + 24 + 2 + 59 + 16 + 199 + 14 + 27

= 386


LOOK


LOOK example in operating system

Total head movements incurred while servicing these requests

= (65 – 53) + (67 – 65) + (98 – 67) + (122 – 98) + (124 – 122) + (183 – 124) + (183 – 41) + (41 – 14)

= 12 + 2 + 31 + 24 + 2 + 59 + 142 + 27

= 299


C-LOOK


C-LOOK example in operating system

Total head movements incurred while servicing these requests

= (183 – 53) + (183 – 14) + (41 – 14)

= 130 + 169 + 27

= 326


 

Question- 7) What is SCAN, C-SCAN, C-LOOK?

Answer: SCAN, C-SCAN and C-LOOK are the disk scheduling algorithms.

a. SCAN

  1. It is also called the elevator algorithm.

  2. Here, the disk arm moves in a specific direction till it reaches the end of the disk. The requests are served on its path.

  3. After reaching the end of the disk, the direction of the arm is reversed, and the requests are served on the path.

b. C-SCAN

  1. The disk arm moves towards the end of the disk.

  2. After reaching the end of the disk, it reverses its direction. Now, the arm services the request on its way.

c. C-LOOK

  1. It is similar to C-SCAN. But, instead of going to the end of the disk, it goes to the last request to be serviced.

  2. The requests are serviced only after the reversal of direction of the arm.

EXAMPLE

Consider a disk queue with requests for I/O to blocks on cylinders 98, 183, 41, 122, 14, 124, 65, 67. The head is initially at cylinder number 53. The cylinders are numbered from 0 to 199.


SCAN


SCAN example in operating system

Total head movements incurred while servicing these requests

= (199 – 53) + (199 – 14)

= 146 + 185

= 331


C-SCAN


C-SCAN example in operating system

Total head movements incurred while servicing these requests

= (65 – 53) + (67 – 65) + (98 – 67) + (122 – 98) + (124 – 122) + (183 – 124) + (199 – 183) + (199 – 0) + (14 – 0) + (41 – 14)

= 12 + 2 + 31 + 24 + 2 + 59 + 16 + 199 + 14 + 27

= 386


C-LOOK


C-LOOK example in operating system

Total head movements incurred while servicing these requests

= (183 – 53) + (183 – 14) + (41 – 14)

= 130 + 169 + 27

= 326


 

Question- 8) Define seek time and latency time.

Answer: Seek Time

Seek time is the time taken by the disk arm to seek the required track in the disk.

Latency Time

Latency time is the time taken by the disk arm to seek the beginning of the required sector in a track. Latency time is also called rotational delay.

Memory access time = seek time + latency time


 

Question- 9) Write notes about disk management and swap-space management.

Answer:

Disk management

Disk management is a utility in every operating system to manage the hard disk drives. Disk management involves creation and deletion of partitions, assignment of drive letters etc., it also involves viewing the partitions in the disk. It is also used to format the partitions and file systems in the hard disk.

Swap-space management

Swap space is the part of the hard disk where the processes which are swapped out of the main memory are stored.

Swap-space management involves the efficient usage of the swap-space to improve the throughput of the system. The swap-space required must be overestimated to prevent crashing of processes due to insufficient swap-space. The swap space must be located either in the normal file system or in a separate disk partition. The swap-space location and the swap-space size are decided by the operating system.


 

Question- 10) What is RAID? Explain its various levels.

Answer:

RAID – Redundant Array of Independent Disks

RAID is a technique which introduces data redundancy in the disk to improve its performance and reliability. Though this technique requires additional storage space, it greatly increases the reliability of disk data. This technique is used to prevent the loss of data in case of disk failure.

RAID 0 (Striping)

In RAID 0, the data is not duplicated. The blocks are striped across the disks. Hence, data once lost cannot be recovered. It is intolerant to disk failure.


RAID 0 in operating system

RAID 1 (Mirroring)

Every block has multiple copies in different disks. The copies of the blocks are stored in different disks. RAID 1 is reliable and tolerant to disk failure.

Assume that there exists 2 copies of a block (level 2 mirroring).It can tolerate maximum of N/2 disk failures.


RAID 1 in operating system

RAID 4 (Block-Level Striping with Dedicated Parity)

In RAID 4 data is not duplicated. Instead, parity bits are used. All the parity bits are stored in the same disk. The parity bit is calculated by XORing all the input bits. If the number of 1’s in the input is odd, the parity bit is 1. Else, the parity bit is 0.

This technique can detect at most one disk failure. If more than one disks fail, this method cannot be used to recover the data.


RAID 4 in operating system

RAID 4 in operating system

RAID 5 (Block-Level Striping with Distributed Parity)

It is similar to RAID 4, but the parity bits are distributed among the disks. This is clearly shown in the figure. Using this technique, utmost one disk failure can be detected. But, the performance of RAID 5 is better than RAID


RAID 5 in operating system

 

Question- 11) What is nested raid?

 Answer: Nested RAID is the combination of more than one RAID levels. Combining two RAID levels improves the performance and combines the benefits of the two RAID techniques.

For example, RAID 1+0 is the combination of RAID 0 and RAID 1 techniques. RAID 1+0 has the benefits of both striping and mirroring. Thus, it gives better performance and reliability.


 



4 views0 comments