0% found this document useful (0 votes)
8 views10 pages

Secondary - Storage Structure-Module5

Uploaded by

PALLAVI Y
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views10 pages

Secondary - Storage Structure-Module5

Uploaded by

PALLAVI Y
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Module V Secondary - Storage Structure

Magnetic disks provide a bulk of secondary storage. Disks come in various sizes and speed. Here
the information is stored magnetically. Each disk platter has a flat circular shape like CD. The
two surfaces of a platter are covered with a magnetic material. The surface of a platter is
logically divided into circular tracks, which are subdivided into sectors. Sector is the basic unit
of storage. The set of tracks that are at one arm position makes up a cylinder.

The number of cylinders in the disk dirve equals the number of tracks in each platter. There may
be thousands of concentric cylinders in a disk drive, and each track may contain hundreds of
sectors. The storage capacity of disk drives is measured in gigabytes.
The head moves from the inner track of the disk to the outer track. When the disk drive is
operating the disks is rotating at a constant speed.
To read or write the head must be positioned at the desired track and at the beginning of the
desired sector on that track.

Seek Time:-Seek time is the time required to move the disk arm to the required track.
Rotational Latency(Rotational Delay):-Rotational latency is the time taken for the
disk to rotate so that the required sector comes under the r/w head.
Positioning time or random access time is the summation of seek time and rotational delay.
Disk Bandwidth:-Disk bandwidth is the total number of bytes transferred divided by
totaltime between the first request for service and the completion of last transfer.
Transfer rate is the rate at which data flow between the drive and the computer.

As the disk head flies on an extremely thin cushion of air, the head will make contact with the
disk surface. Although the disk platters are coated with a thin protective layer, sometimes the
head will damage the magnetic surface. This accident is called a head crash.
Magnetic Tapes

Magnetic tape is a secondary-storage medium. It is a permanent memory and can hold large
quantities of data. The time taken to access data (access time) is large compared with that of
magnetic disk, because here data is accessed sequentially. When the nth data has to be read, the
tape starts moving from first and reaches the nth position and then data is read from nth position. It
is not possible to directly move to the nth position. So tapes are used mainly for backup, for
storage of infrequently used information.

DISK STRUCTURE
Each disk platter is divided into number of tracks and each track is divided into number
of sectors. Sectors is the basic unit for read or write operation in the disk.
Modern disk drives are addressed as a large one-dimensional array. The one-dimensional
array of logical blocks is mapped onto the sectors of the disk sequentially. Sector 0 is the first
sector of the first track on the outermost cylinder. The mapping proceeds in order through that
track, then through the rest of the tracks in that cylinder, and then through the rest of the
cylinders from outermost to innermost.

The disk structure (architecture) can be of two types –


i) Constant Linear Velocity (CLV)
ii) Constant Angular Velocity (CAV)

i) CLV - The density of bits per track is uniform. The farther a track is from the center of
the disk, the greater its length, so the more sectors it can hold. As we move from outer
zones to inner zones, the number of sectors per track decreases. This architecture is
used in CD-ROM and DVD-ROM.
ii) CAV – There is same number of sectors in each track. The sectors are densely packed in
the inner tracks. The density of bits decreases from inner tracks to outer tracks to keep
the data rate constant.

DISK ATTACHMENT

Computers can access data in two ways.


i) via I/O ports (or host-attached storage)
ii) via a remote host in a distributed file system( or network-attached storage)
i) Host-Attached Storage
Host-attached storage is storage accessed through local I/O ports. Example : the typical
desktop PC uses an I/O bus architecture called IDE or ATA. This architecture supports a
maximum of two drives per I/O bus. The other cabling systems are – SATA(Serially Attached
Technology Attachment), SCSI(Small Computer System Interface) and fiber channel (FC).

SCSI is a bus architecture. Its physical medium is usually a ribbon cable. FC is a high-
speed serial architecture that can operate over optical fiber or over a four-conductor copper
cable. An improved version of this architecture is the basis of storage-area networks (SANs).

ii) Network-Attached Storage


A network-attached storage (NAS) device is a special-purpose storage system that is
accessed remotely over a network as shown in the figure. Clients access network-attached
storage via a remote-procedure-call interface. The remote procedure calls (RPCs) are carried via
TCP or UDP over an IP network—-usually the same local-area network (LAN) carries all data
traffic to the clients.
Network- attached storage provides a convenient way for all the computers on a LAN to share
a pool ofstorage files.

iii) Storage Area Network(SAN)


A storage-area network (SAN) is a private network connecting servers and storage units.
The power of a SAN lies in its flexibility. Multiple hosts and multiple storage arrays can attach
to the same SAN, and storage can be dynamically allocated to hosts. A SAN switch allows or
prohibits access between the hosts and the storage. Fiber Chanel is the most common SAN
interconnect.
DISK SCHEDULING

Different types of disk scheduling algorithms are as follows:


