Chap 4 - Rev
Chap 4 - Rev
Chapter 4
Operating System
- Provide utilities
- Multitasking // Multiprogramming
- Handling interrupt
2. Definition
Utility: A program that performs a specific task required for the operation of a computer system
Spooling: Data are temporarily held in a buffer waiting for an output device to access it
-It performs a number of basic tasks, including controlling hardware or file handling
-It allows the user to communicate with the computer using hardware
-It provides the user with a user interface
-PC’s are often used to perform many complex tasks at a time
- The OS is needed to handle this multitasking, therefore, it provides the ability to handle interrupts
Interrupt/Buffer
1. Interrupt: A signal from a device sent to a computer causing the CPU to stop its current operation
temporarily
A signal sent from a device requesting the processor time. Interrupts have different priorities.
Purpose of an Interrupt:
- Used to make sure that important tasks are dealt with immediately
- The interrupt tells the CPU that its attention is required
- A signal that can be sent from a device (attached to the computer)
- A signal that can be sent from software (installed on the computer)
- The interrupt will cause the current process to pause
- The OS will service the interrupt
- After the interrupt is serviced, the previous process is continued
- It enables multi-tasking to be carried out on a computer
- Example printer out of paper
1
Chapter 4
- To identify that the processor's attention is required // to stop the current process/task
- To allow multitasking
- To allow for efficient processing // prioritising actions
- To allow for efficient use of hardware
- To allow time-sensitive requests to be dealt with
- To avoid the need to poll devices
What would happen if interrupt signals were not used in a computer.
- The computer would only start a new task when it had finished processing the current task
- Computer will not be able to multitask
-Errors may not be dealt with
- Computer would become impossible to use
Describe the role of an interrupt in generating a message on the computer that the paper has
jammed.
- Keyboard
- Printer
- Mouse
Example when a printer would generate an interrupt signal
- A peripheral is connected/disconnected
- A key on a keyboard is pressed
- A mouse button click
- A phone/video call is received
- A buffer requires more data
- A printer has a paper jam
- A printer runs out of paper
- A printer runs out of ink
- When switching from one application to another
- Opening an application
2
Chapter 4
Software in the computer that will receive and manage all interrupt signals.
- Operating system
- Interrupt handler
- Interrupt service routine
Q: Describe what is meant by main memory and how it is used in the Von Neumann model for a
computer system.
- RAM
- It is a Primary memory
- It is a Volatile memory
- Holds currently in use data/instructions
- Directly accessed by the CPU
Components in the Von Neumann model for a computer system
3
Chapter 4
2. Types of Buses:
(i) Data Bus: Carries data that is currently being processed. Data can travel in both directions
(bidirectional)
(ii) Address Bus: Carries the address of the next instruction to be fetched. Data travels in one direction
(unidirectional)
(iii) Control Bus: Carries signals to control the actions of the processor. Data travels in one direction
(unidirectional)
3. Types of Registers:
(i) MAR: Memory Address Register. Stores the address of the memory location which is about to be
accessed
(ii) MDR: Memory Data Register. Holds the instruction that is in use from address in MAR.
(iii) PC: Program Counter. Stores the address of the next instruction to be executed.
(iv) CIR: Current Instruction Register. Stores the current instruction being executed
(v) Accumulator: Holds data temporarily that is currently being used in a calculation.
Immediate Access Store: Used to hold data and instructions before they are processed.
- Temporary storage
- To store addresses
- To store data/instructions
- PC stores address of next instruction
- MAR stores address of instruction to be fetched
- MDR stores data from the address in MAR
- ACC stores interim results of calculations/data to be used in calculations
- CIR stores the current instruction being processed
4
Chapter 4
4. Control Unit:
- Hold temporary values during calculations in a register called the accumulator (ACC)
Address Contents
1000 1100
1000 1101
1000 1110
1000 1111
(a) (i) The contents of memory location 1000 0001 are to be read.
Show the contents of the Memory Address Register (MAR) and the Memory Data Register (MDR) during
this read operation: (2)
MAR 1 0 0 0 0 0 0 1
MDR 0 1 0 1 0 0 0 1
(ii) The value 0111 1001 is to be written into memory location 1000 1110.
Show the contents of the MAR and MDR during this write operation: (2)
MAR 1 0 0 0 1 1 1 0
MDR 0 1 1 1 1 0 0 1
5
Chapter 4
3. The instruction is copied from the Memory Data Register (MDR) and placed in the Current Instruction
Register (CIR)
MDR
4. The value in the Program Counter (PC) is incremented so that it points to the next instruction to be
fetched
5. The instruction is decoded CIR
PC + 1
8. Explain how an instruction is fetched in a computer based on the Von Neumann model
- PC holds address of the instruction
- The address held in PC is sent to MAR using address bus Decode