1. 2. 1 Systems Software Flashcards
Operating Systems
- Term refers to collection of programs, work together to provide interface between user and computer
- OS allows user to communicate with PC, perform low level tasks involving management of PC memory and resources
- Desktop OS (Windows, macOS), Mobile OS (iOS, Android)
Features provided by the operating system
- Memory management (Paging, Segmentation, Virtual memory)
- Resource management (Scheduling)
- File management (Moving, Editing, Deleting files and folders)
- Input/Output management (Device Drivers)
- Interrupt management
- Utility software (Disk Defrag, Backup, Formatting, Encryption, Anti-Virus)
- Security (Firewall)
- User interface
Memory Management
- Memory (RAM) must be shared fairly between programs and applications in use
- Role of OS to determine and allocate processor time that each task receives
- This is done through paging, segmentation and the use of virtual memory
Paging
- Memory split up into equal-sized sections (pages)
- Programs made up of certain number of pages
- Can be swapped between RAM and HDD if needed
Segmentation
- Memory split into logical sized divisions (segments)
- Segments vary in size, representative of structure and logical flow of program
- Segments allocated to blocks of code such as conditional statements or loops
Virtual Memory
- Section of HDD, acts as RAM when RAM has insufficient space to store programs being used
- Sections of program not currently in use, temporarily moved to virtual memory through paging
- Frees up memory for other programs in RAM
Disk Thrashing
- Issue with using Paging, Segmentation and Virtual memory, disk thrashing
- Computer “freezes”, result of pages being swapped too frequently between RAM and Virtual memory
- More time spent transferring pages between two then running program
- Issue progressively worse as virtual memory filled up more
- Solution is more RAM
Interrupts
- Signals generated by software or hardware, indicate to processor that process needs attention
- Different types of interrupts, different priorities (level of urgency)
- Needs to be considered by OS when allocating processor time
- Interrupts stored in order of priority in priority queue (abstract data structure)
- Priority queue stored in a special register known as the interrupt register
- Job of OS ensure interrupts serviced fairly, done using Interrupt Service Routine (ISR)
- An Interrupt Service Routine is a program that handles processor interrupts
- Examples of interrupts, Printer signalling completion of print job, peripheral signalling power failure
Interrupt Service Routine
- Processor checks contents of interrupt register at end of each fetch-execute cycle
- If interrupt exists, higher priority than current process being executed
- Content of registers transferred to stack
- Processor responds to interrupt by loading appropriate ISR into RAM
- Flag set to signal ISR begun
- Once interrupt serviced, flag reset, interrupt queue checked for further interrupts (higher priority than current process originally being executed)
- If more interrupts to be serviced, process above repeats till all priority interrupts serviced
- If no more interrupts or lower priority, contents stack transferred back to registers
- Fetch-execute cycle resumes as before
Scheduling
- OS ensures all sections of programs being run (known as “jobs”) receive fair amount of processing time
- Scheduling algorithms implemented to do so, can be either pre-emptive or non-pre-emptive
- Pre-emptive, jobs made to start and stop by OS (Multilevel Feedback Queues, Shortest Remaining Time, Round Robin)
- Non-pre-emptive, job starts left alone till completion (First Come First Served, Shortest Job First)
- Scheduling algorithm used is dependent on the task
Round robin
- Each job given section of processor time (time slice), within which it is allowed to execute
- Once each job used first time slice, OS grants each job another equal slice of processor time
- Continues till job has completed, removed from the queue
- Longer jobs take longer time for coemption, execution inefficiently split up
- Algorithm does not take into account job priority
First come first served
Jobs processed in order of arrival, straightforward to implement, does not take priority into account
Multilevel feedback queues
- Multiple queues, ordered based on priority, difficult to implement
- Hard to decide which job to prioritise based on combo of priorities
Shortest job first
- Queue ordered according to time required for completion, longest job serviced last
- Suited to batch systems, shorter jobs given preference to minimise waiting time
- Requires processor to calculate how long each job takes, not always possible
- Risk of processor starvation if short jobs continue to be added to job queue
- Processor starvation is when a process does not receive enough processor time in order to execute and be completed
Shortest remaining time
- Queue ordered according to time left for completion, jobs with least time to completion serviced first
- Risk of processor starvation for longer jobs
- Does not take priority into account
Types of Operating Systems
We look at 5 types of OS, Distributed, Embedded, Multi-tasking, Multi User and Real Time OS
Distributed OS
OS run across multiple devices, allows the load to be spread across multiple computer processors when completing a task. Makes computers join together via network connections to work as a whole.
Embedded OS
Performs small range of specific tasks, catered towards specific device (Washing machine), limited functionality, hard to update, consumes significantly less power than other types of OS.
Multi-tasking OS
Enables user to carry out tasks seemingly simultaneously. Done by using time slicing, switch between programs and applications in memory.
Multi-user OS
Multiple users, log in from different locations/machines same time, designed for sharing of resources such as files, programs or hardware (printers, scanners etc).
Real Time OS
Used in time critical computer systems, designed to perform task within a guaranteed time frame, used in any situation where response crucial within certain time period for safety (Patients vital readings in hospital)
BIOS
- Basic Input Output system, first program that runs when PC turned on
- Program Counter points to location of BIOS upon start up
- BIOS responsible for running various key tasks before OS loaded into memory
- Runs POST (Power-on self-test), ensures all hardware correctly connected and functional
- Checks CPU clock, memory and processor is operational
- Tests for external memory devices connected to computer
- After checks OS can be loaded into RAM from HDD by bootstrap
Device Drivers
- Computer programs, provided by OS, allows OS to interact with hardware
- Hardware such as keyboard used, device driver communicates this request to OS
- Produces relevant output, in this case displaying letter on screen
- Specific to computers architecture, different driver for different device types (Phones, Consoles etc)
- Drivers interact with OS, therefore specific to OS installed on device
Virtual Machine
- Theoretical computer, software implementation of a computer system
- Provides an environment with a translator for intermediate code to run
- Used to create development environment for programmers to test programs on different OS
- For example, running games consoles via Virtual machine
- Saves time and money of having to purchase multiple devices just for testing
- Can be slower compared to running on device originally designed for
- Can also be used to protect from malware, malware affects VM not device being used
Intermediate Code
- Code halfway between machine and object code (Example is Java)
- Independent of processor architecture
- Can be used across different machines and OS
- Programmers would run intermediate code on Virtual Machines