Unit-5-Disk Scheduling File Handling
Unit-5-Disk Scheduling File Handling
2. SSTF: In SSTF (Shortest Seek Time First), requests having shortest seek time are executed first.
So, the seek time of every request is calculated in advance in the queue and then they are scheduled
according to their calculated seek time. As a result, the request near the disk arm will get executed
first. SSTF is certainly an improvement over FCFS as it decreases the average response time and
increases the throughput of system.
Example:
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 end of disk, it reverses its direction and again
services the request arriving in its path. So, this algorithm works as an elevator and hence also
known as elevator algorithm. As a result, the requests at the midrange are serviced more and those
arriving behind the disk arm will have to wait.
Example:
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 direction from there only. Thus it prevents the extra delay which
occurred due to unnecessary 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:
Kernel I/O Subsystem is responsible to provide many services related to I/O. Following are some of the
services provided.
Scheduling − Kernel schedules a set of I/O requests to determine a good order in which to
execute them. When an application issues a blocking I/O system call, the request is placed on the
queue 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 experienced by the applications.
Buffering − Kernel I/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 speed mismatch between the producer and consumer
of a data stream or to adapt between devices that have different data transfer sizes.
Caching − Kernel maintains cache memory which is region of fast memory that holds copies of
data. Access to the cached copy is more efficient 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 queued
spool files to the printer one 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 simultaneous peripheral operations online.
A spool is a buffer that holds output for a device, such as a printer, that cannot accept interleaved
data streams.
In spooling data is first onto the disk and then CPU interacts with disk via main memory.
Spooling is capable of overlapping I/O operations for one job with CPU operations of other jobs.
Example: using printer
Standard RAID Levels RAID devices use much different architecture, called levels, depending on
the desired balance between performance and fault tolerance. RAID levels describe how data is
distributed across the drives. Standard RAID levels include the following:
Problems with RAID: RAID does not always assure that data are available for the operating system and
its users.
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 methods.
1. Sequential Access
Data is accessed one record right after another is an order.
Read command cause a pointer to be moved ahead by one.
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.
There are no restrictions on which blocks are read/written; it can be done in any order.
User now says "read n" rather than "read next".
Directory: Information about files is maintained by Directories. A directory 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 next-read/next-write pointers.
Protection: Access control on read/write/execute/delete.
Usage: Time of creation, access, modification etc.
Mounting: When the root of one file system is "grafted" into the existing tree of another file
system its called Mounting.
Disadvantage
External fragmentation may occur.
Also, with pre-allocation, it is necessary to declare the size of the file at the time of creation.
Disadvantage:
Internal fragmentation exists in last disk block of file.
There is an overhead of maintaining the pointer in every disk block.
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 each file: The index has one entry for each block allocated to
Manavendra Pratap Singh[ M Tech- IIIT Allahabad]
the file. Allocation may be on the basis of fixed-size blocks or variable-sized blocks. Allocation by blocks
eliminates 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 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 easily be shared outside a network (for example, simply by handing or
mailing someone your file on a diskette), the term file sharing almost always means sharing files in a
network, even if in a small local area network. File sharing allows a number of people to use the same file
or file by some combination of being able to read 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.
Authentication
This deals with identifying each 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
different ways to make sure that the users are authentic are:
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 need to punch a card into the card slot or use the individual key on a keypad to access
the system.
User Attribute Identification