1.2.1 Operating Systems Flashcards
Purpose of operating system and features (6)
Allows the user to interact with hardware through applications - provides interface between user and computer hardware.
- Essential for managing hardware
- Systems Software
Provides:
- User interface (CLI and GUI)
- Peripheral management (input/output devices with drivers) (manages connected hardware)
- Provides utility software (backup, encryption etc)
- Provides security (firewall and managing usernames and passwords)
- Memory management (paging, segmentation and virtual memory)
- File Management (moving, editing, deleting and folders)
Kernel
Heart of the Operating system - looks after most low level hardware operations - Applications use kernel to operate computer hardware.
Types of operating systems (5)
Multi-tasking
● Runs multiple programs at the same time
- By co-coordinating and allocating time slices to each program then switching quickly between programs.
Multi-user - used in schools
● Allows multiple users to access operating system at the same time.
- Manages passwords and access levels
- Risk of starvation if scheduling algorithm not used
Real Time - used in safety critical systems to respond instantly to changes.
● Gives response in a guaranteed very fast time frame
- Uninterrupted
Distributed
● Allows multiple computers to work together on a single task.
- Combines processing power - work on diff parts simultaneously (Parallel processing)
Embedded
● Has a dedicated/limited function and efficiently carries out dedicated function
- Specific to the hardware and built into another device
● Is read-only / cannot be changed as stored in ROM as fixed instructions that don’t need to be changed.
- Instructions often coded in low level languages
Memory Management
Memory Management :
- Allocation and deallocation of memory to programs.
- Protects data from each other for security - doesn’t let programs access memory reserved for other programs.
- Ensures RAM is used efficiently and not wasted.
- Multi - tasking - Efficient Memory Management allows multiple programs to be run at once and more smoothly.
Involves :
- Paging
- Segmentation
- Use of virtual memory
Paging
Splitting up memory is needed to store data in memory when there is not enough continuous main memory space available - can fit around programs without moving them around.
Paging : Physical divisions of memory into Fixed sizes.
- Allows for the use of virtual memory - transferred as pages
- Paging more effective because any free memory space can be used to swap data in and out
- Doesn’t take into account how programs are split - may separate in looping condition - inefficient as better to keep that data together in memory
- Paging causes internal fragmentation whereas (not all fixed size block allocated is used up so some memory is wasted)
Virtual memory
Virtual memory : designated part of secondary storage
- Virtual memory used when RAM is almost full to enable applications to continue to run - more programs can run than RAM available allows.
- Programs not currently in use transferred as pages to virtual memory to free up space for other programs
- Must be transferred back to RAM to be run - slower - excess results in disc thrashing (pages swapped too frequently between RAM and virtual memory)
- Secondary storage cheaper than RAM - useful
Interrupt process
Complete current FDE cycle
Check priority of incoming interrupt
If not higher then continue current program instructions
Else if its higher priority than current task
As ISR Halts / Suspends current process the contents of registers are pushed onto a stack in memory.
Relevant ISR loaded, by loading relevant value into PC that points to ISR
Interrupts can be interrupted / Suspended by higher priority interrupts
When ISR is complete, the previous state is returned through popping from the stack and loading values back into the registers to resume previous process.
What are Interrupts / ISR
Interrupts are the signals that devices and applications use to indicate to the processor that they need attention - have a higher priority so stops current task.
E.g. turning computer off or inputs (can be software or hardware)
Interrupt service routine is a special function that handles a particular interrupt type
- Each interrupt has a corresponding routine that should be concise and efficient.
Scheduling
Scheduling : controls how processors time is allocated (allocates time slices to programs)
- Ensures all programs receive fair amount of processing time
- Ensures CPU time is managed effectively and reduce wait times
- Prevents processes from failing to run
- Processes as many jobs as possible
Scheduling algorithms (RR, FCFS, MLFQ)
Round Robin : Processor time divided equally between all tasks
- Processes get time slice - once time up process suspends until next allocation of processor time,
- uses queue - new processes added to back of queue and once time slice runs out processes are moved to back of queue.
- allows for multitasking where switch between active and background processes.
Advantages: Tasks receive processor time without long wait
Disadvantages: Doesn’t work well with programs that require long amounts of time - inefficiently split up.
First come, First served : Processes run to completion in order processor receives requests to run - uses queue
Advantages: Simplest to implement
Disadvantages: Can be long wait time for short processes delayed by long ones
Multi-level Feedback Queue: Uses multiple queues that are ordered based on priority
- Tasks are moved between queues
- Processor processes from highest priority queue first.
Advantages: Higher priority processes processed first
Disadvantages: Harder to implement
Scheduling algorithms (SJF, SRTF)
Shortest Job First : Uses queue that orders tasks from shortest time to complete to longest time (non-preemptive)
Advantages: Minimizes wait time and many processes executed quickly.
Disadvantages: Risk of starvation (when a process does not receive enough processor time to execute to completion) of longer programs if short jobs keep getting added
Shortest Remaining Time First : Uses queue that orders tasks from shortest time left to complete to longest - if task with less time left comes in it will take priority over current task. (preemptive version of SJF)
Advantages: Minimizes wait time
Disadvantages: Risk of starvation of longer programs if short jobs keep getting added
Drivers
Driver : Program that allows the operating system to communicate with hardware providing an interface between device and operating system.
- Allows OS to Control and interact with devices
- Uses low level language.
e.g. Printer Drivers
All peripherals use drivers that’re specific to computer’s architecture and are updated regularly for fast communication
BIOS
Basic input output system : First program run when computer switched on stored in ROM
- Runs POST which checks all hardware is connected and working properly
- Runs Bootstrap that loads OS from hard disc to main memory
Virtual Machine - Emulating OS
Virtual Machine : Software implementation of a computer - can imitate other computer systems to test programs on different OS from one machine.
- More processing power required - have to run own OS and VM
+ saves time and money to purchase other hardware to test
Virtual Machines - Translate Intermediate code
Virtual machines can be used to translate intermediate code on device
Intermediate code : code that is independent of the processor architecture and halfway between object and source code
+ saves time to code and makes code more portable
- need VM on device to translate (Java virtual machine) and code takes longer to run