Operating system definition
Special type of system software that provides an interface between the user and the computer
Functions of the OS
Memory management
Resource management
Interrupt handling
I/O management
Utility software
Security
User Interface
Memory management purpose
Deal with allocation and deallocation of memory (finite resource)
3 methods of memory management
Paging
Segmentation
Virtual Memory
Paging
Splitting memory into equal sized chunks
- Fixed size
- Physical divisions of data
Advantages of paging
Works well with virtual memory
Disadvantages of paging
Internal fragmentation leads to wasted space
Non-contiguous storage
Segmentation
Splitting memory into variable sized chunks
- Variable size
- Logical divisions of data
Segmentation advantages
Contiguous storage
Segmentation disadvantages
Doesn’t work well with virtual memory
External fragmentation wastes space
Virtual memory
The CPU uses a section of secondary storage when RAM is insufficient
- Sections of programs not currently in use get moved to virtual memory
Virtual memory advantages
Allows continued function when RAM is full
Cheaper than getting more RAM
Virtual memory disadvantages
Much slower access times than RAM
Disk thrashing - too much time wasted swapping data/instructions
Resource management
Deciding which tasks to process, for how long and in what order - done using scheduling algorithms
Objective of scheduling
Maximising throughput and giving each task a fair amount of processing time
Preemptive algorithm
Allocates the CPU for given time slice
Allows for interruption of processes
Non-preemptive
Allocates the CPU to a process which has control until completed/waiting
No interruptions allowed
Examples of preemptive algorithms
Multi-level feedback queues
Shortest remaining time
Round robin
Examples of non-preemptive algorithms
First come first served, shortest job first
Three states of a process
Running - has control of CPU
Ready-to-run - in queue waiting for time slice
Blocked - waiting for I/O operation
Round robin description
Equally distributes processor time among all processes
FCFS description
The process being worked on will have control of CPU until it completes or switches to waiting
Multi level feedback queues description
Shorter and more critical tasks are processed first. Multiples queues used so tasks of equal size are grouped together
Shortest job first
Processes continually sorted in queue so shorter jobs are at the front