OS Flashcards
What is an operating system?
The one program that always runs on a computer, that acts as an intermediary between a ‘user’ of a
computer and the computer hardware
What does an operating system do?
- Allocates resources such as CPU time, memory and storage
- Decides between conflicting requests
- Controls execution of programs to prevent errors and improper use of the computer
What is the bootstrap and what does it do?
Program stored on the ROM or EPROM that is loaded after boot that initialises firmware and loads the operating system
What is a device controller?
Controller: Hardware that manages the data flow between the CPU and the device such as mice, keyboards etc. They include local buffers where data moves between that and memory.
What is stored in the interrupt vector? What is a trap?
IV: Address of instruction, Interrupt service routine
Trap: Interrupt called by software
What is a system call?
When a process accesses the kernel to call a function. Examples are create file, write console, set file security etc. Usually goes through API instead of direct interaction with kernel
How can software interrupt processing when its called from the user space and not the kernel space?
Index is stored in a well known location before moving to kernel space which looks up the interrupt via the index and executes it.
What is dynamic linking?
programs that use libraries all call to a single library stored somewhere
what is swapping
allocating virtual memory and moving processes across to virtual memory
What are the two types of fragmentation?
- External fragmentation: Holes made due to processes of different sizes being allocated and reallocated
- Internal fragmentation: When processes that are slightly larger than blocks they are allocated meaning that the last block will have unused space
What is paging?
Splitting memory into equally sized blocks and allocating memory by blocks to processes. This prevents external fragmentation. Page table is stored in registers or cache depending on size
What is segmentation?
Allocating space depending on process size. Data, program code and symbol table is stored within.
What is thrashing?
When data in virtual memory pages need to be accessed frequently causing processing time to decrease due to long read write times between disk and memory. can be prevented by defining working set as most frequently used pages and keeping them stored in memory and less used ones in virtual memory.
How does the kernel code execute separately to user code?
They have strictly different spaces in memory. Kernel either executes system calls from user processes sent by user or handles device interrupts.
What are the three linux commands related to running kernel modules?
- modprobe inserts module into running kernel
- rmmod removes module from running kernel (if unused)
- lsmod lists currently running modules
What are critical sections in memory and how do they work?
Areas that enforce data structures only being accessed by one thread at a time. This can be done with mutex locks which put the thread to sleep until the structure is unlocked or spinlocks which get the thread to repeatedly check if the structure is unlocked until it is let in.
What are device drivers?
Software that runs in kernel mode that allows other processes to access and interact with devices through device controllers. They have opererations such as open, read, write and close on the device.
What happens when in a device driver interrupt?
- device sends interrupt
- CPU selects appropriate interrupt handler
- Interrupt handler: performs read/write action on device, wakes up processes waiting on interrupt
- Clears interrupt bit of device to allow next interrupt to come