Compare a program and a process.
A program is a file on disk. A process is a program in execution.
Define a process.
A process is a unit of protection and resource allocation.
What does the process store in memory?
Text containing the program code. Data containing global variables. Heap containing memory allocated during runtime.
Define a process control block, and the values it contains.
A data structure representing a process, contains: Process ID, Current process state (running, waiting, etc.), CPU scheduling, memory management, accounting, I/O status information, and Process context.
What accounting information does the PCB store?
CPU used, Clock time elapsed, Time limits.
What IO status information does the PCB store?
IO devices allocated to process, List of opened files.
What is the process context? State the values it contains.
The process context is the machine environment. Contains the program counter and other CPU registers.
Define a thread.
A thread represents an individual execution context.
What does each thread control block contain?
Saved context (registers, including program counter), Scheduler info.
What does the scheduler do?
The scheduler determines which thread to run.
What happens in a context switch?
Saving the context of the currently executing process. Restoring the context of the process being resumed.
State and describe the five process states.
New: process is created. Ready: process is waiting for the CPU. Running: process is being executed on the CPU. Waiting: process is waiting for an event. Terminated: process has finished executing.
Describe the process tree.
Most systems are hierarchical. Parent processes create child processes, forming a tree.
Describe how process creation is done on UNIX.
fork clones a child process from parent. execve replaces child’s memory space with a new program. Parent waits until child exits.
State the 3 reasons of process termination.
Process performs an illegal operation. Parent terminates child. Process executes the last statement and exits.
Explain cascading termination.
If a parent exits, the OS requires children to also exit.
State the two models for IPC.
Shared memory, Message passing.
Explain shared memory IPC.
Processes establish some part of memory both can access.
Explain message passing IPC.
Processes send message to each other mediated by the kernel.
Define signals.
A form of message passing IPC: asynchronous notifications on another process. Each signal is mapped to an integer.
Define pipes.
A form of shared memory IPC. Each pipe has a pair of descriptors: one for reading and one for writing.
What are named pipes?
They appear as files in the filesystem.
How are shared memory segments used?
Read and write via pointers into the shared memory segment. Need to impose controls to avoid collisions when simultaneously reading and writing.