written 8.0 years ago by | modified 8.0 years ago by |
Mumbai University > Computer Engineering > Sem 5 > Operating System
Marks: 10M
Years: Dec 2015
written 8.0 years ago by | modified 8.0 years ago by |
Mumbai University > Computer Engineering > Sem 5 > Operating System
Marks: 10M
Years: Dec 2015
written 8.0 years ago by |
The various I/O buffering techniques are as follows:
1. Single buffering:
When a user process issues an I/O request, the O.S assigns a buffer in the system portion of main memory to the operation.
In the block oriented devices, the techniques can be used as follows: Input transfers are made to the system buffer. When the transfer is complete, the process moves the block into user space and request another block. This is called reading ahead, it is done in the expectation that the block will be needed sometimes in future.
This approach will generally provide a speed up compared to the lack of system buffering. The O.S must keep track of the assignment of system buffers to user processes.
Similar considerations apply to block oriented output. When data are being transmitted to a device, they are first copied from user space into the system buffer, from which they will ultimately be written. The requesting process is now free to continue.
Suppose T is the time required to input one block and C is the computation time required for input request.
In stream oriented I/O, it can be used in two ways,
Line-at a time fashion. Line- at a time operation is used for scroll made terminals. User inputs one line at a time, with a carriage return signaling at the end of a line.
Byte-at a time fashion. Byte-at a time operation is used on forms mode, terminals when each keystroke is significant.
2. Double buffering
An improvement over single buffering is by assigning two system buffers to the operations.
A process transfers data to one buffer while operating system empties the other as shown in fig.
For block oriented transfer execution time is Max[C,T]. It is possible to keep the block oriented device going at full speed.
For Stream oriented input again two types.
For line- at a time I/O, the user process need not be suspendeds for input or output, unless process runs ahead of double buffer.
For byte- at a time operations, double buffer offers no advantage over a single buffer of twice the length.
3. Circular buffer
Double buffering may be inadequate, if the process performs rapid burst of I/O. When two or more buffers are used.
The collection of buffers is called as a circular buffer, with each buffer being one unit in the circular buffer.