Transcript 02-CS-Struc

Course Overview







Introduction
Computer System
Structures
Operating System
Structures
Processes
Process Synchronization
Deadlocks
CPU Scheduling
© 2000 Franz Kurfess








Memory Management
Virtual Memory
File Management
Security
Networking
Distributed Systems
Case Studies
Conclusions
Computer System Structure 1
Computer System Structure
Chapter Overview







Motivation
Objectives
Computer Architecture
Hardware Structure
Program Execution
Handling of Input/Output
(I/O)
Interrupts








© 2000 Franz Kurfess
Storage Structure
DMA
Caching
Protection
Booting
Computer System
Examples
Important Concepts and
Terms
Chapter Summary
Computer System Structure 2
Motivation
© 2000 Franz Kurfess
Computer System Structure 3
Objectives
 know
the essential components of a computer
system, and how they function
 understand the interaction between these
components
 see the differences in the architectures of various
types of computer systems
 PC,
workstation, mainframe, supercomputer
 understand
the interaction between hardware and
the execution of programs
 computer system hardware is the basis for the
execution of programs, and thus for the
© 2000 Franz Kurfess
Computer System Structure 4
Computer Architecture
 overall
design of a computer system
 main emphasis on hardware
 individual
components
 interconnection structure
© 2000 Franz Kurfess
Computer System Structure 5
Von Neumann Architecture
 four
main components
 central
processing unit (CPU)
 main memory
 I/O devices
 interconnection structures (bus)
 basis
for almost all computer systems
© 2000 Franz Kurfess
Computer System Structure 6
Hardware Architecture
CPU
Main Memory
Control Unit
Registers
I/O Devices
Controllers
Arithmetic Logic
Unit
(ALU)
System Bus
© 2000 Franz Kurfess
[David Jones]
Computer System Structure 7
Computer System Operation
 the
CPU executes machine instructions according to
the program specified in the executable
 the CPU can access information directly only if it is
kept in main memory
 CPU and I/O devices operate concurrently
 device controllers interface with the I/O devices
 one
controller may handle several devices of the same
type
 controllers have local buffers
 data
are moved between main memory and the
buffers of device controllers
© 2000 Franz Kurfess
Computer System Structure 8
CPU Registers
 registers
are used for information that must be
immediately accessible to the CPU
 they are integrated on the same chip
 important registers are
 program
counter (PC)
 instruction register
 status registers
 stack pointer
 registers for data
© 2000 Franz Kurfess
Computer System Structure 9
Program Execution
 one
machine instruction is executed after the other
as specified in the executable (program)
 if I/O operations are required, the program under
execution is temporarily suspended, and the CPU
switches to another program
 interrupts are used to signal important events; they
disrupt the flow of execution temporarily
© 2000 Franz Kurfess
Computer System Structure 10
Interrupts
 interrupts
signal the occurrence of important events
in the computer system
 the purpose of an interrupt is to transfer control from
the current task to the OS
 a software-generated interrupt is also called a trap
 the address of the interrupted instruction must be
preserved together with the status of the system
© 2000 Franz Kurfess
Computer System Structure 11
Interrupt Handling
 the
state of the system (mainly the CPU) is
preserved by storing
 registers
(program counter, status word, stack pointer,
data registers)
 additional information about the current program and its
state
 different
types of interrupts are handled by specific
interrupt service routines
 the addresses of the service routines are identified
through the interrupt vector
© 2000 Franz Kurfess
Computer System Structure 12
Simple Interrupt Handling
Interrupt occurs.
CPU pushes PSW, PC onto stack.
CPU finishes current instruction.
CPU signals receipt of Interrupt.
CPU loads new PC value.
May be a single value all the time might vary.
OS saves remainder of process information.
interrupt is processed.
Hardware
Software
OS restores process state information.
Pops old PSW, PC values off the stack.
© 2000 Franz Kurfess
[David Jones]
Computer System Structure 13
Handling of Input/Output (I/O)
 I/O
is initiated by a request from a user program, or
by the OS
 the request is handled by the OS via system calls
 I/O operations typically take much longer than the
execution of an instruction
 e.g.
milliseconds (ms) for hard disk access vs.
nanoseconds (ns) for CPU instructions
 buffers in device controllers are used to diminish the
impact on the CPU
© 2000 Franz Kurfess
Computer System Structure 14
Synchronous I/O
 control
