as computing 1.5.5 hardware. buffers and interrupts a buffer is an area of memory used for holding...

11
AS Computing AS Computing 1.5.5 Hardware 1.5.5 Hardware

Upload: jack-holmes

Post on 18-Jan-2016

213 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 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

AS Computing AS Computing

1.5.5 Hardware 1.5.5 Hardware

Page 2: 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

Buffers and Interrupts 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.

Page 3: 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

How buffers workHow buffers work

If there is not a buffer

CPUALU

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.

Page 4: 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

How buffers work 2How buffers work 2

If there is a buffer.

CPUALU

Buffer Printer

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.

Page 5: 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

An example of the use of a An example of the use of a bufferbuffer

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.

Page 6: 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

Buffers and Interrupts 1Buffers 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 Buffer Printer

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.

Page 7: 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

Buffer and Interrupts 2Buffer and Interrupts 2

CPU

Stack

ALUBuffer 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

Page 8: 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

Buffers and Interrupts 3Buffers and Interrupts 3

CPU

Stack

ALUBuffer Printer

More

Step 3: when the buffer is nealy empty, it sends an interrupt signal to the CPU requesting more data.

Page 9: 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

Buffers and Interrupts 4Buffers and Interrupts 4

CPU

Stack

ALUBuffer Printer

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.

Page 10: 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

Buffers and Interrupts 5Buffers and Interrupts 5

CPU

Stack

ALUBuffer 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.

Page 11: 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

Summary 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.