FCFS (First Come First Serve)
SSTF(Shortest Seek Time First)
SCAN (Elecvator)
C-SCAN
LOOK
C-LOOK

i) FCFS scheduling algorithm: This is the simplest form of disk scheduling algorithm.
This services the request in the order they are received. This algorithm is fair but do
not provide fastest service. It takes no special care to minimize the overall seek time.
Eg:-consider a disk queue with request for i/o to blocks on cylinders. 98, 183, 37,
122, 14, 124, 65, 67

If the disk head is initially at 53, it will first


move from 53 to 98 then to 183 and then to
37, 122, 14, 124, 65, 67 for a total head
movement of 640 cylinders. The wild
swing from 122 to 14 and then back to 124
illustrates the problem with this schedule.
ii) SSTF ( Shortest Seek Time First) algorithm: This selects the request with minimum seek
time from the current head position. SSTF chooses the pending request closest to the
current head position. Eg:- consider a disk queue with request for i/o to blocks on
cylinders. 98, 183, 37, 122, 14, 124, 65, 67

If the disk head is initially at 53, the closest is at cylinder 65, then 67, then 37 is closer then 98 to
67. So it services 37, continuing we service 14, 98, 122, 124 and finally 183. The total head
movement is only236 cylinders. SSTF is a substantialimprovement over FCFS, it is not optimal.

iii) SCAN algorithm: In this the disk arm starts moving towards one end, servicing the
request as it reaches each cylinder until it gets to the other end of the disk. At the
other end, the direction of the head movement is reversed and servicing continues.
The initial direction is chosen depending upon the direction of the head.

Eg:-:-consider a disk queue with request for i/o to blocks on cylinders. 98, 183, 37, 122, 14,
124, 65, 67

If the disk head is initially at 53 and if the head is moving towards the outer track, it services 65,
67, 98, 122, 124 and183. At cylinder 199 the arm will reverse and will move towards the other
end of the disk servicing 37 and then 14. The SCAN is also called as elevator algorithm.

If the disk head is initially at 53 and if the head is moving towards 0th track, it services 37 and
then 14. At cylinder 0 the arm will reverse and will move towards the other end of the disk
servicing 65, 67, 98, 122, 124 and 183.
iv) C-SCAN (Circular scan) algorithm:
C-SCAN is a variant of SCAN designed to provide a more uniform wait time. Like
SCAN, C-SCAN moves the head from end of the disk to the other servicing the request along the
way. When the head reaches the other end, it immediately returns to the beginning of the disk,
without servicing any request on the return.
Eg:- consider a disk queue with request for i/o to blocks on cylinders. 98, 183, 37, 122, 14,
124, 65, 67

If the disk head is initially at 53 and if the head is moving towards the outer track, it services 65,
67, 98, 122, 124 and 183. At cylinder 199 the arm will reverse and will move immediately
towards the other end of the disk, then changes the direction of head and serves 14 and then 37.

Note: If the disk head is initially at 53 and if the head is moving towards track 0, it services 37
and 14 first. At cylinder 0 the arm will reverse and will move immediately towards the other end
of the disk servicing 65, 67, 98, 122, 124 and183.
v) Look Scheduling algorithm:
Look and C-Look scheduling are different version of SCAN and C-SCAN respectively.
Here the arm goes only as far as the final request in each direction. Then it reverses, without
going all the way to the end of the disk. The Look and C-Look scheduling look for a request
before continuing to move in a given direction.

Eg:-:-consider a disk queue with request for i/o to blocks on cylinders. 98, 183, 37, 122, 14,
124, 65, 67

If the disk head is initially at 53 and if the head is moving towards the outer track, it services 65,
67, 98, 122, 124 and183. At the final request 183, the arm will reverse and will move towards the
first request 14 and then serves 37.

vi) C-Look Scheduling algorithm:

If the disk head is initially at 53 and if the head is moving towards the outer track, it services 65,
67, 98, 122, 124 and 183. At the last request, the arm will reverse and will move immediately
towards the first request 14 and then serves 37.

Selection of a Disk-Scheduling Algorithm


SSTF is commonly used and it increases performance over FCFS.
SCAN and C-SCAN algorithm is better for a heavy load on disk.
SCAN and C-SCAN have less starvation problem.
Disk scheduling algorithm should be written as a separate module of the operating
system. SSTF or Look is a reasonable choice for a default algorithm.

SSTF is commonly used algorithms has it has a less seek time when compared with other
algorithms. SCAN and C-SCAN perform better for systems with a heavy load on the disk, (ie.
more read and write operations from disk).

Selection of disk scheduling algorithm is influenced by the file allocation method, if contiguous
file allocation is choosen, then FCFS is best suitable, because the files are stored in contiguous
blicks and there will be limited head movements required. A linked or indexed file, in contrast,
may include blocks that are widely scattered on the disk, resulting in greater head movement.

