PART 3 Review of Third Generation Architecture and Runtime Systems

PART 3 Review of Third Generation Architecture and Runtime Systems

PART 3 Review Of Third Generation Architecture And Runtime Systems CS 503 - PART 3 1 2010 Location Of Hardware In The Hierarchy CS 503 - PART 3 2 2010 Features Of A Third Generation Machine d Processor d Memory system d I / O Devices d Interrupts CS 503 - PART 3 3 2010 Processor d Instruction set d General-purpose and special-purpose registers d Addressing modes d Protection states d ROM code CS 503 - PART 3 4 2010 What Interface Does An Operating System See? instruction set interface ......................................................................................................................... I/O BUS ROM BIOS VERTICAL MICROCODE HORIZONTAL MICROCODE DISCRETE LOGIC PROGRAMABLE LOGIC TRANSISTORS d Multiple levels of hardware d Each level contributes d Result is instruction set CS 503 - PART 3 5 2010 Effective Instruction Set Composition d Discrete & programmable logic d Microcode ± Low-level (horizontal) ± High-level (vertical) d ROM routines ± Example: BIOS functions on a PC d Note: OS can use all CS 503 - PART 3 6 2010 Registers d Local storage d Store active values during computation (e.g., used to compute an expression) d Saved and restored during subprogram invocation d May control processor mode and address space visibility CS 503 - PART 3 7 2010 Memory System d De®nes size of a byte, the smallest addressable unit d Important property: endianness d Provides address space, typically ± Monolithic ± Linear d Includes caching CS 503 - PART 3 8 2010 Byte Order d Order of bytes in integer d Least-signi®cant byte at lowest address ± Called Little Endian d Most-signi®cant byte at lowest address ± Called Big Endian CS 503 - PART 3 9 2010 Memory Caches d Special-purpose hardware units d Speed memory access d Less expensive than high-speed memory d Placed ªbetweenº CPU and memory CS 503 - PART 3 10 2010 Conceptual Placement Of Memory Cache MAIN CPU MEMORY memory cache d All references (including instruction fetch) go through cache d Multi-level cache possible d Key question: are virtual or physical addresses cached? CS 503 - PART 3 11 2010 I / O Devices d Wide variety of peripheral devices available ± Keyboard / mouse ± Disk ± Wired or wireless network interface ± Printer ± Scanner ± Camera ± Sensors d Multiple transfer paradigms (character, block, packet, stream) CS 503 - PART 3 12 2010 Communication Between Device And CPU d I/O through bus ± Parallel wires ± One or more per computer d CPU uses bus to ± Interrogate device ± Control (start or stop) device d Device uses bus to ± Transfer data ± Inform CPU of status CS 503 - PART 3 13 2010 Bus Fundamentals d Wires on bus divided into ± Address lines ± Data lines ± Control lines d Only two basic bus operations ± Fetch ± Store CS 503 - PART 3 14 2010 Bus Operations d Fetch ± CPU places address on bus ± CPU uses control line to signal fetch request ± Device senses its address ± Device puts speci®ed data on bus ± Device uses control line to signal response CS 503 - PART 3 15 2010 Bus Operations (continued) d Store ± CPU places data and address on bus ± CPU uses control line to signal store request ± Device senses its address ± Device extracts data from the bus ± Device uses control line to signal data extracted CS 503 - PART 3 16 2010 Bus Access By CPU d Two basic approaches ± Special instruction(s) used to access bus ± Bus mapped into same address space as memory * Devices placed beyond physical memory * CPU uses normal fetch / store memory instructions * Known as memory-mapped I / O CS 503 - PART 3 17 2010 Illustration Of Address Space On A Typical 32-Bit Embedded System address contents 0xffffffff device space 0x00010000 0x0000ffff physical memory 0x00000000 d Processor uses conventional memory operations to communicate with devices CS 503 - PART 3 18 2010 Address Space In An Intel PC address contents 0xffffffff physical memory 0x001fffff 0x000fffff ROM BIOS and hole VIDEO RAM 0x000A0000 0x0009ffff physical memory 0x00000400 0x000003ff device 0x00000000 space d Nonlinear for backward compatibility d ªHoleº in physical memory from 640KB to 1MB CS 503 - PART 3 19 2010 Interrupt Mechanism d Fundamental role in modern system d Permits I / O concurrent with execution d Allows device priority d Informs CPU when I / O ®nished d Software interrupt also possible CS 503 - PART 3 20 2010 Interrupt-Driven I / O d CPU starts device d Device operates concurrently d Device interrupts the CPU when ®nished with the assigned task d Interrupt timing ± Asynchronous wrt instructions ± Synchronous wrt an individual instruction (occurs between instructions) CS 503 - PART 3 21 2010 Interrupt Details d Device and CPU communicate over bus d Device posts an interrupt d CPU polls bus during fetch / execute cycle d CPU requests interrupt vector d Device sends interrupt number to CPU d CPU saves program state (e.g., by pushing onto the stack) d CPU uses interrupt number to fetch new program state from the interrupt vector in memory d CPU continues the fetch / execute cycle CS 503 - PART 3 22 2010 Interrupt Mask d Bit mask kept in CPU status register d Set by hardware when interrupt occurs; can be reset by OS d Determines which interrupts are permitted d Priorities ± Each device assigned priority level (binary number) ± When servicing level K interrupt, mask set to disable interrupts at level K and lower CS 503 - PART 3 23 2010 Operating System Responsibility d Operating system must ± Store correct information in interrupt vector for each device ± Arrange for interrupt code to save registers used during the interrupt ± Arrange for interrupt code to restore registers before returning from interrupt ± Distinguish among devices, including multiple physical copies of a given device type CS 503 - PART 3 24 2010 Returning From An Interrupt d Special hardware instruction used d Atomically restores ± Old program state ± Interrupt mask ± Program counter d After a return from interrupt, the interrupted code continues and registers are unchanged CS 503 - PART 3 25 2010 Transfer Size And Interrupts d Interrupt occurs after I / O operation completes d Transfer size depends on device ± Serial port transfers one character ± Disk controller transfers one block (e.g., 512 bytes) ± Network interface transfers one packet d Large transfers use Direct Memory Access (DMA) CS 503 - PART 3 26 2010 Direct Memory Access (DMA) d Hardware mechanism d I / O device transfers data to / from memory ± Occurs over bus ± Does not involve CPU d Example use ± Transfer incoming network packet to memory CS 503 - PART 3 27 2010 Direct Memory Access (continued) d Motivation ± Free CPU from I / O d Interface hardware that uses DMA ± More expensive ± May contain RAM, ROM and microprocessor ± More complex to design CS 503 - PART 3 28 2010 Memory Segments In C Programs d C Program has four primary data areas called segments d Text segment ± Contains program code ± Usually unwritable d Data segment ± Contains initialized data values (globals) d Bss segment ± Contains uninitialized data values d Stack segment ± Used for procedure calls CS 503 - PART 3 29 2010 Typical C Storage Layout max address Stack FREE Bss Data Text min address d Stack grows downward d Heap grows upward CS 503 - PART 3 30 2010 Symbols For Segment Addresses d C compiler and / or linker adds three reserved names to symbol table d _etext lies beyond text segment d _edata lies beyond data segment d _end lies beyond bss segment d Only the addresses are signi®cant; values are irrelevant d Program can use the addresses of the reserved symbol to determine the size of segments d Note: names are declared to be extern without the underscore: extern int end; CS 503 - PART 3 31 2010 Runtime Storage For C Function Running As A Process d Text can be shared d Data areas may be shared d Stack cannot be shared d Exact details depend on address space model OS offers CS 503 - PART 3 32 2010 Example Runtime Storage Model: Xinu d Single, shared copy of ± Text segment ± Data segment ± Bss segment d One stack segment per process CS 503 - PART 3 33 2010 Summary d Components of third generation computer ± Processor ± Main memory ± I / O Devices * Accessed over bus * Operate concurrently with CPU * Usually memory mapped * Can use DMA * Use interrupts CS 503 - PART 3 34 2010 Summary (continued) d Interrupt mechanism ± Informs CPU when I / O completes ± Permits asynchronous device operation d C uses four memory areas: text, data, bss, and stack segments d Multiple concurrent computations ± Can share text, data, and bss ± Cannot share stack CS 503 - PART 3 35 2010.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    35 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us