Download presentation
Presentation is loading. Please wait.
Published byDella Douglas Modified over 9 years ago
2
2 Processor(s)Main MemoryDevices Process, Thread & Resource Manager Memory Manager Device Manager File Manager
3
Classic process (used up to late 80s/early 90s) Program in execution on a von Neumann computer New abstraction divides aspects of classic process into two parts Modern process: the part that defines a customized computational framework in which a program executes Thread: the part that keeps track of code executions within this framework Classic process = modern process with 1 thread 3
4
Process manager creates the process abstraction It implements a software environment for processes to run Algorithms that define the behavior of the operating system Data structures to preserve the state of the execution 4
5
Define what “things” threads in the process can reference – the address space (most of the “things” are memory locations) Manage the resources used by the processes/threads Tools to create/destroy/manipulate processes & threads Tools to time-multiplex the CPU – Scheduling (Chapter 7) Tools to allow threads to synchronization the operation with one another (Chapters 8-9) Mechanisms to handle deadlock (Chapter 10) Mechanisms to handle protection (Chapter 14) 5
6
6 Program Process Abstract Computing Environment File Manager Memory Manager Device Manager Protection Deadlock Synchronization Process Description Process Description CPU Other H/W Scheduler Resource Manager Resource Manager Resource Manager Resource Manager Resource Manager Resource Manager Memory Devices Process Mgr
7
7 OS Address Space OS Address Space Control Unit OS interface … Machine Executable Memory ALU CPU P i Address Space P i Address Space P i CPU P i Executable Memory P i Executable Memory P k Address Space P k Address Space … P k CPU P k Executable Memory P k Executable Memory P j Address Space P j Address Space P j CPU P j Executable Memory P j Executable Memory
8
8 Hardware Application Program Application Program Device Mgr Process Mgr Memory Mgr File Mgr UNIX Device Mgr Process Mgr Memory Mgr File Mgr Windows CreateThread() CreateProcess() CloseHandle() WaitForSingleObject() fork() exec() wait()
9
9 OS interface … … … P i CPU Thrd j in P i Thrd k in P i …
10
A process is a sequential program in execution The object program to be executed The data on which the program will execute Resources required by the program The threads in the process A host process environment The status of each thread’s execution Thread-specific data, such as a stack, a PC, and set of register values 10
11
Process address space The collection of addresses a thread can reference Normally refer to an executable memory location Can refer to OS services and resources 11
12
12 Process Address Space Address Binding Executable Memory Other objects Files
13
Some parts are built into the environment Files System services Some parts are imported at runtime Mailboxes Network connections Memory addresses are created at compile (and run) time 13
14
Create process abstraction Create thread abstraction Process/thread synchronization Create resource abstraction Resource protection Cooperation with device manager to implement I/O Implementation of address space 14
15
Composed of: Address space Program to define behavior of process Data used by process Resources needed for thread execution Process created with a minimal set of resources Additional resources allocated as needed 15
16
Hardware process refers to the iterative activity of the control unit Repeatedly fetching and executing instructions 16
17
17 Bootstrap Loader Process Manager Interrupt Handler P1P1 P2P2 PnPn … Machine is Powered up Initialization Load the kernel Service an interrupt Hardware process progress Execute a thread Schedule
18
18 User Mode Instructions User Mode Instructions Application Program User Mode Instructions Abstract Machine Instructions Trap Instruction Supervisor Mode Instructions Supervisor Mode Instructions fork() create() open() OS
19
19 CPU New Thread Descriptor Old Thread Descriptor
20
20 Process Manager Interrupt Handler P1P1 P2P2 PnPn Executable Memory Initialization 1 2 3 4 5 7 Interrupt 8 9 6
21
OS creates/manages process abstraction Descriptor is data structure for each process Register values Logical state Type & location of resources it holds List of resources it needs List of threads List of child processes Security keys etc. 21
22
22 EPROCESS … void *UniqueProcessId; … NT Executive KPROCESS … uint32 KernelTime; uint32 UserTime; … Byte state; NT Kernel
23
Kernel process object including: Pointer to the page directory Kernel & user time Process base priority Process state List of the Kernel thread descriptors that are using this process 23
24
Parent identification Exit status Creation and termination times. Memory status Security information executable image Process priority class used by the thread scheduler. A list of handles used by this process A pointer to Win32-specific information 24
25
The major tasks in managing a thread include Create/destroy a thread Allocate thread-specific resources Manage thread context switching The thread descriptor is the data structure where the OS keeps all information to manage that thread Current state, execution stats, reference to associated process, related threads, etc. 25
26
26 ETHREAD EPROCESS KPROCESS NT Kernel KTHREAD NT Executive
27
27 pid = fork(); UNIX kernel … Process Table Process Descriptor
28
28 CreateProcess(…); Win32 Subsystem ntCreateProcess(…); … ntCreateThread(…); NT Executive NT Kernel … Handle Table Process Descriptor
29
29
30
30 Ready Blocked Running Start Schedule Request Done Request Allocate
31
31 Runnable Uninterruptible Sleep Running Start Schedule Request Done I/O Request Allocate zombie Wait by parent Sleeping Traced or Stopped Request I/O Complete Resume
32
32 Initialized CreateThread Ready Activate Select Standby Running Terminated Waiting Transition Reinitialize Exit Preempt Dispatch Wait Wait Complete Dispatch
33
Resource : Anything that a process can request, then be blocked because that thing is not available. R = {R j | 0 j < m} = resource types C = {c j 0 | for 0 j < m s.t. R j R} = units of R j available Reusable resource : After a unit of the resource has been allocated, it must ultimately be released back to the system. E.g., CPU, primary memory, disk space, … The maximum value for c j is the number of units of that resource Consumable resource : There is no need to release a resource after it has been acquired. E.g., a message, input data, … Notice that c j is unbounded. 33
34
34 There is a resource manager, Mgr(R j ) for every R j Mgr(R j ) Process p i can only request n i c j units of reusable R j p i can request unbounded # of units of consumable R j Process p i can request units of R j if it is currently running request Mgr(R j ) can allocate units of R j to p i allocate
35
35 Process Resource Manager Process Blocked Processes Resource Pool request() release() Policy
36
36 Parent-child relationship may be significant: parent controls children’s execution Ready-Active Blocked-Active Running Start Schedule Request Done Request Allocate Ready-Suspended Blocked-Suspended Suspend Yield Allocate Suspend Activate
37
37 Program Process Abstract Computing Environment File Manager Memory Manager Device Manager Protection Deadlock Synchronization Process Description Process Description CPU Other H/W Scheduler Resource Manager Resource Manager Resource Manager Resource Manager Resource Manager Resource Manager Memory Devices Process Mgr
38
38 System Call Interface File Manager Memory Manager Device Manager Protection Deadlock Synchronization Process Description Process Description CPU Other H/W Scheduler Resource Manager Resource Manager Resource Manager Resource Manager Resource Manager Resource Manager Memory Devices Libraries Process Monolithic Kernel
39
39 Processor(s)Main MemoryDevices Libraries Process Subsystem User Subsystem Hardware Abstraction Layer NT Kernel NT Executive I/O Subsystem T T T T T T TT T
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.