Module 2
OS RESPONSIBILITIES FOR PROCESS MGMT. <ul><li>Creating and deleting of process </li></ul><ul><li>Scheduling of a process (...
WHAT IS A PROCESS? <ul><li>Process  </li></ul><ul><ul><li>–  Program in execution needing resources (such as CPU time, mem...
COMPONENTS OF A PROCESS <ul><li>Code   </li></ul><ul><li>Data </li></ul><ul><li>Resources </li></ul><ul><li>Status </li></...
CLASSIFICATION OF OS ACCORDING TO THE TYPES OF SYSTEM: <ul><li>Single-process single-threaded  – only one process can exec...
CLASSIFICATION OF OS ACCORDING TO THE TYPES OF SYSTEM: <ul><li>Multi-process single threaded  – a single entity (the proce...
CLASSIFICATION OF OS ACCORDING TO THE TYPES OF SYSTEM: <ul><li>Multi-process multi-threaded  – resources are allocated to ...
IS PROCESS THE SAME AS PROGRAM? <ul><li>No, it is both more and less </li></ul><ul><ul><li>More – a program is just part o...
UNIPROGRAMMING & MULTIPROGRAMMING <ul><li>Uniprogramming   </li></ul><ul><ul><li>allows execution of only one process at a...
HOW CAN SEVERAL PROCESSES SHARE ONE CPU? <ul><li>OS takes care of this by making sure that: </li></ul><ul><ul><li>Each pro...
OS EXECUTION <ul><li>An OS executes a variety of programs: </li></ul><ul><ul><li>Batch systems </li></ul></ul><ul><ul><li>...
A PROCESS INCLUDES: <ul><li>Program counter and contents of processor registers. </li></ul><ul><li>Process stack (contains...
SIX (6) PROCESS STATES: <ul><li>New   </li></ul><ul><ul><li>Process is being created but not yet included in the pool of e...
SIX (6) PROCESS STATES: (CONT) <ul><li>Waiting (or blocked) </li></ul><ul><ul><li>Waiting for some event to occur (I/O com...
DIAGRAM OF PROCESS STATE State transition _____ internal _ _ _ _external New Ready Active Exiting Stopped Blocked create r...
PROCESS CONTROL BLOCK (PCB) <ul><li>Each process is represented in the OS by a PCB. </li></ul><ul><li>It is where collecti...
PCB INFORMATION: <ul><li>Process state  </li></ul><ul><li>Program counter (PC) </li></ul><ul><li>CPU Registers  </li></ul>...
PROCESS CONTROL BLOCK
Operations on Processes <ul><li>Create a process </li></ul><ul><li>Destroy a process </li></ul><ul><li>Suspend a process <...
CONTEXT SWITCH <ul><li>When a CPU switches to another process, the system must  save the state of the old process  and  lo...
CONTEXT SWITCH
PROCESS SCHEDULING: <ul><li>Objective of multiprogramming: have some  user process running at all times </li></ul><ul><li>...
SCHEDULING QUEUES <ul><li>Job queue  </li></ul><ul><ul><li>Set of all processes that enter the system </li></ul></ul><ul><...
QUEUING DIAGRAM:
LONG-TERM SCHEDULER (OR JOB SCHEDULER) <ul><li>Selects which processes should be brought into the ready queue; these proce...
LONG TERM SCHEDULER: (CONT) <ul><li>Must make careful selection among the processes (a good process mix).  </li></ul><ul><...
SHORT-TERM SCHEDULER <ul><li>Known as the CPU scheduler. </li></ul><ul><li>Selects which process should be executed next a...
MEDIUM-TERM SCHEDULER (SWAPPER) <ul><li>Involves suspending or resuming processes by swapping or rolling them out of or in...
MEDIUM-TERM SCHEDULER
THREAD: DEFINITION <ul><li>A basic unit of CPU utilization </li></ul><ul><li>Comprises a thread ID, program counter, regis...
EXAMPLES OF THREAD <ul><li>Web browser </li></ul><ul><ul><li>One thread – displays images/text </li></ul></ul><ul><ul><li>...
Upcoming SlideShare
Loading in...5
×

23565104 process-management(2)

1,358

Published on

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

  • Be the first to like this

No Downloads
Views
Total Views
1,358
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
75
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

23565104 process-management(2)

  1. 1. Module 2
  2. 2. OS RESPONSIBILITIES FOR PROCESS MGMT. <ul><li>Creating and deleting of process </li></ul><ul><li>Scheduling of a process (suspending and resuming the execution of process) </li></ul><ul><li>Process synchronization </li></ul><ul><li>Process communication </li></ul><ul><li>Deadlock handling </li></ul>
  3. 3. WHAT IS A PROCESS? <ul><li>Process </li></ul><ul><ul><li>– Program in execution needing resources (such as CPU time, memory, files and I/O devices) to accomplish its tasks. </li></ul></ul><ul><ul><li>Executing set of machine instructions </li></ul></ul><ul><ul><ul><li>Execution of a process must progress in a sequential fashion; at most one instruction is executed on behalf of the process. </li></ul></ul></ul>
  4. 4. COMPONENTS OF A PROCESS <ul><li>Code </li></ul><ul><li>Data </li></ul><ul><li>Resources </li></ul><ul><li>Status </li></ul><ul><li>Threads </li></ul>
  5. 5. CLASSIFICATION OF OS ACCORDING TO THE TYPES OF SYSTEM: <ul><li>Single-process single-threaded – only one process can execute at a time. Once a process is allocated to the CPU, that process runs to completion before any other process can execute. </li></ul><ul><ul><li>Example: DOS </li></ul></ul>
  6. 6. CLASSIFICATION OF OS ACCORDING TO THE TYPES OF SYSTEM: <ul><li>Multi-process single threaded – a single entity (the process), is the object upon which both resource allocation and CPU scheduling are performed. </li></ul><ul><ul><li>Example: UNIX </li></ul></ul>
  7. 7. CLASSIFICATION OF OS ACCORDING TO THE TYPES OF SYSTEM: <ul><li>Multi-process multi-threaded – resources are allocated to the processes but CPU scheduling can be in terms of thread. </li></ul><ul><ul><li>Example: Windows, Mach, Solaris </li></ul></ul>
  8. 8. IS PROCESS THE SAME AS PROGRAM? <ul><li>No, it is both more and less </li></ul><ul><ul><li>More – a program is just part of a process context. </li></ul></ul><ul><ul><li>Less – a program may invoke several processes </li></ul></ul>
  9. 9. UNIPROGRAMMING & MULTIPROGRAMMING <ul><li>Uniprogramming </li></ul><ul><ul><li>allows execution of only one process at a time (e.g. personal computer) </li></ul></ul><ul><li>Multiprogramming </li></ul><ul><ul><li>allows more than one process (e.g. concurrent execution of many processes) </li></ul></ul>
  10. 10. HOW CAN SEVERAL PROCESSES SHARE ONE CPU? <ul><li>OS takes care of this by making sure that: </li></ul><ul><ul><li>Each process gets a chance to run </li></ul></ul><ul><ul><li>(fair scheduling) </li></ul></ul><ul><ul><li>They do not modify each other’s state </li></ul></ul><ul><ul><li>(protection) </li></ul></ul>
  11. 11. OS EXECUTION <ul><li>An OS executes a variety of programs: </li></ul><ul><ul><li>Batch systems </li></ul></ul><ul><ul><li>Time-shared systems </li></ul></ul>
  12. 12. A PROCESS INCLUDES: <ul><li>Program counter and contents of processor registers. </li></ul><ul><li>Process stack (contains temporary data such as subroutine parameters, return addresses, variables) </li></ul><ul><li>Data section (contains global variables) </li></ul><ul><li>Heap </li></ul><ul><ul><li>Memory that is dynamically allocated during run time. </li></ul></ul>
  13. 13. SIX (6) PROCESS STATES: <ul><li>New </li></ul><ul><ul><li>Process is being created but not yet included in the pool of executable processes (resource acquisition) </li></ul></ul><ul><li>Ready </li></ul><ul><ul><li>Waiting to be assigned to the processor </li></ul></ul><ul><li>Running (or active) </li></ul><ul><ul><li>Process that is currently being executed </li></ul></ul>
  14. 14. SIX (6) PROCESS STATES: (CONT) <ul><li>Waiting (or blocked) </li></ul><ul><ul><li>Waiting for some event to occur (I/O completion) </li></ul></ul><ul><li>Stopped </li></ul><ul><ul><li>Special case of blocked where the operator/user suspends the process. </li></ul></ul><ul><li>Terminated (or exiting) </li></ul><ul><ul><li>Process has finished execution. A process is about to be removed from the pool of executable processes. </li></ul></ul>
  15. 15. DIAGRAM OF PROCESS STATE State transition _____ internal _ _ _ _external New Ready Active Exiting Stopped Blocked create resume time-out dispatch suspend kill kill exit error Event occurs or resource available
  16. 16. PROCESS CONTROL BLOCK (PCB) <ul><li>Each process is represented in the OS by a PCB. </li></ul><ul><li>It is where collection of process information are kept and accessed. </li></ul><ul><li>Sometimes called the Task Control Block (TCB) </li></ul>
  17. 17. PCB INFORMATION: <ul><li>Process state </li></ul><ul><li>Program counter (PC) </li></ul><ul><li>CPU Registers </li></ul><ul><li>CPU Scheduling information </li></ul><ul><li>Memory-Management Information </li></ul><ul><li>Accounting information </li></ul><ul><li>I/O status information </li></ul>
  18. 18. PROCESS CONTROL BLOCK
  19. 19. Operations on Processes <ul><li>Create a process </li></ul><ul><li>Destroy a process </li></ul><ul><li>Suspend a process </li></ul><ul><li>Resume a process </li></ul><ul><li>Change the priority of a process </li></ul><ul><li>Block a process </li></ul><ul><li>Wake up a process </li></ul><ul><li>Dispatch a process </li></ul><ul><li>Enable interprocess communication </li></ul>
  20. 20. CONTEXT SWITCH <ul><li>When a CPU switches to another process, the system must save the state of the old process and load the saved state of the new process </li></ul><ul><li>Context-switch time is overhead; the system does no useful work during switching. </li></ul>
  21. 21. CONTEXT SWITCH
  22. 22. PROCESS SCHEDULING: <ul><li>Objective of multiprogramming: have some user process running at all times </li></ul><ul><li>OS keeps the CPU busy with productive work by dynamically selecting (scheduling) the next user process to become active. </li></ul>
  23. 23. SCHEDULING QUEUES <ul><li>Job queue </li></ul><ul><ul><li>Set of all processes that enter the system </li></ul></ul><ul><li>Ready queue (linked-list) </li></ul><ul><ul><li>Set of all processes residing in main memory, ready and waiting to execute. </li></ul></ul><ul><li>Device queues </li></ul><ul><ul><li>Set of processes waiting for an I/O device, each device has a device queue. </li></ul></ul>
  24. 24. QUEUING DIAGRAM:
  25. 25. LONG-TERM SCHEDULER (OR JOB SCHEDULER) <ul><li>Selects which processes should be brought into the ready queue; these processes are spooled to a mass-storage (disk) where they are kept for later execution. </li></ul><ul><li>Controls the degree of multiprogramming </li></ul>
  26. 26. LONG TERM SCHEDULER: (CONT) <ul><li>Must make careful selection among the processes (a good process mix). </li></ul><ul><li>Processes can be described as either: </li></ul><ul><ul><li>I/O bound process – spends more time doing I/O than computations, may short CPU bursts </li></ul></ul><ul><ul><li>CPU bound process – spends more time doing computations, few very long CPU bursts. </li></ul></ul>
  27. 27. SHORT-TERM SCHEDULER <ul><li>Known as the CPU scheduler. </li></ul><ul><li>Selects which process should be executed next and allocates the CPU. </li></ul>
  28. 28. MEDIUM-TERM SCHEDULER (SWAPPER) <ul><li>Involves suspending or resuming processes by swapping or rolling them out of or into memory. </li></ul><ul><li>Swapping </li></ul><ul><ul><li>Removing a process from the memory. </li></ul></ul>
  29. 29. MEDIUM-TERM SCHEDULER
  30. 30. THREAD: DEFINITION <ul><li>A basic unit of CPU utilization </li></ul><ul><li>Comprises a thread ID, program counter, register set, and a stack. </li></ul><ul><li>Process types: </li></ul><ul><ul><li>Single-threaded – performs one task at a time </li></ul></ul><ul><ul><li>Multithreaded – performs more than one task at a time. </li></ul></ul>
  31. 31. EXAMPLES OF THREAD <ul><li>Web browser </li></ul><ul><ul><li>One thread – displays images/text </li></ul></ul><ul><ul><li>Another thread – retrieves data from network </li></ul></ul><ul><li>Word processor </li></ul><ul><ul><li>One thread – displays graphics </li></ul></ul><ul><ul><li>Another thread – responds to user keystrokes </li></ul></ul><ul><ul><li>Another thread – performs spelling and grammar </li></ul></ul>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×