Professional Documents
Culture Documents
Concepts
Computer platform consists of a collection of hardware resources Computer applications are developed to perform some task Inefficient for applications to be written directly for a given hardware platform Operating system provides a convenient to use, feature rich, secure, and consistent interface for applications to use OS provides a uniform, abstract representation of resources that can be requested and accessed by application
3
Process
A program in execution An instance of a program running on a computer The entity that can be assigned to and executed on a processor A unit of activity characterized by the execution of a sequence of instructions, a current state, and an associated set of system instructions
5
Process Elements
Identifier State Priority Program counter Memory pointers Context data I/O status information Accounting information
6
Trace of Process
Sequence of instruction that execute for a process Dispatcher switches the processor from one process to another
Example Execution
10
Trace of Processes
11
12
13
14
Process Creation
15
Process Termination
16
Process Termination
17
Processes
Not-running
ready to execute
Blocked
waiting for I/O
Dispatcher cannot just select the process that has been in the queue the longest because it may be blocked
18
A Five-State Model
Running Ready Blocked New Exit
19
20
Process States
21
22
23
Suspended Processes
Processor is faster than I/O so all processes could be waiting for I/O Swap these processes to disk to free up more memory Blocked state becomes suspend state when swapped to disk Two new states
Blocked/Suspend ReadySuspend
24
25
26
27
28
Memory Tables
Allocation of main memory to processes Allocation of secondary memory to processes Protection attributes for access to shared memory regions Information needed to manage virtual memory
30
I/O Tables
For mgmt of I/O devices & channels I/O device is available or assigned Status of I/O operation Location in main memory being used as the source or destination of the I/O transfer
31
File Tables
Provides information aboutExistence of files Location on secondary memory Current Status Attributes Sometimes this information is maintained by a file management system
32
Process Table
To manage and control processes Location (Where process is located) Attributes in the process control block
Program Data Stack
33
Process Image
34
35
Memory and file tables are managed on behalf of processes, so there must be be some reference to these resources directly or indirectly in the process tables Files referred to in the file tables are accessible via an I/O device and will at some times be in main or virtual memory
36
38
Process Attributes
3 categoriesProcess identification Processor state information Process control information
39
Process Attributes
Process identification
Identifiers
Numeric identifiers that may be stored with the process control block include
Identifier of this process Identifier of the process that created this process (parent process) User identifier
40
Process Attributes
Processor State Information
User-Visible Registers
A user-visible register is one that may be referenced by means of the machine language that the processor executes while in user mode. Typically, there are from 8 to 32 of these registers, although some RISC implementations have over 100.
41
42
43
Process Privileges
Processes are granted privileges in terms of the memory that may be accessed and the types of instructions that may be executed. In addition, privileges may apply to the use of system utilities and services.
46
49
Modes of Execution
User mode
Less-privileged mode User programs typically execute in this mode
Process Creation
Assign a unique process identifier Allocate space for the process Initialize process control block Set up appropriate linkages
Ex: add new process to linked list used for scheduling queue
52
Supervisor call
such as file open
53
55
57
58
59
60
61
62
63