1.4 Operating Systems Flashcards
Operating System
Defintion & Features
A collection of programs that provide an interface between the user & computer, enable the user to communicate with the computer & perform tasks involving the management of memory & resources.
- Memory management
- File management
- Utility software
- Security
- User interface
Paging
When memory is split up into equal-sized sections known as pages (4k bytes) 🟩 🟩 🟩 🟩 . These can then be swapped between main memory & the hard disk as needed.
Segmentation
Memory split into logical sized divisions, known as segments, which vary in size ⬛️ ◼️◾️▪️. These represent the structure & logical flow of the program.
Virtual Memory
Section of the hard drive acts as RAM when the space in main memory is insufficient to store programs being used. Sections of programs not currently being used are temporarily moved into virtual memory through paging, freeing up memory for other programs in RAM.
- Caues ‘disk thrashing’, computer ‘freezes’ due to pages being swapped too frequently between the hard disk and main
memory. Becomes worse as virtual memory is filled up.
Interrupts
- Signals generated by software/hardware to indicate to the processor that a process needs attention
- Different priorities and urgency aken into account by the operating system when allocating processor time
- They are stored within an abstract data structure called a priority queue in an interrupt register
- E.g printer signalling the completion of a print job, peripheral signalling power failure.
Interrupt Service Routine
- Processor checks interrupt register at the end of each FDE cycle.
- If a higher-priority interrupt exists, the CPU’s special purpose registers are temporarily transferred to a stack.
- The processor loads the appropriate Interrupt Service Routine (ISR) into RAM and sets a flag to signal the start of the ISR.
- After servicing the interrupt, the flag is reset, and the interrupt queue is checked for more higher-priority interrupts.
- If more high-priority interrupts exist, the process is repeated until all are serviced.
- Otherwise, the contents of the stack are transferred back to the registers, and the FDE cycle resumes.
Scheduling
What is Scheduling & Types
The operating system ensures all sections of programs being run (known as ‘jobs’) receive a fair amount of processing time. Done through various scheduling algorithms,
Either:
- Pre-emptive: Jobs are actively made to start and stop by the operating system. (E.g SRT, RR)
- Non pre-emptive: Once a job is started, it is left alone until it is completed. (E.g FCFS, SJF)
Scheduling Algorithms
Round Robin: Jobs are given time slices for execution, repeating until completion.
- Advantages: All jobs eventually get processed.
- Disadvantages: Inefficient for longer jobs, no consideration for priority.
First Come First Served: Jobs processed in order of entry.
- Advantages: Simple implementation.
- Disadvantages: No consideration for priority or urgency.
Multilevel Feedback Queues: Uses multiple queues with different priorities.
- Advantages: Considers job priorities.
- Disadvantages: Complex to implement.
Shortest Job First: Queue ordered by total job completion time.
- Advantages: Reduces waiting time in batch systems.
- Disadvantages: Requires estimating job duration, potential processor starvation, no priority consideration.
Shortest Remaining Time: Queue ordered by time left for job completion.
- Advantages: Increases throughput for shorter jobs.
- Disadvantages: No priority consideration, potential processor starvation with continuous short jobs.
Types of Operating Systems
- Distributed: Run across multiple devices, allowing the load to be spread across multiple computer processors when a task is run. (E.g Android, cloud syncing)
- Embedded: Built to perform a small range of specific tasks and catered towards a specific device. Limited in their functionality and hard to update, consume less power (E.g microwave)
- Multi-tasking: Multi-tasking operating systems enable the user to carry out tasks seemingly simultaneously. This is done by using time slicing to switch quickly between programs and applications in memory. (E.g Windows, MacOS)
- Multi-user: Multiple users make use of one computer. A scheduling algorithm Is used to ensure processor time is shared fairly between jobs and prevent processor starvation.
- Real Time: Commonly used in time-critical computer systems, *designed to perform a task within a guaranteed time frame. *Used where a response within a certain time period is crucial to safety. (E.g self driving cars, hospital)
BIOS
Basic input output System
- Program that runs when a computer system is
switched on - Ensures that all hardware (keyboards, disk drives) are correctly connected & functional
- Checking the CPU clock, memory and processor is operational
- Testing for external memory devices connected to the computer
-After checks , OS loaded into RAM from the hard disk by the bootstrap/ bootloader
Device Drivers
- Programs provided by the OS that allow the operating system to interact with hardware.
- Device driver communicates request to the OS which produces relevant output.
- Specific to the computer’s architecture, so different drivers must be used for different device types (E.g phones, games consoles, PCs) & OS
Virtual Machine
- A theoretical computer, a software implementation of a computer system
- Provides an environment with a translator for intermediate code to run
- E.g emulators, Protection from malware, Running incompatible software
Intermediate Code
- Code that is halfway between machine code and object code
- Independent of the processor architecture so can be runacross different machines & OS