returns to the CPU only after I/O is finished
 CPU is idle during that time
 only one outstanding I/O request
© 2000 Franz Kurfess
Computer System Structure 15
Asynchronous I/O
 after
the initiation of I/O, the CPU continues the
execution without waiting
 better resource utilization
 CPU
is not idle
 simultaneous I/O activities involving different devices
 more
complex
© 2000 Franz Kurfess
Computer System Structure 16
Storage Structure
 main
memory
 directly
accessible by the CPU
 secondary
storage
 not
directly accessible by the CPU
 immediately available in the computer system
 large storage capacity
 non-volatile medium
 tertiary
storage
 permanent/long-term
storage
 large storage capacity
 may not be immediately available
© 2000 Franz Kurfess
Computer System Structure 17
Storage Hierarchy
 storage
devices can be categorized according to the
following criteria
 access
speed
 capacity
 cost
 volatility
 faster
storage devices can be used as caches for
slower ones
© 2000 Franz Kurfess
Computer System Structure 18
Hierarchy of Storage Devices
Registers
Cache
Main Memory
Electronic Disk
Magnetic Disk
Optical Disk
Magnetic Tape
© 2000 Franz Kurfess
Computer System Structure 19
Storage Device Characteristics
Storage
Device
Access
Speed
Capacity
Cost
Volatility
Registers
nanoseconds
Kbytes
very
high
high
Cache
tens of
nanoseconds
Mbytes
$100 per
Mbyte
high
M ain
M emory
50-70
nanoseconds
tens or
hundreds of
Mbytes
$10 per
Mbyte
high
Electronic
Disk
100-200
nanoseconds
hundreds of
Mbytes
$1 per
Mbyte
medium
(battery)
M agnetic
Disk
5-15
milliseconds
tens of Gbytes
$100 per
Gbyte
low
Optical
Disk
100
milliseconds
hundreds of
Gbytes
$10 per
Gbyte
low
Tape
Drive
milliseconds to
seconds
hundreds of
Gbytes to
TBytes
$1 per
Gbyte
low
© 2000 Franz Kurfess
Computer System Structure 20
Direct Memory Access (DMA)
 data
are transferred between peripheral devices and
main memory without involvement of the CPU
 performed
by memory management unit and device
controller
 CPU
initiates the transfer of data blocks
 device
controller signals the end of the transfer via an
interrupt
 only one interrupt per block, instead of one per word
© 2000 Franz Kurfess
Computer System Structure 21
Caching
 frequently
or recently used information is stored in
quickly accessible memory
 caches occur at different places in the computer
system
 between
CPU and main memory
 between main memory and peripheral devices (e. g. hard
disk)
 in device controllers; in this case, another term is buffers
 for specific applications (e.g. Web browsers)
© 2000 Franz Kurfess
Computer System Structure 22
Protection
 dual-mode
operation
 CPU protection
 memory protection
 I/O protection
© 2000 Franz Kurfess
Computer System Structure 23
Dual-Mode Operation
 the
system operates in at least two different modes
 user


mode
“regular” execution of user programs
limited access to instructions and resources
 system


mode
execution of OS programs
access to privileged instructions and resources
 requires
hardware support
 interrupt or system call initiate a switch to system
mode
 OS initiates switch to user mode
© 2000 Franz Kurfess
Computer System Structure 24
CPU Protection
 privileged
instructions are only executed in system
mode
 timer is used to generate an interrupt after a certain
time period
 decremented
with every clock tick
 interrupt when it becomes 0
 calculation of the current time
 used for time sharing
 mode
bit indicates status (user or system mode)
© 2000 Franz Kurfess
Computer System Structure 25
Memory Protection
 processes
are allowed to access only their own
memory ranges
 OS range must be protected from user ranges
 memory protection is often implemented through
base and limit registers
© 2000 Franz Kurfess
Computer System Structure 26
Memory Protection
 simple
version, with base and limit register
1,024,000
Process 4
824,000
Process 1
limit register
147,000
640,000
Process 3
range Process 3
493,000
Process 2
398,000
Process 5
232,000
© 2000 Franz Kurfess
0
493,000
base register
Operating
System
Computer System Structure 27
I/O Protection
 I/O
instructions are privileged
 problem: How does a user perform I/O operations?
 solution: I/O requests from the user are handled by
the OS through system calls
 direct access to I/O devices would enable access to
