IO buffering

2,221 views 10 slides Apr 16, 2017
Slide 1
Slide 1 of 10
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10

About This Presentation

Topic: I/O Buffering in Operting System

Discussion Points:
-Why we need buffering?
-Problems in buffering
-Types of I/O Devices
-Types of Buffer
-Types of approaches to buffering
-Which type of buffer is used with which type of I/O device and how?


Slide Content

IO Buffering In Operating System Presented By: Gunjan D Mandaliya Institute Of Technology, Nirma University

Why we need Buffering ? Suppose a user process wants to read data blocks from disk. Data read at virtual location Simple, Read_Block [1000,Disk] Busy waiting, process suspension Problems: Program is hung up Interferes with swapping decisions Gunjan Mandaliya, Institute Of Technology, Nirma University

Moreover, virtual location must be in main memory In paging, target location must be locked Single process deadlock To avoid these overheads and inefficiencies Input transfers in advance Output transfers some time after This technique is known as buffering . Types of I/O Devices: Block-oriented Stream-oriented Gunjan Mandaliya, Institute Of Technology, Nirma University

Types of approaches to buffering:

Single Buffer: Simplest type of support provide a speedup processing one block, while next is being read Swap the process out Block-oriented output Performance Comparison: T+C , max[C,T]+M For block-oriented devices Reading ahead Expectation of block Unnecessarily reading of a block Gunjan Mandaliya, Institute Of Technology, Nirma University

For Stream-oriented devices Line-at-a-time Appropriate for scroll-down(dumb) terminals Ex: A Line Printer For input: Store single line For output: No need to suspend Byte-at-a-time Appropriate for Forms-mode terminals Ex: Sensors & Controllers Follows producer/consumer model Gunjan Mandaliya, Institute Of Technology, Nirma University

Double Buffer: improvement over single buffering A process now transfers data to (or from) one buffer while the operating system empties (or fills) the other. This technique is known as double buffering or buffer swapping . For block-oriented devices Execution Time: max [C,T] C<=T(speed) , C>T (Used 2nd buffer) For byte-oriented devices For line-at-a-time I/O: no need of process suspension For byte-at-a-time I/O: twice the length of buffer Gunjan Mandaliya , Institute Of Technology, Nirma University

Circular Buffer: Double buffering, inadequate with rapid bursts of I/O. To Resolve: 2+ buffers used Collection of 2+ buffers referred as Circular Buffer Bounded-buffer producer/consumer model Gunjan Mandaliya, Institute Of Technology, Nirma University

Any Query? Gunjan Mandaliya, Institute Of Technology, Nirma University

Thank You… Gunjan Mandaliya, Institute Of Technology, Nirma University