Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Os Unit-5

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

UNIT-5

Disk Scheduling Algorithms


FCFS: FCES is the simplest of all the Disk Scheduling Algorithms. In FCFS, the requests are
addressed in the order they arrive in the disk queuc.
Example: Given the following queuc -- 95, I80, 34, 119, 11, 123, 62, 64 with the Read-write head
initially at the track 50 and thc tail track being at l99.
34 19 123

2 SSTF: In SSTF (Shortest Seek Time First), requests having shortest scck time are cxccuted first.
So, the seck time of every request is calculated in advance in the queue and then they are scheduled
according to their calculated scck time. As a result, the request ncar the disk arm will get cxccuted
first. SSTF is certainly an improvement over FCFS as it dccrcases the average response time and
increases the throughput of system.
Example:

0 11 34 50 6264 99 119123 180 199

3 SCAN: In SCAN algorithm the disk arm moves into a particular direction and services the
requests coming in its path and after reaching the cnd of disk, it reverses its dircction and again
services the request arriving in its path. So, this algorithm works as an clevator and hence also
known as elevator algorithm. As a result, the requests at the midrange are serviced more and those
arriving bchind the disk arm will have to wait.
Example:

Manavendra Pratap Singh[ M Tech- liIT Allahabad]


34 50 6264 95 119 123 180 199

4 CSCAN: In SCAN algorithm, the disk arm again scans the path that has been scanned, after
reversing its direction. So, it may be possible that too many requests are waiting at the other cnd or
there may be zero or few requests pending at the scanned area.These situations are avoided
in CSAN algorithm in which the disk arm instead of reversing its dircction goes to the other end of
the disk and starts servicing the requests from there. So, the disk arm moves in a circular fashion
and this algorithm is also similar to SCAN algorithm and hence it is known as C-SCAN (Circular
SCAN).
Example:

0 11 34 50 6264 95 119 123

5. LOOK: It is similar to the SCAN disk scheduling algorithm except for the difference that the
disk arm in spite of going to the end of the disk goes only to the last request to be serviced in front
of the head and then reverses its dircction from there only. Thus it prevents the extra delay which
occurred due to unnccessary traversal to the end of the disk.
6 CLOOK: As LOOK is similar to SCAN algorithm, in similar way, CLOOK is similar to CSCAN
disk scheduling algorithm. In CLOOK, the disk arm in spite of going to the end goes only to the last
request to be serviced in front of the head and then from there goes to the other end's last request.
Thus, it also prevents the extra delay which occurred due to unnecessary traversal to the end of the
disk.
Example:

9 I19 123 I80 199

Manavendra Pratap Singh[ MTech- lIT Allahabad]


Kernel IO Subsystem

Kernel I/OSubsystem is responsible to provide many services related to I/O. Following are some of the
services provided.

Scheduling - Kernel schedules a set of IO requests to determine a good order in which to


exccute them. When an application issues a blocking T/O system call, the request is placed on the
qucue for that device. The Kernel I/O scheduler rearranges the order of the queue to improve the
overall system efficiency and the average response time cxperienced by the applications.
Buffering-Kerncl O Subsystem maintains a memory area known as buffer that stores data
while they are transferred between two devices or between a device with an application
operation. Buffering is done to cope with a specd mismatch betwcen the producer and consumer
of a data stream or to adapt between devices that have different data transfer sizes.
Caching - Kerncl maintains cache memory which is region of fast memory that holds copies of
data. Access to the cachcd copy is more cfficient than access to the original.
Spooling and Device Reservation - A spool is a buffer that holds output for a device, such as a
printer, that cannot accept interleaved data streams. The spooling system copies the qucucd
spool filcs to the printer onc at a time.
Error Handling - an operating system that uses protected memory can guard against many
kinds of hardware and application errors.
Spooling
Spooling refers to simultancous peripheral operations online.
A
spool is a buffer that holds output for a device, such as a printer, that cannot accept interlcaved
data streams.
In spooling data is first onto the disk and then CPU interacts with disk via main memory.
Spooling is capable of overlapping VO operations for one job with CPU operations of other jobs.
Example: using printer

Disk

Card Reader Printer

Manavendra Pratap Singh[ MTech- lIT Allahabad]


