Figure 3. 4b > There is a single queue in which each entry(I) is a pointer to a particular process. Queue Enter DIspatch Exlt Processor Pause ( b) Queuing diagram PROCESSES AND SCHEDULING
PROCESSES AND SCHEDULING Figure 3.4b ➢There is a single queue in which each entry(项) is a pointer to a particular process
Creation and Termination Processes Creation process: os builds the data structures that are used to manage the process and allocates address space to the process. Reasons for process creation s New batch iob Interactive(交互) logon Created by os to provide a service example: printing Spawned(产生) by existing process process tree PROCESSES AND SCHEDULING
PROCESSES AND SCHEDULING Creation and Termination Processes (I) ❖ Creation Process: OS builds the data structures that are used to manage the process and allocates address space to the process. ❖ Reasons for Process Creation ٭ New batch job ٭ Interactive(交互) logon ٭ Created by OS to provide a service example: printing ٭ Spawned(产生)by existing process → process tree
Example of CreateProcess Create( i struct pcb p=alloc pcb; //alloc a empty process control block ∥ initial p p->state- not-running p->parent=current; current->child=p enqueue(WaItqQueue, p): put p into wait queue 魅 PROCESSES AND SCHEDULING
PROCESSES AND SCHEDULING Example of CreateProcess Create() { struct pcb *p; p=alloc_pcb(); //alloc a empty process control block …… // initial p p->state= not-running; p->parent=current; current->child=p; enqueue(WAITQUEUE, p); // put p into wait queue …… }
Creation and Termination Processes(Iy) Reasons for process termination s Halt command User log off s User program exit Program error (eg. no resource for use s Normal completion s Time limit exceeded Memory unavailable PROCESSES AND SCHEDULING
PROCESSES AND SCHEDULING Creation and Termination Processes (II) ❖Reasons for Process Termination ٭ Halt command ٭ User log off ٭ User program exit ٭ Program error(e.g. no resource for use) ٭ Normal completion ٭ Time limit exceeded ٭ Memory unavailable
Creation and Termination Processes (l) Reasons for process termination s Bounds violation s Protection error Example write to read-only file Arithmetic error s Time overrun Process waited longer than a specified maximum for an event PROCESSES AND SCHEDULING
PROCESSES AND SCHEDULING Creation and Termination Processes (III) ❖Reasons for Process Termination ٭ Bounds violation ٭ Protection error ▪ Example write to read-only file ٭ Arithmetic error ٭ Time overrun ▪ Process waited longer than a specified maximum for an event