Download presentation
Presentation is loading. Please wait.
Published byἉλκυόνη Λαγός Modified over 5 years ago
1
Outline Process Management Process manager Hardware process
Process abstraction Process descriptor Thread abstraction
2
Basic OS Functions 5/3/2019 COP4610
3
Process Manager 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 5/3/2019 COP4610
4
Process Manager – cont. Process manager consists of
Basic algorithms and data structures to implement the process and resource abstractions Managing resources used by processes/threads Tools to create/destroy/manipulate processes and threads Scheduling Process synchronization A deadlock strategy Protection strategy 5/3/2019 COP4610
5
Abstract Computing Environment
Process Manager – cont. Program Process Abstract Computing Environment File Manager Memory Device Protection Deadlock Synchronization Description CPU Other H/W Scheduler Resource Devices 5/3/2019 COP4610
6
Implementing the Process Abstraction
OS Address Space Control Unit OS interface … Machine Executable Memory ALU CPU Pi Address Pi CPU Pi Executable Memory Pk Address Pk CPU Pk Executable Pj Address Pj CPU Pj Executable 5/3/2019 COP4610
7
External View of the Process Manager
Hardware Application Program Device Mgr Process Mgr Memory Mgr File Mgr UNIX Windows CreateThread() CreateProcess() CloseHandle() WaitForSingleObject() fork() exec() wait() 5/3/2019 COP4610
8
Modern Processes and Threads
OS interface … Pi CPU Thrdj in Pi Thrdk in Pi 5/3/2019 COP4610
9
Modern Processes and Threads – cont.
5/3/2019 COP4610
10
Processes 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 5/3/2019 COP4610
11
Process Address Space Process address space
A set of locations used by a process to reference primary memory locations, OS services, and resources 5/3/2019 COP4610
12
The Address Space Process Files Other objects Address Space Binding
Executable Memory Other objects Files 5/3/2019 COP4610
13
Building the Address Space
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 5/3/2019 COP4610
14
Process Address Space – cont.
5/3/2019 COP4610
15
System Overview 5/3/2019 COP4610
16
Instruction Execution
Instruction fetch (IF) MAR PC; IR M[MAR] Instruction Decode (ID) A Rs1; B Rs2; PC PC + 4 Execution (EXE) Depends on the instruction Memory Access (MEM) Write-back (WB) 5/3/2019 COP4610
17
The Hardware Process Hardware process refers to the iterative activity of the control unit It fetches an instruction and then executes it repeatedly 5/3/2019 COP4610
18
Tracing the Hardware Process
Bootstrap Loader Process Manager Interrupt Handler P1 P,2 Pn … Machine is Powered up Initialization Load the kernel Service an interrupt Hardware process progress Execute a thread Schedule 5/3/2019 COP4610
19
Context Switching Old Thread Descriptor CPU New Thread Descriptor
5/3/2019 COP4610
20
Context Switching – cont.
Process Manager Interrupt Handler P1 P2 Pn Executable Memory Initialization 1 2 3 4 5 7 8 9 6 5/3/2019 COP4610
21
The Abstract Machine Interface
User Mode Instructions Application Program Abstract Machine Instructions Trap Instruction Supervisor Mode fork() create() open() OS 5/3/2019 COP4610
22
Process Descriptors OS creates/manages process abstraction
Descriptor is data structure for each process Type & location of resources it holds List of resources it needs List of threads List of child processes Security keys 5/3/2019 COP4610
23
Process Descriptor – cont.
5/3/2019 COP4610
24
Windows NT Process Descriptor
EPROCESS … void *UniqueProcessId; NT Executive KPROCESS uint32 KernelTime; uint32 UserTime; Byte state; NT Kernel 5/3/2019 COP4610
25
Windows NT Process Descriptor – cont.
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 5/3/2019 COP4610
26
Windows NT Process Descriptor – cont.
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 5/3/2019 COP4610
27
Thread Abstraction 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 5/3/2019 COP4610
28
Thread Abstraction – cont.
5/3/2019 COP4610
29
Windows NT Thread Descriptor
ETHREAD EPROCESS KPROCESS NT Kernel KTHREAD NT Executive 5/3/2019 COP4610
30
Simple State Diagram Request Done Running Schedule Start Allocate
Ready Blocked Running Start Schedule Request Done Allocate 5/3/2019 COP4610
31
UNIX State Transition Diagram
Request Wait by parent Done Running zombie Schedule Request Sleeping I/O Request Start Allocate Runnable I/O Complete Resume Traced or Stopped Uninterruptible Sleep 5/3/2019 COP4610
32
Windows NT Thread States
CreateThread Terminated Initialized Reinitialize Activate Dispatch Exit Wait Waiting Ready Running Wait Complete Wait Complete Select Preempt Transition Dispatch Standby 5/3/2019 COP4610
33
Summary Process manager
It creates abstract machines for process to run in It is achieved by time-multiplexing the hardware through context-switching To manage processes / threads, process manager uses data structures (process descriptor and thread descriptor) to keep the information for manipulating them 5/3/2019 COP4610
34
Session Information COP 4610 / CGS 5765 Section Recitation time
Section :00-08:55 AM Section :05-09:55 AM Section :15AM -12:05 PM Section :20-1:10 PM 5/3/2019 COP4610
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.