0% found this document useful (0 votes)
12 views

File System Summary Sheet

This document provides an overview of file systems and I/O systems. It discusses key concepts like file structure, file operations, file management systems, device drivers, basic file systems, basic I/O supervisors, logical I/O, access methods, and file organization. The main topics covered are the components and functions of file systems, how they manage files and storage, and how different access methods can structure and retrieve file data.

Uploaded by

ashish mishra
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)
12 views

File System Summary Sheet

This document provides an overview of file systems and I/O systems. It discusses key concepts like file structure, file operations, file management systems, device drivers, basic file systems, basic I/O supervisors, logical I/O, access methods, and file organization. The main topics covered are the components and functions of file systems, how they manage files and storage, and how different access methods can structure and retrieve file data.

Uploaded by

ashish mishra
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/ 21

Chapter 5

File Systems, I/O Systems,


Protection and Security

LEARNING OBJECTIVES

 File systems  Basic input/output supervisor


 File management systems  Logical input/output
 File system architecture  Access methods
 Device drivers

File SyStemS 1. A name


2. An extension (usually separated by a period character)
The file system consists of two distinct parts:
The type of a file may be
1. Collection of files
1. Executable (exe, com, bin)
2. Directory structure
2. Object (obj, o)
File A file is a named collection of related information that is 3. Source code (c, cc, java)
recorded on secondary storage. The files must have 4. Batch (bat, sh)
5. Text (txt, doc)
1. Long-term existence
6. Word processor (wp, text, doc)
2. Sharable between processes
7. Library (lib)
3. Structure
8. Print or view (ps, pdf, jpg)
File attributes A typical file attributes are 9. Archive (zip, tar)
1. Name 10. Multimedia (mpeg, mov, rm)
2. Identifier File structure The four common terms of file systems are
3. Type
1. Field
4. Location
• Basic element of data
5. Size
• Contains a single value
6. Protection
• Has a particular length and data type
7. Time, date and user identification
2. Record
File operations The operations that are applied on files are • It is a collection of related fields
• It is treated as a unit
1. Creation
3. File
2. Deletion
• It is a collection of similar records
3. Closing
• Treated as a single entity
4. Reading
• Has file names
5. Writing
• Access to file may be restricted or unrestricted
File types A common technique for implementing file types is to 4. Database
include the type as part of the file name. The name is split into two • Collection of related data.
parts: • Relationship exists among elements.
Chapter 5  •  File Systems, I/O Systems, Protection and Security  |  7.75

File Management Systems Device Drivers


It is a set of system software that provides services to users 1. It is at the lower part.
and applications in the use of files. Objectives of file man- 2. Communicates directly with peripheral devices.
agement systems are as follows: 3. Initiative to start I/O operations on a device.
1. To meet the data management needs and requirements 4. Processes the completion of an I/O request.
of the user including storage of data.
2. To guarantee, that the data in the file are valid.
Basic File System
3. To optimize performance (i.e., throughput, response
time). 1. Mainly concerned with I/O.
4. To provide Input/Output (I/O) support for a variety of 2. Exchanges blocks of data.
storage device types. 3. Deals with placement of blocks.
5. To minimize or eliminate the potential for lost or 4. Deals with buffering blocks in main memory.
destroyed data.
6. To provide a standardized set of I/O interface routines.
7. To provide I/O support for multiple users. Basic I/O Supervisor
The minimal set of requirements from user’s point of view 1. Responsible for file initiation and termination.
for an interactive, general purpose, file system are as follows: 2. Maintain control structures.
3. Selects the device while file I/O is to be performed.
1. Ability to create, delete, read, write and modify files. 4. Deals with scheduling access to optimize
2. Controlled access to other users files. performance.
3. Control the type of accesses to files. 5. Part of the operating system (OS).
4. Restructure the user’s files.
5. Able to move data between files.
6. Ability to back up and recover user’s files.
Logical I/O
7. Able to access a file by name.
1. Enables users and application to access records.
2. Provides general purpose record I/O capability.
File System Architecture 3. Maintains basic data about file.
The file system architecture is shown below:
User
program Access Methods
1. They reflect different file structures.
Indexed Indexed
2. Provide different ways to access and process data.
Pile Sequential Hashed
Sequential 3. Access methods are as follows:
Logical I/O
•• Sequential: read next, write next
•• Direct: read block n, write block n
Basic I/O Supervisor

File Management Functions


Basic File System
The functions of a file system is shown below:
Disk Device Driver Tape Device Driver

Physical blocks
Physical blocks in in secondary
Records main memory storage
Directory Access buffers
management method Disk
Blocking scheduling
User and
Free
program Operation
commands file name File Storage
manipulation management
functions
User access File structure File allocation
control

Operating system concerns


File management concerns
7.76 | Unit 7  •  Operating System

File Organization and Access 5. New records are placed in a log file or transaction file.
File organization refers to the logical structuring of the 6. Batch update is performed to merge the log file with
records as determined by the way in which they are accessed. the master file.
We choose a particular file organization based on 7. Used in batch applications.
8. Not suitable for interactive applications.
1. Short access time
2. Ease of update Indexed sequential file
3. Economy of storage 1. Index provides a look up capability to quickly reach
4. Simple maintenance the vicinity of the desired record.
5. Reliability 2. It contains key field and a pointer to the main file.
We will discuss five types of file organizations: 3. Index is searched to find highest key value that is
equal to or precedes the desired key value.
1. The pile 4. Search continues in the main file at the location
2. The sequential file indicated by the pointer.
3. The indexed sequential file 5. New records are added to an overflow file.
4. The indexed file 6. Record in main file that precedes it is updated to
5. The direct or hashed file contain a pointer to the new record.
The pile  The pile organization is shown in Figure 1: 7. The overflow is merged with main file during a batch
update.
8. Multiple indexes for the same key can be set up to
increase efficiency.
n
Index
levels
2 Index Main
1 file

Figure 1  Pile file.

1. Data are collected in order they arrive. Overflow


2. The aim is to accumulate mass of data and save. file
3. Records may have different fields.
4. There is no structure. Figure 3  Indexed file.
5. Record are accessed by exhaustive search. 9. Key field required for each record.
6. There can be variable length records. 10. It uses multiple indexes for different key fields.
7. This type of files are encountered when data are 11. It may contain exhaustive index that contains one
collected and stored prior to processing or when data entry for every record in the main file or partial index.
are not easy to organize.
The sequential file  The sequential file is shown in Figure 2. Main file or Partial index or
exhaustive index exhaustive index Exhaustive index

Figure 2  Sequential file.


Primary File
1. Fixed format used for records. (Variable-length records)
2. Records are of same length.
3. All fields are of the same order and length. 12. Used in the applications where timeliness of
4. One field is the key field. It uniquely identifies the information is critical and where data are rarely
record. Records are stored in a key sequence. processed exhaustively.
Chapter 5  •  File Systems, I/O Systems, Protection and Security  |  7.77

Direct or Hashed file Master directory

1. This file has the capability to access any block of a


known address. Sub directory Sub Sub directory
2. Key field required in each record. directory
3. No concept of sequential ordering.
Figure 4 shows hashed file organization:
File
Hash table
Sub directory
Sub directory

Overflow table

