OS midterm Flashcards
4 sources of processor interrupts?
Device Interrupts: signal from controller that says it needs attention
I/O Events: arrival of new info
Timer
Program Errors
Where is the state of an interrupted process saved?
Pushed onto Control Stack
What is locality of reference?
Programs tend to remain in certain regions before moving to new ones
What are the two examples of locality of reference discussed in class?
If a program executes instruction i, it is likely to execute i+1 next
Programs may iterate over a block of data in a loop, which uses the program and the data mostly
How does locality of reference make cache memory effective
If the processor hardware can move the referenced blocks of memory from main
memory into cache memory when the block is first accessed, instructions and/or
data will be found in cache (hit) for all the remaining access while in a region and
the overall execution of the program / process will be that much faster.
What are the restrictions on User Mode compared to Kernel Mode?
Can only access allotted memory
Can’t run privileged instructions
What causes the OS to switch into Kernel mode from User Mode?
Any interrupt
What is the name of the mechanism to request resources or a service from the OS?
Syscall
What are the four steps involved in making a syscall?
- Place the Syscall number and arguments in specified registers
- Send a software interrupt. This saves the current processes’ state on the stack
- Interrupt handler looks at the registers and executes the request
- When finished, restore state using IRET instruction and return to user mode
What are the four innovations of computer systems design that make modern OS possible? Name and describe
- Protected memory: Kernel operates in a region of memory that can only be accessed in kernel mode
- Privileged Instructions: instructions that can only be executed by the processor when it is in kernel mode. 1 and 2 are made to prevent corruption of the OS while running (or stealing protected data)
- Interrupts: Way to interrupt/pause currently running program to handle asynchronous events
- Hardware Timers: periodic interrupts
What info is maintained in the process image?
The process image is the region of memory (disk or main memory) containing
the instructions / data / stack of the program being executed.
In what 2 places is the process image stored?
System Drive (as a file) and Main Memory
What are the 5 steps to create a process image?
- Allocate space for the new image on the system (swap) drive. Copy the text and data segments from the executable file to the new image
- Create PCB and other resources needed for process execution
- Assign unique PID to process
- Copy image from the system drive into main memory
- Put the process in the ready state and put it into the Ready queue
Purpose of the PCB?
Process Control Block: used to maintain info needed to maintain a single process. Maintained by the kernel
What are the 3 categories of info stored in the PCB? Name and explain.
Process Identification: Information to identify the process. PID, PPID, Owning user ID, etc.
Process Control:
Processor state: State of the processor needed to allow the process to be context switched. Aka the state to be restored when process resumes