0% found this document useful (0 votes)
8 views19 pages

Assignment 4449432

Uploaded by

cheriyanlijin123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views19 pages

Assignment 4449432

Uploaded by

cheriyanlijin123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Process Chapter

Assignment 4
WAP to create 3 child process from
the same parent
• Pre- requisites:-
 Knowledge about system calls
 Knowledge about process
 Working of fork & wait system calls

• Objective
 To understand how to use fork system calls
Assignment 4
Requirements:-
1. Create 3 child process from the same parent.
Assignment 4
Requirements:-
1. Create 3 child process from the same parent.

Parent
Assignment 4
Requirements:-
1. Create 3 child process from the same parent.

Parent

Child1 Parent
Assignment 4
Requirements:-
1. Create 3 child process from the same parent.

Parent

Child1 Parent

Child2 Parent
Assignment 4
Requirements:-
1. Create 3 child process from the same parent.

Parent

Child1 Parent

Child2 Parent

Child3 Parent
Assignment 4
Requirements:-
2. Parent has to wait for all the three child process.
Explanation:- Which means parent should not die until
all the three child finishes the execution.
3. Print exit status of each child when they
terminates
Assignment 4
Sample output
Child1 with pid 2020 created
Child2 with pid 2021 created
Child3 with pid 2022 created
Child 2020 is terminated with code 0
Child 2021 is terminated with code 0
Child 2022 is terminated with code 0
Assignment 4
Sample Output:-

• Creation of Child process


Assignment 4
Sample Output:-
Parent pid 2019
Parent
Assignment 4
Sample Output:-
Parent pid 2019
Parent

Child1 with
pid 2020 Child1 Parent
created
Assignment 4
Sample Output:-
Parent pid 2019
Parent

Child1 with
pid 2020 Child1 Parent
created

Child2 with pid Child2 Parent


2021 created
Assignment 4
Sample Output:-
Parent pid 2019
Parent

Child1 with
pid 2020 Child1 Parent
created

Child2 with pid Child2 Parent


2021 created

Child3 Parent
Child3 with pid 2022 created
Assignment 4
Sample output
Parent pid 2019
Parent

Child1 Parent

Child2 Parent

Let’s wait for


Termination of Child3 Parent
the child process
Assignment 4
Sample output
Parent pid 2019
Parent
Child 2020 is
terminated Child1 Parent
with code 0

Child2 Parent

Child3 Parent
Assignment 4
Sample output
Parent pid 2019
Parent
Child 2020 is
terminated Child1 Parent
with code 0

Child 2021 is Child2 Parent


terminated
with code 0
Child3 Parent
Assignment 4
Sample output
Parent pid 2019
Parent
Child 2020 is
terminated Child1 Parent
with code 0

Child 2021 is Child2 Parent


terminated
with code 0
Child 2022 is Child3 Parent
terminated
with code 0
Assignment 4

Sample output: -
Child1 with pid 2020 created
Child2 with pid 2021 created
Child3 with pid 2022 created
Child 2020 is terminated with code 0
Child 2021 is terminated with code 0
Child 2022 is terminated with code 0

You might also like