File
File File

3. Files can be located by following a path from the root,


or master directory down various branches which is
called pathname for the file.
Figure 4  Hashed file organization.
4. Current directory is called the working directory.
5. Files are referenced relative to the working directory.
Naming The use of a tree-structured directory minimizes
File Directories the difficulty in assigning unique names. Any file in the sys-
The collection of files is a file directory. tem can be located by following a path from the root or mas-
Contents ter directory down various braches until the file is reached.
1. Contain information about files, such as attributes, Path name  The series of directory names, culminating in
location, and ownership. the file name itself, constitutes a path name for the file.
2. Itself a file owned by the OS.
3. It provides mapping between file names and the file Example:  Time/Gate/Exam/OS
themselves. The slash is used to delimit names in the sequence. The
name of master directory is implicit, because all paths
Directory Structure starts at that directory. Files can also be referenced from the
1. It consists of list of entries, one for each file. working directory.
2. Sequential file with the name of the file serving as the
key. File sharing  It has got two issues, such as:
3. Provides no help in organizing the files. 1. Access rights
4. Not scalable (same name cannot be used for two 2. Management of simultaneous access
different files). Access rights  Users or groups of users are granted certain
5. As directory grows in size, searching is too time access rights to a file. A wide range of access rights has
consuming. been used. The access rights may be
1. None
Two-level Directory Structure 2. Knowledge
1. Contains one directory for each user and a master 3. Execution
directory. 4. Reading
2. The master directory contains entry for each user 5. Appending
3. User directory is a simple list of files for that user. 6. Updating
4. File naming conflict is solved. 7. Changing protection
8. Deletion

Hierarchical or Tree-structured Directory These access rights can be specified to specific users or user
groups or all users.
1. Contains master directory with user directory
underneath it. Record Blocking  For I/O to be performed, records must be
2. Each user directory may have subdirectories and files organized as blocks. Given the size of a block, there are
as entries. three methods of blocking that can be used:
7.78 | Unit 7  •  Operating System

1. Fixed blocking File Allocation


2. Variable length spanned blocking
Preallocation Versus Dynamic Allocation
3. Variable length unspanned blocking.
Fixed blocking 1. A preallocation policy requires that the maximum
1. Fixed-length records (Figure 5) are used and an size of a file be declared at the time of the file creation
integral number of records are stored in a block. request. For many applications, it is difficult to
2. Possibility of internal fragmentation. estimate the file size.
3. Used for sequential files. It is better to use dynamic allocation, which allocates
space to a file in portions as needed.
R1 R2 R3 R4 Track1
Portion size The portion size which is allocated to a file
may be
1. Variable, large contiguous portions.
R5 R 6 R7 R8 Track2
2. Blocks
Figure 5  Fixed blocking. Some strategies for dealing with fragmentation of free
Variable length spanned blocking  Variable length records space are as follows:
are used and are packed into blocks with no unused space. 1. First-fit: Choose the first unused contiguous group of
Some records can span two blocks. These do not limit the blocks of sufficient size.
size of records. 2. Best-fit: Choose the smallest unused group that is of
sufficient size.
3. Nearest-fit: Choose the unused group of sufficient
R1 R2 R3 R4 R4 R5 R6 Track 1
size that is closest to the previous allocation.

Track 2
File allocation methods  It has three methods as follows:
R6 R7 R8 R9 R9R10 R11 R12 R13
1. Contiguous allocation
Figure 6  Variable blocking: spanned. 2. Chained allocation
3. Indexed allocation
Variable length unspanned blocking Variable length
records (Figure 7) are used, but spanning is not employed. Contiguous allocation  Here, a single set of blocks is allo-
There is wasted space in most blocks and limits record cated to a file at the time of creation. Only a single entry
size. in the file allocation table is created consisting of starting
block and length of the file. It exhibits external fragmenta-
R1 R 2 R3 R4 R5 Track 1 tion and performs compaction.

File allocation table


R6 R 7 R8 R9 R10 Track 2 (FAT)
Start block
File name

Figure 7  Variable blocking: unspanned.


File A
Length

0 1 2 3
File B
: Waste due to record fit to block size
4 5 6 7
File C File A 2 2
: Gaps due to hardware design
8 9 10 11 File B 5 4
: Waste due to block size constraint 12 13 14 15 File C 10 6
from fixed record size.
: Waste due to block fit to track size

Linked or chained allocation  The allocation is done on


basis of individual block. Each block contains a pointer
Secondary Storage Management to the next block in the chain. Only single entry is cre-
1. Space (or blocks) must be allocated to files on disk. ated in the file allocation table consisting of starting block
2. Need to keep track of the space available (free blocks) and length of file. There occurs no external fragmentation
for allocation to files. and it is best for sequential files. There is no accommoda-
3. Preallocation of blocks to files can be used to allocate tion of principle of locality. If block size is n, then only
space for files. For this, it needs to know the maximum n – 1 units of data are stored and 1 unit stores the link
size of the file at the time of creation. information.
Chapter 5  •  File Systems, I/O Systems, Protection and Security  |  7.79

Solution:  Since the first record is record 0, the first byte of


File allocation table(FAT)
record 20 will be at logical location = 32 × 20 = 640

File name
0 1 1 2 3
File A Free Space Management

End
Start
4 5 1 6 2 7
In addition to file allocation table, disk allocation table is
8 9 10 11 also required to know what blocks on the disk are avail-
File A 5
able. Some of the free space management techniques are
12 13 -1 14 15
as follows:

Indexed file allocation  The file allocation table contains a 1. Bit tables
separate one level index for each file. The index has one 2. Chained free portions
entry for each portion allocated to the file. The file allo- 3. Indexing
cation table contains block number for the index. If a file 4. Free block list
requires n blocks, then n + 1 blocks are used, where the first
Bit tables  This method uses a vector containing, one bit for
block contains index information (pointers to data blocks).
each block on the disk. Each entry of a ‘0’ corresponds to a
free block and each ‘1’ corresponds to a block in use.
Index Allocation with Block Pointers
File Allocation Advantage
Table(FAT) 1. Easy to find one or a contiguous group of free blocks.
File Index 2. Smaller in size.
0 1 2 3 Name Block
File B 10 The amount of memory required for a block bitmap will be
4 5 6 7 Disk size in (bytes)
1
8 9 10 2
8 × file system block size
11
6
Chained free portion The free portions may be chained
7 together by using a pointer and length value in each free
portion. This method has negligible space overhead. This
method is suitable for all file allocation methods. The disk
Indexed Allocation with Variable length will become quite fragmented, after some use. It is slower
Portion for individual block file creation and also for deletion.
File allocation table
Indexing  It treats the free space as a file and uses an index
(FAT)
table (same as in file allocation). The index should be on the
File name Index block basis of variable size portions rather than blocks.
File
1 2 3 4 File A 14 Free block list Here, each block is assigned a number
7 8
sequentially and the list of the numbers of all free blocks is
5 6
Start block Length maintained in a reserved portion of the disk.
9 10 11 12 2 3
13 14 15 8 2
Volumes
It is a collection of addressable sectors in a secondary mem-
ory that an OS or application can use for data storage. The
Example 1:  A direct access of file has fixed size 50 byte sectors in a volume need not be consecutive on a physical
records. Assuming the first record is record 1, the first byte storage device. (a single disk equals one volume).
of record 10 will be at what logical location?
Solution: 
Total records = 50 × 10 = 500 Unix File Management
First record is record 1. This record is already read. I-nodes (Index Node)
Logical location of first byte = 500 – 50 = 450
UNIX files are administered by the OS by means of i-node.
The correct logical location = 450 + 1 = 451.
An i-node (index node) is a control structure that contains
Example 2:  A sequential access file has fixed-size 32-byte the key information needed by the OS for a particular file.
records. Assuming that the first record is record 0, the first The attributes of the file as well as its permissions and
byte of record 20 will be at what location? other control information are stored in the i-node. The
7.80 | Unit 7  •  Operating System

