Operating System: Secondary Storage Management; Allocation Methods


Secondary Storage Management



Introduction to Disk


Advantages of disk over main memory.

 Disk is the magnetic medium on which the computer records information. Disks represent the most common form of computer storage. Disk has three major advantages over using main memory:
i)                 Storage capacity available is much larger.
ii)                Price per bit is much lower
iii)               Information’s is not lost when the power is turned off.


Define tracks, sectors, platter, cylinder.

Tracks:
 A disk is divided into tracks. Data stored in concentric circle is known as tracks.
Sectors :
Each track is further divided into sectors. A sector is the smallest unit of information which can be read from or written to the desk. All sectors contain the same number of bytes.
Platters:
The entire circular surface (with tracks and sectors) contributes a platter. A hard disk may contain multiple platters.
Cylinders: A cylinder is a set of tracks which are the same track position of the disk but in different platter surfaces. No seek is necessary for accessing tracks in the same cylinder.

Fixed head disk and moving head disk.

A fixed sized disk has a separate head for each track that arrangement allows the computer to switch from track to track quickly, but it requires a large number of heads, making the device very expensive.
The moving-head disk requires hardware to move head, but only a single head is needed, which in a much cheaper system.

Transfer time, seek time and latency time.

To access a block in the disk, the system must first move the head to the appropriate track or cylinder. This head movement is called a seek and the tine to complete it is seek time. Once the head is at the right track, it must wait until the desired block rotates under the read/write head. This delay is latency time. Transfer time is the time of data between the disk and main memory can take place.

Disk Scheduling Algorithm

why scan algorithm is called elevator algorithm?

The scan algorithm is sometimes called the “elevator ”  algorithm, since it is similar to the behavior of elevators as they service request to move from floor to floor in a building.

What do you know about scan algorithm?
Ans: In the SCAN algorithm, the read/write head or disk arm moves on one direction , performing all requests until no more are needed in that direction and then turns around and comes back. The head continuously scans the disk from end to end.

Free space management 

Sector queuing

Sector queuing is an algorithm for scheduling fixed-head devices. It is based on the division of each track into fixed number of blocks called sectors. The disk address in each request specifies the track and sector. Since seek time is zero for fixed-head devices, the main service time is latency time. For FCFS scheduling, assuming that requests are uniform distributed over sectors, the expected latency is one-half of a revolution.

Free space management

 Files normally stored in disk, some management of disk space is a major concern to file system designers. Since there is only a limited amount of disk space, it is necessary to reuse the space from deleted files for new files. To keep track of free disk space, the file system maintains a free space list. The free space list records all disk blocks which are free. A disk allocation table is used to track of blocks which are available. To create a file, we search the free space lost for the required amount of space and allocate it to the new file. This space is then removed from the free space lost. When a file is deleted, its disk space is added to the space list.


 Allocation Methods.

Problems in contiguous dynamic method.

Contiguous allocation has two backwards:
i)The first difficulty is determining how much space is needed for anew file. Once the implementation of the free space list is defined, we can decide how to find space for a contiguously allocated file.
ii) The second problem is external fragmentation. External fragmentation exists when enough total disk space exits to satisfy a requests, but it is not contiguous; storage is fragmented into number of small holes.

 Contiguous dynamic storage allocation problem and How can it be solved.

Disk space is viewed as a linked of free, used or allocated segments, each segment is a contiguous set of disk block or a hole. A hole is referred to as an unallocated segment. Dynamic storage allocation problem is how to satisfy a request from a list of free blocks.

External fragmentation and How can it be solved?

External fragmentation exists when enough total disk space exists to satisfy a request, but it is not contiguous; storage is fragmented into a large number of small holes. Note an unallocated segment is called a hole. This can be solved by compaction.

Compaction: External fragmentation problem can be solved by compaction scheme. In compaction scheme, the user copies the entire file system onto another floppy disk. The original floppy is then completely freed, creating one large contiguous free hole. The files can then be copied back onto the floppy, by allocating contiguous space from this one large hole. So compaction scheme effectively compacts all free space into one hole, solved the fragmentation problem. But it is time consuming.


Comments

Post a Comment