You are on page 1of 24

Chapter 4 – Operating systems and computer

architecture

Syllabus Content:
1. Computer architecture and the fetch-execute cycle:
 show understanding of the basic Von Neumann model for a computer system and the
stored program concept (program instructions and data are stored in main memory and
instructions are fetched and executed one after another)
 describe the stages of the fetch-execute cycle, including the use of registers and buses
2. Operating systems:
 describe the purpose of an operating system (Candidates will be required to understand the
purpose and function of an operating system and why it is needed. They will not be
required to understand how operating systems work.)
 show understanding of the need for interrupts

Page #98
4 Operating systems and computer architecture

Introduction:

All computers have operating systems which makes it possible to communicate with
software and hardware.
There are many ways of representing computer architecture including the more common
ones known as the von Neumann model.

1) Operating systems (why is it needed):

An operating system is software which controls the operations of the computer system
and manages all of the computer’s hardware and programs.
It provides an interface through which a user can run an application.
It controls how the computer responds to user’s requests and how hardware
communicates with each other.

i) Computers without operating systems:

Some computers do not need an operating system.


An automated system such as household appliances that is microprocessor-controlled
does not require an operating system.
Examples: washing machine, microwave ovens or a digital camera.

ii) Functions of an operating system: iii) Examples of an operating system:

1. Provides a user interface 1. Windows


2. Handles interrupts and errors 2. Linux
3. Memory management 3. Android
4. File management
5. Manages inputs/outputs
6. Allows multitasking
7. Manages multiprogramming
8. Enables batch processing
9. Enables real-time processing
10. File utilities (copy, save, delete etc.)
11. Input/output control
12. Manages error handling
13. Management of user accounts

99
2) Types of interface:

The means of communication between the user and the machine is known as the user
interface.
It consists of both hardware and software through which a user provides input to a
computer or receives information from it.

There are two types of interfaces:

1. Command Line Interface (CLI)


2. Graphical User Interface (GUI)

1) Command Line Interface (CLI):

CLI (command line interface) is the one, where user types a series of commands using
keyboard and communicates directly with computer system.
To use this, the user needs to know what commands are available, understand the
commands and understand the way information is stored in computer system.

i) Describe how a user can select and open an application using CLI including any input
hardware needed.

The user communicates directly with computer system by typing in commands in response
to a prompt.
Several commands are entered to carry out a task such as simply loading software.
The input hardware needed for typing these commands is keyboard or keypad.

ii) Advantages of CLI:

1. It allows direct communication with computer system.


2. It is not restricted to a number of pre-determined options.
3. It is simple interface using keyboard only.
4. It provides with a faster response.

iii) Disadvantages of CLI:

1. A user needs to learn a number of long and complex commands.


2. A user needs to learn how information is stored in computer.
3. The user needs to type in commands which results in possibility of errors.
4. It is slower to type in commands every time.

100
2) Graphical User Interface (GUI):

Graphical interfaces are called GUI (graphical user interface) or WIMP (windows, icons,
menus and pointer) because it displays graphics as well as text.
GUI is very user friendly as user can select options by use of menus of choices and small
pictures which represent different available options.
Choices are selected by the user using a pointing device e.g. mouse.

i) Describe how a user can select and open an application using GUI including any input
hardware needed.

The user interacts with a computer using pictures and symbols or drop down menu.
Tasks are initiated by selecting the icons (e.g. selecting the icon of a software to open it).
It is usually part of a windows environment.
The input hardware needed for selections is pointing device (e.g. mouse) or a touch screen.

ii) Advantages of GUI:

1. The user only needs to click on one simple picture.


2. It is so much easier for the beginner.
3. Several instructions are replaced just by one icon.
4. There is no need to understand how computer works.

iii) Disadvantages of GUI:

1. It is a wasteful of computer memory.


2. If the user wants direct communication, it is effectively more complex.

101
3) Batch processing and real time transaction processing:

Describe the main differences between batch processing and real time transaction
processing.

1) Batch processing:

All data is collected together before it is processed in one go only.


