190 likes | 373 Views
Process. Additional references: Operating Systems: Internals and Design Principles 5e– William Stallings - Pearson. This lecture slide uses images/slides from other references also. . Free memory. User task. Monitor / Kernel. Single tasking. Life is simple here
E N D
Process Additional references: Operating Systems: Internals and Design Principles 5e– William Stallings - Pearson This lecture slide uses images/slides from other references also.
Free memory User task Monitor / Kernel Single tasking • Life is simple here • Have only one task running • Task directly loaded • What will you do to execute such a task? • What if more than one process?
Linux process’ run-time memory • Process • Code • Data part Fig courtesy: Computer Systems: a programmer’s perspective
Process • Program has just code NOT Live entity • Process with data, work-space • Stack • Heap • Open files • File descriptors • Other primitives • ipc, memory, … • Execution snapshots • Register content • Program counter • General purpose registers
Question??? • How are multiple processes handled? • How does process management take place? • Creation, deletion,… • What to do when a process performs I/O? • How to ensure all processes get a chance to execute? • Can processes communicate among one another? • If so, how? • What are the desirable features?
A simple scenario: Two-State Process Model • Process may be in one of two states • Running • Not-running
Both are 2 different scenarios Not-Running Process in a Queue What processes are in queue? Process timed out Process gone for I/O
Process (contd.) • Not-running • Ready to run given chance • Blocked/waiting for event • Why not three states then?
Dispatch Admit Release Ready Running Time out Event Occurs Event Wait Blocked Three state model
Dispatch Admit Release New Ready Running Time out Event Occurs Event Wait Blocked Four state model • Need to create process • Process control block • Verify availability of resources What about termination?
Dispatch Admit Exit Terminate New Ready Running Time out Event Occurs Event Wait Blocked Five state model • Terminate • To wrap up process • Wait conditions before termination
Suspended Processes • Processor is faster than I/O so all processes could be waiting for I/O • Swap these processes to disk to free up more memory • Blocked state becomes suspend state when swapped to disk
One Suspend State (6 state model) • Suspend does not show those that can run once in memory • Two new states • Blocked/Suspend • Ready/Suspend