Process   Organized By: Vinay Arora                 Assistant Professor                 CSED, TU                          ...
Disclaimer           This is NOT A COPYRIGHT          MATERIAL   Content has been taken mainly from the following books:  ...
Process   A Program in Execution is called as a PROCESS.   An operating system executes a variety of programs:      Batch ...
Process in Memory               Vinay Arora                CSED,TU
Process   A Program is a Passive Entity and a Process is an Active Entity.   Process associates PC and a set of other reso...
Set of Values held by a PROCESS   # Current value of Program Counter (PC)   # Contents of the Processors Registers   # Val...
Process States                 Vinay Arora                  CSED,TU
Process States New State: The Process being created. Ready State: The Process is waiting to be assigned to a Processor. Ru...
State Diagram                Vinay Arora                 CSED,TU
State Diagram                Vinay Arora                 CSED,TU
Process Control Block                Vinay Arora                 CSED,TU
Process Control Block Information associated with each Process    Process state    Program counter    CPU registers    CPU...
Various Queues   Job Queue – Set of all processes in the system   Ready Queue – Set of all processes residing in main memo...
Multiple Blocked Queues                Vinay Arora                 CSED,TU
Ready Queue              Vinay Arora               CSED,TU
Context Switch   When CPU switches to another process, the system must save the state   of the old process and load the sa...
Context Switching                Vinay Arora                 CSED,TU
CPU Switching                Vinay Arora                 CSED,TU
Process Scheduling Diagram                Vinay Arora                 CSED,TU
LSM Term Scheduler   Long-Term Scheduler (or Job scheduler) – Selects which Processes   should be brought into the Ready q...
Medium Term Scheduler               Vinay Arora                CSED,TU
Parent & Child Process  Parent Process create Children Processes, which, in turn create other  Processes, forming a tree o...
Process Creation (Unix)   UNIX Examples   Fork System Call creates new Process.   Exec System Call used after a fork to re...
Process Creation (Unix)                 Vinay Arora                  CSED,TU
Tree of Processes on Solaris                 Vinay Arora                  CSED,TU
Process Termination   Process executes last statement and asks the operating system to delete it (exit)            Output ...
InterProcess Communication   Processes within a system may be Independent or Cooperating   Cooperating process can affect ...
Direct Communication   Processes must name each other explicitly:     send (P, message) –send a message to process P     r...
Interaction b/w Processes   Data Sharing – Common Variable/Data.   Message Passing – Communication b/w 2 processes.   Sync...
Message Passing & Shared Memory               Vinay Arora                CSED,TU
Thnx…  Vinay Arora   CSED,TU
Upcoming SlideShare
Loading in …5
×

OS - Process

3,094 views

Published on

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
3,094
On SlideShare
0
From Embeds
0
Number of Embeds
730
Actions
Shares
0
Downloads
511
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

