150 likes | 305 Views
Troisième Partie Chapitre 5 Les interfaces D’entrée-sortie. Computer bus. mem. Dual access memory. Display controller. CPU. Memory Mapped Output. D. I/O. A. D. T. E. A. V. I. C. E. Sy. Polled I/O. Computer bus. CPU. mem. I/O interface. Polling Procedure.
E N D
Troisième Partie Chapitre 5 Les interfaces D’entrée-sortie
Computer bus mem Dual access memory Display controller CPU Memory Mapped Output
D I/O A D T E A V I C E Sy Polled I/O Computer bus CPU mem I/O interface
Polling Procedure public void print(char ch); // Printer polling method { while Sy do {/* wait */}; Data = ch; Sy = true /* activate printer interface */; };
Normal Program Interrupt Handler Interrupt
Where is the interrupt handler ? Fixed direct addresses (INTEL) Fixed indirect addresses (Motorola) Vectored Interrupts (DEC) How to save the program state ? By programmer Automatically, the entire state. Automatically, a part of the state. By shadow registers Interrupt Issues
Direct Interrupt Addresses Contents of P register when interrupt 1 occurred = xyz RESET JMP 00000 Interrupt handler 01000 0D000 Save context 00004 INT.1 JSB 0D000 00008 INT.2 Restore context RET xyz
Indirect Interrupt Addresses Contents of P register when interrupt 1 occurred = xyz Interrupt handler 0D000 INT.2 INT.1 0D000 FFFFF 00000 RESET At interrupt, the entire context, including P, is saved on stack by the control unit. The RTI instruction restores the entire context, including P RTI xyz
+ 1 - Vectored Interrupt Interrupting device After an interrupt, the interrupting device will normally put a JSB instruction on the data bus for calling the interrupt handler
D I/O A D T E A V I C E Sy Interrupt Driven I/O Computer bus CPU interrupt mem I/O interface
Interrupt Driven Printing (1) public void print(char ch); // Printer function pseudocode { while bufferfull do {/* wait */}; put ch intobuffer; if (buffer was empty){start driver} };
Interrupt driven Printing (2) public void pdriver; // Interrupt driven printer driver { while (true) do { if (Buffer is empty) {Suspend pdriver}; Data = Next Character from Buffer; Sy = true; (* activate printer interface *) Suspend driver until printer interrupt; } };
Some orders of magnitude: Processor speed = 50 Millions of Instructions Per Second One loop of the driver = 50 instructions Duration of one I/O operation = 1 μS Maximum I/O throughput = 1 Mbytes/S Data rate on a 100 Mb/s Ethernet = 12.5 Mbytes/S Data rate on a 48x CD reader = 10 Mbytes/s Conclusion : Interrupt driven I/O much too slow for fast peripherals and local area networks. Performance of interrupt driven I/O
D I/O bus request/ bus granted A D T E A V I C E Sy Direct Memory Access Computer bus CPU interrupt DMAC ready mem I/O interface
DMA Controller to CPU Bus Request Bus Granted Interrupt Request Configuration BUS Origin Address Destination Address Ready = Transfert Request Byte Count