0% found this document useful (0 votes)
12 views1 page

Operating System Process Management Tasks

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)
12 views1 page

Operating System Process Management Tasks

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

Operating System Lab Assignment

Part B – Short Coding Questions

Q1. Write a program to create a child process using fork() and print the PIDs of both parent and
child.

Q2. Write a program where the parent waits for the child to finish using wait().

Q3. Write a program in which the child process terminates using exit(0) and the parent prints a
message after child completion.

Q4. Write a program where the child prints numbers from 1 to 5, and the parent waits for the child
before printing its own message.

Q5. Modify the above program so that the parent does NOT wait for the child. Observe the output
difference.

Q6. Write a program where the parent creates two child processes and waits for both of them to
finish.

Q7. Write a program that demonstrates the creation of a zombie process.

Q8. Write a program that demonstrates the creation of an orphan process.

You might also like