You are on page 1of 26

Group 4

Võ Hồ Quốc Huy

Triệu Gia Khiêm

Đoàn Nguyễn Khánh Đăng


CHAPTER 4:
PROCESS
MANAGEMENT
TABLE OF CONTENTS

01 02 03

Process concepts Coordination of Communication


processes between processes

04 05

Synchronize processes Deadlock


01.
Process concepts
Process
The process is a processing program

 Each process has an address space, a command pointer, a


separate set of registers and stacks.

 The process may require some resources such as


CPU,main memory, files and I/O devices.

 The operating system uses a scheduler to determine


when to stop the processing of the processing process
and select the next process to be performed.

 In the system, there are processes of the operating


system and the users.
Purpose for multiple processes working
simultaneously

 Increased CPU usage performance(increased


multichapter level)

 Increased multitasking level

 Increase processing speed


Increased CPU usage performance
(increased multi-chapter level)
 Most of the execution processes undergo many processing cycles
(using CPU) and I/O cycles (using I/O devices) alternating as follows :

CPU IO CPU IO CPU

 If there is only 1 process in the system, then in the IO cycles of the process,
the CPU will be completely idle. The idea of increasing the number of
processes in the system is to utilize the CPU: if process 1 execute IO, then the
operating system can use the CPU to perform process 2 ...
Tiến trình 1:
CPU IO CPU IO CPU

Tiến trình 2:
CPU IO CPU IO
Increased multitasking level

 For each process to rotate in a very short time, giving the impression
that the system has many processes executing simultaneously.
One program counter A

Process
B
Process Four program counter
A switch C
D
B

B C D
A
C
Time
D
Increase processing speed

 Some problems can be processed in parallel, if built


into many units operating at the same time, it will
save processing time.

 For example, consider the calculation of expression


value kq = a * b + c * d. If (a * b) and (c * d) are
performed concurrently, the processing time will be
shorter than a sequential execution.
Thread
 A process can create multiple threads.

 Each thread performs a function and executes it


simultaneously by sharing the CPU.

 Threads in the same process share process address


space but have their own instruction pointers, set of
registers, and stack.

 A thread can also create sub-threads, and take


different states as a process..
Communication between threads
 Processes can communicate with each other only
through mechanisms provided by the operating
system.

 Threads communicate easily through the process's


global variables.

 Threads can be managed by the operating system or


by the operating system and process jointly
managedand take different states as a process.. process
process process process

User
Space

thread Thread
Kemel
Space Kemel Kemel
Thread Example

disk
Thread Example
 A process has three threads, each thread has its own stack
Thread Installation

 Installation in Kernel-space
 Installation in User-space
 Installation in Kernel-space and User-space
Thread Installation in Kernel – space

 The thread table is stored in the Kernel-space.


 Threads are coordinated by the operating
system.
Thread installation in Kernel-space and User-
space

 An operating system thread manages several threads of the process


Thread Installation in User-space

 The thread table is stored in the User-space.


 Threads are coordinated by the process itself.
Thread coordination example

 quantum of process=50 msec


 quantum of thread=5 msec
 Process A has 3 threads, Process B has 4 threads.
Process states
Process management involves overseeing the execution of programs on a
computer system. The fundamental states of a process include:
● New: The process is being created
● Running: Instructions are being executed
● Waiting: The process is waiting for some event to occur
● Ready: The process is waiting to be assigned to a processor
● Terminated: The process has finished execution
Processing mode of the process

Two processing mode:

 Privileged mode allows


access to all parts of the
system and execution of
privileged instructions.

 Non-privileged mode
restricts access and
cannot execute
privileged instructions.
Data structure of process control block
 Process control block (PCB): is a
memory area the stores
descriptive information for the
process:
 Process identifier (1)
 Process status (2)
 Context of the process (3)

 CPU status, Processor, User


resources, Created resource
 Communication information (4):

 Parent process, Child


process, Prority
 Statistical information (5)
Operations on processes
 Create process (create): Involves initiating a new process, allocating
necessary resources, and initializing data structures.
 Destroy process (destroy): Terminates a process and releases associated
resources, including memory and file handles.
 Suspend process (suspend): Temporarily halts a process's execution,
preserving its state in memory.
 Resume process (resume): Restarts the execution of a suspended process,
allowing it to continue from where it was suspended.
 Change process priority (change process ): Adjusts the priority level of a
process, influencing its scheduling and resource allocation within the
system.
Create process (create)
 Identify for new process
 Put the process into the management list of the system
 Determine the priority for the process
 Create PCB for the process
 Allocate initial resources for the process
Destroy process (destroy)
 Revoke system resources allocated of the process
 Destroy the process from all system management lists
 Destroy the PCB of the process
Allocate resources for the process

 The objectives of the allocation technique:

 Ensuring a valid number of concurrent access processes to non-shared resources.

 Allocating resources for the process required during an acceptable delay

 Optimize resource use


Thanks

CREDITS: This presentation template was created by


Slidesgo, including icons by Flaticon, infographics &
images by Freepik

You might also like