The location of directories and index blocks is also important. Since every file must be opened to
be used, and opening a file requires searching the directory structure, the directories will be
accessed frequently. Suppose that a directory entry is on the first cylinder and a file's data are on
the final cylinder. The disk head has to move the entire width of the disk. If the directory entry
were on the middle cylinder, the head would have to move, at most, one-half the width. Caching
the directories and index blocks in main memory can also help to reduce the disk-arm movement,
particularly for read requests.

Because of these complexities, the disk-scheduling algorithm is very important and is written as
a separate module of the operating system.

Disk Management

Disk Formatting
The process of dividing the disk into sectors and filling the disk with a special data structure is
called low-level formatting. Sector is the smallest unit of area that is read/written by the disk
controller. The data structure for a sector typically consists of a header, a data area (usually 512
bytes in size) and a trailer. The header and trailer contain information used by the disk controller,
such as a sector number and an error-correcting code (ECC).

When the controller writes a sector of data during normal I/O, the ECC is updated with a value
calculated from all the bytes in the data area. When a sector is read, the ECC is recalculated and
is compared with the stored value. If the stored and calculated numbers are different, this
mismatch indicates that the data area of the sector has become corrupted and that the disk sector
may be bad.

Most hard disks are low-level-forniatted at the factory as a part of the manufacturing process.
This formatting enables the manufacturer to test the disk and to initialize the mapping from
logical block numbers to defect-free sectors on the disk.
When the disk controller is instructed for low-level-formatting of the disk, the size of data block of
all sector sit can also be told how many bytes of data space to leave between the header and trailer
of all sectors. It is of sizes, such as 256, 512, and 1,024 bytes. Formatting a disk with a larger
sector size means that fewer sectors can fit on each track; but it also means that fewer headers and
trailers are written on each track and more space is available for user data.

The operating system needs to record its own data structures on the disk. It does so in two steps.
partition and logical formatting.
Partition – is to partition the disk into one or more groups of cylinders. The operating system
can treat each partition as though it were a separate disk. For instance, one partition can hold a
copy of the operating system's executable code, while another holds user files.
logical formatting (or creation of a file system) - Now, the operating system stores the initial
file-system data structures onto the disk. These data structures may include maps of free and
allocated space (a FAT or modes) and an initial empty directory.

To increase efficiency, most file systems group blocks together into larger chunks, frequently
called clusters.

Boot Block
When a computer is switched on or rebooted—it must have an initial program to run. This is
called the bootstrap program. The bootstrap program –
 initializes the CPU registers, device controllers, main memory, and then starts the
operating system.
 Locates and loads the operating system from the disk
 jumps to beginning the operating-system execution.

The bootstrap is stored in read-only memory (ROM). Since ROM is read only, it cannot be
infected by a computer virus. The problem is that changing this bootstrap code requires changing
the ROM, hardware chips. So most systems store a tiny bootstrap loader program in the boot
ROM whose only job is to bring in a full bootstrap program from disk. The full bootstrap
program can be changed easily: A new version is simply written onto the disk. The full bootstrap
program is stored in ''the boot blocks" at a fixed location on the disk. A disk that has a boot
partition is called a boot disk or system disk.

The Windows 2000 system places its boot code in the first sector on the hard disk (master boot
record, or MBR). The code directs the system to read the boot code from, the MBR. In addition
to containing boot code, the MBR contains a table listing the partitions for the hard disk and a
flag indicating which partition the system is to be booted from.
Bad Blocks
Disk are prone to failure of sectors due to the fast movement of r/w head. Sometimes the
whole disk will be changed. Such group of sectors that are defective are called as bad blocks.
Different ways to overcome bad blocks are -
 Some bad blocks are handled manually, eg. In MS-DOS.
 Some controllers replace each bad sector logically with one of the spare sectors(extra
sectors). The schemes used are sector sparing or forwarding and sector slipping.

In MS-DOS format command, scans the disk to find bad blocks. If format finds a bad block, it
writes a special value into the corresponding FAT entry to tell the allocation routines not to use
that block.
In SCSI disks , bad blocks are found during the low-level formatting at the factory and is updated
over the life of the disk. Low-level formatting also sets aside spare sectors not visible to the
operating system. The controller can be told to replace each bad sector logically with one of the
spare sectors. This scheme is known as sector sparing or forwarding.

A typical bad-sector transaction might be as follows:


The operating system tries to read logical block 87.
The controller finds that the sector is bad. It reports this finding to the operating system.
The next time the system is rebooted, a special, command is run to tell the SCSI
controller to replace the bad sector with a spare.
After that, whenever the system requests logical block 87, the request is translated into
the replacement sector's (spare) address by the controller.

Some controllers replace bad blocks by sector slipping. Here is an example: Suppose that
logical block 17 becomes defective and the first available spare follows sector 202. Then, sector
slipping remaps all the sectors from 17 to 202, moving them all down one spot. That is, sector
202 is copied into the spare, then sector 201 into 202, and then 200 into 201, and so on, until
sector 18 is copied into sector 19. Slipping the sectors in this way frees up the space of sector 18,
so sector 17 can be mapped to it.

You might also like