1.2.1 Systems Software Flashcards
What’s an Operating System (OS)?
- Software that controls the computer’s hardware and software resources.
- It allows applications to interact with hardware on a computer.
What are the functions of an OS?
- Providing a platform for software to run
- Processor scheduling
- Handling Interrupts
- Memory Management
- Secondary Storage Management
- Input/Output Device Management
- Provides the user interface
- Security
*What is meant by processor scheduling? (OS)
It determines the order in which processes will be executed, allowing for multi-tasking
*What is meant by handling interrupts? (OS)
It deals with requests that disrupt the processor’s work
*What’s meant by memory management? (OS)
Records how memory in the computer is divided and identified so that memory is allocated efficiently between processes that are running
What’s meant by secondary storage management? (OS)
Tracks where files and programs are stored and which parts are available for storage, and managing files and folders based on user permissions
What’s meant by input/output device management? (OS)
Ensures efficient communication with devices and managing functionality issues
How does the OS manage memory?
- Instructions and data initially stored on non-volatile media (e.g. hard disk), they’re then loaded to the main memory for data to be processed and instructions to be executed
- (*)They handle multiple memory management operations, such as:
- Tracking the status of memory and allocation (DC4(???))
- Determining storage requirements
- Controlling memory usage
Tracking status of memory allocation
- Memory divided up into physical address spaces initially marked as free
- OS loads data into these spaces and marks them as allocated
- When data/instructions no longer needed, OS marks them as free again
Memory Allocation Techniques
- Paging
- Segmentation
- Virtual Memory
Logical Address Space
- A series of logical addresses are produced when a program is executed
- The total of these logical addresses makes up the logical address space of that process
Paging
PHYSICAL divisions
- Available memory physically divided into fixed sized chunks called pages
- Each page has an address
- Process loaded into RAM gets allocated sufficient pages (these may not be next to each other)
A page table is used to map between the locations of the logical memory and physical memory
Benefit of paging
Allows data to be stored in a non-contiguous manner (means pages of the same process don’t need to be stored together, but instead allocated to any free space)
Segmentation
LOGICAL divisions
- Memory divided into segments of variable lengths
- Segments can relate to parts of a program (e.g. a particular function or subroutine may occupy a segment)
Segment table used to record where each segment required for a process is located
Segmentation Vs. Paging
Similarities
- Allows programs to run despite insufficient memory
- Pages and segments stored on disk
- Pages and segments transferred to memory when needed
Differences
- Pages are fixed sizes, segments have variable size
- Pages are made to fit sections of memory, while segments are complete sections of program
Virtual Memory
- An area of the hard disk can be allocated as virtual memory if there’s insufficient space space in RAM
- Some pages of a current process are stored in virtual memory and swapped out when needed
- If too many processes are running with insufficient RAM, lots of time is spent swapping pages in and out of virtual memory
- Repeatedly swapping pages can cause the computer to noticeably slow down, also known as disk thrashing
Interrupts
A signal that is sent to the processor to request immediate attention. When it receives this request, it suspends what it’s doing and runs the process associated with the signal.
CPU checks for interrupts at the end of each clock cycle
Examples:
- Power failure
- Scheduled interrupt from internal clock
- Hardware error occurs
- I/O device sends an interrupt signal
Interrupt Service Routine (ISR)
- A mini program that’s designed to respond to an interrupt’s request.
- They can be built into an operating system or provided via device drivers
Interrupts in the FDE cycle
- Processor receives interrupt
- Processor completes FDE cycle of instruction it was running at time of interrupt
- Contents of the processor registers saved to memory
- Origin of interrupt identified so appropriate ISR can be called (other low-priority interrupts put on hold to allow ISR to finish running)
- PC updates with address of first ISR instruction and ISR completes its execution
- Registers are reloaded with values from memory
- Lower-priority interrupts put on hold are re-established
- PC set to point to address of next instruction to be executed from previously running program
Processor Scheduling
- Single CPU can only process instructions for one application at a time, so the OS must schedule when each app can use the CPU
- This provides the illusion of multi-tasking
Aims of Scheduling
- Provide an acceptable response time to all users
- Maximise time CPU is fully engaged
- Ensure fairness on a multi-user system
Round Robin
Preemptive method
- Each program allocated a time slice (via FIFO) during which it can use the CPU's resources - If it's not complete when its time's up, it stops running and the computer switches to the next allocated process
Pro: Ensures every task is allocated time without a long wait
Con: Doesn’t scale well - as more processes run, time slices get smaller meaning tasks are less likely to be completed quickly
First Come First Served
First program to arrive is executed until completion.
Pros:
- Simplest method to implement
- No risk of starvation (when a process cannot complete its execution because it’s constantly denied processor time)
Cons:
- Can be a long wait before a process can run
Can work well in a system with only a few concurrent processes
Shortest Remaining Time
Preemptive Method
- Time to completion estimated as each new program arrives - Program with shortest remaining time to completion executed first, allowing new program to take over from the current process
Con: Can delay longer processes from completing sooner if shorter processes are added in the meantime