You are on page 1of 22

IGCSE COMPUTER

SCIENCE
Theory of Computer Science – Operating Systems and
Computer Architecture
Outlines
■ Operating Systems
– OS Functions
– Command Line Interface (CLI)
– Graphical User Interface (GUI)
■ Interrupts
– Interrupt Request Handler
– IRQ
– Buffer
■ Computer Architecture
– Vonn Neumann Architecture
– Detailed Look
– Buses
– Memory
– Processor
– Fetch-execution Cycle
Operating Systems

■ An Operating System is an essential software which enables interaction between user


and computer hardware.
■ Computer checks for an operating system on start-up, loads it, and the rest of it is
controlled by the OS.
■ The heart of OS is a collection of commands to interact with computer hardware.
■ An OS can be:
– Real-time or batch processed
– Single or multi-user
– Embedded or Distributed
– CLI based or GUI based
Operating System Functions
■ I/O control
■ Human-Computer Interface
■ Task handling
■ Error handling
■ Interrupt handling
■ Application software management
■ User management
■ File utilities
■ Processor and memory
■ Security management
Operating Systems – Command Line
Interface

DOS Unix
Operating Systems – Graphical User
Interface
■ Windows
■ OSX
■ iOS
■ Ubuntu Linux
■ Redhat Linux
■ Android
■ Chrome OS
Interrupts
■ An interrupt is a signal from any device attached to the computer to the processor.
■ Interrupts are managed by a component of processor called Interrupt controller.
■ In case of an interrupt, the processor turns its attention towards the device which
generated the interrupt, and starts listening. For example:
– Your printer was printing fine, until a paper jammed.
– You plugged in your headphones and the audio port interrupted processor.
– An interrupt is generated on a mouse click, key press, screen touch, etc.
■ Interrupts allow us to execute multiple tasks at once. If processor is busy in another
task, it saves the state of that task and attends the interrupt. After the request is
fulfilled, it resumes doing what it was doing before.
Interrupt Life Cycle
Interrupt Request Queue (IRQ)

■ Interrupts are handled by a special component inside the processor, called


Interrupt controller.
■ Interrupt handler is a process executed by Interrupt controller.
■ Each device maintains its own IRQ or Interrupt Request Queue.
■ In an IRQ, multiple interrupts stand in a queue and wait for their turn.
■ The IRQ follows first-come-first-serve rule.
■ The interrupts from IRQ’s are received by Interrupt controller in another
queue called ready queue. The interrupts are sent to processor from ready
queue.
■ This structure prevents hardware conflicts.
Buffers

■ Buffer is a term used to refer to temporary memory of a device.


■ The purpose of buffer is to reduce idle time.
■ For example, Printer has a small buffer memory, in which it keeps
complete document. This way, the printer does not have to communicate
with CPU to print every page.
■ Another example is buffering videos on YouTube. A portion is video is
loaded into the buffer memory of browser. This ensures continuous
playback.
■ Buffer memory is usually tiny, fast and volatile, Processor itself has a
very fast buffer memory called Cache.
Buffers and Interrupts

■ Buffer memory and interrupts work


together to ensure that:
– The processor is serving more
than one processes
– Processor is not wasting time in
idle mode
■ This happens so fast that user feels
that:
– Each program is running in
parallel
– Each program is being served in
real time without delay
Computer Architecture

■ Modern day computers follow Von Neumann’s Architecture (1945), a


computer with a memory to store programs and data, and a processor to
execute them.
■ This architecture consists of 3 conceptual components:
– CPU: consisting of an Arithmetic and Logic Unit and Control Unit.
– Memory: consisting of storages (primary, secondary, buffer) to store
programs and data.
– I/O: the devices to interact with outside world
■ All the data and signals are transported between these 3 components via
electrical paths called “Bus”.
Von Neumann Architecture
Detailed Look

■ Memory Unit: all data is stored here


