Functions of an
OCR Operating
A Level System
Unit 2
Computer Science
Systems software and
H446 – Paper 1 applications generation
1
Objectives
• Understand the function and purpose of an
operating system
• Describe memory management (paging, segmentation
and virtual memory)
• Describe the role of interrupts and an Interrupt Service
Routine (ISR) within the fetch-decode-execute cycle
• Describe the need for processor scheduling algorithms
• Describe scheduling algorithms: round robin, first come
first served, multi-level feedback queues, shortest job
first and shortest remaining time
1. Describe what this illustration shows.
2. Does the user ever interact with the operating system?
User
Applications
Operating
System
Hardware
Functions of an Operating System
Unit 2 Systems software and applications generation
What is an Operating System?
• You need software to manage communication with
your computer hardware
• The boot loader in ROM loads the Operating System
(OS) into RAM when the computer is switched on
• The OS manages the hardware and provides an
interface for the user and the application software
Functions of an Operating System
Unit 2 Systems software and applications generation
What functions does the
OS provide?
• User interface
• Memory management
• Interrupt handling
• Processor scheduling
• Device management
• Handles Security
Operating systems – Systems software
The need for, function and purposes of operating systems
Parts of the OS
An operating system has a number of important roles which are shown in the diagram
The operating system has four main parts:
• The KERNAL
• The DEVICE DRIVERS
• The USER INTERFACE
• The SYSTEM UTILITIES
Functions of an Operating System
Unit 2 Systems software and applications generation
User interface
• The Operating System hides the complexity of the
hardware from the user by providing a user interface
• Other than a desktop computer, what devices might have an
operating system?
• What different types of OS user interface have you seen?
Functions of an Operating System
Unit 2 Systems software and applications generation
Different types of Interface
Operating systems – Systems software
Device Drivers
Device drivers are a core part of the operating system.
Every piece of hardware that communicates with the operating system will require a device driver, for
example:
internal: the hard disk, RAM, graphics card, sound card etc
external: printer, monitor, mouse, keyboard etc
• A device driver enables the operating system to control and communicate with the device.
• There could be hundreds of device drivers pre-installed with the operating system, and the right ones
for that particular computer set-up is loaded on boot-up.
• The exact detail of which device driver is needed by the operating system is kept in a file - in Windows,
the file is called the 'registry' and in Linux the details will be stored as a number of 'configuration files'.
• Makers of printers, graphics tablets, scanners, digital cameras and so on, will normally provide device
drivers for each make of operating system. A device driver for Windows is different from the device
driver for Linux.
• This is why if you remove an operating system such as Windows from a hard disk, and install Linux
instead, you will need to make sure you have all the correct device drivers available for each piece of
hardware.
Operating systems – Systems software
Utilities software
The operating system contains a number of system utilities, each of which have a
specific task to carry out.
This part of the operating system provides all the basic facilities that run in the
background without user interaction. For example:
• Print spool services
• Cryptographic password management.
• File management services
In addition to the system utilities that come with the operating system, you can
also install additional utility software. For example:
• anti-virus utility
• disk defragmenter utility
• file compression utility.
Functions of an Operating System
Unit 2 Systems software and applications generation
Memory management
• Programs and their data need to be loaded into RAM
• The Operating System must manage the allocation
of RAM to the different programs
• There may not be sufficient RAM for all desired
processes to be completely loaded into RAM at once
Functions of an Operating System
Unit 2 Systems software and applications generation
Paging
• Available memory is divided into fixed size chunks
called pages
• Each page has an address
• A process loaded into RAM is allocated sufficient
pages, but those pages may not be contiguous (next
to each other) in physical terms
Functions of an Operating System
Unit 2 Systems software and applications generation
Paging
1. Process A requires two pages in RAM, process B
requires three pages
Functions of an Operating System
Unit 2 Systems software and applications generation
Paging
2. Process A ends
Functions of an Operating System
Unit 2 Systems software and applications generation
Paging
3. Process C is started, but it needs three pages of
RAM so it is allocated non-contiguous pages
Functions of an Operating System
Unit 2 Systems software and applications generation
Page table
A page table maps between the logical memory
locations and the physical memory locations
Functions of an Operating System
Unit 2 Systems software and applications generation
Segmentation
• Alternatively, memory is divided into segments which can be of
different lengths
• Segments can relate to parts of a program, for example a
particular function or subroutine may occupy a segment
Functions of an Operating System
Unit 2 Systems software and applications generation
Virtual memory
• A computer has a fixed amount
of RAM; the demands for
memory will often exceed this
amount
• An area of the hard disk can be
designated as
virtual memory
• Some of the pages of a current
process are stored in virtual
memory until they are needed,
at which point they are
swapped into RAM
Functions of an Operating System
Unit 2 Systems software and applications generation
Virtual memory
• If many processes are running and the computer has
insufficient RAM, lots of time is spent swapping
pages in and out of virtual memory
• Repeatedly swapping pages can noticeably slow
down the computer
• This is known as disk thrashing
Functions of an Operating System
Unit 2 Systems software and applications generation
Visual Example
Functions of an Operating System
Unit 2 Systems software and applications generation
Interrupts
• It is vital that the CPU can be interrupted
when necessary
• Interrupts can be sent to the CPU by software,
hardware devices or the CPU’s internal clock
• Can you think of any reasons why processing might need to
be interrupted?
Functions of an Operating System
Unit 2 Systems software and applications generation
Interrupt examples
• An I/O device sends an interrupt signal
• The printer runs out of paper
• An error occurs in a program
• A scheduled interrupt from the internal clock
• Power failure
Functions of an Operating System
Unit 2 Systems software and applications generation
Interrupts
• The CPU checks at the end of each clock cycle
whether there are any interrupts to be processed
Functions of an Operating System
Unit 2 Systems software and applications generation
Interrupts – using the stack
• When an interrupt is detected, the processor stops
fetching instructions and instead pushes the current
contents of its registers onto a stack
Functions of an Operating System
Unit 2 Systems software and applications generation
Interrupts – using the stack
• The CPU uses an interrupt service routine to
process the interrupt
• When processing has finished, the values can be popped
from the stack and reloaded into the CPU
Functions of an Operating System
Unit 2 Systems software and applications generation
Interrupt priority
• Interrupts have different priorities, and will be
processed in order of priority
• Interrupts can themselves be interrupted if the new
interrupt is of a higher priority
Functions of an Operating System
Unit 2 Systems software and applications generation
Interrupt priority
• If a higher priority interrupt occurs whilst an interrupt
is being processed, the original interrupt’s registers
will be pushed onto the stack as well
Functions of an Operating System
Unit 2 Systems software and applications generation
Interrupt priority
• A stack is a LIFO data structure, so the last data to
be pushed on will be the first to be retrieved
Functions of an Operating System
Unit 2 Systems software and applications generation
Functions of an Operating System
Unit 2 Systems software and applications generation
Processor scheduling
• A single CPU can only process instructions for one
application at a time
• The Operating System must schedule when each
application can use the CPU
• This gives the illusion of multi-tasking – multiple
applications appear to be running simultaneously
Functions of an Operating System
Unit 2 Systems software and applications generation
Aims of scheduling
• To provide an acceptable response time to all users
• To maximise the time the CPU is usefully engaged
• To ensure fairness on a multi-user system
https://www.youtube.com/watch?v=8krglDppRhM&ab_channel=Craig%27n%27Dave
Functions of an Operating System
Unit 2 Systems software and applications generation
Round Robin
• Each job is allocated (by FIFO) a time slice during
which it can use the CPU’s resources
• How does the scheduler know when to switch between
time slices?
• If the job has not completed by the end of its time
slice, the next job is allocated a time slice
Functions of an Operating System
Unit 2 Systems software and applications generation
First come first served
• The first job to arrive is executed until it completes
• What do you think the drawbacks of this system might be?
Functions of an Operating System
Unit 2 Systems software and applications generation
Shortest remaining time
• Pre-emptive
• The time to completion is estimated as each new
job arrives
• The job with the shortest remaining time to
completion is executed, meaning that a shorter new
job can take over from the current process
• Why does this algorithm not constantly switch between two
jobs as they become closer to completion?
• What do you think ‘starvation’ is, and why might it occur if this
algorithm is used to schedule processor time?
Functions of an Operating System
Unit 2 Systems software and applications generation
Shortest job first
• Also known as “shortest process next”
• As with shortest remaining time, the total execution
time of each job is estimated by the user
• The waiting job with the smallest total execution time
is executed when the current job completes
• Unlike shortest remaining time, this algorithm is not pre-
emptive. What do you think this means?
Functions of an Operating System
Unit 2 Systems software and applications generation
Multi level feedback queues
• Multiple queues are created with different
priority levels
• If a job uses too much CPU time it is moved to a
lower priority queue
• Processes can also be moved to a higher priority
queue if they have waited a long time
Functions of an Operating System
Unit 2 Systems software and applications generation
Plenary
• The Operating System (OS) manages memory
allocation, CPU time and provides an interface
• Memory can be allocated in pages
• Virtual memory allows pages to be swapped in and
out of RAM as they are needed
• The CPU processes jobs according to a
scheduling algorithm
• The CPU can be interrupted if a job with a
higher priority arrives
Functions of an Operating System
Unit 2 Systems software and applications generation
PLENARY
1. Describe five purposes of operating systems (5 marks)
2. Describe how the operating system uses device drivers (2 marks)
3. An airport terminal has a menu interface installed.
a) Other than menu interfaces, give two examples of types of user interface (2 marks)
b) Give two advantages of menu user interfaces (2 marks)
4. Operating systems include many utility programs
a) State the difference between utility programs and application software (1 mark)
b) Give three examples of utility programs that a student might encounter while creating
coursework for school, including their purpose (3 marks)