1 / 28

Outline

Outline. Process Management. Process Manager. Process manager creates the process abstraction It implements a software environment for processes to run Process manager consists of Basic algorithms and data structures to implement the process and resource abstractions Scheduling

emery-burt
Télécharger la présentation

Outline

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Outline • Process Management

  2. Process Manager • Process manager creates the process abstraction • It implements a software environment for processes to run • Process manager consists of • Basic algorithms and data structures to implement the process and resource abstractions • Scheduling • Process synchronization • A deadlock strategy • Protection strategy COP4610

  3. Process Manager – cont. COP4610

  4. Process Model • A process consists of the following tangible elements • A program to define the behavior of the process • The data operated on by the process and the results it produces • A set of resources • The process descriptor for the OS to keep track of the process COP4610

  5. Processes – cont. COP4610

  6. Process Descriptor • Process descriptor (also called process control block) • Is the data structure used by the process manager to record the status of a process while the process manager algorithms monitor and control the process COP4610

  7. Process Descriptor – cont. • Process descriptor includes the following • Its processor registers contents at the time it was last suspended • Its processor state • The address space mapping details • Its memory state • A pointer to its stack • The resources that have been allocated to it • The resources that it needs COP4610

  8. Process Descriptor – cont. COP4610

  9. Process State Diagram COP4610

  10. Process State Diagram – cont. • Process creation (new  ready) • Create/find an available process descriptor entry • Assign a unique process ID • Define the address space that the process needs • Load the desired program into the address space • Initialize the data, stack, and resources available to the process • Set the process’s state to ready and add to the ready queue COP4610

  11. Process State Diagram – cont. • Ready list – set of all processes residing in main memory, ready and waiting to execute • Ready  Running • By the CPU scheduler • When the process is chosen to run next, the OS restores the register values from the process descriptor, including PC and the process starts running again COP4610

  12. Process State Diagram – cont. • Context switch • When CPU is switched to another process, the system must save the status of the old process and load the saved status for the new process • Context switch time is overhead; the system does not do useful work while switching from application’s point of view • Context switch time is hardware dependent; it can be a significant factor in CPU scheduling algorithm design COP4610

  13. Process State Diagram – cont. • How many context switches does it take for the • OS to switch from one user process to another? COP4610

  14. Process State Diagram – cont. • Running  Blocked • When the resources requested by the process are not available immediately, the process will be blocked, and its state will be changed from running to blocked and be removed from the ready list COP4610

  15. Process State Diagram – cont. • Running  Ready • In a time-sharing system, when a process uses its allowed time slice, it will be suspended by OS through a timer interrupt • The process will be put back to the ready list and the scheduler will choose one among the ready processes COP4610

  16. Process State Diagram – cont. • Running  Running • When the resources requested are available immediately, the process allows to continue to run. • This, however, depends on the scheduling algorithm implementation COP4610

  17. Process State Diagram – cont. • Running  Terminated • When a process finishes, the OS will release the resources allocated to the process • The process descriptor data structure will also be released • However, it may not be done immediately • In UNIX, the process descriptor is released after the parent has called “wait” system call to collect its status information • If the process’s parent exits before it does, the process becomes a zombie COP4610

  18. Process State Diagram – cont. • Blocked  Ready • When the resources requested by the process become available, the process will be marked as ready and be put back into the ready list COP4610

  19. Process Address Space • Process address space • A set of locations used by a process to reference primary memory locations, OS services, and resources COP4610

  20. Process Address Space – cont. COP4610

  21. Process Address Space – cont. COP4610

  22. Process Hierarchy COP4610

  23. Unix Process Hierarchy COP4610

  24. Resource Manager • Each resource type is associated with a resource manager • The resource manager is responsible for allocating resources to processes and returning released resources COP4610

  25. Resource Manager – cont. COP4610

  26. Resource Manager – cont. • Resource descriptor is to save the state of the resource type COP4610

  27. Resource Manager – cont. COP4610

  28. Resource Manager – cont. • Reusable resources • Resources that can be allocated and must be returned to the system after the process has finished using them • Such as memory • Consumable resources • Resources that can cause a process to be blocked on request but are never released by that process • Such as input data COP4610

More Related