■ Processing Unit: all functions are executed in
this unit.
– ALU: a sub component of processor
which performs arithmetic functions as
well as logical operations
■ Control Unit: controls what instructions to
perform
■ Input/Output Device Unit: where user
provides instructions and receives the output.
■ Registers: the fastest memory in a computer,
processor stores only current data in registers
during execution.
Buses
■ Buses in computers are similar to buses in real world. They carry data or
signals on fixed path ways.
■ An 8-channel bus in a computer has 8 electrical wires on circuit for
communication.
How many buses does a USB flash drive have?
■ There are 3 types of buses:
– Data bus: used to send and receive actual data between the 3
components.
– Address bus: carries addresses of memory blocks where the data is
meant to be read or written.
– Control bus: contains actual instructions regarding what to do with
the data. E.g. read, write, delete
Memory
■ Memory is a hardware device where computer stores information. It
consists of several partitions.
■ Main memory and Hard Disks have different ways of organizing storage.
For example, hard disks have Tracks, Sectors, Clusters and Partitions. On
the other hand, main memory has Banks, Blocks, Rows and extra
Registers.
■ A partition contains two spaces, first to store an address and second to
store actual data.
■ MAR: Memory Address Register to store addresses
■ MDR: Memory Data Register to store data
Memory
■ E.g. A block in memory can be like:
ADDRESS HEX-ADDRESS DATA
0001 1010 1A A
0001 1011 1B 9
0001 1100 1C 2
0001 1101 1D @
… … …
1111 0000 F0 5
1111 0001 F1 /
1111 0010 F2
… … …
1111 1111 FF X
Processor
■ A processor (or microprocessor) is the
brain of a computer.
■ This is the architecture of a simple 8-bit
processor
■ ALU: Arithmetic and Logic Unit
■ Register File and IR: processor’s internal
memory
■ CU: controls all instructions in processor
■ PC: contains next instruction to execute
■ MAR: keeps address of memory
■ MUX: is the Multiplexer responsible for
breaking large input data into small
chunks for processor to process easily.
Fetch-Execution Cycle
■ Fetch Cycle:
– The instruction to execute
is fetched from memory
address stored in PC
– The instruction is moved to
CIR
– The instruction codes is
decoded into signals
■ Execute Cycle:
– Control Unit sends this
signal to the component
responsible to execute that
specific instruction
Example
User executes an instruction: ADD 2 and 3.
1. The input is read from Keyboard (I/O) device. The keyboard stores these characters in its
buffer memory and after the instruction is complete, an interrupt signal is sent to the Interrupt
controller.
2. The Control Unit (inside Processor) acts on the interrupt signal. It sets STORE instruction to
CIR register and ADD instruction to PC. (Remember that there is a unique code for each
instruction which processor understands, that code is saved in the memory).
3. The STORE instruction asks the memory to save the values 2 and 3 in a free memory area.
E.g. 2 bytes were available in addresses 11110010 and 11110011.
4. Next, the ADD instruction is moved from PC to CIR and PRINT instruction is saved in PC
register in Control Unit.
5. Control Unit requests ALU to execute ADD operation on the values stored in memory
addresses: 11110010 and 11110011
Note that the addresses are sent via Address bus; values 2 and 3 are sent via Data Bus and
instructions PRINT, ADD, STORE, are sent via Control Bus.
Example
6. Control Unit now requests ALU to execute ADD operation on the values stored in
memory addresses: 11110010 and 11110011.
7. ALU receives ADD instruction from Control Unit, and addresses 11110010 and
11110011; then requests memory to send values inside these two addresses.
8. Memory sends 2 and 3 to ALU via Data Bus.
9. The ALU now has all ingredients to execute instruction, i.e. ADD 2 and 3.
10. The addition operation is finally performed and the results are stored in another
memory address, say 11111001.
11. Now, that the ADD instruction is complete, the Control Unit moves PRINT
instruction to CIR.
12. PRINT instruction picks the result 5 from memory address 11111001 and stores in
the buffer memory of the Output device, i.e. Monitor.
13. The monitor finally reads the result from buffer and displays to the user.
Challenge

1. Create a list of all distributions of Linux OS with their logo as an HTML


web page.
2. In a classroom, raising your hand is a gentle way to make an interrupt
request to the teacher. However, this does not apply as is to your
academic setting. Propose another way to create interrupt requests to
teachers, who are teaching multiple students together.

You might also like