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

Seek Time

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Seek Time

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Q.1 Explain I/O Devices.

I/O with computer systems can be roughly grouped into three categories:

Human readable: Suitable for communicating with the computer user. Examples include printers
and terminals, the latter consisting of video display, keyboard, and perhaps other devices such as a
mouse.

Machine readable: Suitable for communicating with electronic equipment. Examples are disk drives,
USB keys, sensors, controllers, and actuators.

Communication: Suitable for communicating with remote devices. Examples are digital line drivers
and modems.

NOTE: I/O devices can also be categorised as:

Block-oriented device stores information in blocks that are usually of fixed size, and transfers are
made one block at a time. Generally, it is possible to reference data by its block number. Disks and
USB keys are examples of block-oriented devices.

Stream-oriented device transfers data in and out as a stream of bytes, with no block structure.
Terminals, printers, communications ports, mouse and other pointing devices, and most other devices
that are not secondary storage are stream oriented.

Q.2 Define seek time and latency time.

Seek Time

Seek Time is measured defines the amount of time it takes a hard drive's read/write head to find the
physical location of a piece of data on the disk.

Latency Time

Latency is the average time for the sector being accessed to rotate into position under a head, after a
completed seek.

Q3. What are the disadvantages of single contiguous memory allocation?

Disadvantages:

1) For new files it is very difficult to find the spaces here.

2) Further more you can't extend the file .

3)The one big disadvantage is the difficulty about fragmentation.

Q4. Define character device driver and block device driver.

A character device driver provides data a character at a time; this is usually used for data streams
like sound devices and keyboards. You use a character device driver to stream sequential data.

A block device driver can provide random access data. You need this if you’re trying to access files
on the device.
Q5. What is the difference between directory and File?

The basic difference between the two is that files store data, while folders store files and other folders.
The folders, often referred to as directories, are used to organize files on your computer.

Q6. What are files and explain the access methods for files.

A file is basically a sequence of bytes organized into blocks that are understandable by any machines.
In other words, the collection of related information that is stored in a secondary storage device is also
called a file.

The file is a collection of logically related entities. According to the users view a file is the smallest
allots space of the logical secondary storage. The object that stores data, information, settings or
commands used with a computer program on a computer is called file. In graphical user interface
(GUI) such as Microsoft Windows, files display as icons that relate to the program that opens the file.

Attributes of file

A file is referred by its name, a name or string is a collection of character. There are many systems
which differentiate the upper and lower case of the alphabet. When a file is saved by any name it
becomes independents for the user and file name should be unique. The system does not allow the
files of the same types of name. The attributes of the file may vary from the one operating system to
another operating system. Following are some attribute of the file,

• Name - The name of any file is the information which is in readable form for the users.

• Identifier - The identifier is a unique tag number which identifies the file within the file system. It is
not possible for the human to read the identifier or tag number.

• Type - type is needed for the system that supports different types of file.

• Size - In this attribute, the current or the maximum size of the file is included (in bytes, words,
blocks).

• Location - This attribute of the file is the pointer to the file and the location of the file where the file
is stored on that device.

• Protection - this information determines the control and assigns the power of reading, writing and
executing. It also defines that who can do the reading, writing.

• Time date and user identification - This type of data is useful for the protection, security and
usage monitoring. It also defines the last creation, last modification and last use of the file.

File Access Method

The file contains the information but when it required to used this information can be access by the
access methods and reads into the computer memory.Some system provides only one access method
and some provide more than onaccess method to access the file,

1. Sequential Access Method

A sequential access is that in which the records are accessed in some sequence,i.e., the information in
the file is processed in order, one record after the other.This access method is the most primitive one.
The idea of Sequential access is based on the tape model which is a sequential access device. We
consider Sequential access method is best because most of the records in a file are to be processed.
For example, transaction files.

Example: Compilers usually access files in this fashion.

2. Direct or Random Access Methods

Sometimes it is not necessary to process every record in a file. It is not necessary to process all the
records in the order in which they are present in the memory. In all such cases, direct access is
used.The disk is a direct access device which gives us the reliability to random access of any
fileblock. In the file, there is a collection of physical blocks and the records of that blocks.

Eg. Databases are often of this type since they allow query processing that involves immediate access
to large amounts of information. All reservation systems fall into thiscategory.

3. Index Access Method

An indexed file is a computer file with an index that allows easy random access to any record given
its file key. The key is an attribute that uniquely identifies a record. We can say that If more than one
index is present the other ones are alternate indexes. The creation of the indexes is done with the file
but maintained by the system.

