Lecture 3 - Function and Structure Flashcards
How do programs request services from the OS?
Traps or exceptions
How do hardware devices usually request attention from the OS?
Interrupts
What is the fetch execute cycle?
Fetch instruction at program counter
decode and execute
Write results to registers/memory
Increment counter
repeat
What are device drivers?
Routines that interact with specific device types
Encapsulate device-specific knowledge, e.g.
How to initialise device
How to request IO
How to handle interrupts or errors
What two methods can the cpu use to know whether a device is ready/finished?
Polling - device sets flag when it is busy, program tests the flag in a loop waiting for change
Interrupts - when device is ready forces CPU to jump to a specific instruction address
After interrupt is processed CPU returns to previous address and continues execution
How does the storage hierarchy work?
Main memory - large ish storage media - very fast - direct cpu access
Secondary storage - large, slow, no direct access
Speed vs Cost vs Volatility (Pick two)
What is caching?
Copying info into faster storage system
Main memory is fast cache for secondary storage
What is the point of Hardware Protection?
Make sure user programs cannot mess up other programs or OS itself
What is dual mode operation?
Hardware support of differentiating between two modes of operation: user mode (for users)
Kernel mode (for operating system)
How is dual mode operation done at the hardware level?
Mode bit added to indicate current mode (kernel = 0, user = 1)
When interrupt or fault occurs - switch to kernel mode
Priviledged instructions only allowed in kernel mode
All I/O instructions are _______ instructions
privileged
How does memory protection work?
two registers - base register and limit register
base holds smallest legal address for current program
Limit holds size of legal address range for current program
Any attempt to access outside this is refused
Kernel mode can access any mem
The load instructions for base and limit registers are ____________ instructions
privileged
What is CPU protection?
Timer - interrupts control after specified period to ensure OS maintains control
Prevents program going into infinite loop and stopping OS from running
Timer also used to implement timesharing
Timer operations are privileged instructions
What is a system call?
When a program needs a service from the OS
Passes relevant info to OS
OS performs the service if it is permitted for the program
OS checks to ensure info passed to it is ok