RAID/ Redundant Array of Independent Disks
RAID is the way of combining several independent and relatively small disks into a single storage of a
large size. The disks included into the array are called array members. RAID storage uses multiple disks
in order to provide fault tolerance., to improve overall performance, and to increase storage capacity in a
system. This is in contrast with older storage devices that used only a single disk drive to store data. The
disks can be combincd into the array in different ways which are known as RAID levels. Each of RAID
levels has its own characteristics of.

Standard RAID Levels RAID devices use much different architccture, called levels, depending on
the desired balance between performance and fault tolerance. RAID levels describe how data is
distributed across thc drives. Standard RAID levels include the following:

(a) RAID O. non-redundant striping

999000 (b) RAID 1: mirored disks.

(c) RAID 2 memory-style error-corecting codes.

() RAID 3: bit intereaved parity.

(e) RAID 4: biock-interieaved parity.

( RAID 5: block interleaved distrbuted parity

(a) RAID 6: P+ Qredundancy.

RAID levels.

Manavendra Pratap Singh[ MTech- IlIT Allahabad]


Level 0: Striped disk array without fault tolerance
Provides data striping (spreading out blocks of cach file across multiple disk drives) but no
redundancy. This improves performance but does not deliver fault tolerance. If one drive fails
then all data in the array is lost.
Level 1: Mirroring and duplexing
Provides disk mirroring. Level lprovides twice the read transaction rate of single disks and the
same write transaction rate as single disks.
Level 2: Error-correcting coding
Not a typical implemecntation and rarcly uscd, Level 2 stripes data at the bit level rather than the
block level.
Level 3: Bit-interleaved parity
Provides byte-level striping with a dedicated parity disk. Level 3, which cannot service
simultancous multiple requests, also is rarely uscd.
Level 4: Dedicated Parity drive
A
commonly uscd implementation of RAID, Level 4 provides block-level striping (like Level 0)
with a parity disk. Ifa data disk fails, the parity data is uscd to crcate a replaccment disk. A
disadvantage to Level 4 is that the parity disk can create write bottlenccks.
Level 5: Block interleaved distributed parity
Provides data striping at the byte level and also stripe error corrcction information. This results in
excellent performance and good fault tolerance. Level 5 is one of the most popular
implementations of RAID.
Level 6: Independent data disks with double parity
" Provides block-level striping with parity data distributed across all disks.
Level 10: A stripe of mirrors
Not onc of the original RAID levels, multiple RAID lmirrors are created, and a RAID 0 stripe is
crcated over these.

Problems with RAID: RAID does not always assure that data are available for the operating system and
its users.

Manavendra Pratap Singh[ MTech- IlIT Allahabad]


File Svstems
File:A file is a collcction of related information that is recorded on secondary storage. Or file is a
collection of logically related entities. From user's perspective a file is the smallest allotment of logical
secondary storage.
File Access Methods: The way that files are accessed and read into memory is determined by Access
methods. Usually a single access method is supported by systems while there are OS's that support
multiple access mcthods.
1. Sequential Access
Data is accessed onc record right after another is an order.
* Read command cause a pointer to be moved ahcad by onc.
Write command allocate space for the record and move the pointer to the new End Of File.
Such a method is reasonable for tape.
2. Direct Access
* This method is useful for disks.
The file is viewed as a numbered sequence of blocks or records.
3 There are no restrictions on which blocks are rcad/written; it can bc done in any order.
3 User now says "rcad n" rather than "rcad next".

3. Indexed Sequential Access


* It is built on top of Scquential access.
It uses an Index to control the pointer while accessing files.

Directory: Information about files is maintained by Directories. Adirectory can contain multiple
files. It can even have directories inside of them. In Windows we also call these directories as
folders.
Following is the information maintained in a directory:
Name: The name visible to user.
Type: Type of the directory.
Location: Device and location on the device where the file header is located.
Size: Number of bytes/words/blocks in the file.
Position: Current ncxt-read/next-write pointers.
Protection: Access control on rcad/writelexccuteldelete.
Usage: Time of creation, access, modification ctc.
Mounting: When the root of onc file system is "grafted" into the cxisting tree of another file
system its called Mounting.

Manavendra Pratap Singh[ MTech- IlIT Allahabad]


FILE Organization
1. Continuous Allocation: A single continuous set of blocks is allocated to a file at the time of file
creation. Thus, this is a pre-allocation strategy, using variable size portions. The file allocation table necds
just a single entry for cach file, showing the starting block and the length of the file. This method is best
from the point of view of the individual sequential file. Multiple blocks can be read in at a time to
improve L/O performance for sequential processing. It is also casy to retrieve a single block. For example,
ifa file starts at block b, and the ith block ofthe file is wanted, its location on secondary storage is simply
bt+i-l.

Fille A

File B
13 14

17
FilleC
21 22 23 24
FilleE
26| 27 28
Fille D
31 32 J3334

File allocation table


File name Start block Length
File
File B 9
File C 18
File D
Filc E 26

Disadvantage
External fragmentation may occur.
Also, with pre-allocation, it is nccessary to declare the size of the file at the timc of creation.
2. Linked Allocation (Non-contiguous allocation): Allocation is on an individual block basis. Each
block contains a pointer to the next block in the chain. Again the file table nceds just a single entry for
cach file, showing the starting block and the length of the file. Although pre-allocation is possible, it is
more common simply to allocate blocks as nceded. Any free block can be added to the chain. The blocks
nced not be continuous. Increase in file size is always possible if frce disk block is available. There is no
external fragmentation because only one block at a time is necded but there can be internal fragmentation
but it exists only in the last disk block of file.
Disadvantage:
Internal fragmentation exists in last disk block of fil.
* There is an overhecad of maintaining the pointer in every disk block.
o If the pointer of any disk block is lost, the file will be truncated.
* It supports only the sequential access of files.
3. Indexed Allocation:
It addresses many of the problems of contiguous and chained allocation. In this case, the file allocation
table contains a separate one-level index for cach file: The index has one cntry for cach block allocated to
Manavendra Pratap Singh[ MTech- lIT Allahabad]
the file. Allocation may be on the basis of fixed-size blocks or variable-sized blocks. Allocation by blocks
climinates external fragmentation, whereas allocation by variable-size blocks improves locality. This
allocation technique supports both sequential and direct access to the file and thus is the most popular
form of file allocation.

File B

s[

2s J26J27J2s 29] 28
4

File allocation table


File name Index block

Fille B

File sharing
File sharing is the public or private sharing of computer data or space in a network with various levels
of access privilege. While files can casily be shared outside a nctwork (for example, simply by handing or
mailing somcone your file on a diskette), the term filesharing almost always means sharing files in a
network, even if in a small local arca network. File sharing allows a number of people to use the same file
or file by some combination of being able to rcad or view it, write to or modify it, copy it, or print it.
Typically, a file sharing system has one or more administrators. Users may all have the same or may have
different levels of access privilege. File sharing can also mean having an allocated amount of personal file
storage in a common file system.
Protection and Security Methods
The different methods that may provide protect and securities for different computer systems are:
Authentication
This deals with identifying cach user in the system and making sure they are who they claim to be. The
operating system makes sure that all the users are authenticated before they access the system. The
nt ways to make sure that the users are authentic arc:
Username/ Password
Each user has a distinct username and password combination and they need to enter it correctly
before they can access the system.
User Key/ User Card
The users necd to punch a card into the card slot or use the individual key on a keypad to access
the system.
User Attribute Identification

Manavendra Pratap Singh[ MTech- IIT Allahabad]


Different user attribute identifications that can be used are fingerprint, eye retina ete. These are
unique for cach user and are comparcd with the cxisting samples in the database. The user can
only acccss the system if there is a match.
One Time Password
These passwords provide a lot of security for authentication purposes. Aone time password can be
generated cxclusivcly for a login every time a uscr wants to cnter the system. It cannot be uscd more than
once. The various ways a one time password can be implemented arc:
Random Number
The system can ask for numbers that correspond to alphabets that are pre arranged. This
combination can be changed cach time a login is required.
Secret Key
A hardware device can create a secret kcy related to the user id for login. This key can change
cach time.

File system Implementation


Numerous on-disk and in-memory configurations and structures are being used for implementing a file
system. These structures differ bascd on the operating system and the file system but applying following
general principles.
A boot control block usually contains the information requircd by the system for booting an
operating system from that volume. When the disks do not contain any operating system, this block can
be treated as cmpty. This is typically the first chunk of a volume.
A volume control block holds volume or thc partition details, such as the number of blocks in
the partition, size of the blocks or chunks, frec-block count along with free-block pointers.
A directory structure per file system is requircd for organizing the files.
The FCB contains many details regarding any file which includes file permissions, ownership:
the size of file and location of data blocks.

Manavendra Pratap Singh[ MTech- lIIT Allahabad]

You might also like