4. Index sequential Access Method

The index sequential access method is a modification of the direct access method. Basically, it is kind
of combination of both the sequential access as well as direct access. The main idea of this method is
to first access the file directly and then it accesses sequentially. In this access method, it is necessary
for maintaining an index. The index is nothing but a pointer to a block. The direct access of the index
is made to access a record in a file. The information which is obtained from this access is used to
access the file. Sometimes the indexes are very big. So to maintain all these hierarchies of indexes are
built in which one direct access of an index leads to information of another index access. The main
advantage in this type of access is that both direct and sequential access of files is possible with the
help of this method.

Q7. Write short notes on:

(i) File system protection and security

(ii) Linked file allocation methods

The allocation methods define how the files are stored in the disk blocks. There are three main

disk space or file allocation methods.

• Contiguous Allocation

• Linked Allocation

• Indexed Allocation

The main idea behind these methods is to provide:


• Efficient disk space utilization.

• Fast access to the file blocks.

All the three methods have their own advantages and disadvantages as discussed below:

1. Contiguous Allocation

In this scheme, each file occupies a contiguous set of blocks on the disk. For example, if a file
requires n blocks and is given a block b as the starting location, then the blocks assigned to the file
will be: b, b+1, b+2,......b+n-1. This means that given the starting block address and the length of the
file (in terms of blocks required), we can determine the blocks occupied by thefile.

The directory entry for a file with contiguous allocation contains

• Address of starting block

• Length of the allocated portion.

The file ‘mail’ in the following figure starts from the block 19 with length = 6 blocks. Therefore,

it occupies 19, 20, 21, 22, 23, 24blocks.

Advantages:

• Both the Sequential and Direct Accesses are supported by this. For direct access, the address of the
kth block of the file which starts at block b can easily be obtained as (b+k).

• This is extremely fast since the number of seeks are minimal because of contiguous allocation of file
blocks.

Disadvantages:

• This method suffers from both internal and external fragmentation. This makes it inefficient in terms
of memory utilization.

• Increasing file size is difficult because it depends on the availability of contiguous memory at a
particular instance.

2. Linked List Allocation

In this scheme, each file is a linked list of disk blocks which need not be contiguous. The disk blocks
can be scattered anywhere on the disk. The directory entry contains a pointer to the starting and the
ending file block. Each block contains a pointer to the next block occupied by the file. The file ‘jeep’
in following image shows how the blocks are randomly distributed. The last block (25) contains -1
indicating a null pointer and does not point to any other block.

Advantages:

• This is very flexible in terms of file size. File size can be increased easily since the system does not
have to look for a contiguous chunk of memory.

• This method does not suffer from external fragmentation. This makes it relatively better in terms of
memory utilization.

Disadvantages:

• Because the file blocks are distributed randomly on the disk, a large number of seeks are needed to
access every block individually. This makes linked allocation slower.

• It does not support random or direct access. We can not directly access the blocks of a file. A block
k of a file can be accessed by traversing k blocks sequentially (sequential access ) from the starting
block of the file via block pointers.

• Pointers required in the linked allocation incur some extra overhead.

3. Indexed Allocation

In this scheme, a special block known as the Index blockcontains the pointers to all the blocks
occupied by a file. Each file has its own index block. The ith entry in the index block contains the disk
address of the ith file block. The directory entry contains the address of the index block as

shown in the image:


Advantages:

• This supports direct access to the blocks occupied by the file and therefore provides fast access to
the file blocks.

• It overcomes the problem of external fragmentation.

Disadvantages:

• The pointer overhead for indexed allocation is greater than linked allocation.

• For very small files, say files that expand only 2-3 blocks, the indexed allocation would keep one
entire block (index block) for the pointers which is inefficient in terms of memory utilization.
However, in linked allocation we lose the space of only 1 pointer perblock.

Q8. Directory Implementation.

Directories need to be fast to search, insert, and delete, with a minimum of wasted disk space.

i) LinearList

A linear list is the simplest and easiest directory structure to set up, but it does have some drawbacks.

• Finding a file (or verifying one does not already exist upon creation) requires a linear search.

• Deletions can be done by moving all entries, flagging an entry as deleted, or by moving the last
entry into the newly vacant position.

• Sorting the list makes searches faster, at the expense of more complex insertions and deletions.

• A linked list makes insertions and deletions into a sorted list easier, with overhead for the links.

