Académique Documents
Professionnel Documents
Culture Documents
No Buffering
Without a buffer, OS directly accesses the device as and when it needs A data area within the address space of the user process is used for I/O
No Buffering
Process must wait for I/O to complete before proceeding busy waiting (like programmed I/O) process suspension on an interrupt (like interrupt-driven I/O or DMA) Problems the program is hung up waiting for the relatively slow I/O to complete interferes with swapping decisions by OS
3
No Buffering
It is impossible to swap the process out completely because the data area must be
I/O Buffering
It may be more efficient to perform input transfers in advance of requests being made and to perform output transfers some time after the request is made.
Block-oriented Buffering
For block-oriented I/O devices such as
disks and USB drives
Information is stored in fixed sized blocks Transfers are made a block at a time Can reference data by block number
6
Stream-Oriented Buffering
For stream-oriented I/O devices such as terminals printers communication ports mouse and other pointing devices, and most other devices that are not secondary storage Transfer information as a stream of bytes
7
Single Buffer
OS assigns a buffer in the system portion of main memory for an I/O request
OS is able to swap the process out because the I/O operation is taking place in system memory
10
Double Buffer
Use two system buffers instead of one A process can transfer data to or from one buffer while OS empties or fills the other buffer
13
Circular Buffer
More than two buffers are used Each individual buffer is one unit in a circular buffer Used when I/O operation must keep up with process Follows the bounded-buffer producer/consumer model
14
Buffer Limitations
Buffering smoothes out peaks in I/O demand
But with enough demand eventually all buffers become full and their advantage is lost
In multiprogramming environment, buffering can increase the efficiency of OS and the performance of individual processes
15
Roadmap
I/O Buffering Disk Scheduling
16
17
18
19
Due to the seek time, the order in which sectors are read from disk has a tremendous effect on I/O performance
20
21
22
Priority
Control of the scheduling is outside the control of disk management software Goal is not to optimize disk use but to meet other objectives Often, short batch jobs & interactive jobs are given higher priority than longer jobs Provide high throughput & good interactive response time Longer jobs may have to wait an excessively long time
23
Last-in, first-out
Good for transaction processing systems The device is given to the most recent user so there should be little arm movement for moving through a sequential file Possibility of starvation since a job may never regain the head of the line
24
25
SCAN
Arm moves in one direction only, satisfying all outstanding requests until it reaches the last track in that direction then the direction is reversed LOOK policy: reverse direction when there are no more requests in a direction
26
SCAN
SCAN is biased against the area most recently traversed does not exploit locality SCAN favors jobs whose requests are for tracks nearest to both innermost and outermost tracks and the latest-arriving jobs
27
28
N-step-SCAN
With SSTF, SCAN, C-SCAN, the arm may not move if processes monopolize the device by repeated requests to one track: arm stickiness Segments the disk request queue into subqueues of length N Subqueues are processed one at a time, using SCAN New requests are added to other queue when a queue is being processed
29
FSCAN
Two subqueues When a scan begins, all of the requests are in one of the queues, with the other empty During the scan, all new requests are put into the other queue Service of new requests is deferred until all of the old requests have been processed
30
Performance Compared
Comparison of Disk Scheduling Algorithms
31