SlideShare a Scribd company logo
1
Process Description and Control
2
Requirements of an Operating
System
• Interleave the execution of multiple processes
to maximize processor utilization while
providing reasonable response time
• Allocate resources to processes
• Support inter process communication and
user creation of processes
3
Manage Execution of Applications
• Resources made available to multiple
applications
• Processor is switched among multiple
applications
• The processor and I/O devices can be used
efficiently
4
Process
• A program in execution
– Sometimes also called a task
• 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
What is a process?
• Components of a process include
– the program to be executed (i.e. code)
– data on which the program will execute
– Links to resources used by the program such as
memory and file(s)
– information on the process’ execution status
• Is a process the same as a program?
6
Processes vs. Programs
• No!, it is both more and less.
• more—a program is just part of a process’
context.
• A single program can be executed by two
different users – i.e. the same program can be
part of >1 process
• less—a program may actually create several
processes.
– e.g. Compilation in Unix
7
Programming: uni- vs multi-
• Some systems allow the execution of only one
process at a time (e.g. early PC's). These are called
uniprogramming systems.
• Others allow more than one process to share the
CPU over time: multi-programming systems
• NOT multiprocessor systems!
– Still only 1 CPU
• In a multiprogramming system, the OS switches the
CPU from process to process running each for some
“time quantum”
• The CPU is actually running one and only one
process at a time.
8
• Multitasking can be conveniently described in terms
of multiple processes running in (pseudo) parallel
9
Execution model
• Operating system designers have developed a model
that makes multiple process software relatively easy
to understand
• In this model, each runnable piece of software on the
computer—even components of the operating system
itself—is organized into one or more sequential
processes
• Instructions are executed sequentially in each process
• Each process can be visualized as a block of code
with a pointer identifying the next instruction to be
executed.
10
Sharing the CPU
• How can several processes share one CPU?
• The operating system takes care of this by
making sure:
– each process gets a chance to run—scheduling.
– they do not modify each other’s state—protection.
• Note that these are two issues that come up
over and over whenever we think about sharing
resources…
11
• The O/S has to multiplex resources to the
processes
• a number of processes have been created
• each process during the course of its execution
needs access to system resources: CPU, main
memory, I/O devices
12
• A process image consists of three components
1.an executable program
2.the associated data needed by the program
3.the execution context of the process, which contains
all information the O/S needs to manage the process
(ID, state, CPU registers, stack, etc.)
13
14
Process Elements
• Identifier
• State
• Priority
• Program counter
• Memory pointers
• Context data
• I/O status information
• Accounting information
15
Process Control Block
• Contains the process elements
• Created and manage by the operating system
• Allows support for multiple processes
16
The Process Control Block (PCB)
• The Process Control Block
(PCB) Typical process
image implementation
• is included in the context,
along with the stack
• is a “snapshot” that contains
all necessary and sufficient
data to restart a process
where it left off (ID, state,
CPU registers, etc.)
• is one entry in the operating
system’s process table
(array or linked list)
17
Process Control Block
18
Trace of Process
• Sequence of instruction that execute for a
process
• Dispatcher switches the processor from one
process to another
• The dispatcher is a routine program in kernel
memory space
19
Example Execution
Main MemoryAddress
Dispatcher
Process A
Process B
Process C
Program Counter
0
100
5000
8000
8000
12000
Figure 3.2 Snapshot of Example Execution (Figure 3.4)
at Instruction Cycle 13
20
Trace of Processes
21
22
A Dispatcher
23
Two-State Process Model
• Process may be in one of two states
– Running
– Not-running
24
Not-Running Process in a Queue
• How does the O/S keep track of processes and
states?
• By keeping a queue of pointers to the process
control blocks
• The queue can be implemented as a linked list if
each PCB contains a pointer to the next PCB
25
Process Creation
• Some events that lead to process creation
• The system boots
– when a system is initialized, several background
processes or “daemons” are started (email, logon,
etc.)
• A user requests to run an application
– by typing a command in the CLI shell or double-
clicking in the GUI shell, the user can launch a new
process
26
Process Creation
• An existing process spawns a child process
– for example, a server process (print, file) may
create a new process for each request it handles
– The init daemon waits for user login and spawns
a shell
• A batch system takes on the next job in line
27
Process Hierarchies
• Parent creates a child process, child processes
can create their own processes
• Forms a hierarchy
– UNIX calls this a "process group"
• Windows has no concept of process hierarchy
– all processes are created equal
28
Process Creation
29
Process Termination
• Some events that lead to process termination (exit)
• Regular completion, with or without error code
– The process voluntarily executes an exit(err) system call to
indicate to the O/S that it has finished
• Fatal error (uncatchable or uncaught)
– Service errors: no memory left for allocation, I/O error, etc.
– Total time limit exceeded
– Arithmetic error, out-of-bounds memory access, etc.
• Killed by another process via the kernel
– The process receives a SIGKILL signal
– In some systems the parent takes down its children with it
30
Process Pause / Dispatch
• Some events that lead to process pause / dispatch
• I/O wait
– a process invokes an I/O system call that blocks waiting for
the I/O device: the O/S puts the process in “Not Running”
mode and dispatches another process to the CPU
• Preemptive timeout
– the process receives a timer interrupt and relinquishes
control back to the O/S dispatcher: the O/S puts the process
in “Not Running” mode and dispatches another process to
the CPU
– Not to be confused with “total time limit exceeded”, which
leads to process termination
31
Problem with the two-state model
• Some “Not Running” processes are blocked
(waiting for I/O, etc.)
• The O/S wastes time scanning the queue for
ready →solution: divide “Not Running” into
“Ready” and “Blocked”
32
Process States
• How does the O/S keep track of three process
states?
• Queuing diagram of a three-state Blocked/Ready
process model
• by keeping an extra queue for blocked processes
33
• To further reduce scanning, blocked processes
can be placed in separate queues depending on
the event type
34
Representation of Process Scheduling
35
36
37
38
Process States
• Two independent concepts ×two values each
– Whether a process is waiting on an event (is “Blocked”) or
not
– Whether a process has been swapped out of main memory
(is “Suspended”) or not
• =Four combined states
– “Ready”: the process is in memory and available for
execution
– “Blocked”: the process is in main memory awaiting an event
– “Suspended Blocked”: the process is in secondary memory
and awaiting an event
– “Suspended Ready”: the process is in secondary memory but
is available for execution as soon as it is loaded into memory
39
Process Suspension
• Note: Release of memory by swapping is not
the only motivation for suspending processes.
• Various background processes may also be
turned off and on, depending on CPU load,
suspicion of a problem, some periodical timer
or by user request.
40
Operating System Control
Structures
• The O/S has to multiplex resources to the
processes
• To do this, the O/S must keep information
about the current status of each process and
resource
• Tables are constructed for each entity the
operating system manages
41
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
42
I/O Tables
• 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
43
File Tables
• Existence of files
• Location on secondary memory
• Current Status
• Attributes
• Sometimes this information is maintained by a
file management system
44
Process Table
• Where process is located
• Attributes in the process control block
– Program
– Data
– Stack
45
Memory
Devices
Files
Processes
Process 1
Memory Tables
Process
Image
Process
1
Process
Image
Process
n
I/O Tables
File Tables
Figure 3.11 General Structure of Operating System Control Tables
Primary Process Table
Process 2
Process 3
Process n
46
Process Control Block
• 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
47
Process Control Block
• 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.
48
Process Control Block
• Processor State Information
– Control and Status Registers
These are a variety of processor registers that are employed to
control the operation of the processor. These include
• Program counter: Contains the address of the next instruction to be
fetched
• Condition codes: Result of the most recent arithmetic or logical
operation (e.g., sign, zero, carry, equal, overflow)
• Status information: Includes interrupt enabled/disabled flags,
execution mode
49
Process Control Block
• Processor State Information
– Stack Pointers
• Each process has one or more last-in-first-out (LIFO)
system stacks associated with it. A stack is used to store
parameters and calling addresses for procedure and system
calls. The stack pointer points to the top of the stack.
50
Process Control Block
• Process Control Information
– Scheduling and State Information
This is information that is needed by the operating system to perform its
scheduling function. Typical items of information:
•Process state: defines the readiness of the process to be scheduled for
execution (e.g., running, ready, waiting, halted).
•Priority: One or more fields may be used to describe the scheduling
priority of the process. In some systems, several values are required (e.g.,
default, current, highest-allowable)
•Scheduling-related information: This will depend on the scheduling
algorithm used. Examples are the amount of time that the process has
been waiting and the amount of time that the process executed the last
time it was running.
•Event: Identity of event the process is awaiting before it can be resumed
51
Process Control Block
• Process Control Information
– Data Structuring
• A process may be linked to other process in a queue,
ring, or some other structure. For example, all processes
in a waiting state for a particular priority level may be
linked in a queue. A process may exhibit a parent-child
(creator-created) relationship with another process. The
process control block may contain pointers to other
processes to support these structures.
52
Process Control Block
• Process Control Information
– Interprocess Communication
• Various flags, signals, and messages may be associated
with communication between two independent
processes. Some or all of this information may be
maintained in the process control block.
– 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.
53
Process Control Block
• Process Control Information
– Memory Management
• This section may include pointers to segment and/or
page tables that describe the virtual memory assigned to
this process.
– Resource Ownership and Utilization
• Resources controlled by the process may be indicated,
such as opened files. A history of utilization of the
processor or other resources may also be included; this
information may be needed by the scheduler.
54
55
56
57
58
59
60
61
62
Execution of the Operating System
• Non-process Kernel
– Execute kernel outside of any process
– Operating system code is executed as a separate
entity that operates in privileged mode
• Execution Within User Processes
– Operating system software within context of a user
process
– Process executes in privileged mode when
executing operating system code
63
UNIX Process States

More Related Content

PPT
Process management
PPT
Processes Control Block (Operating System)
PDF
Operating Systems 1 (6/12) - Processes
PPTX
Process Control Block & Threads and Their Management
DOC
Lesson 7 Process Control Block
PPTX
Process control block(PCB)
PPTX
process control block
PDF
Processes description and process control.
Process management
Processes Control Block (Operating System)
Operating Systems 1 (6/12) - Processes
Process Control Block & Threads and Their Management
Lesson 7 Process Control Block
Process control block(PCB)
process control block
Processes description and process control.

What's hot (17)

PPTX
process control blockPcb
PPTX
Operating system 18 process creation and termination
PPTX
os assignment -individual presenation.pptx
PPT
12 process control blocks
PPTX
Unix Process management
PDF
Unit 4
DOC
Operating Systems Unit Two - Fourth Semester - Engineering
PPT
Operating System 3
PPTX
Processes and operating systems
PPTX
Operating system concepts
PPTX
Process concept
PDF
Ch3 processes
PPTX
Mis unit iii by arnav
PPTX
Os unit 3 , process management
PPT
水晶礦脈
PPTX
Os unit 2
process control blockPcb
Operating system 18 process creation and termination
os assignment -individual presenation.pptx
12 process control blocks
Unix Process management
Unit 4
Operating Systems Unit Two - Fourth Semester - Engineering
Operating System 3
Processes and operating systems
Operating system concepts
Process concept
Ch3 processes
Mis unit iii by arnav
Os unit 3 , process management
水晶礦脈
Os unit 2
Ad

Similar to Lecture5 (20)

PPTX
Operating Systems Process Management.pptx
PPT
Ch2_Processes_and_process_management_1.ppt
PPTX
operating system module 2 presentation notes
DOCX
CHAPTER READING TASK OPERATING SYSTEM
PPTX
Operating Systems chap 2_updated2 (1).pptx
PPTX
Unit 1 process management operating system.pptx
PDF
OS - Process Concepts
PDF
Chapter 3.pdf
PPTX
Operating Systems chap 2_updated2.pptx
PDF
process.pdfzljwiyrouyaeutoaetodtusiokklhh
PPT
Chapter03
PPTX
2Chapter Two- Process Management(2) (1).pptx
PDF
Lecture 2- Processes.pdf
DOCX
BITS 1213 - OPERATING SYSTEM (PROCESS,THREAD,SYMMETRIC MULTIPROCESSOR,MICROKE...
PPT
Lecture 8 9 process_concept
PDF
Process Management.pdf
PPTX
Process and thread Management Operating system
PPTX
OS (1).pptx
PDF
Operating System-Concepts of Process
Operating Systems Process Management.pptx
Ch2_Processes_and_process_management_1.ppt
operating system module 2 presentation notes
CHAPTER READING TASK OPERATING SYSTEM
Operating Systems chap 2_updated2 (1).pptx
Unit 1 process management operating system.pptx
OS - Process Concepts
Chapter 3.pdf
Operating Systems chap 2_updated2.pptx
process.pdfzljwiyrouyaeutoaetodtusiokklhh
Chapter03
2Chapter Two- Process Management(2) (1).pptx
Lecture 2- Processes.pdf
BITS 1213 - OPERATING SYSTEM (PROCESS,THREAD,SYMMETRIC MULTIPROCESSOR,MICROKE...
Lecture 8 9 process_concept
Process Management.pdf
Process and thread Management Operating system
OS (1).pptx
Operating System-Concepts of Process
Ad

Recently uploaded (20)

PDF
Structs to JSON How Go Powers REST APIs.pdf
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
additive manufacturing of ss316l using mig welding
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
Internet of Things (IOT) - A guide to understanding
PPT
Project quality management in manufacturing
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
Arduino robotics embedded978-1-4302-3184-4.pdf
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
Strings in CPP - Strings in C++ are sequences of characters used to store and...
PPTX
web development for engineering and engineering
PPTX
Lesson 3_Tessellation.pptx finite Mathematics
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPT
Mechanical Engineering MATERIALS Selection
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
UNIT 4 Total Quality Management .pptx
DOCX
573137875-Attendance-Management-System-original
Structs to JSON How Go Powers REST APIs.pdf
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
additive manufacturing of ss316l using mig welding
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Internet of Things (IOT) - A guide to understanding
Project quality management in manufacturing
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Arduino robotics embedded978-1-4302-3184-4.pdf
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Strings in CPP - Strings in C++ are sequences of characters used to store and...
web development for engineering and engineering
Lesson 3_Tessellation.pptx finite Mathematics
bas. eng. economics group 4 presentation 1.pptx
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Mechanical Engineering MATERIALS Selection
CH1 Production IntroductoryConcepts.pptx
UNIT 4 Total Quality Management .pptx
573137875-Attendance-Management-System-original

Lecture5

  • 2. 2 Requirements of an Operating System • Interleave the execution of multiple processes to maximize processor utilization while providing reasonable response time • Allocate resources to processes • Support inter process communication and user creation of processes
  • 3. 3 Manage Execution of Applications • Resources made available to multiple applications • Processor is switched among multiple applications • The processor and I/O devices can be used efficiently
  • 4. 4 Process • A program in execution – Sometimes also called a task • 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. 5 What is a process? • Components of a process include – the program to be executed (i.e. code) – data on which the program will execute – Links to resources used by the program such as memory and file(s) – information on the process’ execution status • Is a process the same as a program?
  • 6. 6 Processes vs. Programs • No!, it is both more and less. • more—a program is just part of a process’ context. • A single program can be executed by two different users – i.e. the same program can be part of >1 process • less—a program may actually create several processes. – e.g. Compilation in Unix
  • 7. 7 Programming: uni- vs multi- • Some systems allow the execution of only one process at a time (e.g. early PC's). These are called uniprogramming systems. • Others allow more than one process to share the CPU over time: multi-programming systems • NOT multiprocessor systems! – Still only 1 CPU • In a multiprogramming system, the OS switches the CPU from process to process running each for some “time quantum” • The CPU is actually running one and only one process at a time.
  • 8. 8 • Multitasking can be conveniently described in terms of multiple processes running in (pseudo) parallel
  • 9. 9 Execution model • Operating system designers have developed a model that makes multiple process software relatively easy to understand • In this model, each runnable piece of software on the computer—even components of the operating system itself—is organized into one or more sequential processes • Instructions are executed sequentially in each process • Each process can be visualized as a block of code with a pointer identifying the next instruction to be executed.
  • 10. 10 Sharing the CPU • How can several processes share one CPU? • The operating system takes care of this by making sure: – each process gets a chance to run—scheduling. – they do not modify each other’s state—protection. • Note that these are two issues that come up over and over whenever we think about sharing resources…
  • 11. 11 • The O/S has to multiplex resources to the processes • a number of processes have been created • each process during the course of its execution needs access to system resources: CPU, main memory, I/O devices
  • 12. 12 • A process image consists of three components 1.an executable program 2.the associated data needed by the program 3.the execution context of the process, which contains all information the O/S needs to manage the process (ID, state, CPU registers, stack, etc.)
  • 13. 13
  • 14. 14 Process Elements • Identifier • State • Priority • Program counter • Memory pointers • Context data • I/O status information • Accounting information
  • 15. 15 Process Control Block • Contains the process elements • Created and manage by the operating system • Allows support for multiple processes
  • 16. 16 The Process Control Block (PCB) • The Process Control Block (PCB) Typical process image implementation • is included in the context, along with the stack • is a “snapshot” that contains all necessary and sufficient data to restart a process where it left off (ID, state, CPU registers, etc.) • is one entry in the operating system’s process table (array or linked list)
  • 18. 18 Trace of Process • Sequence of instruction that execute for a process • Dispatcher switches the processor from one process to another • The dispatcher is a routine program in kernel memory space
  • 19. 19 Example Execution Main MemoryAddress Dispatcher Process A Process B Process C Program Counter 0 100 5000 8000 8000 12000 Figure 3.2 Snapshot of Example Execution (Figure 3.4) at Instruction Cycle 13
  • 21. 21
  • 23. 23 Two-State Process Model • Process may be in one of two states – Running – Not-running
  • 24. 24 Not-Running Process in a Queue • How does the O/S keep track of processes and states? • By keeping a queue of pointers to the process control blocks • The queue can be implemented as a linked list if each PCB contains a pointer to the next PCB
  • 25. 25 Process Creation • Some events that lead to process creation • The system boots – when a system is initialized, several background processes or “daemons” are started (email, logon, etc.) • A user requests to run an application – by typing a command in the CLI shell or double- clicking in the GUI shell, the user can launch a new process
  • 26. 26 Process Creation • An existing process spawns a child process – for example, a server process (print, file) may create a new process for each request it handles – The init daemon waits for user login and spawns a shell • A batch system takes on the next job in line
  • 27. 27 Process Hierarchies • Parent creates a child process, child processes can create their own processes • Forms a hierarchy – UNIX calls this a "process group" • Windows has no concept of process hierarchy – all processes are created equal
  • 29. 29 Process Termination • Some events that lead to process termination (exit) • Regular completion, with or without error code – The process voluntarily executes an exit(err) system call to indicate to the O/S that it has finished • Fatal error (uncatchable or uncaught) – Service errors: no memory left for allocation, I/O error, etc. – Total time limit exceeded – Arithmetic error, out-of-bounds memory access, etc. • Killed by another process via the kernel – The process receives a SIGKILL signal – In some systems the parent takes down its children with it
  • 30. 30 Process Pause / Dispatch • Some events that lead to process pause / dispatch • I/O wait – a process invokes an I/O system call that blocks waiting for the I/O device: the O/S puts the process in “Not Running” mode and dispatches another process to the CPU • Preemptive timeout – the process receives a timer interrupt and relinquishes control back to the O/S dispatcher: the O/S puts the process in “Not Running” mode and dispatches another process to the CPU – Not to be confused with “total time limit exceeded”, which leads to process termination
  • 31. 31 Problem with the two-state model • Some “Not Running” processes are blocked (waiting for I/O, etc.) • The O/S wastes time scanning the queue for ready →solution: divide “Not Running” into “Ready” and “Blocked”
  • 32. 32 Process States • How does the O/S keep track of three process states? • Queuing diagram of a three-state Blocked/Ready process model • by keeping an extra queue for blocked processes
  • 33. 33 • To further reduce scanning, blocked processes can be placed in separate queues depending on the event type
  • 35. 35
  • 36. 36
  • 37. 37
  • 38. 38 Process States • Two independent concepts ×two values each – Whether a process is waiting on an event (is “Blocked”) or not – Whether a process has been swapped out of main memory (is “Suspended”) or not • =Four combined states – “Ready”: the process is in memory and available for execution – “Blocked”: the process is in main memory awaiting an event – “Suspended Blocked”: the process is in secondary memory and awaiting an event – “Suspended Ready”: the process is in secondary memory but is available for execution as soon as it is loaded into memory
  • 39. 39 Process Suspension • Note: Release of memory by swapping is not the only motivation for suspending processes. • Various background processes may also be turned off and on, depending on CPU load, suspicion of a problem, some periodical timer or by user request.
  • 40. 40 Operating System Control Structures • The O/S has to multiplex resources to the processes • To do this, the O/S must keep information about the current status of each process and resource • Tables are constructed for each entity the operating system manages
  • 41. 41 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
  • 42. 42 I/O Tables • 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
  • 43. 43 File Tables • Existence of files • Location on secondary memory • Current Status • Attributes • Sometimes this information is maintained by a file management system
  • 44. 44 Process Table • Where process is located • Attributes in the process control block – Program – Data – Stack
  • 45. 45 Memory Devices Files Processes Process 1 Memory Tables Process Image Process 1 Process Image Process n I/O Tables File Tables Figure 3.11 General Structure of Operating System Control Tables Primary Process Table Process 2 Process 3 Process n
  • 46. 46 Process Control Block • 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
  • 47. 47 Process Control Block • 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.
  • 48. 48 Process Control Block • Processor State Information – Control and Status Registers These are a variety of processor registers that are employed to control the operation of the processor. These include • Program counter: Contains the address of the next instruction to be fetched • Condition codes: Result of the most recent arithmetic or logical operation (e.g., sign, zero, carry, equal, overflow) • Status information: Includes interrupt enabled/disabled flags, execution mode
  • 49. 49 Process Control Block • Processor State Information – Stack Pointers • Each process has one or more last-in-first-out (LIFO) system stacks associated with it. A stack is used to store parameters and calling addresses for procedure and system calls. The stack pointer points to the top of the stack.
  • 50. 50 Process Control Block • Process Control Information – Scheduling and State Information This is information that is needed by the operating system to perform its scheduling function. Typical items of information: •Process state: defines the readiness of the process to be scheduled for execution (e.g., running, ready, waiting, halted). •Priority: One or more fields may be used to describe the scheduling priority of the process. In some systems, several values are required (e.g., default, current, highest-allowable) •Scheduling-related information: This will depend on the scheduling algorithm used. Examples are the amount of time that the process has been waiting and the amount of time that the process executed the last time it was running. •Event: Identity of event the process is awaiting before it can be resumed
  • 51. 51 Process Control Block • Process Control Information – Data Structuring • A process may be linked to other process in a queue, ring, or some other structure. For example, all processes in a waiting state for a particular priority level may be linked in a queue. A process may exhibit a parent-child (creator-created) relationship with another process. The process control block may contain pointers to other processes to support these structures.
  • 52. 52 Process Control Block • Process Control Information – Interprocess Communication • Various flags, signals, and messages may be associated with communication between two independent processes. Some or all of this information may be maintained in the process control block. – 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.
  • 53. 53 Process Control Block • Process Control Information – Memory Management • This section may include pointers to segment and/or page tables that describe the virtual memory assigned to this process. – Resource Ownership and Utilization • Resources controlled by the process may be indicated, such as opened files. A history of utilization of the processor or other resources may also be included; this information may be needed by the scheduler.
  • 54. 54
  • 55. 55
  • 56. 56
  • 57. 57
  • 58. 58
  • 59. 59
  • 60. 60
  • 61. 61
  • 62. 62 Execution of the Operating System • Non-process Kernel – Execute kernel outside of any process – Operating system code is executed as a separate entity that operates in privileged mode • Execution Within User Processes – Operating system software within context of a user process – Process executes in privileged mode when executing operating system code