exact i-node structure varies from UNIX implementation to 3. The blocks of a file on disk are not necessarily
another. The FreeBSD i-node structure is shown in Figure 8. contiguous.
4. An indexed method is used to keep track of each file,
File Allocation with i-node includes a number of direct pointers and
1. It is done on a block basis. three indirect pointers.
2. Allocation is dynamic.

Data Data Data Data


Mode
Owners (2) Data

Timestamps (4)
Data
Size Data Data

Direct (0) Data

Direct (1) Data

Pointer Pointer
Data
:
:
: Pointer Data

Direct (12) Pointer


Single indirect
Data
Double indirect
Pointer
Triple indirect Data
Pointer
Block count

Reference Pointer Pointer


count Data
Flags (2) Pointer
Data
Generation Pointer
number
Block size Pointer
Extended Data
attribute size
Extended
attribute blocks
Inode

Figure 8  Structure of free BSD i-node and file.

5. The free BSD i-node includes 120 bytes of address •• If the file contains still more blocks, the fifteenth
information that is organized as fifteen 64-bit addresses. address in the i-node points to a triple indirect block
6. The first 12 addresses point to the first 12 data blocks that is a third level of indexing. This block points to
of the file. additional double indirect blocks.
7. If the file requires more than 12 data blocks, one or
The capacity of FreeBSD file with 4 kB block size is shown
more levels of indirection are used as follows:
below:
•• The thirteenth address in the i-node points to a block
on disk that contains the next portion of the index. Level Number of Blocks Number of Bytes
This is referred to as the single indirect block. Direct 12 48 K
•• If the file contains more blocks, the fourteenth Single indirect 512 2M
address in the i-node points to a double indirect Double indirect 512 × 512 = 256 K 1G
block. Each block consists of single indirect blocks,
Triple indirect 512 × 256K = 128 M 512 G
each of which contains pointers to file blocks.
Chapter 5  •  File Systems, I/O Systems, Protection and Security  |  7.81

The total number of data blocks in a file depends on the Device I/O
capacity of the fixed-size blocks in the system. In FreeBSD, The requested operations and data are converted into appro-
the minimum block size is 4 kB, and each block can hold a priate sequences of I/O instructions, channel commands
total of 512 block addresses. Thus, the maximum size of a and controller orders.
file with this block size is over 500 GB.
Scheduling and Control
Windows NT File System
The actual queuing and scheduling of I/O operations
The windows NT file system provides a combination of reli- occurs at this layer as well as the control of the operations.
ability, compatibility and performance, which are not avail- Interrupts are handled. I/O status is collected and reported.
able in the FAT file system.
1. It will quickly perform standard file operations, such Communication Port
as write, read and search.
2. It also performs file-system recovery on very large User Communication Device
hard disks. process architecture I/O
3. NTFS file system formatting on a volume results in
the creation of several system files and the master file
table (MST), which contains information about all Hardware
Scheduling
the files and folders on the NTFS (Figure 9). and control

Partition Here, the communication architecture may itself consist of


boot Master file a number of layers.
sector table System files File area

Figure 9  NTFS after formatting. File System


4. It includes security features required for high-end User Directory File Physical
personal computers and file servers. processes management system organization
5. It supports data access control and ownership
privileges.
6. Folders shared on a Windows NT are assigned specific
Hardware Scheduling Device I/O
permissions. and control
7. It allows users to assign permissions to individual files.
Directory management  Here, the symbolic file names are
converted to identifiers that either reference the file directly
I/O Systems or indirectly through a file descriptor or index table.
Design Objectives of OS File system This layer deals with the logical structure of
Two objectives of OS for I/O systems are as follows: files and with the operations that can be specified by users,
1. Efficiency such as open, close, read, write.
2. Generality
Physical organization Allocation of secondary storage
space and main storage buffers is generally treated here.
Logical Structure of the I/O Function
The three most important logical structures are as follows: I/O buffering  In buffering, we perform input transfers in
1. Local peripheral devices advance of requests being made and perform output trans-
2. Communication ports fers sometime after the request is made. We will discuss
3. File system 1. Single buffering
2. Double buffering
Local Peripheral Device 3. Circular buffering
OS User process
User Logical Device Scheduling
Hardware
process I/O I/O and control
I/O device IN

Logical I/O
Manages general I/O functions on behalf of user processes,
allowing them to deal with the device in terms of a device iden-
Figure 10  No buffering.
tifier and simple commands, such as open, close, read, write.
7.82 | Unit 7  •  Operating System

OS User process Circular Buffer


OS
User process
I/O IN Move
Device
I/O IN : Move
Device :

Figure 11  Single buffering.

•• When a user process issues an I/O request, the OS assigns


a buffer in the system portion of main memory to the 1. Here, more than two buffers are used. Each individual
operation. buffer is one unit of circular buffer.
•• Provides a speed up compared to the lack of system
buffering. Kernal I/O Subsystem
•• For block oriented devices, input transfers are made to the Kernel I/O provides I/O-related services. It is built on the
system buffer. When the transfer is complete, the process hardware and device driver infrastructure.
moves the block into user space and immediately requests One of the responsibilities of Kernal I/O subsystem is to
another block. This is same for block-oriented output. protect itself from the erroneous process and malice users.
•• Suppose that T is the time required to input one block and Services provided by the I/O subsystem are as follows:
that C is the computation time that intervenes between
1. Scheduling 4. Spooling
input requests.
2. Buffering 5. Device reservation
Without buffering, the execution time per block = T + C.
3. Caching 6. Error handling
With a single buffer, the execution time per block = max
[C, T] + M,
where M = Time required to move the data from the sys- Disk Scheduling
tem buffer to user memory. Hard Disk Performance Parameters
•• For stream-oriented I/O, the single buffering scheme can be
(Terminologies)
used in a line-get-a-time fashion or a byte-at-a-time fashion.
Seek time  It is defined as the time required to move the disk
OS User process arm to the required track. It consists of
1. Initial start-up time
Move 2. The time taken to traverse the tracks that has to be
I/O IN crossed once the access arm is up to speed.
Device
Seek time, Ts = m × n + S
Figure 12  Double buffer where Ts = Estimated seek time
•• An improvement over single buffer.  n = Number of track traversed
•• A process now transfers data to one buffer while the OS m = Constant that depends on the disk drive
empties the other. This is known as double buffering or  S = Start-up time
buffer swapping. Rotational delay  Time required to reach the desired sector
•• For block-oriented transfer, the estimated execution time by read/write head. Rotational speed ranges from 5400 to
is max [C, T]. 10,000 rpm.
•• The stream-oriented transfer may be line-at-a-time or
byte-at-a-time. 1. Floppy disks typically rotate between 300 and 600 rpm.
2. For 1,00,000 rpm, the average rotational delay will be
3 ms.
Automatic and Explicit Buffering Transfer time  The transfer time to or from the disk depends
An indefinite length queue is provided in automatic buff- on the speed of the disk.
ering. Sender never blocks to copy a message. No speci- b
fications are present for providing automatic buffering. T=
rN
One method is to reserve large amount of memory. In this
method, most of the memory is wasted. where, T = Transfer time
The size of the queue is provided in explicit buffer-    b = Number of bytes to be transferred
ing. Sender will block if the requested space is more than    N = Number of bytes on a track
available. In this scheme, memory wastage is less likely to  r = Rotation speed in revolutions/second
happen. Total average access time
Chapter 5  •  File Systems, I/O Systems, Protection and Security  |  7.83