• More complex data structures, such as B-trees, could also be considered.

ii) Hash Table

• A hash table can also be used to speed up searches.

• Hash tables are generally implemented in addition to a linear or other structure.

Q9. Explain:

i) I/O Buffering
ii) SequentialFile
iii) IndexedFile

i) I/O Buffering: Input/output (I/O) buffering is a mechanism that improves the throughput of input
and output operations. It is implemented directly in hardware and the corresponding drivers (hence the
block devices found in Unix- like systems), and is also ubiquitous amongprogramming language
standardlibraries.
I/O operations often have high latencies; the time between the initiation of an I/O process and its
completion may be millions of processor clock cycles. Most of this latency is due to the hardware
itself; for example, information cannot be read from or written to a hard disk until the spinning of the
disk brings the target sectors directly under the read/write head.

ii) Sequential File: A sequential access is that in which the records are accessed in some sequence i.e
the information in the file is processed in order, one record after the other. This access method is the
most primitive one.

Example: Compilers usually access files in this fashion.

iii) Indexed File:

• This mechanism is built up on base of sequential access.

• An index is created for each file which contains pointers to various blocks.

• Index is searched sequentially and its pointer is used to access the file directly.

Q10. Explain Bit-Vectors.

A bit-vector can be written as the sequence of bits contained in the string, preceded by #◆;

any delimiter character, such as whitespace, will terminate the bit-vector syntax. For example:

#◆10110 ;A five-bit bit-vector; bit 0 is

a 1 #◆ ;An empty bit-vector

The bits notated following the #◆, taken from left to right, occupy locations within the bit- vector
with increasing indices. The leftmost notated bit is bit-vector element number 0, the next one is
element number 1, and so on. The function print1 will print any bit-vector (not just a simple one)
using this syntax, but the function read will always construct a simple bit-vector when it reads this
syntax.

Q11. Differentiate between Blocking & Non Blocking I/O.

Some control over how the wait for I/O to complete is accommodated is available to the programmer
of user applications. Most I/O requests are considered blocking requests, meaning that control does
not return to the application until the I/O is complete. The delayed from systems calls such read() and
write() can be quite long. Using systems calls that block is sometimes called synchronous
programming. In most cases, the wait is not really a problem because the program can not do anything
else until the I/O is finished. However, in cases such as network programming with multiple clients or
with graphical user interface programming, the program may wish to perform other activity as it
continues to wait for more data or input fromusers.

One solution for these situations is to use multiple threads so that one part of the program is not
waiting for unrelated I/O to complete. Another alternative is to use asynchronous programming
techniques with non blocking system calls. An asynchronous call returns immediately, without
waiting for the I/O to complete. The completion of the I/O is later communicated to the application
either through the setting of some variable in the application or through the triggering of a signal or
call-back routine that is executed outside the linear control flow of the application.
A good example of nonblocking behavior is the select() system call for network sockets. Using
select(), an application can monitor several resources at the same time and can also poll for network
activity without blocking. The select() system call identifies if data is pending or not, then read() or
write() may be used knowing that they will complete immediately.

Q12. Explain RAID File system.

RAID

Redundant Array of Independent Disks

Consists of seven levels, zero through six

RAID Level-0

Not a true RAID because it does not include redundancy to improve performance or

provide data protection

User and system data are distributed across all of the disks in the array

Logical disk is divided into strips

RAID Level-1
Redundancy is achieved by the simple expedient of duplicating all the data

There is no “write penalty”

When a drive fails the data may still be accessed from the second drive

Principal disadvantage is the cost

RAID Level-2

Makes use of a parallel access technique

Data striping is used

Typically a Hamming code is used

Effective choice in an environment in which many disk errors occur

RAID Level-3

Requires only a single redundant disk, no matter how large the disk array

Employs parallel access, with data distributed in small strips

Can achieve very high data transfer rates

RAID Level-4

Makes use of an independent access technique

A bit-by-bit parity strip is calculated across corresponding strips on each data disk,

and the parity bits are stored in the corresponding strip on the parity disk
Involves a write penalty when an I/O write request of small size is performed

RAID Level-5

Similar to RAID-4 but distributes the parity bits across all disks

Typical allocation is a round-robin scheme

Has the characteristic that the loss of any one disk does not result in data loss

RAID Level-6

Two different parity calculations are carried out and stored in separate blocks on

different disks

Provides extremely high data availability

Incurs a substantial write penalty because each write affects two parity blocks

You might also like