Chapter3_ProcessConcept-Operation_on_Processes.pptx

SaraZara10 14 views 16 slides Mar 03, 2025
Slide 1
Slide 1 of 16
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16

About This Presentation

ppt for the student


Slide Content

processes OUTLINE Process Concept Process Scheduling Operations on Processes Inter-process Communication Examples of IPC Systems Communication in Client-Server Systems

Fork( ) ?

Fork( ) ?

Fork( ) ?

Fork( ) ?

Fork( ) ?

Fork( ) ?

Fork( ) ?

Fork( ) ?

Process creation A process may create several processes during the execution. Creating process is called a parent and a created process is called a child . Parent process create children process, which, in turn create other processes, forming a tree of processes Generally, process identified and managed via a process identifier ( pid )

Process creation: fork() Creates a child process. Child process contains exact copy of the memory space of the parent process. Child process contains the same text/code section but executes independently

Exec() Exec is a collection of function e.g., execlp () , ececve () , execl () , are use to execute any program/script. Typically exec used after a fork() by child process to replace the memory space with a new program. PID does not change but the data, heap, and stack of the child are replace by new program

Process creation (cont..) Fork( ) system call creates new process Exec( ) system call used after fork to replace the process memory space with a new program.

Process Termination Process executes last statement and asks the operating system to delete it (exit) Process resources are deallocated by operating system Parent may terminate execution of children processes (abort). Task assigned to child is no longer required If parent is exiting Some operating system do not allow to continue if its parent terminates All children terminated – cascading termination.

15 Execution Trace: fork() RAM CPU Kernel stack data text …. n=fork(); If (n == 0) .. else if (n>0) ... PC PCB-Parent Process-Parent x pid PC n sys_fork() {….} PC y pid PCB-Child text Process-Child n stack data …. n=fork(); If (n == 0) .. else if (n>0) ... y

16 Execution Trace: fork() with execlp() RAM CPU Kernel stack data text …. n=fork(); If (n == 0) …exec() else if (n>0) ... PC PCB-Parent Process-Parent x pid PC n sys_fork() {….} PC y pid PCB-Child text Process-Child n stack data …. n=fork(); If (n == 0) …exec() else if (n>0) ... y sys_execve() {….} new code