It does not require human intervention once processing has been started.
It does not need to up to date files immediately.
The system is not time sensitive.

i) Examples of the use of batch processing:

1. Processing of utility bills (e.g. gas, electricity and water).


2. Processing of cheques.

2) Real time transaction processing:

The individual transactions are processed as it occurs.


It requires immediate quick response from the user.
It keeps updating files immediately as more data is received.

i) Examples of the use of real time transaction processing:

1. Online booking of seats in a cinema.


2. Online booking of flights.

4) Real time transaction processing and real time process control:


Q1. A large cinema uses a computer system to control the air conditioning and also the day
to day running of the business (such as booking seats).
Using examples from the cinema application, explain the difference between real time
transaction processing and real time process control.

1) Real time transactions:

The individual transactions are processed as it occurs.


It keeps updating files immediately as more data is received.
Example: online booking of seats in cinema.

2) Real time processing:

The physical quantities are continuously monitored.


The inputs are compared with pre-set values and processed fast enough to affect output.
It uses sensors, ADC and DAC.
Example: temperature control in air conditioner.

102
5) What is handshaking?

It is used to describe the process of one computer establishing a connection with


another computer or a device.
The handshake is exchange of signals to verify the connection, speed and authorization of
the computer trying to connect to it.

Q1. State the term that means “exchange of signals between two devices to ensure
synchronization when communication starts”.

Handshaking.

6) Utility software:

Utility programs are part of the operating system of a computer.


They are routines which carry out important tasks which are necessary.
They are not application programs but still so important that the system cannot run
without them.
Examples of utility software’s are: disk formatter, file handlers, hardware drivers, file
compressors and etc.

7) File management:

The memory manager is responsible for the maintenance of primary memory.


The file manager is responsible for the maintenance of secondary storage (e.g. hard
disks).

i) The operating system is responsible for the following activities in connections with file
management:

1. File creation and deletion.


2. Directory creation and deletion.
3. Support for manipulating files and directories.
4. Mapping files onto secondary storage.
5. File backup on stable storage media.
6. Identify and locate a selected file.
7. Blocking for access to files.

103
8) Interrupts:

i) Describe the purpose of an interrupt in a computer system. (4)

It is a signal sent from a device or from software to the processor (that attention is
required).
It is used to attend to certain tasks/issues.
Interrupt causes the processor/OS to pause what it is doing, service the interrupt and then
continue with previous process.
Interrupts have different levels of priority depending upon the task.
It enables multi-tasking to be carried out on a computer.
Example: interrupts can occur when there is a paper jam in a printer, or a software error has
occurred etc.

9) Buffers:

Buffers are used in computers as small temporary memory area in RAM.


They are used to store data while it is being moved from one place to another.
These are essentials in modern computers since hardware device operate at much lower
speed than microprocessor.
Buffers are typically used when there is a difference between the rate at which data is
received and the rate at which it can be processed, or in the case that these rates are
variable.
They are used in a printer spooler or in online video streaming.

Q1. State the name for the area of memory used to store temporarily the data being sent to
the printer. (1)

Printer buffer.

104
10) What is meant by Von Neumann architecture?

In early years, computers were not able to store programs until 1945; John von Neumann
developed the idea of a stored-program computer, referred to as Von Neumann Architecture
concept.

He designed architecture for an electronic digital computer with subdivisions of a central


arithmetic part, a central control part, a memory to store both data and instructions, external
storage, and input and output mechanisms.

The Von Neumann architecture uses a single processor which follows a linear sequence of fetch
decode-execute. The processor has some special registers which are discrete memory locations
with special purposes attached.

Quite simply, his idea was to hold programs and data in a memory. Data would then move
between the memory unit and the processor.

i) Simplest diagram to demonstrate his architecture is given below:

11) Buses:

The data, address and control buses connect the processor, memory and I/O controllers.
They are used to connect together the internal components of the CPU and provide
pathway for transmitting data and instructions.
They essentially move data around the computer and send out control signals to ensure
everything is properly synchronized.

105
i) Type of buses with their descriptions:

1) Address bus:

It is a unidirectional bus (signals travel in one direction only).


