16. System Software and Virtual Machines
1. Purposes of an Operating System
he OS is responsible for managing the computer's hardware efficiently to ensure the system runs
T
smoothly - this is known as resource management and is vital for:
● Maximising performance
● Reducing bottlenecks
● Ensuring multitasking works correctly
Start-up and system loading
● When a computer is switched on, the Basic Input/Output System (BIOS) (often stored in ROM)
starts a bootstrap program
● The bootstrap program loads part of the OS (the kernel and other essential parts of the OS) from
the hard disk/SSD into main memory (RAM)
● On mobile devices (smartphones/tablets):
○ Start-up is nearly instantaneous because they use flash memory
○ Flash memory is typically split into two parts: a read-only section where the OS resides,
and a section where apps/user data are stored
The kernel is the core of the OS, responsible for managing:
● Process management - schedules processes, allocates CPU time, handles multitasking, to allow
for better utilisation of CPU time/resources
● Memory management - dynamically allocates RAM to processes, handles virtual memory,
prevents clashes, in the most optimum manner
● Device management - controls I/O devices using device drivers
● Interrupt handling - deals with interrupts from hardware (e.g. DMA controller or I/O devices)
● File management - handles reading/writing from files and file systems
Direct Memory Access (DMA):
● The DMA controller allows hardware to access main memory independently of the CPU
● This is essential because I/O devices are much slower than the CPU
● Steps:
○ The DMA initiates the data transfer
○ This frees up the CPU to carry out other tasks while slower I/O operations take place
○ Once data transfer is complete, the DMA sends an interrupt signal to the CPU
he role of an operating system e.g. Windows, Linux, ChromeOS, iOS, is to manage the hardware
T
(resources), whilst hiding the complexities of the hardware from the user, by providing a user interface -
it forms a bridge between the physical hardware of a computer and the user or application software
The OS hides hardware complexity from the user through methods such as:
● Provision of a Graphical User Interface (GUI) rather than Command Line Interface (CLI) to allow
the user to interact using pictures/icons, and control devices by ‘pointing and clicking’, which is
more intuitive, avoiding the need for complex commands involving memory locations/buses
● Use of device drivers - handle communication with and make it easier to control peripherals e.g.
printers, within the operating system of the computer rather than on the separate device itself
● Device mapping - different devices (physical and virtual) are easy to identify on the network,
check their status, or use
● The user interacts only with the Application layer (of the TCP/IP protocol suite), leaving the
lower layers and their complexities hidden from the user
, Multitasking:
● Multi-tasking allows computers to carry out (seem to carry out) more than one process at a time
● The OS monitors the state of each process, using scheduling to determine which order to execute
processes in, and ensure hardware resources shared/used efficiently, without processes clashing
● This benefits process management by allowing more tasks to complete than would be the case if
they had to run one task after another (without multitasking)
Process:
● A process is a program in execution
● Each running application is treated as a separate process by the OS
● A process does not always run continuously, and can change state
Process Control Block (PCB):
● Data structure created in memory that holds all the data needed for a process to run
● The PCB will store:
○ current process state (ready, running or blocked)
○ process privileges (such as which resources it is allowed to access)
○ register values (PC, MAR, MDR and ACC)
○ process priority and any scheduling information
○ the amount of CPU time the process will need to complete (burst time)
○ a process ID which allows it to be uniquely identified
Process states:
● Running - CPU time has been allocated and the process is currently being executed
● Ready - the process is ready to execute (it could otherwise run), but is waiting (in the ready
queue) for a slice of CPU time by a higher priority process
● Blocked - process waiting for an external event/resource (usually I/O operation) to be completed
Process scheduling routines:
● Process scheduling is required to ensure that all processes are executed in a timely manner
● Enables multitasking/multiprogramming/multiprocessing
● Minimises CPU idle time
● Ensures fair access to resources for processes - no process is starved of resources
● Ensures jobs/processes are completed in order of priority
urnaround time = Completion time - arrival time
T
Waiting Time = Turnaround time - burst time
First come first served scheduling (FCFS):
● Adds processes to the back of the ready queue as they arrive
● Executes processes in the order they arrive in
● Non-pre-emptive - once resources have been allocated/the process has begun executing, it will
continue until complete or put in a waiting state once
● Benefits:
○ Ensures starvation of any processes does not occur
○ Simple and easy to understand (no need to know burst times of processes in advance)
○ Fair in the sense that processes are served in the order they arrive
● Drawbacks:
○ This can lead to poor performance if a long process arrives before shorter processes,
which then get stuck behind the long process for ages
○ High-priority tasks have to wait for their turn in the queue
1. Purposes of an Operating System
he OS is responsible for managing the computer's hardware efficiently to ensure the system runs
T
smoothly - this is known as resource management and is vital for:
● Maximising performance
● Reducing bottlenecks
● Ensuring multitasking works correctly
Start-up and system loading
● When a computer is switched on, the Basic Input/Output System (BIOS) (often stored in ROM)
starts a bootstrap program
● The bootstrap program loads part of the OS (the kernel and other essential parts of the OS) from
the hard disk/SSD into main memory (RAM)
● On mobile devices (smartphones/tablets):
○ Start-up is nearly instantaneous because they use flash memory
○ Flash memory is typically split into two parts: a read-only section where the OS resides,
and a section where apps/user data are stored
The kernel is the core of the OS, responsible for managing:
● Process management - schedules processes, allocates CPU time, handles multitasking, to allow
for better utilisation of CPU time/resources
● Memory management - dynamically allocates RAM to processes, handles virtual memory,
prevents clashes, in the most optimum manner
● Device management - controls I/O devices using device drivers
● Interrupt handling - deals with interrupts from hardware (e.g. DMA controller or I/O devices)
● File management - handles reading/writing from files and file systems
Direct Memory Access (DMA):
● The DMA controller allows hardware to access main memory independently of the CPU
● This is essential because I/O devices are much slower than the CPU
● Steps:
○ The DMA initiates the data transfer
○ This frees up the CPU to carry out other tasks while slower I/O operations take place
○ Once data transfer is complete, the DMA sends an interrupt signal to the CPU
he role of an operating system e.g. Windows, Linux, ChromeOS, iOS, is to manage the hardware
T
(resources), whilst hiding the complexities of the hardware from the user, by providing a user interface -
it forms a bridge between the physical hardware of a computer and the user or application software
The OS hides hardware complexity from the user through methods such as:
● Provision of a Graphical User Interface (GUI) rather than Command Line Interface (CLI) to allow
the user to interact using pictures/icons, and control devices by ‘pointing and clicking’, which is
more intuitive, avoiding the need for complex commands involving memory locations/buses
● Use of device drivers - handle communication with and make it easier to control peripherals e.g.
printers, within the operating system of the computer rather than on the separate device itself
● Device mapping - different devices (physical and virtual) are easy to identify on the network,
check their status, or use
● The user interacts only with the Application layer (of the TCP/IP protocol suite), leaving the
lower layers and their complexities hidden from the user
, Multitasking:
● Multi-tasking allows computers to carry out (seem to carry out) more than one process at a time
● The OS monitors the state of each process, using scheduling to determine which order to execute
processes in, and ensure hardware resources shared/used efficiently, without processes clashing
● This benefits process management by allowing more tasks to complete than would be the case if
they had to run one task after another (without multitasking)
Process:
● A process is a program in execution
● Each running application is treated as a separate process by the OS
● A process does not always run continuously, and can change state
Process Control Block (PCB):
● Data structure created in memory that holds all the data needed for a process to run
● The PCB will store:
○ current process state (ready, running or blocked)
○ process privileges (such as which resources it is allowed to access)
○ register values (PC, MAR, MDR and ACC)
○ process priority and any scheduling information
○ the amount of CPU time the process will need to complete (burst time)
○ a process ID which allows it to be uniquely identified
Process states:
● Running - CPU time has been allocated and the process is currently being executed
● Ready - the process is ready to execute (it could otherwise run), but is waiting (in the ready
queue) for a slice of CPU time by a higher priority process
● Blocked - process waiting for an external event/resource (usually I/O operation) to be completed
Process scheduling routines:
● Process scheduling is required to ensure that all processes are executed in a timely manner
● Enables multitasking/multiprogramming/multiprocessing
● Minimises CPU idle time
● Ensures fair access to resources for processes - no process is starved of resources
● Ensures jobs/processes are completed in order of priority
urnaround time = Completion time - arrival time
T
Waiting Time = Turnaround time - burst time
First come first served scheduling (FCFS):
● Adds processes to the back of the ready queue as they arrive
● Executes processes in the order they arrive in
● Non-pre-emptive - once resources have been allocated/the process has begun executing, it will
continue until complete or put in a waiting state once
● Benefits:
○ Ensures starvation of any processes does not occur
○ Simple and easy to understand (no need to know burst times of processes in advance)
○ Fair in the sense that processes are served in the order they arrive
● Drawbacks:
○ This can lead to poor performance if a long process arrives before shorter processes,
which then get stuck behind the long process for ages
○ High-priority tasks have to wait for their turn in the queue