a collection of programs that work together to provide an interface between the user and the computer
enable user to communicate with computer and perform certain low-level tasks
essential in devices like laptops, phones and consoles
Operating Systems - Desktop Examples
windows
macOS
Operating Systems - phone examples
iOS
android
Operating Systems - Features
memory management
resource management
file management
input/output management
interrupt management
utility software
security
user interface
Memory Management - Examples
paging
segmentation
virtual memory
Resource Management - Examples
scheduling
File Management - Examples
moving
editing
deleting files
folders
Input/Output Management - Examples
device drivers
Utility Software - Examples
disk defragmenter
backup
formatting
Security - Examples
firewall
Memory Management
computer memory needs to be shared fairly between programs and applications
main memory is often not large enough to store all programs being used
OS must determine and allocate length of processor time each task receives via paging, segmentation and virtual memory
Paging
when memory is split into equal sized sections (pages) with programs made up of a number of equally sized pages
these pages can be swapped between main memory and hard disk as needed
Segmentation
splitting up memory into logically sized divisions (segments) which vary in size
these represent the structure and logical flow of the program
segments are allocated to blocks of code like conditional statements or loops
Virtual Memory
uses section of the hard drive to act as a RAM when there isn't enough space in main memory to store programs being used
sections of program not in use are temporarily moved to virtual memory through paging, freeing up memory for other programs in RAM
Disk Thrashing
when computer 'freezes' as a result of pages being swapped too much between hard disk and main memory
due to this, more time is spent transferring pages between main memory and hard disk than spent running program
issue gets worse as virtual memory fills up
Interrupts
signals generated by software/hardware to indicate to processor that a process needs attention
different types have different priorities and how urgent they are needs to be taken into account by OS when allocating processor time
interrupts are stored in order of priority in abstract data structure - priority queue in interrupt register
Interrupts - Examples
printer signaling a completed print
peripheral signaling power failure
Interrupt Service Routine (ISR)
processor checks contents of interrupt register at end of each FDE cycle
if interrupt exists that's higher priority than process being executed, current contents of special purpose registers in CPU are temporarily transferred to stack
processor responds to interrupt by loading appropriate ISR into RAM
a flag is set to signal the ISR has begun, once serviced, the flag resets
Scheduling - Algorithm Types
pre-emptive
non pre-emptive
Pre-Emptive
jobs are actively made to start and stop by OS
Pre-Emptive - Examples
Multilevel Feedback Queues
Shortest Remaining Time
Round Robin
Non Pre-Emptive
once job is started, it's left alone until it is completed
Non Pre-Emptive - Examples
First Come First Served (FCFS)
Shortest Job First
Round Robin
each job is given a section of processor time (time slice) that it can execute in
when each job in queue has used its first time slice, OS repeats process until a job has been completed, at which point it's removed from queue
Round Robin - Disadvantages
while it ensures each job is seen to, longer jobs take much longer for completion as execution is inefficiently split into multiple cycles
algorithm doesn't account for job priority
First Come First Served (FCFS)
jobs are processed in chronological order by when they entered the queue
straightforward to implement
does not account for job priority
Multilevel Feedback Queues
uses multiple queues, each ordered based on a different priority
this can be difficult to implement due to deciding which job to prioritise based on a combination of priorities
Shortest Job First
queue storing jobs is ordered according to time required for completion, with longest jobs serviced at the end
most suited to batch systems
requires processor to know/calculate how long each job will take which isn't always possible
there's also a risk of processor starvation if short jobs continue being added to job queue
Shortest Remaining Time
queue storing jobs is ordered according to time left for completion
jobs with least time to completion are serviced first
risk of processor starvation for longer jobs if short jobs are added to job queue
OS - Types
distributed
embedded
multi-tasking
real time
Distributed OS
runs across multiple devices
allows load to be spread across multiple computer processors when task is run
Embedded OS
built to perform small range of specific tasks
catered to a specific device
limited functionality
hard to update
consume significantly less power than other OS
Multi-Tasking OS
let user carry out tasks almost simultaneously
uses time slicing to switch quickly between programs and applications in memory
Multi-User
multiple users make use of one computer (usually a supercomputer) in a multi-user system
scheduling algorithm must be used to ensure processor time is split fairly between jobs
without suitable scheduling algorithm, it risks processor starvation
Real Time
often used in time-critical computer systems
designed to perform task in guaranteed time frame
used in any situation where a response in a certain time period is crucial to safety
Processor Starvation
when a process is not given enough processor time to execute and complete
Basic Input Output System (BIOS)
first program to run when computer is turned on
program counter (PC) register points to location of BIOS at each start up
BIOS is responsible for running various key tests before OS is loaded to memory
critical to system as only after checks are completed can OS be loaded to RAM from hard disk
BIOS - Checks
Power-on Self Test (POST) - ensures all hardware is connected and functional
checking CPU clock, memory and processor is operational
test for external memory devices connected to computer
Device Drivers
programs provided by OS and let OS interact with hardware
when hardware is used, it's the device driver that communicates the request to OS which produces relevant output
device drivers are specific to computer's architecture, so different drivers need to be used for different device types
as they interact with the OS, the drivers are also specific to the OS on the device
Virtual Machine
theoretical computer
a software implementation of a computer system
provides an environment with a translator for intermediate code to run