2.1 (SYSTEM SOFTWARE) Flashcards
Functions of an OS?
Resource management
File Management
Interrupt handling
Security
Providing a platform for software to run
Providing a user interface
Providing utilities
State utilities an OS may provide (5)
Encryption, compression, defragmentation, system backup, disk cleanup
How is memory management made more efficient?
Paging
Segmentation
Virtual memory
What is paging?
Chunking of primary memory into pages (equal sized blocks)
As users move between applications the memory is dynamically allocated
Paging can lead to internal fragmentation due to unused space in a page not being able to be used
(eg a 60kb file in a 64kb page would have 4 kb of unused space)
What is segmentation?
Chunking memory into blocks that correspond to different types of data
These can be different sizes
Space efficient due to only allocating space depending on the amount an application needs
Can lead to external fragmentation due to blocks taken away can’t be guaranteed to be the same size as a new block, leaving gaps
In turn the maximum block size that can be added is reduced
What is virtual memory?
If a computer is running low on primary memory it can allocate a section of secondary storage as an extension of the main memory
This allows the OS to offload date from the primary memory to the virtual memory, creating an illusion of larger memory, allowing for further multitasking
However this is considerably slower than RAM
Over reliance leads to performance issues
What is an interrupt?
Signal to the processor to stop the current task, to perform different task temporarily
When an interrupt occurs, the processor suspends the current program and transfers control to an interrupt service routine
Types of interrupts and how they occur (3)
Hardware:
Generated by peripherals (I/O requests)
Software:
Triggered by the software or the operating system (Requests to open a file, division by 0 errors)
Trap:
Intentionally triggered by a program (Debugging, unexpected error handling)
Interrupt Process
1.
Interrupt generation
Interrupt controller passes this to the interrupt handler for assesment
2.
Interrupt handler decides if the interrupt needs to be dealt with now or later
If yes the current contents of the processor are saved into the stack
3.
The processor fetches te corresponding Interrupt service routine (ISR) to the interrupt type
4.
The processor transfers control to the ISR and executes the routine to handle the specific interrupt
5.
After the ISR completes the processor restores the contents of the registers (off the stack)
What is an ISR?
A special function that handles a particular interrupt type
Each type of interrupt has a corresponding routine eg.printer jams
ISRs should be concise, efficient and carefully deseigned to minimise the time taken to execute as they often handle time sensitive events
Describe interrupt priority
Interrupt prioritisation means the processor can acknowledge and switch to
resolving a higher-priority interrupt
Prioritising interrupts is vital because many things can go wrong at the same time
Lower-priority ISRs may be temporarily suspended until the higher-priority ISR
completes the execution
Nesting of interrupts refers to the ability of the processor to handle interrupts
within interrupts
Proper management of nested interrupts avoids potential conflicts and ensures
system stability
What is scheduling?
Deciding which tasks to process, for how long, and in what order is achieved
through scheduling algorithms
A CPU is responsible for processing tasks as fast as possible
Different algorithms are used to prioritise and process tasks that need CPU time
The algorithms have different uses, benefits and drawbacks.
What are the categories of scheduling and how do they work with pros and cons?
Pre-emptive:
Allocates the CPU for a specific time quantum to a process
Allows interruption of processes currently being handled
It can result in low-priority processes being neglected if high-priority processes
arrive frequently
Example algorithms include Round Robin and Shortest Remaining Time First
Non pre-emptive:
Once the CPU is allocated to a process, the process holds it until it completes its
burst time or switches to a ‘waiting’ state
A process cannot be interrupted unless it completes or its burst time (amount of time a task is expected to take) is reached
If a process with a long burst time is running, shorter processes will be neglected
Example algorithms include First Come First Serve and Shortest Job First
Give each Scheduling algorithms pros and cons (5)
Round robin:
Pros:
All processes get a fair share of the CPU
Good for time-sharing systems
Predictable, as every process gets equal time
Cons:
Choosing the right time quantum can be difficult
This can lead to a high turnaround time and waiting time for long processes
First come first serve:
Pros:
Simple and easy to understand
Fair in the sense that processes are served in the order they arrive
Cons:
This can lead to poor performance if a long process
arrives before shorter processes
High-priority tasks wait for their turn in the queue
Multi level feedback queues:
Pros:
Smaller tasks are prioritised
Creates a prioritisation system where similar-sized tasks are queued together
Cons:
More complex than other algorithms
Setting the correct parameters (e.g., number of queues, ageing rules) can be complex
Shortest job first:
Pros:
Minimises waiting time
Efficient and fast for short processes
Cons:
Requires knowing the burst time of processes in advance
Long processes can starve if short processes keep arriving
Shortest time remaining:
Pros:
Ideal for jobs that have shorter burst times
It is pre-emptive, so it can be aligned with CPU for best
performance (time quantum)
Cons:
Like SJF, it requires knowing the burst time of processes in advance
High context switching overhead due to pre-emption
Distributed OS
Run on multiple machines appearing as a single unit, used for efficient task distribution and load balancing
Hadoop is an open-source OS designed to process big data using multiple nodes in a distributed network.