It carries signals relating to addresses between the processor and the memory of the
next item to be fetched.

2) Data bus:

It is a bi-directional bus (data can travel in both directions).


It sends data between the processor, the memory unit and the input/output devices
that is currently being processed.

3) Control bus:

It is regarded as both unidirectional and bi-directional bus (due to internal connections


within the computer architecture).
It carries signals relating to the control and coordination of all activities within the
computer (e.g. read and write functions).

ii) A more detailed diagram to demonstrate Von Neumann architecture is given below:

106
i) Address:

An address is the location of where data can be found in a computer memory.


Each address in the memory is unique.
They are contained in the memory unit.

ii) Register:

It is simply a high-speed storage area within the computer.


Registers are used to temporarily hold data and instructions during processing.

12) Memory Unit:

The computer memory is made up of number of partitions; each consisting of an address


and its contents.
The address uniquely identifies each location in the memory and the content is the
binary value stored in each location.

i) Describe the following registers:

1) MAR:

The memory address register (MAR) is used to hold the memory address that contains
either the next piece of data or an instruction that is to be used.

2) MDR:

The memory data register (MDR) acts like a buffer and stores data and instructions that
are in use from the address stored in MAR.
It is used whenever anything is to go from the central processing unit to main memory,
or vice versa.

107
13) Processor:

The central processor contains the arithmetic-logic unit (also known as the arithmetic
unit) and the control unit.
The arithmetic-logic unit (ALU) is where data is processed.
This involves arithmetic and logical operations.
Arithmetic operations are those that add and subtract numbers, and so on.
Logical operations involve comparing binary patterns and making decisions.

14) Control Unit:

The control unit is used to manage the flow of data and interaction between the
components of the processor.
It fetches instructions from memory, decodes them and synchronizes the operations
before sending signals to other components of the computer telling them “what to do”.
It controls the operations of memory, processor and input/output.
The program counter and the current instruction registers are in the control unit.

Describe the following registers:

1) PC:

The program counter (PC) holds the address of the current or next instruction to be
fetched/processed/executed.
It also stores the number of processes that have been completed.
Sometimes the program counter is called the Sequence Control Register (SCR) as it
controls the sequence in which instructions are executed.

2) CIR:

The current instruction register (CIR) holds the current instruction that is to be
executed.

3) ALU:

The arithmetic-logic unit (ALU) is where data is processed. This involves arithmetic and
logical operations. Arithmetic operations are those that add and subtract numbers, and so
on. Logical operations involve comparing binary patterns and making decisions.
*More simply it can be stated that:* ALU is used to carry out calculations on data.

108
4) IAS:

The immediate access store (IAS) is used to hold data and instructions waiting to be
processed after they are loaded from the main memory.

5) ACC:

The accumulator (ACC) is used to temporarily hold data that is currently being used in
a calculation.
It is found in the arithmetic unit.

6) IR:

The index register (IR) is a microprocessor register used for modifying operand
addresses during the run of a program, typically for doing vector/array operations.
They are used for a special kind of indirect addressing where an immediate constant (i.e.
which is part of the instruction itself) is added to the contents of the index register to form
the address to the actual operand or data.

i) Detailed explanation of IR:

A CPU cannot do math on data registers, although it can do it indirectly with an index
register.
For example, to process your first name, a program move 300 to MAR and 0 to the index
register.
An indexed operation adds the index value to the MDR, retrieving the letter at location
300.
Next, the program increments the index by 1 and gets the next letter.
It repeats this process until it has moved the whole name.

The index register works with the data registers, allowing a program to process strings of data
efficiently. Moreover, it gives greater speed and convenience to address registers.

15) Input/Output:

It is used to allow interaction with the computer.

16) The fetch-execute cycle:

The processor firstly fetches some data and instructions from memory and stores them in
suitable registers.
Each instruction is then decoded before finally being executed.
This is known as the fetch-execute cycle.

109
The PC (program counter) contains the address of the next instruction to be fetched.

The address contained in the PC (program counter) is copied to the MAR (memory address
register) via the address bus.

