Download presentation
Presentation is loading. Please wait.
1
Lecture 45 Syed Mansoor Sarwar
Operating Systems Lecture 45 Syed Mansoor Sarwar
2
© Copyright Virtual University of Pakistan
Agenda for Today Review of the previous lecture Space Allocation Techniques Free Space Management Disk Structure and Scheduling Access time and disk bandwidth Disk scheduling algorithms (FCFS, SSTF, Scan, C-Scan, Look, C-Look) Course Recap Future Directions 17 September 2018 © Copyright Virtual University of Pakistan
3
© Copyright Virtual University of Pakistan
Review of Lecture 44 File Sharing and Protection Read, write, and execute permissions User, group, and others chmod, ls –l, ls –ld, umask, ls –i Per Process File Descriptor Table Space Allocation Techniques Contiguous, Linked, Index 17 September 2018 © Copyright Virtual University of Pakistan
4
© Copyright Virtual University of Pakistan
Index Allocation Need index table Random access Linked scheme – Linked list of index blocks … … Directory Entry … 17 September 2018 © Copyright Virtual University of Pakistan
5
© Copyright Virtual University of Pakistan
Index Allocation Two-level index table … File Data Blocks Directory Entry … … First Level Index 17 September 2018 © Copyright Virtual University of Pakistan
6
© Copyright Virtual University of Pakistan
UNIX Allocation 17 September 2018 © Copyright Virtual University of Pakistan
7
© Copyright Virtual University of Pakistan
UNIX Allocation 4 KB block 4-byte disk pointers 10 direct pointers to file blocks Maximum file size? Amount of space needed to store pointers? 17 September 2018 © Copyright Virtual University of Pakistan
8
File Allocation Table (FAT)
17 September 2018 © Copyright Virtual University of Pakistan
9
Free-Space Management
Bit vector 1 2 n-1 … 0 block[i] is free 1 block[i] is occupied bit[i] = Block number calculation (number of bits per word) * (number of 0-value words) + offset of first 1 bit 17 September 2018 © Copyright Virtual University of Pakistan
10
Free-Space Management
Example for overhead of bit map Block size = 4 KB = 212 bytes Disk size = 40 GB = 40 * 230 bytes Overhead = 40 * 230/212 = 40 * 218 bits = 40 * 32 KB = 1280 KB Easy to get contiguous files 17 September 2018 © Copyright Virtual University of Pakistan
11
Free-Space Management
Linked list (free list) Cannot get contiguous space easily Overhead (number of pointers used to maintain free space) 17 September 2018 © Copyright Virtual University of Pakistan
12
Free-Space Management
17 September 2018 © Copyright Virtual University of Pakistan
13
Free-Space Management
Grouping First (n-1) pointers to free blocks and last pointer to another such block Counting An entry contain address of the first free block and number of free contiguous blocks that follow the first block—good for contiguous allocation 17 September 2018 © Copyright Virtual University of Pakistan
14
© Copyright Virtual University of Pakistan
I/O Operations Number of I/O operations (inserting, deleting, and reading a file block) needed for the various allocation schemes Assumptions Directory, Bit-map, and index blocks are in the main memory Worst-case and best-case scenarios 17 September 2018 © Copyright Virtual University of Pakistan
15
© Copyright Virtual University of Pakistan
I/O Operations File size of 100 blocks Insert a block after the 50th block Read 50th block Insert 101st block Delete 50th block Assumptions Directory, Bit-map, and index blocks are in the main memory Worst-case and best-case scenarios 17 September 2018 © Copyright Virtual University of Pakistan
16
Secondary Storage Management
Maintains the file system, its directories, and keeps track of free secondary storage space Provides device drivers to control transfer of data between memory and secondary storage devices Optimizes the completion of I/O tasks by employing algorithms to facilitate efficient disk usage File Management System I/O System Secondary Storage Management System 17 September 2018 © Copyright Virtual University of Pakistan
17
© Copyright Virtual University of Pakistan
Disk Structure Disk drives are addressed as large 1-dimensional arrays of logical blocks, the smallest units of transfer (usually 512 bytes). The 1-dimensional array of logical blocks is mapped into the sectors of the disk sequentially. Block 0 is the first sector of the first track on the outermost cylinder. Mapping proceeds in order through that track, then through the rest of the tracks in that cylinder, and then through the rest of the cylinders from outermost to innermost. 17 September 2018 © Copyright Virtual University of Pakistan
18
© Copyright Virtual University of Pakistan
Disk Scheduling Disk Access Time has two major components Seek time is the time for the disk heads to the desired cylinder (track) Rotational latency is the time waiting for the disk to rotate the desired sector under the disk head Want to minimize seek time 17 September 2018 © Copyright Virtual University of Pakistan
19
© Copyright Virtual University of Pakistan
Disk Scheduling Disk bandwidth is the total number of bytes transferred, divided by the total time between the first request for service and the completion of the last transfer We can improve access time and bandwidth by scheduling the servicing of disk I/O request in a good order. 17 September 2018 © Copyright Virtual University of Pakistan
20
© Copyright Virtual University of Pakistan
Disk Scheduling Several algorithms exist to schedule the servicing of disk I/O requests. These include: First-Come-First-Serve (FCFS) Shortest Seek Time First (SSTF) Scan Circular Scan (C-Scan) Look C-Look 17 September 2018 © Copyright Virtual University of Pakistan
21
© Copyright Virtual University of Pakistan
FCFS Illustration shows total head movement of 640 cylinders. 17 September 2018 © Copyright Virtual University of Pakistan
22
Shortest Seek Time First (SSTF)
Selects the request with the minimum seek time from the current head position. SSTF scheduling is a form of SJF scheduling; may cause starvation of some requests. Illustration shows total head movement of 236 cylinders. 17 September 2018 © Copyright Virtual University of Pakistan
23
© Copyright Virtual University of Pakistan
SSTF 17 September 2018 © Copyright Virtual University of Pakistan
24
© Copyright Virtual University of Pakistan
SCAN The disk arm starts at one end of the disk, and moves toward the other end, servicing requests until it gets to the other end of the disk, where the head movement is reversed and servicing continues. Also known as the elevator algorithm Total head movement is 208 cylinders 17 September 2018 © Copyright Virtual University of Pakistan
25
© Copyright Virtual University of Pakistan
SCAN 17 September 2018 © Copyright Virtual University of Pakistan
26
© Copyright Virtual University of Pakistan
LOOK Version of SCAN Arm only goes as far as the last request in each direction, then reverses direction immediately, serving requests while going in the other direction. That is, it looks for a request before continuing to move in a given direction. 17 September 2018 © Copyright Virtual University of Pakistan
27
© Copyright Virtual University of Pakistan
LOOK 17 September 2018 © Copyright Virtual University of Pakistan
28
© Copyright Virtual University of Pakistan
Recap of Lecture Space Allocation Techniques Free Space Management Disk Structure and Scheduling Access time and disk bandwidth Disk scheduling algorithms (FCFS, SSTF, Scan, C-Scan, Look, C-Look) 17 September 2018 © Copyright Virtual University of Pakistan
29
© Copyright Virtual University of Pakistan
Recap of Course OS services and structures Processes and threads Process scheduling Concurrent processes Deadlocks in computer systems Memory management Virtual memory File system interface File system implementation Secondary storage management 17 September 2018 © Copyright Virtual University of Pakistan
30
© Copyright Virtual University of Pakistan
Future Directions Advanced Operating Systems System Programming Linux Kernel Programming 17 September 2018 © Copyright Virtual University of Pakistan
31
© Copyright Virtual University of Pakistan
Operating Systems Lecture 45 Syed Mansoor Sarwar 17 September 2018 © Copyright Virtual University of Pakistan
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.