sensitive information and programs
© 2000 Franz Kurfess
Computer System Structure 28
Booting
 after
powering on a computer system, its main
memory is empty: how can the execution of
programs be started?
 a small part of the operating system (BIOS, kernel)
is stored in non-volatile ROM
 the CPU starts the execution of that memory section
by default
 more parts of the OS are loaded from secondary
storage (hard disk)
 after the essential parts of the OS have been
installed, the execution of user programs can begin
© 2000 Franz Kurfess
Computer System Structure 29
Computer System Examples
 Personal
 IBM
Computers
PC compatibles, Apple Macintosh
 Workstations
 SUN
Sparcstation, DEC Alpha, Silicon Graphics
 Mainframes
 IBM
360 Family
 Supercomputers
 Cray
© 2000 Franz Kurfess
Computer System Structure 30
Characteristics of
Computer Systems
 usage
 processing
power
 main memory size
 secondary storage space
 user interface
© 2000 Franz Kurfess
Computer System Structure 31
Personal Computers
 individual
 limited
users
multitasking
 general-purpose
applications
 word
processing, spreadsheet, presentation, graphics,
data base, etc.
 Pentium-class
microprocessors
 tens of MBytes main memory
 GBytes of secondary storage space
 graphical user interface
 resolution
© 2000 Franz Kurfess
800x600, hundreds of colors
Computer System Structure 32
Workstations
 individual
 full
users
multitasking
 special-purpose
applications (high-end)
 graphics,
animation, scientific computing and visualization,
software development, data bases, etc.
 RISC
microprocessors
 SUN
Sparc, DEC Alpha, MIPS, PowerPC
 hundreds
of MBytes main memory
 tens of GBytes secondary storage space
 graphical user interface
 resolution
© 2000 Franz Kurfess
1600x1200, thousands or millions of colors
Computer System Structure 33
Mainframes
 multiple
 full
 often
users
multi-user (time-sharing), multitasking
special-purpose applications (high-end)
 corporate
information systems, transaction processing,
data base, software development, etc.
 custom-specific
CPUs or multiple RISC
microprocessors
 GBytes main memory
 hundreds of GBytes secondary storage space
 alphanumeric or graphic terminal
 sometimes
© 2000 Franz Kurfess
networked PCs are used as terminals
Computer System Structure 34
Supercomputer
 multiple
 full
users
multi-user (time-sharing), multitasking
 special-purpose
applications (high-end)
 computation-intensive
 scientific
computing, simulation, modeling, animation,
data mining, etc.
 custom-specific
CPUs or multiple RISC
microprocessors
 GBytes of main memory
 hundreds of GBytes secondary storage space
 networked workstations, PCs are used for access
© 2000 Franz Kurfess
Computer System Structure 35
Example Supercomputer
 Accelerated
Strategic Computing Initiative (ASCI)
Option Red currently is the world’s fastest
supercomputer (Feb. 98)
 more than 1 teraFLOPS (1012 floating point
operations per second)
 used for computer-based modeling, simulation, and
virtual prototyping
© 2000 Franz Kurfess
Computer System Structure 36
ASCI Red
 massively
parallel
 9000
Pentium Pro CPUs in 4500 computing nodes
 additional nodes for



I/O (file and network services)
service (user interaction)
system nodes (diagnostics, booting)
 distributed
 128
memory
MByte of RAM per computing node
 double
two-dimensional mesh interconnection
network for message passing
 400
 two
MBps in each direction
operating systems
© 2000 Franz Kurfess
Computer System Structure 37
Important Concepts and Terms















architecture
booting
cache
computer system
CPU
CPU registers
direct memory access (DMA)
hardware
integrated circuit
interrupt
main memory
microprocessor
multiprocessing
multiprogramming
multitasking
© 2000 Franz Kurfess
















operating system
process
process control block (PCB)
peripheral device
preemptive multitasking
RAM
registers (CPU)
ROM
software
state of a process
task
thread
time-sharing
transistor
user interface
Computer
System Structure
von-Neumann
architecture
38
Chapter Summary
 almost
all computer systems are based on the von
Neumann architecture
 CPU,
memory, I/O devices, interconnection (bus)
 the
performance of the computer system hardware
depends on that of the individual components as
well as on their interaction and cooperation
 the main purpose of the computer system is the
execution of programs
 the same computer system can be used for a variety
of tasks by running different programs
© 2000 Franz Kurfess
Computer System Structure 39