Professional Documents
Culture Documents
Computer System Overview-1
Computer System Overview-1
Computer System Overview-1
Systems:
Internals Chapter 1
and Design
Principles Computer System
Overview
Ninth Edition
By William Stallings
I/O
Processor Modules
Main System
Memory Bus
Referred to as
the Central
Processing Unit
(CPU)
© 2017 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Main Memory
Stores data and programs
Typically volatile
Contents of the memory is lost when
the computer is shut down
Referred to as real memory or
primary memory
Provides for
communication among
processors, main memory,
and I/O modules
I/O AR
Data
Execution
unit Data
I/O BR Data
Data
PC = Program counter
Buffers IR = Instruction register
MAR = Memory address register
MBR = Memory buffer register
I/O AR = Input/output address register
I/O BR = Input/output buffer register
Processor reads
Processor executes
(fetches) instructions
each instruction
from memory
Two steps
© 2017 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Fetch Stage Execute Stage
1 4 1
I/O
Command
Figure 1.5a WRITE
5
WRITE
2a
END
2
Flow of Control 2b
WRITE WRITE
Without 3a
Interrupts 3
3b
WRITE WRITE
1 4 1 4 1
I/O I/O
Command Command
Figure 1.5b
WRITE WRITE WRITE
5
2a
END
2 2
END
3a
3 3
3b
WRITE
X = interrupt occurs during course of execution of
WRITE WRITE
user program
(a) No interrupts (b) Interrupts; short I/O wait (c) In
© 2017 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
I/O User I/O User I/O
Program Program Program Program Program
4 1 4 1 4
Figure 1.5c
2a
END
2
Interrupt Interrupt
2b Handler Handler
END END
3a
3b
WRITE WRITE
No interrupts (b) Interrupts; short I/O wait (c) Interrupts; long I/O wait
© 2017 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
User Program Interrupt Handler
i
Interrupt
occurs here i+1
Interrupts
Disabled
Check for
Fetch next Execute interrupt;
START instruction instruction initiate interrupt
Interrupts
handler
Enabled
HALT
1 1
4 4
I/O operation
I/O operation;
processor waits 2a concurrent with
processor executing
5 5
2b
2
4
I/O operation
4 3a concurrent with
processor executing
I/O operation;
processor waits 5
5 3b
1 1
4 4
5
2
4
4
3 I/O operation
concurrent with
I/O operation; processor executing;
processor waits then processor
waits
5
5
Device controller or
other system hardware
issues an interrupt
Save remainder of
process state
information
Processor finishes
execution of current
instruction
Process interrupt
Processor signals
acknowledgment
of interrupt
Restore process state
information
Processor pushes PSW
and PC onto control
stack
Restore old PSW
and PC
Processor loads new
PC value based on
interrupt
Y Start Y Start
Interrupt General Interrupt General
Service Registers Service Registers
Y + L Return Routine T Y + L Return Routine T–M
Stack Stack
Pointer Pointer
Processor Processor
T–M T
N User's N User's
N+1 N+1
Program Program
Main Main
Memory Memory
An interrupt occurs
while another interrupt Two approaches:
is being processed
• e.g. receiving data from • Disable interrupts
a communications line while an interrupt is
and printing results at being processed
the same time • Use a priority scheme
Interrupt
Handler Y
Interrupt
User Program Handler X
Interrupt
Handler Y
15
0 t=
t =1
t = 25
t= t = 25 Disk
40 interrupt service routine
t=
35
Greater capacity
Faster = smaller cost per
access time bit
= greater Greater
cost per bit capacity =
slower access
speed
hierarchy:
ch
Me o a r d Ca
mo in
ry M a or y
m
Me
sk
Ou Di
t tic
Sto boar ne OM
Increasing capacity B
Decreasing frequency of
access to the memory by
the processor
Figure 1.14 The Memory Hierarchy
© 2017 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
T1 + T2
T2
T1
0 1
Fraction of accesses involving only Level 1 (Hit ratio)
Also
referred to
as auxiliary
memory
• External
• Nonvolatile
• Used to store
program and
data files
© 2017 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Invisible to the OS
Interacts with other memory management hardware
Processor must access memory at least once per instruction
cycle
Processor execution is limited by memory cycle time
Exploit the principle of locality with a small, fast memory
Fastest Fast
Less Slow
fast
C-1
Block Length
(K Words)
(a) Cache
Block M – 1
2n - 1
Word
Length
(b) Main memory
RA - read address
Receive address
RA from CPU
Load main
Deliver RA word
memory block
to CPU
into cache slot
DONE
Number
of cache Block size
levels
Main
categories
are:
Write Mapping
policy function
Replacement
algorithm
Cache Size
Block
Size
The unit of data
Small caches have
exchanged
significant impact
between cache and
on performance
main memory
© 2017 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Mapping Function
Determines which cache
location the block will occupy
When one block is read
in, another may have to be
replaced
Two constraints affect
design:
The more flexible the
mapping function, the
more complex is the
circuitry required to
search the cache
© 2017 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Replacement Algorithm
System Bus
Main I/O
Memory I/O Adapter
Subsystem
I/O
Adapter
I/O
Adapter