Summary

These lecture notes cover file management, disk management, and related topics. The document discusses file systems, disk scheduling algorithms (FCFS, SSTF, SCAN, LOOK), and different types of files.

Full Transcript

UNIT – 5 File Management, Disk Management, Security and Protection File System – Introduction – Files and File System – File Structure – File Naming and File Type – File Access Disk Management – Introduction – Disk Scheduling Algorithm...

UNIT – 5 File Management, Disk Management, Security and Protection File System – Introduction – Files and File System – File Structure – File Naming and File Type – File Access Disk Management – Introduction – Disk Scheduling Algorithm FCFS SSTF SCAN LOOK and C-LOOK Solid state Drive vs. Hard Disk Drive Virtual Machines UNIT – 5 File Systems UNIT – 5 File Systems The file system provides a convenient mechanism to store and retrive the data and programs from this medium. File are used as a collection of related information, the meaning of which is defined by its creator. These files are mapped to the disks or other storage media by the Os. UNIT – 5 File Systems Files, a convenient environment is created that allows one to write, read, save and retrieve the program and data on any type of store media. A Files, thus is a collection of related information that is mapped on to a secondary storage. The information stored in a file is in bits, bytes, lines or records. The user only sees the logica view of the file. The sytem views all the work required to map the logical file to the secondary storage. UNIT – 5 File Systems The following are the primary constituents of a file system: – File Management It manages how the files are stored, referenced, shared and secured. – File Allocation It provides the methods to allocate files on the disk space. – File Access Methods It provides the methods to access stored files. UNIT – 5 File Systems – File Structure The basic element of data is Field, is a single value item. When multiple fields are combined to form a meaningful collection, it is known as a record. When such similar records are collected, it is known as a file. Os must support a required structure for a certain type of file. UNIT – 5 File Systems – File Structure UNIT – 5 File Systems – File Naming & File Types All the file name has two parts, seperated by a period (.). First part is the name of the file, define by the user. Second part is known as extension. UNIT – 5 File Systems – File Naming & File Types An OS must recoganize the type of the file, because the operations performed on its depend on its type. Source code file -.c Object file -.obj or.o Executable file -.exe or.com or.bin Text file -.txt or.doc Batch file -.bat Archive file -.zip or.rar Multimedia file -.jpg or.mp3 or.mov UNIT – 5 File Systems – File Naming & File Types In general files are the following types: – Regular Contain the user information – Directory Is a file type used to orgnize the list of files in a group. – Special A special file contains no data but provides a mechanism that maps physical devices to file name. UNIT – 5 File Systems – File Access The following are some file access methods: – Sequential File Access – Direct File Access – Indexed Sequential File Access UNIT – 5 File Systems – File Access Sequential File Access - It is the simplest access method. Information in the file is processed in order, one record after the other. This mode of access is by far the most common; for example, editor and compiler usually access the file in this fashion. Direct Access - Another method is direct access method also known as relative access method. A filed-length logical record that allows the program to read and write record rapidly in no particular order. Index sequential method – It is the other method of accessing a file that is built on the top of the sequential access method. These methods construct an index for the file. The index, like an index in the back of a book, contains the pointer to the various blocks. To find a record in the file, we first search the index, and then by the help of pointer we access the file directly. UNIT – 5 Disk management UNIT – 5 Disk Management – Disk Scheduling There are several reason disk scheduling is important for I/ O operations. – Many process may send I/O request and the processor can service one I/O at a time. – When Disk is near to full. – Random requests from the user may also need disk scheduling. UNIT – 5 Disk Management – Disk Scheduling Algorithms FCFS (First Come First Serve) SSTF (Shortest Seek Time First) SCAN (Elevator Algoritm) LOOK C-LOOK C - SCAN FCFS FCFS is the simplest of all Disk Scheduling Algorithms. In FCFS, the requests are addressed in the order they arrive in the disk queue. FCFS Suppose the order of request is- 82,170,43,140,24,16,190 and current position of Read/Write head is: 50 FCFS 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 Advantage & Disadvantage of FCFS Advantages - Every request gets a fair chance No indefinite postponement Disadvantages - Does not try to optimize seek time May not provide the best possible service SSTF (Shortest Seek Time First) In SSTF (Shortest Seek Time First), requests having the 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 the system. SSTF (Shortest Seek Time First) Suppose the order of request is- 82,170,43,140,24,16,190 and current position of Read/Write head is: 50 SSTF (Shortest Seek Time First) 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 SSTF (Shortest Seek Time First) Advantages of Shortest Seek Time First – The average Response Time decreases – Throughput increases 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. SCAN In the SCAN algorithm the disk arm moves in a particular direction and services the requests coming in its path and after reaching the end of the disk, it reverses its direction and again services the request arriving in its path. So, this algorithm works as an elevator and is hence also known as an elevator algorithm. As a result, the requests at the midrange are serviced more and those arriving behind the disk arm will have to wait. SCAN 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”. SCAN The total overhead movement (total distance covered by the disk arm) is calculated as = (199-50) + (199-16) = 332 C-SCAN In the SCAN algorithm, the disk arm again scans the path that has been scanned, after reversing its direction. So, it may be possible that too many requests are waiting at the other end or there may be zero or few requests pending at the scanned area. These situations are avoided in the CSCAN algorithm in which the disk arm instead of reversing its direction goes to the other end of the disk and starts servicing the requests from there. So, the disk arm moves in a circular fashion and this algorithm is also similar to the SCAN algorithm hence it is known as C-SCAN (Circular SCAN). C-SCAN 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”. C-SCAN The total overhead movement (total distance covered by the disk arm) is calculated as: =(199-50) + (199-0) + (43-0) = 391 LOOK LOOK Algorithm 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. LOOK 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”. LOOK 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. C-LOOK 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” C-LOOK The total overhead movement (total distance covered by the disk arm) is calculated as = (190-50) + (190-16) + (43-16) = 341

Use Quizgecko on...
Browser
Browser