Notes m5
Notes m5
Notes m5
Module-5
Abort the processes
Abort all the Deadlocked Processes: Aborting all the processes will certainly break the
deadlock but at a great expense. The deadlocked processes may have been computed for a long
time, and the result of those partial computations must be discarded and there is a probability
of recalculating them later.
Abort one process at a time until the deadlock is eliminated: Abort one deadlocked process at a
time, until the deadlock cycle is eliminated from the system. Due to this method, there may be
considerable overhead, because, after aborting each process, we have to run a deadlock
detection algorithm to check whether any processes are still deadlocked.
Selecting a victim: We must determine which resources and which processes are to be
preempted and also in order to minimize the cost.
Rollback: We must determine what should be done with the process from which resources are
preempted. One simple idea is total rollback. That means aborting the process and restarting it.
Starvation: In a system, it may happen that the same process is always picked as a victim. As a
result, that process will never complete its designated task. This situation is called Starvation
and must be avoided. One solution is that a process must be picked as a victim only a finite
number of times.
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.
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.
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.
CAV
CLV
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 amaximum
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).
Network-
attached storage provides a convenient way for all the computers on a LAN to share a pool of
storage files.
DISK SCHEDULING
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
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
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.
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.
A drive has 200 cylinders numbered 0 to 199. The drive is currently serving a request 53 .The
queue of pending requests in order is: 98, 183, 37, 122, 14, 124, 65, 67 starting from current
head position, what is total distance travelled for LOOK Algorithm, if the head is moving
towards 0?
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.
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.
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).
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.