NURUL NAIM BINTI ABDULLAH SANI B031210190MOHD SHAZWAN BIN KAMARUDIN DARUS B031210196FIRDHAUSADNIN BIN RAHMAT B031210378CHONG CAI NING B031210080
Input Output Buffering There is a speed mismatch between I/Odevices and CPU. This leads to inefficiency in processes beingcompleted. To increase the efficiency, it may beconvenient to perform input transfers inadvance of requests being made and toperform output transfers some time after therequest is made. This technique is known as buffering
Input Output Buffering In discussing the various approaches tobuffering, it is sometimes important to makea distinction between two types of I/Odevices: Block-oriented devices store information in blocksthat are usually of fixed size and transfers aremade one block at a time for example disk,tape Stream-oriented devices transfer data in and outas a stream of bytes, with no block structure forexample terminals, printers, communicationsport, mouse.
What is single buffer ?? Operating system assigns a buffer in mainmemory for an I/O request Example when a user process issues an I/Orequest, the operating system assigns a buffer inthe system portion of main memory to the operation
Single buffer process The simplest type of buffering is single buffering. When a user process issues and I/O request, theoperating system assigns a buffer in the systemportion of main memory to the operation. For block-oriented devices, the single bufferingscheme can be described as follows: Inputtransfers are made to the system buffer. When the transfer is complete, the process movesthe block into user space and immediatelyrequests another block.
For stream oriented I/O, the single bufferingscheme can be used in a line- at- a time Fashionor a byte-at-a-time fashion. In line-at-a-time fashion user input and outputto the terminal is one line at a time. For eg.Scroll-mode terminals, line printer. Suppose thatT is required to input one block andthat C is the computation time. single buffer : you read and write on the samebuffer, can be messy if both reading and writingtake place at the same time.Single buffer process
What is double buffer ? Two buffers are used for the I/O operation .It’salso the process uses the content of one bufferwhile the I/O device uses the other. Double-buffering possibly sounds harder than itactually is.
ADVANTAGES The user does not see every pixel modification(so if the same pixel gets modified 5 times, theuser will only see the last one).This helpspreventing flickering (or screen flashes). Double-buffering usually takes care of artifactsyou or the user might be experiencing. Writing to video memory is only performedonce, on the buffer swap, instead of repeatedlyfor every pixel of which some might beoverlapped later and might be invisible.
DISADVANTAGES Even though double-bufferingis useful, it also has negativecharacteristics. Each is listedwith an explanation and apossible solution.
Circular Buffering When more than 2 buffers are used-- each individual buffer is one unit in the circularbuffer… Is used when…--double buffering may be not enough if processperform rapid bursts of I/O… Therefore, this type of buffering is needed forkeeping up with the process
Circular buffer of a processused for data transfer between 2 processes.Producer process: place item into circular bufferConsumer process: remove the itemVariable capacity of circular buffer accommodatetime ≠ producer and consumer process…--can execute faster than the other queue that hold avariable amount of data since…A fixed size block of memory is allocated just oncefrom memory management and then reused.
-- often is used to decouple 2 processes thatoperate at different speeds…-> fast producer process:--- can “burst” data into buffer and thencontinue with its processing-> slower consumer process:--- can read the data with its own rate withoutsynchronizing and slowing the producer.Circular buffer of a process
-the average rate, over time, of bothproducer and consumer process must besame to avoid over or underflow ofcondition of the circular buffering(“Synchronize Mode “ of operation)Circular buffer of a process
--- 2 methods can avoid data lossin synchronize mode--- 2 methods can avoid data loss in synchronize mode:a) Calling blocking method: calling thread to block until the Circular buffer hasthe requested number of items.b) WaterMark method: fire an event when the number of items in thecircular buffer reaches a preset level…~~ eliminating wasting processing time due toprocess block.