Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Experiment 5- Processes Management using System Calls

Aim: To introduce the concept of creating a new child process, performing


operations on processes and working with orphan and zombie processes.

Lab Exercise(s):

1. Write a program using systems for operations on processes to create a


hierarchy of processes P1->P2->P3.Also print the id and parent id for
each process.

Output:
2. Write a program using system calls for operation on processes to
create a hierarchy of processes. Also, simulate process p4 as orphan
and p5 as zombie.

Output:
3. Write a program using system calls for operation on processes to
create a hierarchy of processes. Also, simulate process p4 as orphan
process and p7 as a zombie.

Viva Questions:
1. What is the difference between orphan and zombie processes?
An orphan process is formed when it's parent dies while the process
continues to execute, while zombie process is a process which has
terminated but it's entry is there in the system.

2. How many child processes will be created if three consecutive fork


statements are used in a main function.
This creates four additional processes.

3. In case of p=fork(), which process will be executed is p>0.


Zero: if it is the child process (the process created). Positive value: if it is
the parent process. Negative value: if an error occurred.
4. In case of p=fork(), which process will be executed is p<0.
Zero: if it is the child process (the process created). Positive value: if it is
the parent process. Negative value: if an error occurred.

5. Which system call causes the parent process to stop until the child
completes the execution.
The wait system call blocks the caller until one of its child process
terminates. If the caller doesn't have any child processes, wait returns
immediately without blocking the caller. Using wait the parent can obtain
the exit status of the terminated child.

6. What is the function of an excel system call?


This system call runs an executable file in the context of an already
running process. It replaces the previous executable file.

You might also like