unit 5 - file and input management
unit 5 - file and input management
Advantages:
Disadvantages:
Example:
Suppose the order of request is- (82,170,43,140,24,16,190)
And current position of Read/Write head is: 50
So, total overhead movement (total distance covered by the disk arm) =
(82-50)+(170-82)+(170-43)+(140-43)+(140-24)+(24-16)+(190-16) =642
Advantages of FCFS
Here are some of the advantages of First Come First Serve.
• Every request gets a fair chance
• No indefinite postponement
Disadvantages of FCFS
Here are some of the disadvantages of First Come First Serve.
• Does not try to optimize seek time
• May not provide the best possible service
Example:
Suppose the order of request is- (82,170,43,140,24,16,190)
And current position of Read/Write head is: 50
So,
Total overhead movement (total distance covered by the disk arm) =
(50-43)+(43-24)+(24-16)+(82-16)+(140-82)+(170-140)+(190-170) =208
Advantages of Shortest Seek Time First
Here are some of the advantages of Shortest Seek Time First.
• The average Response Time decreases
• Throughput increases
Disadvantages of Shortest Seek Time First
Here are some of the disadvantages of Shortest Seek Time First.
• Overhead to calculate seek time in advance
• Can cause Starvation for a request if it has a higher seek time as compared to incoming
requests
• The high variance of response time as SSTF favors only some requests
Example:
Suppose the requests to be addressed are-82,170,43,140,24,16,190. And the Read/Write arm
is at 50, and it is also given that the disk arm should move “towards the larger value”.
Therefore, the total overhead movement (total distance covered by the disk arm) is
calculated as
Therefore, the total overhead movement (total distance covered by the disk arm) is
calculated as
So, the total overhead movement (total distance covered by the disk arm) is calculated as:
=(199-50) + (199-0) + (43-0) = 391
Advantages of C-SCAN Algorithm
Here are some of the advantages of C-SCAN.
• Provides more uniform wait time compared to SCAN.
So, the total overhead movement (total distance covered by the disk arm) is calculated as:
= (190-50) + (190-16) = 314
C-LOOK
As LOOK is similar to the SCAN algorithm, in a similar way, C-LOOK is similar to the
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:
1. Suppose the requests to be addressed are-82,170,43,140,24,16,190. And the Read/Write
arm is at 50, and it is also given that the disk arm should move “towards the
larger value”
Following are the logical structures of a directory, each providing a solution to the problem
faced in previous type of directory structure.
1) Single-level directory:
The single-level directory is the simplest directory structure. In it, all files are contained
in the same directory which makes it easy to support and understand.
A single level directory has a significant limitation, however, when the number of files
increases or when the system has more than one user. Since all the files are in the same
directory, they must have a unique name. If two users call their dataset test, then the
unique name rule violated.
Advantages:
• Since it is a single directory, so its implementation is very easy.
• If the files are smaller in size, searching will become faster.
• The operations like file creation, searching, deletion, updating are very easy in such a
directory structure.
• Logical Organization: Directory structures help to logically organize files and
directories in a hierarchical structure. This provides an easy way to navigate and
manage files, making it easier for users to access the data they need.
2) Two-level directory:
As we have seen, a single level directory often leads to confusion of files names among
different users. The solution to this problem is to create a separate directory for each
user.
In the two-level directory structure, each user has their own user files directory
(UFD). The UFDs have similar structures, but each lists only the files of a single user.
System’s master file directory (MFD) is searched whenever a new user id is created.
Advantages:
• The main advantage is there can be more than two files with same name, and would be
very helpful if there are multiple users.
• A security would be there which would prevent user to access other user’s files.
• Searching of the files becomes very easy in this directory structure.
Advantages:
• This directory structure allows subdirectories inside a directory.
• The searching is easier.
• File sorting of important and unimportant becomes easier.
• This directory is more scalable than the other two directory structures explained.
Disadvantages:
• As the user isn’t allowed to access other user’s directory, this prevents the file sharing
among users.
• As the user has the capability to make subdirectories, if the number of subdirectories
increase the searching may become complicated.
• Users cannot modify the root directory data.
• If files do not fit in one, they might have to be fit into other directories.
Advantages:
• Sharing of files and directories is allowed between multiple users.
• Searching becomes too easy.
• Flexibility is increased as file sharing and editing access is there for multiple users.
Disadvantages:
• Because of the complex structure it has, it is difficult to implement this directory
structure.
• The user must be very cautious to edit or even deletion of file as the file is accessed by
multiple users.
• If we need to delete the file, then we need to delete all the references of the file inorder
to delete it permanently.
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.
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
per block.
Here are some advantages and disadvantages of free space management techniques in
operating systems:
Advantages:
1. Efficient use of storage space: Free space management techniques help to optimize the
use of storage space on the hard disk or other secondary storage devices.
2. Easy to implement: Some techniques, such as linked allocation, are simple to implement
and require less overhead in terms of processing and memory resources.
3. Faster access to files: Techniques such as contiguous allocation can help to reduce disk
fragmentation and improve access time to files.
Disadvantages: