Disk Management in an Operating System

Disk Management in an Operating System

Introduction:

The disk is the secondary storage media, which is used to store data permanently. The data stored in the disk is provided to the user program via I/O requests. Disk management is a very important function of the operating system. The disk management system performs many functions such as storing data permanently on disk and fetching data from disk into RAM.

Disk-Management

Disk Buffering: 

Disk buffering is the mechanism of providing a temporary storage area, where data is stored before it is finally shifted to the disk. When a process issues an I/O requests for I/O operating, data is stored in a buffer (known as disk buffer) before being transferred to the process. For example, when data is read from disk, it is first shifted to the buffer, and then transferred to the process. Similarly, when a process issues Write commands to store data on the disk, data is first transferred to disk buffer and then is written on the disk.

Disk Scheduling:

We knew that the time to read or write a disk block is determined by three factors: the seek time, the rotational delay, and the transfer time. the performance of a system for performing I/O operating can be improved by reducing the seek time.
In multiprogramming systems, multiple processes run at the same time. These processes may generate servel requests for I/O operating. The operating system maintains a queue to handle these requests. Then, the operating system handles these requests one-by-one, picking from the queue.
When a process needs an I/O operating from disk, it issues a system call to the operating system. If the disk controller is free, the request can be executed (or accepted) immediately. If the controller (or drive) is busy, then the incoming requests will be placed in the queue of pending requests for that drive. For multiprogramming systems, the queue may have served pending requests. The operating system must schedule these requests properly by using disk scheduling algorithms so that the means seek time is reduce and system efficiency is increased. Several algorithms have been proposed for scheduling disk I/O requests. The most popular and commonly used algorithms are described below:

   First-Come First-Served (FCFS):

First-Come First-Served is the simplest form of the disk scheduling algorithm. It is also known as First-In-First-Out (FIFO). The disk controller accepts requests one at a time and places the request in a queue and takes action on these requests in order on a First-Out First-In basis. the FIFO policy increase the mean seek time. It is the major disadvantage of this policy.

Priority (PRI):

With a system based on (PRI), the requests are handled according to a priority basis. often short batch I/O jobs and interactive I/O jobs are given higher priority than longer I/O jobs. In systems that use priority scheduling policy, the disk management software does not control this scheduling policy. This policy is not designed to improve the efficiency of the disk. This approach allows a lot of short I/O jobs to be flushed through the system quickly and provides good interactive response time. However, longer I/O jobs may have to wait for a long time. The disadvantage of this policy is that starvation may occur due to longer I/O jobs.

Shortest Seek Time First (SSTF):

The SSIF algorithm selects the disk I/O request that requires the minimum seek time from the current head position. Only that I/O request is serviced first that is close to the disk arm. This algorithm may provide better performance than FIFO, but it or ensures a minimum average seek time. Starvation may also occur in adopting this policy.

Scan:

With Scan policy, the read/write head is required to move in one direction only. The arm starts to move at one end of the disk in the computer network system and moves towards the other end of technology, fulfilling (or servicing) requests as it reaches each cylinder until it gets to the other end of the disk of the system. At the other end, the direction of the head movement is reserved, and again fulfills requests in order and in that direction, and so on. 

C-Scan:

The C-Scan (Circular Scan) is a different version of the scan algorithm that only services requests while moving in one direction. When the last track has been reached, it immediately returns to the beginning of the disk (starting track).

F-scan:

The F-scan policy is like an N-step Scan,  but it uses two sub-queue, each of unlimited lengths. While requests in one subqueue are processed, all new requests are placed into the other queue. Thus, the service of a new request is postponed until all of the old requests have been processed.

Formatting:

A magnetic disk is just a blank disk coated with magnetic recording material. Before data can be written on a disk, it must be formatted. In formatting, the surface(s) of the disk is logically organized into tracks and sectors through the operating system. There are two kinds of formatting:
  • Low-Level Formatting.
  • High-Level Formatting.

Low-Level Formatting:

The process through which a disk is logically divided into tracks and each track is further subdivided into the sector is known as low-level formatting or physically formatting. In low-level formatting, each sector is further subdivided into a header, a data area, and a trailer. In the data area, actual data (of 512 bytes in size) is stored. The header and trailer contain information used by the disk controller, such as sector number and an error-correcting code (ECC). When data is written in a sector the ECC is updated with a value calculating from all the bytes stored in the data area. Similarly, when a sector is read, the value of ECC is re-calculated and is compared with the stored value in the data area. If the value of ECC is different than the value of bytes read from the data area, this mistake indicates that the data area of the sector has become corrupt and the disk sector may be ''bad''. If only a few bits of data are corrupted, the controller can identify the data error. Actually, ECC is an error detecting code. The controller automatically executes it whenever a sector is read or written. Low-Level formatting of the hard disk is often done by the manufactures. In this way, the manufactures can test the disk.
The most operating system also provides the facility to divide the hard disk into multiple virtual disks called particular. Each particular is treated as a separate disk.

High-Level Formatting:

Before files can be stored on a disk, an empty. File Systems must be created on the disk. For this purpose, the operating system stores an initial file system data structure onto the disk. This purpose is known as high-level formatting or logical formatting. The data structure may be a FAT (File Allocation Table) and an initially empty directory.
Some file system groups block (one or more sector) into the larger block, known as clusters. Disk I/O is done via blocks, but file system I/O is done via clusters. In this way, the performance of I/O operating is increased.


 

Comments

Popular posts from this blog

Modern scenario of information technology:

Deadlock Questions and Answers pdf

What is the bus interconnection?