Documente Academic
Documente Profesional
Documente Cultură
When a computer is switched on or reset there must be an Main memory is the only large storage area that the CPU can
initial program that gets the system running. This program is directly access. Hence, any programs that are currently being
called the bootstrap and tends to be simple. The bootstrap executed must be in main memory. This includes critical parts
program will: of the operating system. Main memory is one of the key
initialize a variety of registers, devices, memory control resources for the operating system to manage.
devices, Main memory consists of an array of words or bytes.
load the operating system into memory, and
start the operating system running. 0
1
10101111
11001100
2 10010011
3 10010000
4 10010111
5 11111000
6 11111111
7 11111111
: :
The Cache 5 The Cache 6
10 he ll o wo 1100 rl
d!
Data Lines
There are a number of key components that are contained
inside the CPU(Central Processing Unit). These include:
Control Unit : This directs the flow of information within the CPU. Instruction Register
Register 1
ALU(Algorithmic and Logic Unit) : This unit does the basic
computation within the CPU. Register 2 Clock
Control
Registers : These are to store words that are currently being processed Unit
Address Lines
within the CPU. Register 3
Instruction Pointer : A register that points to the next instruction in Inc
memory to execute. ALU
Instruction Register : The register that contains the current instruction MUX
that is being executed.
Instruction Pointer
Instruction Cycle 9 Instructions 10
3. Execute
4. Increment instruction
instruction pointer
Instructions 11 Example 12
The assembly language instruction can be divided into two Consider the following line of code:
parts: x := y + 7;
Operation code(op code) - tells the CPU which operation to Suppose the variable x is stored in memory location A0. y is
perform. stored in location A1.
Operands - these are the parameters for the operations. They The assembly instructions of this line of code would look
could be : address locations, register indexes, or values. something like :
Op-code Operands
Interrupts 13 Interrupts 14
Interrupts 15 DMA 16
Interrupts must be handled quickly. Direct Memory Access(DMA) enables the computer to move
The interrupt handler must return the state of the process to blocks of memory to and from devices or within memory. This
is achieved by stealing bus clock cycles from the CPU.
exactly the way it found it. This will clearly involve saving
and resorting the program counter and any other registers that For low speed devices, such as a serial port, interrupts are
are used by the interrupt handler. The complete state of the sufficiently efficient to handle this data transfer.
running process is not saved, as this would be a waste of time. However, for high speed devices, such as a network card,
Usually, other interrupts are disabled while an interrupt is interrupts are insufficient. As the rate of requests is faster than
being handled. Some architectures support priorities for the rate the handler can deal with them.
interrupts. So an interrupt handler may be interrupted by an The operating system sets up control information, counters,
interrupt with higher priority.
and pointers for the transfer. Once the DMA transfer is
Modern operating systems are interrupt driven. Events are complete the operating system can be informed by an
signaled by an interrupt or a trap(software interrupt). interrupt.
Storage Structure 17 Storage Structure 18
In the von Neumann style architecture instructions are fetched Magnetic disks are the most common from of secondary
from main memory and executed. Instructions will Load/Store storage as they are able to hold large quantities of data and are
from/to main memory. However, from the memories non-volatile.
perspective all that is seen is a series of addresses with either a Most programs will remain on disk until required. Also the
read or write command.
disk is the main location that non-temporary data is stored.
It would be nice to store all data and programs in main Hence, efficient management of the magnetic disk is critical
memory. However, this is not possible for two reasons: for a system to run well.
the size of memory is generally too small,
contents is lost when power is turned off(it is usually a
volatile storage device).
Some architectures have special instructions for the CPU to There is a variety of storage devices computers may store
communicate with I/O devices. information within. They may be arrange in a hierarchy in
terms of : cost per bit, capacity, and speed.
Other use memory-mapped I/O where control, data, and status
registers of a device sit in fixed locations in the memory space.
Registers
(it is not real memory it just looks like it from the CPU) The
CPU may view these locations as ordinary memory and Cache
simply load and store data to and from these locations to
Main Memory
achieve the required I/O.
Electronic Disk
Magnetic Disk
Optical Disk
Magnetic Tapes
Hardware Protection 21 Hardware Protection 22
Hardware protection is provided by most architectures to Dual-Mode Operation : there is two modes of operation user
prevent user programs running wild. mode and monitor mode( also called supervisor, system, or
A user program may contain bugs or be malice. In either case privileged mode). Restrictions are placed on what instruction
it is undesirable that this user program can adversely effect may be executed in user mode. A trap occurs if a user program
attempts to execute a privileged instruction.
either the operating system or other user programs. As user
programs generally execute directly on the CPU, hardware I/O Protection : user programs are general prevented from
protection is essential to make the computer system more directly performing any I/O operations. Hence, all I/O must be
reliable/stable. done through the operating system.
CPU Protection : a user program should be prevented from
taking control of the CPU. This may be achieved by using a
timer that causes an interrupt.
Hardware Protection 23
Monitor
+
CPU Limit 0
Job 1
<
>=
Job 2
Address Error