
CS 414 : Operating Systems
UNIVERSITY OF VIRGINIA
Department of Computer Science
Fall 2005
Topic 2: Processes
๎
Context switching: saving the state (to where?) and restoring it
What gets saved? Everything that next process could damage:
๎
program counter, processor status word, registers.
๎
all of memory? all disks? all the stuff on tape?
๎
options for memory contents: a) trust next process b) move everything to disk (Alto sys-
tem), c) memory protection
๎
Why tricky?
๎
All machines provide some special hardware support.
๎
Motorola 68000: hardware just moves PC and status word to the stack. OS then handles
rest of state itself. Must be done carefully. Why?
๎
Intel 432: hardware does all state saving and restoring into process control block, and
even dispatching. Desirable?
๎
Ugly issue of performance: sometimes making dirty shortcuts.
๎
Birth of a process: creating it from scratch:
๎
Allocate memory
๎
Load code and data into memory.
๎
Create (empty) call stack.
๎
Create and initialize process control block.
๎
Make process known to dispatcher.
โ 2.1 โ