Beruflich Dokumente
Kultur Dokumente
Implementing
Processes, Threads,
and Resources
Pj CPU
PPi Executable
i Executable
Memory
Memory
PPj Executable
j Executable
Memory
Memory
Pk CPU
PPk Executable
k Executable
Memory
Memory
CPU
ALU
Control
Unit
OS
OSAddress
Address
Space
Space
PPi Address
i Address
Space
Space
PPk Address
k Address
Space
Space
PPj Address
j Address
Space
Space
OS interface
Device Mgr
UNIX
Memory Mgr
File Mgr
exec()
Memory Mgr
File Mgr
Process Mgr
Device Mgr
wait()
CreateThread()
CloseHandle() CreateProcess()
WaitForSingleObject()
Process Mgr
fork()
Windows
Hardware
Thrdk in Pi
Pi CPU
OS interface
Map
Map
Program
Static data
Resources
AddressSpace
Space
Address
Stack
Stack
Processes &Threads
State
State
Map
Map
Memory-Mapped-Resources
1. Most of the components in a computer
system can be referenced by memory
addresses. (One of the exception is the
processor it self)
2. The address space provides a uniform
mechanism by which a process can
reference bytes in all memory-mapped
resources.
3. Each resource manager is responsible for
binding addresses with addressable
elements of the resource.
Process
Process
Address
Binding
Executable
Memory
Files
Other objects
Machine is
Powered up
Bootstap
Process Interrupt
Loader Manager Handler P1
P,2
Pn
fork()
open()
OS
User
UserMode
Mode
Instructions
Instructions
Supervisor
SupervisorMode
Mode
Instructions
Instructions
create()
Process
Manager
Interrupt
Handler
2
4
9
P1
P2
Pn
OS Families-Example
POSIX Standard Description Release
POSIX.1-1988 system interfaces and headers
SunOS 4.1
Solaris 2.0
Solaris 2.4
Solaris 2.6
Solaris 2.5
Solaris 2.5
Process Descriptors
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
Security keys
etc. (see Table 6.1 and the source code of your
favorite OS)
NT Kernel
NT Executive
uint32
uint32
Byte
void
KernelTime;
UserTime;
state;
*UniqueProcessId;
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
ETHREAD
KTHREAD
NT Kernel
NT Executive
UNIX
UNIXkernel
kernel
Process Table
Process Descriptor
Creating a Process in NT
CreateProcess();
Win32
Win32Subsystem
Subsystem
ntCreateProcess();
ntCreateThread();
NT
NTExecutive
Executive
Handle Table
NT
NTKernel
Kernel
Process Descriptor
Windows NT Handles
Application
Handle
User Space
Supervisor Space
Executive Object
Kernel
Object
NT Executive
NT Kernel
Running
Request
Schedule
Start
Allocate
Blocked
Ready
zombie
Sleeping
Done
Running
Schedule
Request
I/O Request
Start
Allocate
Runnable
I/O Complete
Uninterruptible
Sleep
Resume
Traced or Stopped
Initialized
Activate
Dispatch
Exit
Running
Wait
Waiting
Ready
Wait Complete
Wait Complete
Transition
Dispatch
Preempt
Reinitialize
Select
Terminated
Standby
Resources
Resource: Anything that a process can request, then be
blocked because that thing is not available.
R = {Rj | 0 j < m} = resource types
C = {cj 0 | RjR (0 j < m)} = units of Rj 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 cj 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 cj is unbounded.
request
Mgr(Rj)
Process
Process
allocate
Blocked Processes
Process
Process
Process
Process
Process
Process
Process
Process
request()
release()
Resource Pool
Process Hierarchies
Parent-child relationship may be significant:
parent controls childrens execution
Done
Request
Running
Yield
Request
Ready-Active
Blocked-Active
Schedule
Suspend
Activate
Allocate
Suspend
Activate
Suspend
Start
Ready-Suspended
Allocate
Blocked-Suspended
Process
Process
Abstract Computing Environment
File
Manager
Process
Deadlock
Process
Deadlock
Description
Description
Protection
Protection
Synchronization
Synchronization
Device
Manager
Devices
Devices
Memory
Manager
Memory
Memory
Scheduler
Scheduler
CPU
CPU
Resource
Resource
Resource
Resource
Resource
Manager
Resource
Manager
Manager
Manager
Manager
Manager
Other
OtherH/W
H/W
UNIX Organization
Libraries
Libraries
Process
Process
Process
Process
Process
Process
System
SystemCall
CallInterface
Interface
Process
Deadlock
File
Process
Deadlock
Description
Manager
Description
Protection
Protection
Synchronization
Synchronization
Device
Memory
Resource
Resource
Resource
Scheduler
Resource
Manager Manager
Scheduler
Resource
Manager
Resource
Manager
Manager
Manager
Manager
Manager
Monolithic Kernel
Devices
Devices
Memory
Memory
CPU
CPU
Other
OtherH/W
H/W
Windows NT Organization
T
Process
Process
T
T
T
Process
Process
Process
Process
Libraries
Libraries
Subsystem
Subsystem
User
Subsystem
Subsystem
NT Executive
NT Kernel
Hardware
HardwareAbstraction
AbstractionLayer
Layer
Processor(s)
Main Memory
Subsystem
Subsystem
I/O
I/OSubsystem
Subsystem
Devices