Week 3: Processes (Model trafficing schedulling) Flashcards
Why do modern computers appear to perform multiple tasks simultaneously?
The processor switches between programs multiple times per second, giving the illusion of multitasking.
What is the role of the operating system in multi-programming?
To keep track of running programs and manage the switching between them.
How must processes be executed?
They must execute sequentially even though they may be interrupted so other processes can run.
What is a process tree?
It’s a hierarchy where parent processes create child processes, which in turn can create their own child processes.
What are the three resource-sharing options during process creation?
- Parent and children share all resources
- Children share a subset of the parent’s resources
- Parent and child share no resource
What are the two resource-sharing execution options during process creation?
- Parent and children execute concurrently
- Parent waits until children terminate
What are the two resource-sharing program options during process creation?
- The child is a duplicate of the parent
- The child has a program loaded into it
What occurs during normal process termination?
The process executes its final instruction, exits, ensures output data is written, and deallocates its resources.
Under what circumstances might a parent process terminate a child process?
If the child exceeds a resource limit, becomes stuck, or if the parent process itself is terminated.
What are the five states of a process?
- New
- Ready
- Running
- Blocked (Waiting)
- Terminated.
What does it mean when a process is “Blocked”?
The process is waiting for an event to occur.
What typical information does the operating system hold about a process?
- Process management information: process state, program counter, processor registers, time process started,
process ID, parent ID - Memory management information: code location and size, data location and size, stack
- I/O management information: files open and modes, I/O devices in use, current directory
Why is process information necessary?
To allow the operating system to resume a process in the correct state after an interruption.
What is the purpose of process tables in an operating system?
To store information about each process, enabling management and state tracking.
What happens to a process’s table entry when it is interrupted?
The operating system updates the process’s state and any related information.
What are the two types of interrupts?
- Software
- Hardware
What happens when an interrupt occurs?
The microprocessor finishes the current instruction and passes control to an interrupt handling routine.
What is preserved during interrupt handling?
The state of essential registers, including the program counter, is preserved to enable the resumption of execution.
What governs the execution of interrupt handling routines?
The operating system decides which code runs based on the type of interrupt.
What is a clock interrupt?
A hardware interrupt triggered when an internal timer reaches zero, to interrupt user processes that are simply doing long calculations
When is it only possible to change the value of the internal timer of the clock interrupt?
When the operating system is in privileged mode
What happens during a context switch?
The operating system saves the state of the old process and loads the saved state of a new process to run it
What factors influence the time taken for context switching?
The efficiency of the operating system and the level of hardware support.
Why is the time spent on context switching considered overhead?
Because the system does no useful work while switching
In what does the amount of time context switching take depend?
The operating system and the hardware
What are the different classes of scheduler types?
- Long-term: selects which processes should be brought into the queue
- Medium-term: selects which process is temporarily suspended and swapped out of main memory to reduce the number of processes occupying memory
- Short-term: selects which process should be executed by the processor
What is the race condition?
The condition which its result depends on the race (timing) of two processes.