Chapter(4)
Operating System and Computer
Architecture
Contents
Operating systems
interrupts and buffers
computer architecture and the von Neumann computer model
The fetch–execute cycle.
Operating System(OS)
What is operating system?
is essentially software running in the background of a computer system that manages
many of the basic functions.
responsible for the operation and smooth running of a computer.
Most general purpose computers (including smartphones and tablets) will have an
operating system to manage the running of other programs and control the system’s inputs
and outputs.
Simple devices (Washing Machine,
Example of OS microwave, oven)
Window Android don’t always have an operating
system.
Why?
The input is usually a button
Linux IOS
pressed or a touchscreen option
selected
perform a simple hardware function.
Operating System(OS)
Function of OS
Provides an Human computer interface for computer interaction
Control of inputs and outputs
Interrupt and error handling
Loading and running of application/software
File management (copy, save, sort, delete)
Processor management for multitasking
Memory management
Security (access rights, user accounts etc) and so on
Operating System
When the computer is turned on:
The initiating programs are loaded into memory
from the ROM (read only memory) chip.
These programs run to check if there is any errors
in hardware, processor, internal memory and bios
(basic input–output system)
If no errors are detected, then OS is loaded into
memory.
Interrupt
is a signal sent from a device or from software to the processor.
will cause the processor to temporarily stop what it is doing and service the interrupt.
The interrupt handler is the part of the operating system which is responsible for dealing
with interrupt signals.
The interrupt handler prioritizes interrupt as they are received.
For every interruption, the current task needs to be stopped, with it’s status saved (so it
can resume later).
allow computers to carry out many tasks at the same time.
can occur when, for example:
a disk drive is ready to receive more data
an error has occurred, such as a paper jam in a printer
the user has pressed a key to interrupt the current process ( Ctrl+Alt+Break)
a software error has occurred
Buffer
Is a temporary memory area in computer .
Act as the holding area for data
Used to compensate the speed difference between
CPU (fast) and hardware(slow)
Data from processor or memory unit to be sent to a
hardware is sent to buffer
The hardware can get data from butter and the
processor can carry out other task.
Example streaming a video from the internet
How buffers and interrupts are used when
a document is sent to a printer for printing
The processor
continuous with its task
NO
Any data YES The contents of buffer are
The print data is sent to
sent to emptied to the printer and
the buffer from memory
printer? printing take place
The processor can carry NO All data
out other task while the sent to
butter are being emptied printer?
YES
When all data have been printed,
The current task is
an interrupt signal send to the
stopped temporarily and
processor to request more data
the interrupt is served.
to be printed.
Von Neumann Model
Very early computers were not able to store CPU
program and data, therefore they weren’t
run/process without human intervention.
Von Neumann architecture was
first published by John von Neumann in
1945.
This architecture is based on the stored-
program computer concept, where
instruction and data are stored in the same
memory.
A processor and memory unit are linked
together to move data by connections known
as BUSES.
Bus
Component of Von Neumann Model
Central Processing Unit (CPU)
Control Unit (CU)
Input Device Arithmetic/logic Unit(ALU) Output Device
PC CIR
Register
MAR MDR AC
Memory
Central Processing Unit (CPU)
is the electronic circuit responsible for executing the instructions of a computer
program.
Is also called processor or microprocessor
Consists of
CU
ALU
Register
Register
is simply a high speed storage area within the computer.
All data must be stored in a register before it can be processed.
MAR Memory Address Hold the location of data that need to be
Register accessed
MDR Memory data Register Hold data that is being stored to or retrieved from
memory
AC Accumulator Store the intermediate results of ALU
PC Program Counter contains the address of the next instruction to be
executed.
CIR Current Instruction Contains the current instruction during processing
Register
ARITHMETIC AND LOGIC UNIT (ALU)
perform arithmetic (e.g. add, subtract, etc.) and logic (e.g. AND,
OR, NOT, etc.) operations
Used Accumulator to hold the results of calculations
Control Unit
controls the operation of the memory, processor and input/output devices.
Interpret the instruction and send signals via control bus to tell the other
components what to do.
Contains two registers.
CURRENT INSTRUCTION REGISTER (CIR) : contains the current instruction
during processing.
PROGRAM COUNTER (PC): contains the address of the next instruction to
be executed.
Memory unit
is the storage space in the computer, where data and Address Contents
instructions required for processing are stored 0000 0000 1100 1010
is split into a number of partitions to store data. 0000 0001 1011 0001
Each partition consists of an unique ADDRESS and its 0000 0010 1111 1011
CONTENTS (data)(both in binary form)
.
Use two register to read/write the data in memory. .
Memory Address Register : store the address 1111 1110 0001 0010
Memory Data Register : store the contents/ data 1111 1111 0111 1011
Memory
Address
The location of where
data can be stored in
a computer memory
Memory unit
Read Operation Address Contents
Read 0000 0010 (instruction) 0000 0000 1100 1010
0000 0001 1011 0001
Step 1: The address is written in MAR. 0000 0010 1111 1011
MAR .
0 0 0 0 0 0 1 0 .
1111 1110 0001 0010
Step 2: The read signal is sent to the
memory via the control bus 1111 1111 0111 1011
Step 3: The content of address in
MAR are written in MDR
MDR
1 1 1 1 1 0 1 1
Memory unit
Write Operation Address Contents
Write 0001 0010 to 1111 1111
0000 0000 1100 1010
Data ADD
0000 0001 1011 0001
Step 1: The data is written in MDR.
MDR 0000 0010 1111 1011
0 0 0 1 0 0 1 0 .
.
Step 2: The address of location is
written in MAR 1111 1110 0001 0010
MDR
1111 1111 0111 1011
0001 0010
1 1 1 1 1 1 1 1
Step 3: The write signal is sent to the
memory via the control bus
Input and Output Devices
Input Devices
convert external data into a form the computer can understand (e.g.
keyboards, touchscreens and microphones).
Output devices
show the results of computer processing in a humanly understandable
form (e.g. printers, monitors and loudspeakers).
FETCH–EXECUTE CYCLE
In store program concept, the instructions and data are stored in the same memory
(RAM)
To carry out a set of instructions, the processor first of all FETCHES some data
and instructions from memory and store in register.
Each instruction needs to be decoded before finally being EXECUTED.
The instruction is fetched and executed one after another.
This is all known as the FETCH–EXECUTE CYCLE
Fetch and Execute Cycle
Memory (RAM)
PC 5
3001
3004
3003 3002
MAR
3003
3001 3003 Read 3001
3004 Write …..
MDR
Read 3001
CIR
Immediate access store (IAS) holds data and
instructions when they are loaded from main
Read 3001 memory and are waiting to be processed.
Fetch and Execute Cycle
The PC contain the address of the next
instruction to be fetched
This address is copied to MAR via the
address bus
The instruction at the address is copied
into MDR temporarily
The instruction in MDR is then placed in
CIR
If the instruction contain an address, it is
placed in MAR
The value in PC is incremented, pointed
to the next instruction to be fetched
The instruction is decoded and executed
Complete the sentence using The central processing unit (CPU) ................. the
the given list. data and instructions needed and stores them in the
Not all items in the list need to .................to wait to be processed.
be used.
The ................holds the address of the next
• accumulator (ACC)
• address bus
instruction. This address is sent to the .................
• arithmetic logic unit (ALU) The data from this address is sent to the ..................
• control unit (CU) . The instruction can then be decoded and ............. .
• data bus Any calculations that are carried out on the data are
• executed done by the ............ . During calculations, the data
• fetches is temporarily held in a register called the ............. .
• immediate access store (IAS)
• memory address register
(MAR)
• memory data register (MDR)
• program counter (PC)
• saved
• transmits