Define a process.
A program in execution; process execution must progress in sequential fashion.
What three things does a process include?
Program counter, stack, data section.
Name the five process states.
New, running, waiting, ready, terminated.
Ready vs waiting state.
Ready: the process is waiting to be assigned to a processor. Waiting: the process is waiting for some event to occur.
Which event moves a process from running back to ready?
An interrupt (slide 8).
Where does a waiting process go when its I/O or event completes?
To the ready state (not directly to running).
List the information kept in a PCB.
Process state, program counter, CPU registers, CPU scheduling information, memory-management information, accounting information, I/O status information.
Job queue vs ready queue vs device queues.
Job queue: all processes in the system. Ready queue: processes in main memory, ready and waiting to execute. Device queues: processes waiting for an I/O device.
What does the long-term (job) scheduler select?
Which processes should be brought into the ready queue.
What does the short-term (CPU) scheduler select?
Which process should be executed next, and it allocates the CPU.
Which scheduler must be fast, and why?
The short-term scheduler, because it is invoked very frequently (milliseconds).
Which scheduler controls the degree of multiprogramming?
The long-term scheduler (the degree of multiprogramming = the number of processes in memory).
I/O-bound vs CPU-bound process.
I/O-bound: more time doing I/O than computations, many short CPU bursts. CPU-bound: more time doing computations, few very long CPU bursts.
What does medium-term scheduling add to the queueing diagram?
Partially executed processes can be swapped out and later swapped in to the ready queue.
What happens during a context switch?
The system saves the state of the old process and loads the saved state for the new process; the context is represented in the PCB.
Why is context-switch time called overhead?
Because the system does no useful work while switching; the time depends on hardware support.
Three options for resource sharing between parent and child.
Share all resources; children share a subset of the parent's resources; share no resources.
Why restrict a child to a subset of the parent's resources?
It prevents any process from overloading the system by creating too many subprocesses.
fork vs exec in UNIX.
fork creates a new process; exec is used after a fork to replace the process' memory space with a new program.
After pid = fork(), what does pid == 0 mean?
The code is running in the child process (which then calls execlp to run ls).
Three reasons a parent may abort a child.
The child has exceeded allocated resources; the task assigned to the child is no longer required; the parent is exiting (some OSs do not allow the child to continue).
What is cascading termination?
When a parent terminates in an OS that does not allow a child to continue without it, all its children are terminated.