1 b Shortest Seek Time First (SSTF)  When a disk operation


Ta = Ts + + finishes, choose the request that is closer to the current head
2r rN
position or choose the request that has minimum seek time
Ts → average seek time from the current head position.
Hard Disk Scheduling Algorithms Example 4: Consider the following requests: 87, 170, 40,
Disk bandwidth and fast access time are to be considered. 150, 36, 72, 66, 15. Find the average head movement for SSTF.
Bandwidth is the total number of bytes transferred divided The initial head position is say 60. Now, closest to the
by the total time between the first request for service and head position is the request at cylinder 66. Then, the closest
completion of the last transfer. to 66 is 72, closest request to 72 is 87, and so on. Total head
movements = (66 – 60) + (72 – 66) + (87 – 72) + (87 – 40)
FCFS (First Come First Served)  The disk in controller + (40 – 36) + (36 – 15) + (150 – 15) + (170 – 150) = 6 + 6 +
processes the I/O requests the order in which they arrive, 15 + 47 + 4 + 21 + 135 + 20 = 254 cylinders
thereby moving backwards and forwards across the sur-
254
face of the disk to get the next requested location each time Average head movements = = 31.75 cylinders
(Figure 10). 8

Example 3: A disk queue has the following requests to Advantages


read tracks: 1. It minimizes latency
87, 170, 40, 150, 36, 72, 66, 15 2. Better throughput than FIFO method

Consider the disk head is initially at cylinder 60. Total head


movement = (87 – 60) + (170 – 87) + (170 – 40) + (150 – Disadvantages
40) + (150 – 36) + (72 – 36) + (72 –66) + (66 – 15) = 27 + 1. Starvation occurs if some process has to wait for long
83 + 130 + 110 + 114 + 36 + 6 + 51 = 557 cylinders time until its requests are satisfied.
2. SSTF services requests for those tracks which are
557
=
Average head movement = 69.6 cylinders highly localized.
8
SCAN/elevator algorithm  The disk head constantly moves
Advantage from the most inner cylinder to the outer cylinder and then
Improved response time as a request gets response in fair it changes its direction back towards the centre. As the head
amount of time. moves, if there is a request for the current disk position then
it is satisfied.
Disadvantages
1. It is known as elevator algorithm because it services
1. Involves a lot of random head movements and disk all the request of going up and then reaching at the
rotations. top, it goes downward.
2. Throughput is not efficient. 2. It needs two information:
3. Used in small systems only where I/O efficiency is •• Direction of head movement
not very important. •• Last position of the disk head
0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180


87

40 170

150
36
72

66

15

Figure 13  FCFS.


7.84 | Unit 7  •  Operating System

0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180

66
72

87

40
36
15
150

170

Figure 14  SSTF

