TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
G143
1. A Presentation On
I/O-Buffering
Department Of Information Technology
Year(2017-18)
Guided By:-
Department Of Information Technology
RAJKIYA ENGINEERING COLLEGE,DEOGAON
AZAMGARH (U P)-276201 (INDIA)
Presented By:-
Name : Nikhil Gupta
Department Of Information Technology
2. Contents
I/O Buffering
Types Of I/O Devices
No Buffering
User Level Buffering
Types of buffering
Single Buffering
Double Buffering
Circular Buffering
Utility Of Buffering
Conclusion
References
3. I/O Buffering
A process of storing data in memory area called Buffers while data is being
transferred between two devices or between a device and an application.
I/O buffering The process of temporarily storing data that is passing between a
processor and a peripheral. The usual purpose is to smooth out the difference in rates
at which the two devices can handle data.
Input/output (I/O) buffering is a mechanism that improves the throughput of input
and output operations. It is implemented directly in hardware and the corresponding
drivers (hence the block devices found in Unix-like systems)
Buffering is done due to 3 reason
a) To cope with the speed mismatch between producer (or sender) and consumer (or
receiver) of a data stream.
b) To adapt between the devices having different data-transfer size.
c) To support copy semantics for application I/O.
4. Types Of I/O Devices
1.Block-oriented Devices :-All I/O devices are classified as either character or block
devices. With block devices data is transferred in a block of bytes and required a
buffering mechanism to allow faster input and output operations. Also, block devices
accept input and output only in blocks. E.g. (hard drives, floppy disks, and optical
drives such as DVD-ROM, and CD-ROM)
2.Stream-oriented:-character devices (also called stream of bytes devices) transfer data
in a few streams of bytes. Such devices don’t required buffering mechanism, and
they don’t operate with a fixed block size
5. No Buffering
Process must read/write a device a byte/word a time.
Each individual system call adds significant overhead.
Process must what until each I/O is complete.
i) Blocking/waking adds to overhead
ii) Many short run of a process is inefficient.
What happens if buffer is paged out to disk.
i) Could lose data while buffer is paged in
ii) Could lock buffer in memory (needed for DMA), however many processes
doing I/O reduce RAM available for paging.
iii) Can cause deadlock as RAM is limited resource.
Fig no. - 01
6. User Level buffering
User process can process one block of data while next block is read in.
Swapping can occur since input is taking place in system memory, not user
memory.
Operating system keeps track of assignment of system buffers to user processes.
Assume:
– T is transfer time for a block from device
– C is computation time to process incoming block
– M is time to copy kernel buffer to user buffer
Computation and transfer can be done in parallel.
Without buffering: Execution time is T+C.
With buffering: Execution time is max [C,T]+M, where M is time required to move
the data from system buffer to user memory.
7. User Level buffering
Process specifies a memory buffer that incoming data is placed in until it fills.
– Filling can be done by interrupt service routine.
– Only a single system call, and block/wakeup per data buffer.
Much more efficient.
When is buffer available for re-use?
– Either process must block until potential slow device drains buffer
– OR deal with asynchronous signals indicating buffer drained
8. Single Level Buffering
Operating system assigns a buffer in Kernel’s memory for an I/O request .
Stream Oriented
i) Used a line at time.
ii) User input from a terminal with carriage return signaling the end of the line.
iii) Output to the terminal is one line at a time.
Block-oriented
i) Input transfers made to buffer
ii) Block moved to user space when needed.
iii) Another block is moved into the buffer.(Read ahead)
Fig no. - 02
9. Double Level Buffering
Use two system buffers instead of one.
A process can transfer data to or from one buffer while the operating system
empties or fills the other buffer.
Computation and Memory copy can be done in parallel with transfer.
May be insufficient for really burst traffic.
– Lots of application writes between long periods of computation
– Long periods of application computation while receiving data
– Might want to read-ahead more than a single block for disk
Fig no. - 03
10. Circular Level Buffering
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.
Double buffering may be inadequate if the process performs rapid bursts of I/O.
The problem can often be alleviated by using more than two buffers.
When more than two buffers are used, the collection of buffers is itself referred to as
a circular buffer with each individual buffer being one unit in the circular buffer.
Fig no. - 04
11. Utility Of Buffering
Buffering is a technique that smoothest out peaks in I/O demand. However, no
amount of buffering will allow an I/O device to keep pace with a process indefinitely
when the average demand of the process is greater than the I/O device can service. If
offline operation after the data has been read and the CPU is operated on it the
magnetic tapes are instructed to store the next input into some reserve memory are
a called buffer.
Buffering is done for 3 reasons
-To cope with the speed mismatch between producer (or sender) and consumer
(or receiver) of a data stream.
-To adapt between devices having different data.
-Transfer size-To support copy semantics for application I/O.
12. Conclusion
The time taken to complete a job is faster but the CPU is more utilized as the access
time from memory to the CPU is faster than the access time from any I/O device to
the CPU.
Buffering overlaps I/O of a job with job’s computations. In a multiple programming
environment, when there is a variety of I/O activity and a variety of process activity
to service, buffering is one tool that can increase the efficiency the OS and
the performance of individual processes.