Unit4 - Subjective Questions

CSE325 • Practice Questions with Detailed Answers

1

Explain the fork() system call with respect to process creation. What are its possible return values?

2

Differentiate between the fork() and exec() system calls.

3

What is a Zombie Process? How is it created and how can it be removed from the system?

4

Describe the concept of an Orphan Process. What happens to an orphan process in a Linux/Unix system?

5

Derive the number of processes created by a program containing consecutive fork() system calls. Provide an example with .

6

Explain the purpose of the wait() system call. What information does it provide to the parent process?

7

Discuss the exec() family of functions. List at least four variants and explain the meaning of the suffixes (l, v, p, e).

8

What are Signals in an operating system? Name three common signals and their default actions.

9

Write a C code snippet to demonstrate the creation of an Orphan Process.

10

Write a C code snippet to demonstrate the creation of a Zombie Process.

11

How does waitpid() differ from the standard wait() system call? Explain the significance of the pid argument in waitpid().

12

Explain the concept of Copy-on-Write (COW) in the context of the fork() system call.

13

Explain the use of the kill() system call. What are its arguments?

14

What macros are used to interpret the status integer returned by wait()? Explain WIFEXITED and WEXITSTATUS.

15

Compare the Default Action, Ignoring, and Handling (Catching) of signals.

16

Explain the role of the signal() system call with a syntax example.

17

A process executes the following code:
c
fork();
fork();
execlp("echo", "echo", "Hello", NULL);
fork();

How many times will "Hello" be printed? Explain your reasoning.

18

How does a shell (like bash) use fork(), exec(), and wait() to execute a command typed by the user?

19

What is the SIGCHLD signal? When is it generated and how should a parent process handle it?

20

Distinguish between getpid() and getppid().