Chapter 2
Chapter 2
Computer System
Structures
1
Computer System
Architecture
2
Adapted from Silberschatz, Galvin and Gagne (2013), Operating System Concepts
Computer-System
Operation
A general-purpose computer system consists of one or more
CPUs and a number of device controllers.
Each device controller is in charge of a specific type of
device.
Each device controller has a local buffer.
The CPU and device controllers can execute concurrently.
Device controller informs CPU that it has finished its
operation by causing an interrupt.
Interrupt indicates the occurrence of an event from either
the hardware or software.
3
Adapted from Silberschatz, Galvin and Gagne (2013), Operating System Concepts
Interrupt Handling
When the CPU is interrupted, it stops what it is doing and
immediately transfers execution to a fixed location.
4
Adapted from Silberschatz, Galvin and Gagne (2013), Operating System Concepts
Interrupt Handling (Cont)
Separate segments of code determine what action should
be taken for each type of interrupt.
5
Adapted from Silberschatz, Galvin and Gagne (2013), Operating System Concepts
Interrupt Handling
6
Adapted from Silberschatz, Galvin and Gagne (2013), Operating System Concepts
Synchronous I/O
Structure
After I/O starts, control returns to user program only
upon I/O completion.
7
Adapted from Silberschatz, Galvin and Gagne (2013), Operating System Concepts
Asynchronous I/O
Structure
After I/O starts, control returns to user program without
waiting for I/O completion.
9
Adapted from Silberschatz, Galvin and Gagne (2013), Operating System Concepts
Storage Structure
Main memory – only large storage media that the CPU
can access directly.
10
Adapted from Silberschatz, Galvin and Gagne (2013), Operating System Concepts
Storage Hierarchy
Storage systems organized in hierarchy.
o Speed
o Cost
o Volatility
11
Adapted from Silberschatz, Galvin and Gagne (2013), Operating System Concepts
Storage Device Hierarchy
12
Adapted from Silberschatz, Galvin and Gagne (2013), Operating System Concepts
Caching
13
Adapted from Silberschatz, Galvin and Gagne (2013), Operating System Concepts
Dual-Mode Operation
In order to ensure the proper execution of the operating
system, the computer system must be able to distinguish
between the execution of operating system code and user-
defined code.
14
Adapted from Silberschatz, Galvin and Gagne (2013), Operating System Concepts
Modes of Operation
15
Adapted from Silberschatz, Galvin and Gagne (2013),
Operating System Concepts
Dual-Mode Operation
Mode bit is added to computer hardware to indicate the current mode:
kernel (0) or user (1).
In the kernel mode, the software has complete control of the processor
and all instruction, registers and memory.
This level of control is not necessary and for safety is not desirable for
user programs.
16
Adapted from Silberschatz, Galvin and Gagne (2013), Operating System Concepts
I/O Protection
All I/O instructions are privileged instructions; user
program cannot issue I/O instructions directly.
17
Adapted from Silberschatz, Galvin and Gagne (2013), Operating System Concepts
Use of A System Call to
Perform I/O
18
Adapted from Silberschatz, Galvin and Gagne (2013), Operating System Concepts
Memory Protection
The computer system must provide memory protection at
least for the interrupt vector and the interrupt service
routines.
20
Adapted from Silberschatz, Galvin and Gagne (2013), Operating System Concepts
Hardware Address
Protection
21
Adapted from Silberschatz, Galvin and Gagne (2013), Operating System Concepts
Hardware Address
Protection
When executing in kernel mode, the operating system has
unrestricted access to both monitor and user’s memory.
The load instructions for the base and limit registers are
privileged instructions.
22
Adapted from Silberschatz, Galvin and Gagne (2013), Operating System Concepts
CPU Protection
Timer – interrupts computer after specified period to
ensure operating system maintains control over CPU.
o Every time the clock ticks, the counter is decremented.
o When timer reaches the value 0, an interrupt occurs.
23
Adapted from Silberschatz, Galvin and Gagne (2013), Operating System Concepts
Summary
Computer-system operation Dual-mode operation
Interrupt handling I/O protection
I/O structure Memory protection
Storage structure / Storage CPU protection
hierarchy
24
Adapted from Silberschatz, Galvin and Gagne (2013), Operating System Concepts