Chapter 1 Computer system overview. After studying this chapter, you should be able to: Describe the basic elements of a computer system and their interrelationship, eplain the steps taken by a processor to execute an instruction, understand the concept of interrupts and how and why a processor uses interrupts,...
Trang 1Chapter 1 Computer System Overview
Patricia Roy Manatee Community College, Venice, FL
Trang 2Operating System
more processors
devices
Trang 3Basic Elements
– Two internal registers
• Memory address resister (MAR)
– Specifies the address for the next read or write
• Memory buffer register (MBR)
– Contains data written into memory or receives data read from memory
Trang 4Basic Elements
– I/O address register
– I/O buffer register
Trang 7Computer Components:
Top-Level View
Trang 8Processor Registers
– Enable programmer to minimize main memory references by optimizing register use
– Used by processor to control operating of the processor
– Used by privileged OS routines to control the execution of programs
Trang 9User-Visible Registers
programs and system programs
Trang 10– Stack pointer: Points to top of stack
Trang 11Control and Status Registers
– Contains the address of an instruction to be fetched
• Instruction register (IR)
– Contains the instruction most recently fetched
– Contains status information
Trang 12Control and Status Registers
– Bits set by processor hardware as a result of operations
– Example
• Positive, negative, zero, or overflow result
Trang 14Basic Instruction Cycle
Trang 15Instruction Fetch and Execute
memory
the instruction to be fetched next
Trang 17Characteristics of a Hypothetical
Machine
Trang 18Example of Program Execution
Trang 20Classes of Interrupts
Trang 21Program Flow of Control
Trang 24Interrupt Stage
• If interrupt
– Suspend execution of program
– Execute interrupt-handler routine
Trang 25Transfer of Control via Interrupts
Trang 26Instruction Cycle with Interrupts
Trang 27Program Timing: Short I/O Wait
Trang 28Program Timing: Long I/O Wait
Trang 29Simple Interrupt Processing
Trang 30Changes in Memory and Registers for an Interrupt
Trang 31Changes in Memory and Registers for an Interrupt
Trang 32Sequential Interrupt Processing
Trang 33Nested Interrupt Processing
Trang 34execute
executed depend on their relative priority and whether they are waiting for I/O
control may not return to the program that was executing at the time of the interrupt
Trang 35Memory Hierarchy
Trang 36The Memory Hierarchy
Trang 37Going Down the Hierarchy
memory by the processor
Trang 40Cache and Main Memory
Trang 41Cache Principles
memory
block of memory read into cache
• Because of locality of reference, it is likely that future memory references are in that block
Trang 42Cache/Main-Memory Structure
Trang 43Cache Read Operation
Trang 44– Larger block size yields 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
Trang 45– Chooses which block to replace
– Least-recently-used (LRU) algorithm
Trang 46Cache Principles
– 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
Trang 47Programmed I/O
action, not the processor
the I/O status register
operation is complete
Trang 48Interrupt-Driven I/O
• Processor is interrupted when I/O module ready to
exchange data
• Processor saves context of
program executing and
begins executing
interrupt-handler
Trang 50Direct Memory Access
directly to or from memory
the transfer is complete