OS - Process

  1. 1. Process Organized By: Vinay Arora Assistant Professor CSED, TU Vinay Arora CSED,TU
  2. 2. Disclaimer This is NOT A COPYRIGHT MATERIAL Content has been taken mainly from the following books: Operating Systems Concepts By Silberschatz & Galvin,Operating Systems: Internals and Design Principles By William Stallings www.os-book.com www.cs.jhu.edu/~yairamir/cs418/os2/sld001.htm www.personal.kent.edu/~rmuhamma/OpSystems/os.html http://msdn.microsoft.com/en-us/library/ms685096(VS.85).aspxhttp://www.computer.howsttuffworks.com/operating-system6.htm http://williamstallings.com/OS/Animations.html Etc… Vinay Arora CSED,TU
  3. 3. Process A Program in Execution is called as a PROCESS. An operating system executes a variety of programs: Batch System – Jobs Time-Shared Systems – User Programs or Tasks A Process Includes: Program Counter Stack Data Section Vinay Arora CSED,TU
  4. 4. Process in Memory Vinay Arora CSED,TU
  5. 5. Process A Program is a Passive Entity and a Process is an Active Entity. Process associates PC and a set of other resources with it. A Program becomes a Process when an executable file is loaded into memory. Two Techniques are present for loading Executable Files. (Double Clicking EXE, Running EXE through Command Prompt) Vinay Arora CSED,TU
  6. 6. Set of Values held by a PROCESS # Current value of Program Counter (PC) # Contents of the Processors Registers # Value of the Variables # The Process Stack (SP) which typically contains temporary data such as subroutine parameter, return address, and temporary variables. # A Data Section that contains Global Variables. Vinay Arora CSED,TU
  7. 7. Process States Vinay Arora CSED,TU
  8. 8. Process States New State: The Process being created. Ready State: The Process is waiting to be assigned to a Processor. Running State: A Process is said to be running if it has the CPU. Blocked (or Waiting) State: A Process is said to be blocked if it is waiting for some event to happen. Terminated State: The Process has finished Execution. Vinay Arora CSED,TU
  9. 9. State Diagram Vinay Arora CSED,TU
  10. 10. State Diagram Vinay Arora CSED,TU
  11. 11. Process Control Block Vinay Arora CSED,TU
  12. 12. Process Control Block Information associated with each Process Process state Program counter CPU registers CPU scheduling information Memory-management information Accounting information I/O status information Vinay Arora CSED,TU
  13. 13. Various Queues Job Queue – Set of all processes in the system Ready Queue – Set of all processes residing in main memory, ready and waiting to execute Device Queues – Set of processes waiting for an I/O device Processes migrate among the various queues Vinay Arora CSED,TU
  14. 14. Multiple Blocked Queues Vinay Arora CSED,TU
  15. 15. Ready Queue Vinay Arora CSED,TU
  16. 16. Context Switch When CPU switches to another process, the system must save the state of the old process and load the saved state for the new process via a Context Switch. Context of a process represented in the PCB Context-switch time is overhead. Time dependent on hardware support Vinay Arora CSED,TU
  17. 17. Context Switching Vinay Arora CSED,TU
  18. 18. CPU Switching Vinay Arora CSED,TU
  19. 19. Process Scheduling Diagram Vinay Arora CSED,TU
  20. 20. LSM Term Scheduler Long-Term Scheduler (or Job scheduler) – Selects which Processes should be brought into the Ready queue Short-Term Scheduler (or CPU scheduler) – Selects which Process should be executed next and allocates CPU Medium-Term Scheduler – Intermediate Level of Scheduling. Limit the Multiprogramming and executes Swapping. Vinay Arora CSED,TU
  21. 21. Medium Term Scheduler Vinay Arora CSED,TU
  22. 22. Parent & Child Process Parent Process create Children Processes, which, in turn create other Processes, forming a tree of Processes Generally, Process identified and managed via a Process Identifier (PId) Resource Sharing Parent and Children share all Resources Children share subset of parent’s Resources Parent and child share no Resources Execution Parent and Children execute Concurrently Parent waits until children Terminate Vinay Arora CSED,TU
  23. 23. Process Creation (Unix) UNIX Examples Fork System Call creates new Process. Exec System Call used after a fork to replace the process’ memory space with a new Program. Vinay Arora CSED,TU
  24. 24. Process Creation (Unix) Vinay Arora CSED,TU
  25. 25. Tree of Processes on Solaris Vinay Arora CSED,TU
  26. 26. Process Termination Process executes last statement and asks the operating system to delete it (exit) Output data from child to parent (via wait) Process resources are deallocated by operating system Parent may terminate execution of children processes (abort) Child has exceeded allocated resources Task assigned to child is no longer required If parent is exiting Some operating system do not allow child to continue if its parent terminates All children terminated - Cascading Termination Vinay Arora CSED,TU
  27. 27. InterProcess Communication Processes within a system may be Independent or Cooperating Cooperating process can affect or be affected by other processes, including sharing data Reasons for cooperating processes: Information sharing Computation speedup Modularity Convenience Cooperating processes need Inter Process Communication (IPC) Two models of IPC - Shared memory & Message passing Vinay Arora CSED,TU
  28. 28. Direct Communication Processes must name each other explicitly: send (P, message) –send a message to process P receive (Q, message) –receive a message from process Q Properties of Communication link Links are established automatically A link is associated with exactly one pair of communicating processes Between each pair there exists exactly one link The link may be unidirectional, but is usually bi-directional Vinay Arora CSED,TU
  29. 29. Interaction b/w Processes Data Sharing – Common Variable/Data. Message Passing – Communication b/w 2 processes. Synchronization – Coordination in Activities. Signals – To Convey a situation to a Process so that it can perform some special actions to handle the situation. Concurrency & Parallelism. Computational Speed Up. Scheduling & Dispatching. Vinay Arora CSED,TU
  30. 30. Message Passing & Shared Memory Vinay Arora CSED,TU
  31. 31. Thnx… Vinay Arora CSED,TU

×