Example 5:  For the following track requests: 87, 170, 40, 2. Disk arm keeps scanning between two extremes; this
150, 36, 72, 66, 15. (Initially head is at track 60 to the arm may result in wear and tear of the disk assembly.
is moving outwards. 3. Certain requests arriving ahead of the arm position
Total head movement = (66 – 60) + (72 – 66) + (87 – 72) + would get immediate service but some other requests
(150 – 87) + (170 – 150) + (180 – 170) + (180 – 40) + (40 that arrive behind the arm position will have to wait
– 36) + (36 – 15) for the arm to return back.
= 6 + 6 + 15 + 63 + 20 + 10 + 140 + 4 + 21
C–SCAN algorithm (one–way elevator algorithm)  It treats
= 285 cylinders
the cylinder as a circular list. The head sweeps from the
285
Average head movement = = 35.6 cylinders innermost cylinder to the outermost cylinder, satisfying the
8 waiting requests in order of their locations. When it reaches
Advantages the outermost cylinder, it sweeps back to the innermost cyl-
inder without satisfying any requests and then starts again.
1. Throughput better than FIFO.
2. Basic for most scheduling algorithms. Example 6:  Consider the cylinders requests:
3. Eliminates the discrimination. 87, 170, 40, 150, 36, 72, 66, 15 Starting cylinder = 60th
4. No starvation. (arm moving outwards)
Total head movement = (66 – 60) + (72 – 66) + (87 – 72) +
Disadvantages (150 – 87) + (170 – 150) + (180 – 170) + (180 – 0) + (15 – 0)
1. Because of the continuous scanning of disk from end + (36 – 15) + (40 – 36)
to end, the outer tracks are visited less often than the = 6 + 6 + 15 + 63 + 20 + 10 + 180 + 15 + 21 + 4 = 340
mid-range tracks. 340
Average head movement = = 35.6 = 42.5
8

0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180

66
72

87

150

170
15
36
180

Figure 15  SSTF


Chapter 5  •  File Systems, I/O Systems, Protection and Security  |  7.85

0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180

66
72
87

150
170

180
36
15 40

Figure 16  C–SCAN


Advantage LOOK/SEEK algorithm  Look is similar to SCAN, but
Lower service variability. stops moving inwards (or) outwards when there are no more
requests in that direction.
Disadvantages
Example 7:  Consider the following requests:
1. An average head movement is more compared to
87, 170, 40, 150, 36, 72, 66, 15 initially head is at track 60
SCAN algorithm.
(moves outwards).
2. Increase in the total seek time
0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180

66
72

87

150

15 170
40
36

Figure 17  LOOK

275 sequential read and write it is about 3 Mbps to 50 Mbps for


=
Average head movement = 34.37 the random read and write.
8
C–LOOK/C–SEEK algorithm  The head moves inwards ser- RAID (Redundant Array
vicing requests until there are no more requests in that direc-
tion. Then it jumps to the outer most outstanding request.
of Independent Disks)
1. It is multiple disk database design.
Magnetic Disk and Factors that 2. It consists of seven levels, zero through six.
Determine Access Speed 3. Characteristics of RAID Levels:
•• RAID is a set of physical disk drives viewed by the
The factors that determine the access speed are rotational speed,
OS as a single logical drive.
which is measured in revolutions per minute are seek time, the
•• Data are distributed across the physical drives of an
time taken to read or write the particular sector of the disk.
array in a scheme known as striping.
The other factors are sequential read, sequential write,
•• Redundant disk capacity is used to store parity
random read and random write. These vary enormously, but
information, which guarantees data recoverability
for spinning disks one can expect 25 Mbps to 150 Mbps for
in case of a disk failure.
7.86 | Unit 7  •  Operating System

RAID Level 0:

Strip 0 Strip 1 Strip 2 Strip 3

Strip 4 Strip 5 Strip 6 Strip 7 F o(b) F 1(b) F 2(b)

Strip 8 Strip 9 Strip 10 Strip 11

Strip 12 Strip 13 Strip 14 Strip 15

Figure 20  RAID 2 (Redundancy through Hamming code).

Figure 18  Non-redundant (RAID0) 6. Here redundancy is achieved through hamming code.
1. It does not include redundancy. 7. N + m disks required.
2. N disks are required.
3. Data available in RAID level 0 is lower than single disk. RAID Level 3:
4. It has high data transfer capacity.
5. It has high I/O request rate.
RAID Level 1:

Strip 3 b0 b1 b2 b3 p(b)
Strip 0 Strip 1 Strip 2
Strip 4 Strip 5 Strip 6 Strip 7
Strip 8 Strip 9 Strip 10 Strip 11

Strip 12 Strip 13 Strip 14 Strip 15 Figure 21  RAID 3 (bit-interleaved parity)

1. It has bit interleaved parity.


2. Provides parallel access.
3. N + 1 disks required.
Strip 7
RAID Level 4:
Strip 0 Strip 1 Strip 2 Strip 3
Strip 4 Strip 5 Strip 6 Strip 7
Strip 8 Strip 9 Strip 10 Strip 11 P (0 − 3)
Block 0 Block 1 Block 2 Block 3
Strip 12 Strip 13 Strip 14 Strip 15 Block 4 Block 5 Block 6 Block 7 P (4 − 7)
Block 8 Block 9 Block 10 Block 11 P(8 − 11)
Block 12 Block 13 Block 14 Block 15 P (12 − 15)
Figure 19  RIAD 1 (Mirrored)

1. Redundancy is achieved by the simple expedient of


Figure 22  RAID 4 (Block-level parity)
duplicating all the data.
2. 2N disks required. 1. N + 1 disks required.
3. Data availability is higher than RAID 2, 3, 4, or 5. But 2. Provides independent access.
lower than RAID 6. 3. Consider an array of five drives in which X0 through
4. Recovery from failure is simple. X3 contains data and X4 is the parity disk.
5. RAID1 costs more.
Suppose that a write is performed that only involves a strip
on disk X1. Initially for each bit i, we have the following
RAID Level 2:
relationship:
X4 (i) = X3(i) ⊕ X2 (i) ⊕ X1(i) ⊕ X0(i)
After the update, with potentially altered bits indicated
by a prime symbol:
b0 b1 b2 b3
X4′ (i) = X3(i) ⊕ X2 (i) ⊕ X1′ (i) ⊕ X0 (i)
= X3 (i) ⊕ X2 (i) ⊕ X1′ (i) ⊕ X0 (i) ⊕ X1 (i) ⊕ X1 (i)
= X4 (i) ⊕ X1 (i) ⊕ X1′ (i)
Chapter 5  •  File Systems, I/O Systems, Protection and Security  |  7.87

RAID Level 5: New section Old section

MRU LRU
Re-reference:
count unchanged
Block 0 Block 1 Block 2 Block 3 P (0 − 3) Re-reference:
Block 4 Block 5 Block 6 P (4 − 7) Count = count +1
Block 7
Block 8 Block 9 P(8 − 11) Block 10 Block 11 Miss (new block brought in)
Block 12 P(12 − 15) Block 13 Block 14 Block 15 Count = 1
P(16 − 19) Block 16 Block 17 Block 18 Block 19
  (A) FIFO

New section Middle section Old section


1. It has block level distributed parity. MRU LRU
2. Provides independent access.
3. It has N + 1 disks.   (B) Use of three sections.

In FIFO, the blocks are logically organized in a stack;


RAID Level 6: where the top part of the stack is the new section. When
there is a cache hit, the referenced block is moved to top
of the stack. If the block was already in the new section, its
reference count is not incremented; otherwise it is incre-
Block 0 Block 1 Block 2 mented by 1.
Block 6
In another technique, we divide the stack into three sec-
Block 4 Block 5
tions: New, middle and old. Here only blocks in the old sec-
Block 8 Block 9 P (8 − 11) tion are eligible for replacement.
Block 12 P (12 − 15) Q (12 − 15)

Protection and Security


System protection Protection refers to a mechanism for
controlling the access of programs, processes or users to the
Block 3 P (0 − 3) Q (0 − 3)
resources defined by a computer system.
P (4 − 7) Q (4 − 7) Block 7
Q (8 − 11) Block 10 Block 11 Principles of Protection
Block 13 Block 14
Programs, users and even systems are given just enough
Block 15
privileges to perform their tasks. This is the principle of
least privilege.
Domain of protection  A computer system is a collection of
processes and objects. The objects may be software or hard-
1. It has dual redundancy.
ware objects. The operations that are possible may depend
2. It provides independent access.
on the object.
3. It has N + 2 disks.
A process should be allowed to access only those
resources for which it has authorization. At any time, a pro-
Disk Cache: cess should be able to access only those resources that it
1. It is a buffer in main memory for disk sectors. currently requires to complete its task. This requirement is
2. The cache contains a copy of some of the sectors on referred as need to know principle and is useful in limiting
the disk. the amount of damage, which a faulty process can cause in
3. Replacement policy: the system.
•• LRU
•• LFU Domain structure  Each domain defines a set of objects
and the types of operations that may be invoked on each
But these two replacement policies lead to poor perfor- object.
mance. So a new technique frequency-based replacement The ability to execute an operation on an object is an
is proposed. Two alternatives of frequency-based technique access right. A domain is a collection of access rights, each
are shown below: of which is an ordered pair <obj-name, rights-set>
7.88 | Unit 7  •  Operating System

File System Security Decomposition by row yields. Capability tickets.


1. A general model of access control for file management
User A File 1 File 3
is an access matrix.
2. The basic elements of the model are as follows: OWN OWN
R R
•• Subject: An entity capable of accessing objects.
W W
•• Object: Anything to which access is controlled.
•• Access right: The way in which an object is accessed
by a subject.
Access matrix format is shown below: User B File 1 File 2 File 3 File 4

File 1 File 2 File 3 File 4 Account 1 Account 2 OWN


R R W R
User OWN OWN Inquiry W
A R R credit
W W
User R OWN W R Inquiry Inquiry
B R debit credit
W User C File 1 File 2 File 4

User R R OWN Inquiry OWN


R
C W R Debit R R
W W
W

The access matrix may be decomposed by columns,


yielding access control lists. The access control list for
above matrix is Note: These tickets would have to be held in a region of
memory inaccessible to users.
File 1 A B C
System security  This is the protection afforded to an auto-
OWN R mated information system in order to attain objectives of
R R W preserving the integrity, availability and confidentiality of
W information system resources.

Objectives of Computer Security


Confidentiality  Preserving authorized restrictions on infor-
File 2 B C
mation access and disclosure, including means for protect-
OWN ing personal privacy and proprietary information.
R
R
W
Integrity Guarding against improper information modifi-
cation or destruction, including ensuring information non-
repudiation and authenticity.
Availability  Ensuring timely and reliable access to and use
File 3 A B of information.
OWN Authenticity  The property of being genuine and being able
R W to be verified and trusted.
W Accountability The security goal that generates the require-
ment for actions of an entity to be traced uniquely to that entity.

Threats, Attacks and Assets


File 4 B B
Threats and attacks  Unauthorized disclosure is the threat
OWN to confidentiality. The attacks of following this threat are as
R R follows:
W
1.
Exposure: Sensitive data are directly released to an
unauthorized entity.
2.
Interception: An unauthorized entity directly accesses
Note: This allows users that are not explicitly listed as hav- sensitive data traveling between authorized sources
ing special rights to have a default set of rights. and destinations.
Chapter 5  •  File Systems, I/O Systems, Protection and Security  |  7.89

3.
Inference: A threat action where an unauthorized entity Passive attacks
indirectly accesses sensitive data by reasoning from 1. These are in the nature of monitoring of the
characteristics or by-products of communications. transmissions.
4.
Intrusion: An unauthorized entity gains access to 2. Attackers obtain information that is being transmitted.
sensitive data by circumventing a system’s security 3. Two types of passive attacks:
protections. •• Release of message contents.
•• Traffic analysis
Deception  Threat to either system integrity or data integ-
4. These are very difficult to detect because they do not
rity. Types of attacks that can result are as follows:
involve any alteration of the data.
1. Masquerade: An unauthorized entity gains access to Active attacks
a system or performs a malicious act by posing as an 1. These attacks involves some modification of the date
authorized entity. stream or the creation of a false stream and can be
2. Falsification: False data deceive an authorized entity. subdivided into four categories:
3. Repudiation: An entity deceives another by falsely •• Replay
denying responsibility for an act. •• Masquerade
•• Modification of messages
Disruption  A circumstance or event that interrupts or pre-
•• Denial of service
vents the correct operation of system services and func- 2. It is difficult to prevent active attacks absolutely.
tions. Attacks for this threat are as follows:
Intruders  Three types of intruders:
1.
Incapacitation: Prevents or interrupts system
operation by disabling a system component. Masquerader  An individual who is not authorized to use the
2.
Corruption: Undesirably alters system operation by computer and who penetrates a systems access controls to
adversely modifying system functions or data. exploit a legitimate user’s account. He is likely to be an outsider.
3.
Obstruction: A threat action that interrupts delivery
of system service by hindering system operation. Misfeasor  A legitimate user who accesses data, programs
or resources for which such access is not authorized or who
Usurpation  A circumstance or event that results in control is authorized for such access but misuses his or her privi-
of system services or functions by an unauthorized entity. leges (generally an insider).
Attacks with this threat are as follows:
Clandestine user An individual who seizes supervisory
1.
Misappropriation: An entity assumes unauthorized control of the system and uses this control to evade auditing
logical or physical control of a system resource. and access controls or to suppress audit collection (either
2.
Misuse: Causes a system component to perform outsider or insider).
a function or service that is detrimental to system
security. Hackers  Those who hack into computers do so for the thrill
of it or for status. Attackers often took for targets of oppor-
Threats and assets  The assets of a computer are as follows: tunity and then share the information with others.
1. Hardware
Criminals Organized group of hackers have become a
2. Software
widespread and common threat to internet based systems.
3. Data
4. Communication lines Malicious software overview  The most sophisticated types
Hardware  A major threat to computer system hardware is of threats to computer systems are presented by programs
the threat to availability (e.g., theft of CD-ROMS). that exploit vulnerabilities in computing systems. These
threats are referred as malicious software (or) malware.
Software
1. It is designed to cause damage to or use up the
1. A key threat to software is an attack on availability
resources of a target computer.
(e.g., deletion of software).
2. There are two types of malicious software:
2. A threat to integrity.
•• Those that need a host program.
3. A threat to confidentiality.
Example:  Viruses, logic bombs.
Data  Threats to data are an attack on •• Those that are independent.
1. Availability Example:  Worms, bot programs.
2. Confidentiality 3. We can also differentiate between two types of
3. Integrity software threats:
Communication lines and networks  Two types of attacks: •• That do not replicate. These programs are activated
1. Passive attacks by a trigger.
2. Active attacks Example:  Logic bombs, backdoors.
7.90 | Unit 7  •  Operating System

•• Those that replicate. 1. Infection mechanism


Example:  Viruses, worms 2. Trigger
3. Payload
Backdoor (trapdoor)  It is a secret entry point into a pro-
gram that allows someone who is aware of the backdoor Phases of computer virus are
to gain access without going through usual security access 1. Dormant phase
procedures. 2. Propagation phase
3. Triggering phase
Logic bomb  It is a program inserted into software by an 4. Execution phase
intruder. It lies dormant until a predefined condition is met;
the program then triggers an unauthorized act.
Trojan Horse It is an apparently useful program, con- Types of Virus
taining hidden code that, when invoked, performs some 1. Encrypted virus
unwanted or harmful function. 2. Stealth virus
Mobile code  It is a software that can be shipped unchanged 3. Polymorphic virus
to a heterogeneous collection of platforms and execute with 4. Metamorphic virus
identical semantics.
Worms A worm is a program that can replicate itself and
Viruses A computer virus is a piece of software that can send copies from computer to computer across network
infect other programs by modifying them. connections.

Nature of Viruses Bots  A bot is a program that secretly takes over another
A virus can do anything that other programs do. It attaches internet attached computer and then uses that computer
itself to another program and executes secretly when the host to launch attacks that are difficult to trace to the bot’s
program is run. Three parts of computer virus are as follows: creator.

Exercises
Practice Problems 1 (A) 5 (B) 0
Directions for questions 1 to 15:  Select the correct alterna- (C) 10 (D) 13
tive from the given choices. 5. A disk is formatted into 40 sectors and 20 tracks. The
1. Given a system using unspanned blocking and 100 byte disk rotates at 200 ms in one revolution. The time taken
blocks. A file contains records 30, 40, 55, 80, 30, 40. by the head to move from the centre to the rim is 10 ms.
What percentage of space will be wasted in the blocks There are three different files stored on the disk:
allocated for the file? File P : Sector 2, track 4
(A) 31.25% (B) 41.25% File Q : Sector 5, track 1
(C) 51.25% (D) 62.15% File R : Sector 6, track 2
 Calculate the average latency time required for the
2. Disk requests come into the disk driver for cylinders
three files.
15, 25, 10, 2, 35, 9, 42 in that order. The disk head is
(A) 22.55 ms (B) 32.22 ms
currently positioned over cylinder 15. A seek takes 6
(C) 21.66 ms (D) 30.22 ms
msec per cylinder moved. What is the total seek time
6. Match the following
using First Come First Served Algorithm?
(A) 750 msec (B) 650 msec (a) RAID0 (1) Parallel access
(C) 550 msec (D) 450 msec (b) RAID1 (2) Striping
(c) RAID2 (3) Use hamming code
3. A Java application needs to load 50 libraries. To load (d) RAID3 (4) Mirrored
each library, one disk access is required. Seek time to (A) a – 2, b – 4, c – 3, d – 1
access the location is 10 ms. Rotational speed is 6000 (B) a – 1, b – 2, c – 3, d – 4
rpm. The total time needed to load all libraries is (C) a – 3, b – 2, c – 4, d – 1
(A) 0.65 sec (B) 0.75 sec (D) a – 4, b – 1, c – 2, d – 3
(C) 0.85 sec (D) 1 sec
7. The correct matching for the following pairs is
4. A program has just read the 13th record in a sequential (A) Disk scheduling (1) Round Robin
access file. If it wants to read the 10th record next, how (B) Batch processing (2) SCAN
many records must the program read to input the tenth (C) Time sharing (3) LIFO
record? (D) Interrupt processing (4) FIFO
Chapter 5  •  File Systems, I/O Systems, Protection and Security  |  7.91

(A) A – 3, B – 4, C – 2, D – 1 clockwise or anti-clockwise. The times required to perform


(B) A – 4, B – 3, C – 2, D – 1 certain operations are as follows:
(C) A – 2, B – 4, C – 1, D – 3 I. Rotate the disk through one revolution = 200 ms
(D) A – 2, B – 1, C – 4, D – 3
II. Move the disk head from the centre to the rim = 20 ms
8. A program P reads and processes 2000 consecutive
III. Read and transmit one block of data = 0.3 ms
records from a sequential file stored on device R with-
Three files are stored on the disk:
out using any file system facilities. Given the following:
File A: 2 blocks at track 6
Size of each record = 3500 bytes
File B: 5 blocks at track 2
Access time of R = 20 ms
File C: 1 block at track 5
Data transfer rate of R = 500 × 103 bytes/sec
CPU time to process each record = 5 m sec 11. The disk head is initially at sector 0, track 0. If all three
What is the elapsed time of P if R contains unblocked files A, B and C are to be read in the minimum amount of
records and P does not use buffering? time, they should be read in the following order:
(A) 64 sec (B) 46 sec (A) A, B, C (B) A, C, B
(C) 34 sec (D) 17 sec (C) B, C, A (D) C, A, B
9. A disk has 19456 cylinders, 16 heads and 63 sectors per 12. The disk head is initially at sector 0, track 0. The files
track. The disk spins at 5400 rpm. Seek time between are read in the order C, B, A. The total time to read the
adjacent tracks is 2 ms. Assuming the read/write head files is
is already positioned at track 0, how long does it take to (A) 143.9 ms (B) 100.4 ms
read the entire disk? (C) 114.0 ms (D) 102.6 ms
(A) 35 min (B) 68 min 13. The most nearly average latency time for the sequence
(C) 58 min (D) 53 min CBA is:
(A) 1 ms (B) 7 ms
10. On a disk with 1000 cylinders, numbered 0 to 999,
(C) 27 ms (D) 50 ms
compute the number of tracks the disk arm must move
to satisfy all the requests in the disk queue using SCAN 14. The most nearly average seek time for CBA is
algorithm. Assume the last request serviced was at track (A) 1 ms (B) 8 ms
345 and the head is moving towards 0. The queue in (C) 30 ms (D) 50 ms
FIFO order contains requests for the following tracks: 15. A CD has 150 tracks rotating at 3500 rpm. Average
123, 874, 692, 475, 105, 376 seek time for consecutive tracks is 0.1 ms, the disk is
(A) 219 (B) 635 subjected to read data from the track numbers 89, 75,
(C) 845 (D) 1219 112, 5. What is the total seek time if the requests are
served unidirectionally (C-Scan) and the first request
Common data for questions 11 to 14:  In the operation determines initial direction? Assume that the current
of a certain disk drive mechanism, a disk is formatted into position of the head is at track 100.
20 sectors and 10 tracks. The disk can be rotated either (A) 20.2 ms (B) 16.9 ms
(C) 21.3 ms (D) 14 ms

Practice Problems 2 3. Let us assume that the user process is 10 MB in size


Directions for questions 1 to 15:  Select the correct alterna- and backing store is a standard hard disk with a transfer
tive from the given choices. rate of 40 MB per second. Let the average latency is
8 millisecond. Find actual time transfer of the 10 MB
1. The strategy that allocates the smallest possible chunk process to or from main memory?
of disk space that is sufficient to the file is
(A) 8 ms (B) 250 ms
(A) Nearest fit (B) Best fit
(C) Worst fit (D) First fit (C) 258 ms (D) 516 ms

2. If a process of 200 kB is transferred from backing store 4. Disk scheduling involves deciding
to memory and average disk latency is 10 ms, then (A) which disk should be accessed next
what would be the total swap time, if transfer ratio is 2 (B) the order in which disk access requests must be
Mbps? serviced.
(A) 10 ms
(C)  the physical location when files should be ac-
(B) 20 ms
cessed in the disk
(C) 30 ms
(D) 40 ms (D) disk access time and an unused space.
7.92 | Unit 7  •  Operating System

5. The root directory of a disk should be placed 10. Which of the following is a program that spreads
(A) at a fixed address in the memory throughout the network?
(B) anywhere on the disk (A) Trojan Horse (B) Virus
(C) at a fixed location on the system disk (C) TSR (D) Worm
(D) at a location on floppy. 11. A program has just read the 15th record in a sequential
6. Direct access methods are not effectively supported by access file. If it wants to read the 10th record next, how
(A) Contiguous allocation many records must the program read to input the tenth
(B) Linked allocation record?
(C) Indexed allocation (A) 0 (B) 5
(D) Sequential allocation (C) 4 (D) 10
7. In which of the following directory systems, it is pos- 12. Formatting of a floppy disk refers to
sible to have multiple paths for a file, starting from the (A) Arranging the data on the disk in contiguous fashion
root directory? (B) Writing the directory
(A) Single-level directory (C) Erasing the system area
(B) Two-level directory (D) Writing identification information on all tracks
(C) Tree-structured directory 13. Sector interleaving in disks is done by
(D) A cyclic graph directory (A) the disk manufacturer
8. The most common system’s security method is: (B) the disk controller card
(A) Passwords (C) the operating system
(B) Key card systems (D) the user
(C) Surveillance system 14. Disk I/O is done in terms of
(D) Lock system (A) Tracks
(B) Blocks
9. Trojan Horse programs
(C) Bits
(A) are legitimate programs that allow unauthorized
(D) Bytes
access.
(B) are hacker programs that do not show up on the 15. How many six-letter passwords can be constructed
system using lowercase letters and digits?
(C) really do not work (A) 266 (B) 106
(D) are immediately discovered (C) 36 6
(D) 356

Previous Years’ Questions


1. Consider a disk drive with the following specifica- (C) 512 Mbyte, 20 bits
tions: [2005] (D) 64 Gbyte, 28 bits
16 surfaces, 512 tracks/surfaces, 512 sectors/track, 1 3. For a magnetic disk with concentric circular tracks,
KB/sector, rotation speed 3000 rpm. The disk is oper- the seek latency is not linearly proportional to the
ated in cycle stealing mode whereby whenever one 4 seek distance due to [2008]
byte word is ready it is sent to memory; similarly, for (A) non-uniform distribution of requests
writing, the disk interface reads a 4 byte word from (B) arm starting and stopping inertia
the memory in each DMA cycle. Memory cycle time (C) higher capacity of tracks on the periphery of the
is 40 nsec. The maximum percentage of time that the platter
CPU gets blocked during DMA operation is: (D) use of unfair arm scheduling policies
(A) 10 (B) 25 4. Consider a file of 16384 records. Each record is 32
(C) 40 (D) 50 bytes long and its key field is of size 6 bytes. The file
2. Consider a disk pack with 16 surfaces, 128 tracks per is ordered on a non-key field, and the file organization
surface and 256 sectors per track. 512 bytes of data is unspanned. The file is stored in a file system with
are stored in a bit serial manner in a sector. The capac- block size 1024 bytes, and the size of a block pointer
ity of the disk pack and the number of bits required is 10 bytes. If the secondary index is built on the key
to specify a particular sector in the disk are, respec- field of the file, and a multi-level index scheme is
tively: [2007] used to store the secondary index, the number of first-
(A) 256 Mbyte, 19 bits level and second-level blocks in the multi-level index
(B) 256 Mbyte, 28 bits are, respectively [2008]
Chapter 5  •  File Systems, I/O Systems, Protection and Security  |  7.93

(A) 8 and 0 (B) 128 and 6 the FAT is 4 bytes in size. Given a 100 × 106 bytes
(C) 256 and 4 (D) 512 and 5 disk on which the file system is stored and data block
5. Consider a disk system with 100 cylinders. The size is 103 bytes, the maximum size of a file that can
requests to access the cylinders occur in following be stored on this disk in units of 106 bytes is ______?
sequence: [2009]  [2014]
4, 34, 10, 7, 19, 73, 2, 15, 6, 20 11. Consider a disk pack with a seek time of 4 mil-
liseconds and rotational speed of 10000 rotations
Assuming that the head is currently at cylinder 50,
per minute (RPM). It has 600 sectors per track and
what is the time taken to satisfy all requests if it takes
each sector can store 512 bytes of data. Consider a
1ms to move from one cylinder to adjacent one and
file stored in the disk. The file contains 2000 sectors.
shortest seek time first policy is used?
Assume that every sector access necessitates a seek,
(A) 95 ms (B) 119 ms
and the average rotational latency for accessing each
(C) 233 ms (D) 276 ms
sector is half of the time for one complete rotation.
Common data for questions 6 and 7:  A hard disk has The total time (in milliseconds) needed to read the
63 sectors per track, 10 platters each with 2 recording sur- entire file is ________. [2015]
faces and 1000 cylinders. The address of a sector is given 12. Suppose the following disk request sequence (track
as a triple 〈c, h, s〉 , where c is the cylinder number, h is the numbers) for a disk with 100 tracks is given: 45, 20,
surface number and s is the sector number. Thus, the 0th 90, 10, 50, 60, 80, 25, 70. Assume that the initial
sector is addressed as 〈0, 0, 0〉 , the 1st sector as 〈0, 0, 1〉, position of the R/W head is on track 50. The addi-
and so on tional distance that will be traversed by the R/W head
6. The address <400, 16, 29> corresponds to the sector when the Shortest Seek Time First (SSTF) algorithm
is used compared to the SCAN (Elevator) algorithm
number: [2009]
(assuming that SCAN algorithm moves towards 100
(A) 505035 (B) 505036
when it starts execution) is ______ tracks. [2015]
(C) 505037 (D) 505038
7. The address of the 1039th sector is [2009] 13. Consider a typical disk that rotates at 15000 rotations
(A) 〈0, 15, 31〉 (B) 〈0, 16, 30〉 per minute (RPM) and has a transfer rate of 50 × 106
(C) 〈0, 16, 31〉 (D) 〈0, 17, 31〉 bytes/sec. If the average seek time of the disk is twice
the average rotational delay and the controller’s trans-
8. A file system with 300 GByte disk uses a file descrip- fer time is 10 times the disk transfer time, the average
tor with 8 direct block addresses, 1 indirect block time (in milliseconds) to read or write a 512-byte sec-
address and 1 doubly indirect block address. The size tor of the disk is ________ [2015]
of each disk block is 128 bytes and the size of each
disk block address is 8 bytes. The maximum possible 14. Consider a disk queue with requests for I/O to blocks
on cylinders 47, 38, 121, 191, 87, 11, 92, 10. The
file size in this file system is [2012]
C-LOOK scheduling algorithm is used. The head is
(A) 3 Kbytes
initially at cylinder number 63, moving towards larger
(B) 35 Kbytes
cylinder numbers on its servicing pass. The cylinders
(C) 280 Kbytes
are numbered from 0 to 199. The total head move-
(D) dependent on the size of the disk
ment (in number of cylinders) incurred while servic-
9. Consider a hard disk with 16 recording surfaces ing these requests is _____. [2016]
(0–15) having 16384 cylinders (0–16383) and each 15. In a file allocation system, which of the following
cylinder contains 64 sectors (0–63). Data stor- allocation scheme(s) can be used if no external frag-
age capacity in each sector is 512 bytes. Data are mentation is allowed? [2017]
organized cylinder-wise and the addressing format I. Contiguous
is <cylinder no., surface no., sector no.>. A file of II. Linked
size 42797 KB is stored in the disk and the starting III. Indexed
disk location of the file is <1200, 9, 40>. What is the (A) I and III only (B) II only
cylinder number of the last sector of the file, if it is (C) III only (D) II and III only
stored in a contiguous manner?[2013]
16. Consider a storage disk with 4 platters (numbered as
(A) 1281 (B) 1282
0, 1, 2 and 3), 200 cylinders (numbered as 0, 1, ...,
(C) 1283 (D) 1284
199), and 256 sectors per track (numbered as 0, 1,
10. A FAT (File allocation table)-based file system is ..., 255). The following 6 disk requests of the form
being used, and the total over head of each entry in [sector number, cylinder number, platter number] are
7.94 | Unit 7  •  Operating System

received by the disk controller at the same time: reversing the direction of the head movement once is
[120, 72, 2], [180, 134, 1], [60, 20, 0], [212, 86, 3], 15 milliwatts. Power dissipation associated with rota-
[56, 116, 2], [118, 16, 1] tional latency and switching of head between different
platters is negligible.
Currently the head is positioned at sector number 100
of cylinder 80, and is moving towards higher cylinder The total power consumption in milliwatts to satisfy
numbers. The average power dissipation in moving all of the above disk requests using the Shortest Seek
the head over 100 cylinders is 20 milliwatts and for Time First disk scheduling algorithm is _________.
 [2018]

Answer Keys
Exercises
Practice Problems 1
1. A 2. A 3. B 4. C 5. C 6. A 7. C 8. A 9. C 10. D
11. C 12. B 13. C 14. B 15. A

Practice Problems 2
1. B 2. C 3. D 4. B 5. C 6. D 7. C 8. A 9. A 10. D
11. D 12. D 13. C 14. B 15. C

Previous Years’ Questions


1. B 2. A 3. C 4. C 5. B 6. C 7. C 8. B 9. D 10. 99.6
11. 14020 12. 10 13.  6.1 to 6.2 14. 346 15. D 16. 85

You might also like