computer systems lecturer: szabolcs mikulas office: b38b e-mail: [email protected] url:...
TRANSCRIPT
![Page 1: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/1.jpg)
Computer Systems• Lecturer: Szabolcs Mikulas• Office: B38B• E-mail: [email protected]• URL: http://www.dcs.bbk.ac.uk/~szabolcs/compsys.html• Textbook:
W. Stallings, Operating Systems: Internals and Design Principles, 6/E, Prentice Hall, 2006
• Recommended reading:W. Stallings, Computer Organization and Architecture 7th ed., Prentice Hall, 2008A.S. Tanenbaum, Modern Operating Systems, 2nd or 3rd ed. Prentice Hall, 2001 or 2008
![Page 2: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/2.jpg)
Chapter 1Computer System Overview
Patricia RoyManatee Community College, Venice, FL
©2008, Prentice Hall
With additional inputs from Computer Organization and Architecture, Parts 1 and 2
Operating Systems:Internals and Design Principles, 6/E
William Stallings
![Page 3: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/3.jpg)
von Neumann/Turing• Stored Program concept• Main memory storing programs and data• ALU operating on binary data• Control unit interpreting instructions from
memory and executing• Input and output equipment operated by
control unit
![Page 4: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/4.jpg)
Structure of von Neumann machine
![Page 5: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/5.jpg)
Structure - Top Level
Computer
Main Memory
InputOutput
SystemsInterconnection
Peripherals
Communicationlines
CentralProcessing Unit
Computer
![Page 6: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/6.jpg)
Structure - The CPU
Computer Arithmeticand Logic Unit
ControlUnit
Internal CPUInterconnection
Registers
CPU
I/O
Memory
SystemBus
CPU
![Page 7: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/7.jpg)
Computer Components: Top-Level View
![Page 8: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/8.jpg)
Control and Status Registers• Used by processor to control operating of the
processor• Used by privileged OS routines to control the
execution of programs• Program counter (PC): Contains the address of
an instruction to be fetched• Instruction register (IR): Contains the
instruction most recently fetched• Program status word (PSW): Contains status
information
![Page 9: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/9.jpg)
User-Visible Registers• May be referenced by machine language,
available to all programs – application programs and system programs
• Data• Address
– Index: Adding an index to a base value to get the effective address
– Segment pointer: When memory is divided into segments, memory is referenced by a segment and an offset
– Stack pointer: Points to top of stack
![Page 10: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/10.jpg)
Instruction Execution
• Two steps– Processor reads (fetches) instructions from
memory– Processor executes each instruction
![Page 11: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/11.jpg)
Basic Instruction Cycle
![Page 12: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/12.jpg)
Fetch Cycle
• Program Counter (PC) holds address of next instruction to fetch
• Processor fetches instruction from memory location pointed to by PC
• Increment PC– Unless told otherwise
• Instruction loaded into Instruction Register (IR)
• Processor interprets instruction and performs required actions
![Page 13: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/13.jpg)
Execute Cycle• Processor-memory
– data transfer between CPU and main memory• Processor I/O
– Data transfer between CPU and I/O module• Data processing
– Some arithmetic or logical operation on data• Control
– Alteration of sequence of operations– e.g. jump
• Combination of above
![Page 14: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/14.jpg)
Characteristics of a Hypothetical Machine
![Page 15: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/15.jpg)
Example of Program Execution
![Page 16: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/16.jpg)
Interrupts
• Interrupt the normal sequencing of the processor
• Most I/O devices are slower than the processor– Processor must pause to wait for device
![Page 17: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/17.jpg)
Classes of Interrupts
![Page 18: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/18.jpg)
Program Flow of Control
![Page 19: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/19.jpg)
Program Flow of Control
![Page 20: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/20.jpg)
Interrupt Stage
• Processor checks for interrupts• If interrupt occurred
– Suspend execution of program– Execute interrupt-handler routine
![Page 21: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/21.jpg)
Transfer of Control via Interrupts
![Page 22: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/22.jpg)
Instruction Cycle with Interrupts
![Page 23: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/23.jpg)
Simple Interrupt Processing
![Page 24: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/24.jpg)
Multiple Interrupts1 Disable interrupts
– Processor will ignore further interrupts whilst processing one interrupt
– Interrupts remain pending and are checked after first interrupt has been processed
– Interrupts handled in sequence as they occur
2 Define priorities– Low priority interrupts can be interrupted by
higher priority interrupts– When higher priority interrupt has been
processed, processor returns to previous interrupt
![Page 25: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/25.jpg)
Sequential Interrupt Processing
![Page 26: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/26.jpg)
Nested Interrupt Processing
![Page 27: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/27.jpg)
Time Sequence of Multiple Interrupts
![Page 28: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/28.jpg)
Connecting
• All the units must be connected• Different type of connection for different type
of unit– Memory– Input/Output– CPU
![Page 29: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/29.jpg)
Computer Modules
![Page 30: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/30.jpg)
Memory Connection
• Receives and sends data• Receives addresses (of locations)• Receives control signals
– Read– Write– Timing
![Page 31: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/31.jpg)
Input/Output Connection(1)
• Similar to memory from computer’s viewpoint• Output
– Receive data from computer– Send data to peripheral
• Input– Receive data from peripheral– Send data to computer
![Page 32: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/32.jpg)
Input/Output Connection(2)
• Receive control signals from computer• Send control signals to peripherals
– e.g. spin disk• Receive addresses from computer
– e.g. port number to identify peripheral• Send interrupt signals (control)
![Page 33: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/33.jpg)
CPU Connection
• Reads instruction and data• Writes out data (after processing)• Sends control signals to other units• Receives (& acts on) interrupts
![Page 34: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/34.jpg)
Buses
• There are a number of possible interconnection systems
• Single and multiple BUS structures are most common
• e.g. Control/Address/Data bus (PC)
![Page 35: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/35.jpg)
Physical Realization of Bus Architecture
![Page 36: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/36.jpg)
Data Bus
• Carries data– Remember that there is no difference between
“data” and “instruction” at this level• Width is a key determinant of performance
– 8, 16, 32, 64 bit
![Page 37: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/37.jpg)
Address bus
• Identify the source or destination of data• e.g. CPU needs to read an instruction (data)
from a given location in memory• Bus width determines maximum memory
capacity of system– e.g. 8080 has 16 bit address bus giving 64k
address space
![Page 38: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/38.jpg)
Control Bus
• Control and timing information– Memory read/write signal– Interrupt request– Clock signals
![Page 39: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/39.jpg)
Bus Interconnection Scheme
![Page 40: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/40.jpg)
Traditional (ISA) (with cache)
![Page 41: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/41.jpg)
Memory Hierarchy
• Faster access time, greater cost per bit• Greater capacity, smaller cost per bit• Greater capacity, slower access speed
![Page 42: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/42.jpg)
The Memory Hierarchy
![Page 43: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/43.jpg)
Going Down the Hierarchy
• Decreasing cost per bit• Increasing capacity• Increasing access time• Decreasing frequency of access to the
memory by the processor
![Page 44: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/44.jpg)
Performance Balance
• Processor speed increased• Memory capacity increased• Memory speed lags behind processor speed
![Page 45: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/45.jpg)
Logic and Memory Performance Gap
![Page 46: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/46.jpg)
Cache Memory
• Processor speed faster than memory access speed
• Exploit the principle of locality of reference: During the course of the execution of a program, memory references tend to cluster, e.g. loops
![Page 47: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/47.jpg)
Cache and Main Memory
![Page 48: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/48.jpg)
Cache Principles
• Contains copy of a portion of main memory• Processor fist checks cache• If not found, block of memory read into cache• Because of locality of reference, likely future
memory references are in that block
![Page 49: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/49.jpg)
Cache/Main-Memory Structure
![Page 50: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/50.jpg)
Cache Read Operation
![Page 51: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/51.jpg)
Size
• Cache size– Small caches have significant impact on
performance• Block size
– The unit of data exchanged between cache and main memory
– Larger block size more hits until probability of using newly fetched data becomes less than the probability of reusing data that have to be moved out of cache
![Page 52: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/52.jpg)
(Re)placement
• Mapping function– Determines which cache location the block will
occupy• Replacement algorithm
– Chooses which block to replace– Least-recently-used (LRU) algorithm
![Page 53: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/53.jpg)
Write policy
• Dictates when the memory write operation takes place– Can occur every time the block is updated– Can occur when the block is replaced
• Minimize write operations• Leave main memory in an obsolete state
![Page 54: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/54.jpg)
Dynamic RAM• Bits stored as charge in capacitors• Charges leak• Need refreshing even when powered• Simpler construction• Smaller per bit• Less expensive• Need refresh circuits• Slower• Main memory• Essentially analogue
– Level of charge determines value
![Page 55: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/55.jpg)
Static RAM• Bits stored as on/off switches• No charges to leak• No refreshing needed when powered• More complex construction• Larger per bit• More expensive• Does not need refresh circuits• Faster• Cache• Digital
– Uses flip-flops
![Page 56: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/56.jpg)
I/O Devices
• Peripherals with intensive I/O demands• Large data throughput demands• Processors can handle this• Problem moving data • Solutions:
– Caching– Buffering– Higher-speed interconnection buses– More elaborate bus structures– Multiple-processor configurations
![Page 57: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/57.jpg)
Typical I/O Device Data Rates
![Page 58: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/58.jpg)
Hard disk
![Page 59: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/59.jpg)
Speed
• Seek time– Moving head to correct track
• (Rotational) latency– Waiting for data to rotate under head
• Access time = Seek + Latency• Transfer rate
![Page 60: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/60.jpg)
Input/Output Problems
• Wide variety of peripherals– Delivering different amounts of data– At different speeds– In different formats
• All slower than CPU and RAM• Need I/O modules
![Page 61: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/61.jpg)
I/O Steps
• CPU checks I/O module device status• I/O module returns status• If ready, CPU requests data transfer• I/O module gets data from device• I/O module transfers data to CPU• Variations for output, DMA, etc.
![Page 62: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/62.jpg)
I/O Mapping
• Memory mapped I/O– Devices and memory share an address space– I/O looks just like memory read/write– No special commands for I/O
• Large selection of memory access commands available• Isolated I/O
– Separate address spaces– Need I/O or memory select lines– Special commands for I/O
• Limited set
![Page 63: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/63.jpg)
Input Output Techniques
• Programmed• Interrupt driven• Direct Memory Access (DMA)
![Page 64: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/64.jpg)
Programmed I/O (1)
• CPU has direct control over I/O– Sensing status– Read/write commands– Transferring data
• CPU waits for I/O module to complete operation
• Wastes CPU time
![Page 65: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/65.jpg)
Programmed I/O (2)
• CPU requests I/O operation• I/O module performs operation• I/O module sets status bits• CPU checks status bits periodically• I/O module does not inform CPU directly• I/O module does not interrupt CPU• CPU may wait or come back later
![Page 66: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/66.jpg)
Programmed I/O (3)
• I/O module performs the action• Sets the appropriate bits in the
I/O status register• CPU checks status bits
periodically• No interrupts occur• Processor checks status until
operation is complete
![Page 67: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/67.jpg)
Interrupt Driven I/O
• Overcomes CPU waiting• No repeated CPU checking of device• I/O module interrupts when ready
![Page 68: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/68.jpg)
Interrupt Driven I/O (2)
• CPU issues read command• I/O module gets data from peripheral whilst
CPU does other work• I/O module interrupts CPU• CPU requests data• I/O module transfers data
![Page 69: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/69.jpg)
Interrupt-Driven I/O (3)
• Processor is interrupted when I/O module ready to exchange data
• Processor saves context of program executing and begins executing interrupt-handler
![Page 70: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/70.jpg)
Simple Interrupt
Processing
![Page 71: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/71.jpg)
Direct Memory Access
• Interrupt driven and programmed I/O require active CPU intervention– Transfer rate is limited– CPU is tied up
• DMA, an additional module (hardware) on bus• DMA controller takes over from CPU for I/O
![Page 72: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/72.jpg)
Typical DMA Module Diagram
![Page 73: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/73.jpg)
DMA Operation
• CPU tells DMA controller:-– Read/Write– Device address– Starting address of memory block for data– Amount of data to be transferred
• CPU carries on with other work• DMA controller deals with transfer• DMA controller sends interrupt when finished
![Page 74: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/74.jpg)
Direct Memory Access
• Transfers a block of data directly to or from memory
• An interrupt is sent when the transfer is complete
• More efficient
![Page 75: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/75.jpg)
DMA Transfer - Cycle Stealing
• DMA controller takes over bus for a cycle• Transfer of one word of data• Not an interrupt
– CPU does not switch context• CPU suspended just before it accesses bus
– i.e. before an operand or data fetch or a data write• Slows down CPU but not as much as CPU
doing transfer
![Page 76: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/76.jpg)
DMA Configurations (1)
• Single Bus, Detached DMA controller• Each transfer uses bus twice
– I/O to DMA then DMA to memory• CPU is suspended twice
![Page 77: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/77.jpg)
DMA Configurations (2)
• Single Bus, Integrated DMA controller• Controller may support >1 device• Each transfer uses bus once
– DMA to memory• CPU is suspended once
![Page 78: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/78.jpg)
Key is Balance
• Processor components• Main memory• I/O devices• Interconnection structures
![Page 79: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/79.jpg)
Improvements in Chip Organization and Architecture
• Increase hardware speed of processor– Fundamentally due to shrinking logic gate size
• More gates, packed more tightly, increasing clock rate• Propagation time for signals reduced
• Increase size and speed of caches– Dedicating part of processor chip
• Cache access times drop significantly
• Change processor organization and architecture– Increase effective speed of execution– Parallelism
![Page 80: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/80.jpg)
Problems with Clock Speed and Logic Density• Power
– Power density increases with density of logic and clock speed
– Dissipating heat
• RC delay– Speed at which electrons flow limited by resistance and
capacitance of metal wires connecting them– Delay increases as RC product increases– Wire interconnects thinner, increasing resistance– Wires closer together, increasing capacitance
• Memory latency– Memory speeds lag processor speeds
• Solution: More emphasis on organizational and architectural approaches
![Page 81: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/81.jpg)
Increased Cache Capacity
• Typically two or three levels of cache between processor and main memory
• Chip density increased– More cache memory on chip
• Faster cache access
• Pentium chip devoted about 10% of chip area to cache
• Pentium 4 devotes about 50%
![Page 82: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/82.jpg)
More Complex Execution Logic
• Enable parallel execution of instructions• Pipeline works like assembly line
– Different stages of execution of different instructions at same time along pipeline
• Superscalar allows multiple pipelines within single processor– Instructions that do not depend on one another
can be executed in parallel
![Page 83: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/83.jpg)
New Approach – Multiple Cores• Multiple processors on single chip
– Large shared cache• Within a processor, increase in performance
proportional to square root of increase in complexity• If software can use multiple processors, doubling
number of processors almost doubles performance• So, use two simpler processors on the chip rather
than one more complex processor• With two processors, larger caches are justified
– Power consumption of memory logic less than processing logic
• Example: IBM POWER4– Two cores based on PowerPC
![Page 84: Computer Systems Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/compsys.html Textbook:](https://reader033.vdocuments.us/reader033/viewer/2022052701/56649c5a5503460f9490389b/html5/thumbnails/84.jpg)
Intel Microprocessor Performance