The instruction is then copied from the memory location contained in the MAR (memory
address register) and is placed in the MDR (memory data register).

The entire instruction is then copied from the MDR (memory data register) and placed in the
CIR (current instruction register).

The value in the PC (program counter) is then incremented by 1 so that it points to the next
instruction to be fetched.

The address part of the instruction, if any, is placed in the MAR (memory address register).

The instruction is finally decoded and is then executed by sending out signals (via the control
bus) to various components of the computer system.

110
Q1. The seven stages in a von Neumann fetch-execute cycle are shown in the table below.
Put each stage in the correct sequence by writing the numbers 1 to 7 in the right hand
column. The first one has been done for you.

111
Answer:

112
17) READ and WRITE function of memory unit (MAR and MDR):

1) READ operation:

We will use the memory section shown below. Suppose we want to READ the contents of
memory location 1111 0001. We will use this address and its content:

Address Contents
1111 0000 0111 0010
1111 0001 0101 1011
1111 0010 1101 1101
1111 0011 0111 1011

1111 1100 1110 1010


1111 1101 1001 0101
1111 1110 1000 0010
1111 1111 0101 0101

The address of location 1111 0001 to be READ from is first WRITTEN into the MAR
(memory address register):

MAR 1 1 1 1 0 0 0 1
A read signal is sent to the computer memory using the control bus.
Then the contents of the memory location 1111 0001 are put into the MDR (memory data
register):

MDR 0 1 0 1 1 0 1 1
R

113
2) WRITE operation:

Again we will use the memory section given above. Suppose this time we want to show how
the value 1001 0101 was WRITTEN into memory location 1111 1101.
The data to be stored is first WRITTEN into MDR (memory data register):

MDR 1 0 0 1 0 1 0 1
R
This data has to be WRITTEN into memory location with the address 1111 1101; so this address is
now written into MAR:

MAR 1 1 1 1 1 1 0 1
Finally, a write signal is sent to the computer memory using the control bus and this value will
then be written into the correct memory location in the memory section.

i) Simple explanation from paper’s point of view:

The examiner will give you a table of memory section like the one above.
You’ll be asked to perform either READ or WRITE or maybe both operations.

ii) In the part of READ operation,

Examiner will tell you that the content of a memory location e.g. 1111 0000 is to be read
and then ask you to show contents of MAR and MDR during this read operation.
Two registers will be given to you, one for MAR and one for MDR.
Now you simply have to write the address which is to be read e.g. 1111 0000 in the MAR
register.
The content value given in the table at this address will be simply copied and written into
the MDR register.

iii) In the part of WRITE operation,

Examiner will tell you that the value e.g. 1100 1100 is to be written into memory location
e.g. 0011 1111 and then again ask you to show contents of MAR and MDR during this
write operation.
Two registers will be given to you, one for MAR and one for MDR.
Now you simply have to write the value (content) which is to be written e.g. 1100 1100 in
the MDR register.
The memory location in which this value is to be written e.g. 0011 1111 will be simply
written in MAR register.

114
iv) In the end,

The examiner may ask you to state or show any changes to the memory following the
read and write operations.
In this case, just look at the table of memory sections. Look at the two addresses used in
both parts of questions. If you find any address has the value of its content missing, just
state that value over there which was given to you in any of the both parts depending upon
which parts content value is missing.

115
Exam Style Questions:
Q1. To process an instruction, a central processing unit (CPU) goes through a cycle that has
three main stages.
Name each stage in this cycle. (3)

Stage 1 = Fetch
Stage 2 = Decode
Stage 3 = Execute

Q2. The Von Neumann model for a computer system has several components that are used
in the fetch-execute cycle. One component is main memory.
Describe what is meant by main memory and how it is used in the Von Neumann model for
a computer system. (3)

Main memory means the primary memory or RAM.


It is volatile memory.
It is used to hold data and instructions that are currently in use.
It is directly accessed by central processing unit (CPU).

Q3.

116
Answer:

Q4.

117
118
Answer:

119
May/June 2020 (12) Questions:

Q1.

Answer:

120
Q2.

Answer:

121

You might also like