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).
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.
Disk Management
Question- 1) What are the properties of a Hard magnetic disk?
Answer: The following are the properties of a magnetic hard disk:
A magnetic hard disk uses magnetization to read and write data.
The information is stored in the form of a magnetic field below the surface of the spinning disk.
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.
The magnetic hard disks are non-volatile. Hence, they are used for permanent storage of data.
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.
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.
Question- 5) What are various allocation methods in a disc?
Answer: The following are the three major disk allocation methods:
Contiguous allocation
Linked allocation
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.
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.
Indexed allocation
In indexed allocation, each file has an index. The index consists of pointers to the memory locations occupied by the file.
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
FCFS – First Come First Served
The requests are served based on their arrival time.
The request which arrives first is served first
It is the simplest disk scheduling algorithm.
b. SSTF
SSTF – Shortest Seek Time First
The request with the shortest seek time is served first.
If the request is nearer to the current position of the disk arm, it is processed first.
It increases the throughput of the system.
c. SCAN
It is also called the elevator algorithm.
Here, the disk arm moves in a specific direction till it reaches the end of the disk. The requests are served on its path.
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
The disk arm moves towards the end of the disk.
After reaching the end of the disk, it reverses its direction. Now, the arm services the request on its way.
e. LOOK
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.
The requests are serviced on the way.
f. C-LOOK
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.
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
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
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
Total head movements incurred while servicing these requests
= (199 – 53) + (199 – 14)
= 146 + 185
= 331
C-SCAN
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
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
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
It is also called the elevator algorithm.
Here, the disk arm moves in a specific direction till it reaches the end of the disk. The requests are served on its path.
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
The disk arm moves towards the end of the disk.
After reaching the end of the disk, it reverses its direction. Now, the arm services the request on its way.
c. C-LOOK
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.
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
Total head movements incurred while servicing these requests
= (199 – 53) + (199 – 14)
= 146 + 185
= 331
C-SCAN
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
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 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 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 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
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.
Comments