what is os
operating system:
-boot loader from ROM loads OS into RAM
-manages hardware and provide interface and application software
the need of os
provide interface
control access
control hardware(peripheral management)
act as a platform which application can be run
function of os
-UI
-memory management
-interrupt handling
-processor scheduling
memory management
paging and segmentation
-os needs to manage the allocation of main memory (RAM) for the programs
paging
memory split into fixed size
-pages are memory divided into fixed size chunks
-each page have an address
-pages can be used by programs and processes
-page table maps the logical memory location and physical memory location
disadvantage: takes no account of how it splits the program-> pages will not be contiguous in physical terms
segmentation
memory split into different lengths
-segments are memory divided into different lengths
-could store a part of program (e.g. particular function/subroutine)
virtual memory
when some of the pages currently open but not actively in used are temporarily swapped and allocated into secondary storage
problem: disk thrashing
-> as main memory fills up and pages are constantly swapping with virtual memory→ computer gets slower
interrupts
sending a signal to the cpu to raise awareness
examples:
-I/O devices sends interrupt signal
-printer out of paper
-error in program
-power failure
-scheduled interrupt(e.g. updates)
role of ISR
mini program to repsond to interrupt request
role of interrupt and ISR within FDE cycle
interrupts are checked at the end of each clock cycle
ISR kicks in if needed
- pushing current contents of its registers into a stack
- popped from stack and reloaded into CPU once interrupt process is finished
purpose of processor scheduling
-one cpu process instruction for one application at a time
-os need to schedule when application to use cpu
- illusion of multi-tasking/ applications running simultaneously
aim of processor scheduling
process of scheduling
scheduling algorithm
round robin
FCFS
SJF
STR
multi-level feedback queue
round robin (RR)
first come first served
shortest time remaining
shortest job first
multi-level feedback queue
advantage: allows flexibility
disadvantage: complex and abstract
suitability: when system has more than one processor/processor core, that can handle more than one process queue at a time
types of os
distributed
embedded
multi-user
multi-tasking
real time
distributed os
using the processing power of multiple computers across a network for one single task
embedded os
multi-tasking os
multi-user os
handle request of multiple people using different computers on a network at the same time