Processes
Process – a program in execution; process execution must progress in sequential fashion
Textbook uses the terms job and process almost interchangeably
As a process executes, its state changes:
new: The process is being created
running: Instructions are being executed
waiting: The process is waiting for some event to occur
ready: The process is waiting to be assigned to a process
terminated: The process has finished execution
Diagram of Process State
As a process executes, it changes state
new: The process is being created
ready: The process is waiting to run
running: Instructions are being executed
waiting: Process waiting for some event to occur
terminated: The process has finished execution
Fetch
Exec
R0
…
R31
F0
…
F30
PC
…
Data1
Data0
Inst237
Inst236
…
Inst5
Inst4
Inst3
Inst2Inst1
Inst0
Addr 0
Addr 232-1
What happens during execution?
Execution sequence:
Fetch Instruction at PC
Decode
Execute (possibly using registers)
Write results to registers/mem
PC = Next Instruction(PC)
Repeat
PC
PC
PC
PC
CPU3
CPU2
CPU1
Shared Memory
Assume a single processor. How do we provide the illusion of multiple processors?
Multiplex in time!
Each virtual “CPU” needs a structure to hold:
Program Counter (PC), Stack Pointer (SP)
Registers (Integer, Floating point, others…?)
How switch from one CPU to the next?
Save PC, SP, and registers in current state block
Load
浙江省深化普通高中课程改革方案 来自淘豆网m.daumloan.com转载请标明出处.