Processes, System Calls, and Shells
Stub. The process abstraction and the process API (fork/exec/wait), direct execution as the mechanism for running a process efficiently, and how a shell is built on top of these primitives — including pipes and I/O redirection.
The process is the OS’s central abstraction for a running program, and this note covers it end to end: what state a process needs (address space, registers, open files — the process control block), the Unix API for creating and controlling processes (the famously separated fork/exec, plus wait), and direct execution — running the process’s instructions straight on the CPU rather than interpreting them, with limited direct execution (traps into the kernel) as the mechanism that keeps this safe. Shells and pipes are the payoff: a shell is just a process that uses this exact API in a loop, and a pipe is nothing more than an anonymous file descriptor wired from one process’s stdout to another’s stdin.
Outline (TODO — flesh out each)
- The process abstraction; process state
- The process API — fork, exec, wait
- Direct execution; limited direct execution and traps
- Building a shell on top of fork/exec/wait
- Pipes and I/O redirection