Chapter 7 - Functions of an operating system Flashcards
OS
- manages the hardware and provides an interface for the user and the application software
- boot loader in ROM loads OS into RAM when power is on
Functions - Memory management
- Manages allocation of RAM to different programs (or virtual RAM if RAM fills up)
- benefits - better security (doesn’t let programs access memory reserved for other programs); multitasking (allows multiple programs to run at once)
Memory management - Paging and segmentation
Paging:
- available memory divided into fixed-size chunks (4KB) with an address
- each program is allocated sufficient pages, but they might not always be next to each other (contiguous), which slows down access
- page table uses mapping to store link between physical memory address and logical address spaces
(or) Segmentation:
- Memory is divided into segments of different lengths, so programs will be allocated the exact length they need
Functions - Interrupts
- Can be sent to CPU by software, hardware or clock to carry out a more important task
- CPU checks at the end of each clock cycle whether there are interrupts to be processed
- State of CPU needs to be stored to resume the cycle once interrupt is taken care of:
1. Processor stops fetching instructions
2. Pushes current contents of registers onto a stack (a data structure with last in, first out order)
Interrupt priority – if another interrupt with a higher priority comes up during an interrupt, the state of the registers during the previous interrupt are pushed onto the stack and the newer interrupt is taken care of
Functions - Processor scheduling
- OS schedules when each app can use the CPU, giving the illusion of multi-tasking (multiple apps running at the same time)
- Aims of scheduling: Provide an acceptable response time to all tasks; Maximise CPU time when fully engaged; Ensure fairness in allocating time to each task
Scheduling algorithms - Round robin
FIFO (first in first out), each job allocated time slice for CPU time, if job is not complete by the end of its time slice, next job is allocated a time slice
Scheduling algorithms - First come first served
First job to arrive is executed until it is completed, unless if something has a higher priority
Scheduling algorithms - Shortest time remaining
Give priority to task which closest to finishing (estimated when task arrives), problem is that a long task might be starved of CPU time
Scheduling algorithms - Shortest job first
Total execution time estimated and shortest execution time job completed first because other tasks are waiting for less time
Scheduling algorithms - Multi-level feedback queues
- aim: maximise processor use, so gives preference to short jobs; gives preference to I/O bound processes; separates processes into categories based on processor time
- jobs move between queues depending on how much processor time they use
- I/O processes are slow so they are kept running all the time to prevent bottlenecks
Functions - Backing store management
- files/apps are transferred from backing storage into memory when loaded
- file management system: OS keeps track of where files are stored, which areas of storage are free so they can be easily accessed/allocated space in RAM
Functions - Peripheral management
Printing:
1. OS checks if printer is switched on and online
2. checks if it is a printer (and not a keyboard for e.g.)
3. transfers data to be printed
4. data held at buffer as it waits to be printed