silberschatz and galvin
play

Silberschatz and Galvin Chapter 2 Computer-System Structures CPSC - PDF document

CPSC 410-Richard Furuta Silberschatz and Galvin Chapter 2 Computer-System Structures CPSC 410-501 Fall 1994 01/19/99 1 Topics CPU/Device interface I/O structure Storage structure and hierarchy Hardware protection CPSC 410-501


  1. CPSC 410-Richard Furuta Silberschatz and Galvin Chapter 2 Computer-System Structures CPSC 410-501 Fall 1994 01/19/99 1 Topics ¥ CPU/Device interface ¥ I/O structure ¥ Storage structure and hierarchy ¥ Hardware protection CPSC 410-501 Fall 1994 01/19/99 2 01/19/99 1

  2. CPSC 410-Richard Furuta Computer-System Architecture CPSC 410-501 Fall 1994 01/19/99 3 Storage-Device Hierarchy CPSC 410-501 Fall 1994 01/19/99 4 01/19/99 2

  3. CPSC 410-Richard Furuta CPU/Device Interface ¥ Assume Von Neumann architecture ¥ Assume each device has a small hardware buffer (one record) ¥ Handshaking Ð CPU responsible for data transfer Ð Device raises flag when consistent state (Q: what is consistent ?) Ð CPU transfers information and notifies device ¥ CPU control ? CPSC 410-501 Fall 1994 01/19/99 5 CPU Control Busy Waiting repeat { while (device busy) {} ; transfer record; notify device; } until (transfer finished) What are the pros and cons? CPSC 410-501 Fall 1994 01/19/99 6 01/19/99 3

  4. CPSC 410-Richard Furuta Busy Waiting Time line I/O Routine I/O Routine CPU Device I/O Operation Time CPSC 410-501 Fall 1994 01/19/99 7 CPU Control Polling ¥ CPU loads appropriate registers and initiates operation ¥ CPU switches to a different activity ¥ From time to time CPU queries hardware flag to see if device is finished Ð if so, CPU performs transfer Ð if not, CPU returns to other task ¥ Pros and cons? CPSC 410-501 Fall 1994 01/19/99 8 01/19/99 4

  5. CPSC 410-Richard Furuta Polling Time line I/O Routine CPU Test and Test Initiate Test Test Transfer Device I/O Operation Time CPSC 410-501 Fall 1994 01/19/99 9 Asynchronous Control Interrupts ¥ CPU loads appropriate registers and initiates operation ¥ CPU carries on with another task ¥ When device completes operation, it informs CPU with interrupt ¥ CPU stops what it is doing and transfers control to interrupt handler (located at predefined location in memory) ¥ Pros and cons? CPSC 410-501 Fall 1994 01/19/99 10 01/19/99 5

  6. CPSC 410-Richard Furuta Interrupts Time line I/O Routine Transfer CPU I/O Interrupt request Device I/O Operation Time CPSC 410-501 Fall 1994 01/19/99 11 Use of interrupts (AKA traps) ¥ External events (i/o, timers) ¥ Internal events: Ð system calls Ð errors (illegal instruction, addressing violation, operand out of range, etc.) Ð page faults Ð ... CPSC 410-501 Fall 1994 01/19/99 12 01/19/99 6

  7. CPSC 410-Richard Furuta Implementation of Interrupts ¥ Multiple classes of interrupts (perhaps associated with different events) ¥ Interrupt handler : small software routine that determines what caused interrupt and what to do (AKA interrupt service routine) ¥ Reserved set of locations in low memory that are indices to interrupt handlers (vectors) CPSC 410-501 Fall 1994 01/19/99 13 Interrupt Implementation Hardware instruction cycle: while (true) { fetch next instruction increment instruction counter carry out instruction if interrupt pending then { store instruction counter, save state as necessary jump to handler (by setting IC from vector) } } CPSC 410-501 Fall 1994 01/19/99 14 01/19/99 7

  8. CPSC 410-Richard Furuta Interrupt Implementation ¥ Where is return address stored? ¥ How many interrupts can be active at a given time? What if more than one is active? ¥ What if interrupts arrive too fast? How can this be prevented? CPSC 410-501 Fall 1994 01/19/99 15 Direct Memory Access (DMA) CPSC 410-501 Fall 1994 01/19/99 16 01/19/99 8

  9. CPSC 410-Richard Furuta Direct Memory Access (DMA) ¥ High speed I/O devices ¥ Device transfers block of data to memory directly with no intervention by CPU Ð 128 to 4096 bytes common ¥ Device notifies CPU that data has been transfered (how?) ¥ Extension: channels Ð special purpose processors that also offload CPU work by, e.g., handling device errors, code conversion, formatting functions during DMA activity CPSC 410-501 Fall 1994 01/19/99 17 Other Interrupt Examples ¥ Timers ¥ User-generated signals (SIGHUP, SIGQUIT, SIGKILL) ¥ Dual-mode instructions Ð User mode and monitor mode (AKA system/supervisor) ¥ Hardware protection implementation Ð Base/limit registers, set in monitor mode (why?) Ð hardware insures address references in legal range and traps if not CPSC 410-501 Fall 1994 01/19/99 18 01/19/99 9

  10. CPSC 410-Richard Furuta CPU Protection ¥ Timer--interrupts computer after specified period to ensure operating system maintains control Ð Timer decremented every clock tick Ð When it reaches the value 0, an interrupt occurs ¥ Implements time sharing ¥ Implements current time clock CPSC 410-501 Fall 1994 01/19/99 19 Hardware Protection ¥ Dual-mode operation ¥ I/O protection ¥ Memory protection ¥ CPU protection CPSC 410-501 Fall 1994 01/19/99 20 01/19/99 10

  11. CPSC 410-Richard Furuta Dual-Mode Operation ¥ Hardware support differentiates between Ð User mode -- execution done on behalf of a user Ð Monitor mode (aka supervisor mode or system mode) -- execution done on behalf of operating system ¥ Mode bit shows current mode ¥ Switches on interrupt or fault ¥ Privileged instructions only in monitor mode CPSC 410-501 Fall 1994 01/19/99 21 Dual-Mode Operation CPSC 410-501 Fall 1994 01/19/99 22 01/19/99 11

  12. CPSC 410-Richard Furuta I/O Protection ¥ User program can cause problems with I/O Ð Issuing illegal I/O instructions Ð Accessing memory locations that arenÕt under its control Ð Refusing to relinquish the CPU ¥ All I/O instructions are privileged instructions ¥ User programs carry out I/O through the operating system CPSC 410-501 Fall 1994 01/19/99 23 I/O Operations ¥ Process requests I/O operation through a system call Ð Trap to specific location in the interupt vector Ð Control passes through the interrupt vector to service routine in OS; enters monitor mode Ð Monitor verifies correctness of parameters, executes the request, exits monitor mode, returns control to the user program CPSC 410-501 Fall 1994 01/19/99 24 01/19/99 12

  13. CPSC 410-Richard Furuta Memory protection ¥ Must protect interrupt vector and interrupt service routines ¥ Desirable to protect other usersÕ memory spaces ¥ Two registers determine the range of legal addresses a program may access Ð Base register (smallest legal physical memory address) Ð Limit register (size of range) CPSC 410-501 Fall 1994 01/19/99 25 CPSC 410-501 Fall 1994 01/19/99 26 01/19/99 13

  14. CPSC 410-Richard Furuta Memory protection ¥ Accomplished by protection hardware (disabled in monitor mode) CPSC 410-501 Fall 1994 01/19/99 27 01/19/99 14

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend