Presentation is loading. Please wait.

Presentation is loading. Please wait.

AS Computing 1.5.5 Hardware. Buffers and Interrupts A buffer is an area of memory used for holding data during input/output transfers to and from disk.

Similar presentations


Presentation on theme: "AS Computing 1.5.5 Hardware. Buffers and Interrupts A buffer is an area of memory used for holding data during input/output transfers to and from disk."— Presentation transcript:

1 AS Computing 1.5.5 Hardware

2 Buffers and Interrupts A buffer is an area of memory used for holding data during input/output transfers to and from disk or tape. By using buffers, the problem of working at the speed of the slowest devices can be overcome. It imporves the efficiency of data transfer betwwen two devices working at different speeds by allowing big blocks of data to be collected together and then set at once rather than a constant stream of that that needs constant CPU management. A buffer can also be an exernal piece of hardware designed specificlly for the purpose of buffering.

3 How buffers work If there is not a buffer CPU ALU Printer The CPU will take charge of the data transfer. The data goes from the RAM, vai the ALU and out to the printer. The printer works very slow compare to the CPU. If you send data constantly, byte by byte, the CPU will have to slow down the speed so that the printer can receive the data. This means that the CPU is not being used as efficiently as possible.

4 How buffers work 2 If there is a buffer. CPU ALU BufferPrinter When the CPU send data to a file, all of the data can be transferred to the buffer. The buffer works at the speed of the CPU so data tranfer between the CPU and the buffer s very fast. The CPU is now free to do other tasks while the buffer can transfer data to the printer. This immediately imporves the transfer of data because the CPU is not wating and trying to constantly send data.

5 An example of the use of a buffer Secondary storage devices, such as disks or tapes are usualy interfaced to the operating system software by using buffers. For example, sending a file to a printer. The file is held in memory (RAM). We know that memory is part of the CPU and therefore works very quickly and also all data in and out of the CPU goes via the ALU. Printer print out pages much slower than the speed a CPU can work at.

6 Buffers and Interrupts 1 For example, sending a file to a printer. What if the whole file is too large to fit intot he buffer? CPU Stack ALU Stop File BufferPrinter Step 1: the CPU fills the buffer with as much of a file as it can via the ALU. When it is full, a ‘stop’ singal ia sent by the buffer to the CPU.

7 Buffer and Interrupts 2 CPU Stack ALU Buffer Pinter Step 2: the CPU is now free to get on with another job. The buffer sends its contents to the printer. Buffer is full

8 Buffers and Interrupts 3 CPU Stack ALU BufferPrinter More Step 3: when the buffer is nealy empty, it sends an interrupt signal to the CPU requesting more data.

9 Buffers and Interrupts 4 CPU Stack ALU BufferPrinter File Stop Step 4: the CPU stops its current job. It saves the contents of its registers into the stack and then fills up the buffer again, until it receives the ‘stop’ interrupt from the buffer.

10 Buffers and Interrupts 5 CPU Stack ALU Buffer Printer Step 5: the buffer continues to transfer data to the printer. The CPU pops the contens of the stack back into the registers and carries on from before the interrupt.

11 Summary When the CPU gets the I/O interrupt, it checks the priority of the interrupt. The CPU has to decide whether or not the job it is currently doing is more important than filling up the buffer. If it is less important, then it carries on what it is doing until it is finished, and then it services the buffer interrupt; if it is more important, the CPU will stop what it is doing now and saves the contents of it registers onto the stack, then sends the buffer more of the files until it gets the ‘stop’ signal again. The buffer resumes sending data to the printer whilst the CPU go back to the job that it left off before the interrupt.


Download ppt "AS Computing 1.5.5 Hardware. Buffers and Interrupts A buffer is an area of memory used for holding data during input/output transfers to and from disk."

Similar presentations


Ads by Google