Question
1. Use Internet sources and give an overview of the command that is used in Windows for creating a process. 2. In a Unix environment,
1. Use Internet sources and give an overview of the command that is used in Windows for creating a process.
2. In a Unix environment, execute parent.c, child.c and orphan.c as follows:
Note: upload first the 3 files in your venus home directory.
child and parent:
- compile the child and parent:
gcc parent.c o parent
gcc child.c o child
- run the parent in the current directory (the parent after the fork will call the child)
Dont worry about warning messages.
./parent
orphan:
- compile and run the orphan:
gcc orphan.c o orphan
./orphan
Observe and understand the programs execution output.
Extensively comment the output of the programs by relating the theory discussed in class, the meaning of the covered commands and the program listings.
3. Write a very simple program that will show the possibility of having zombie processes.
Write a program named zombie.c
The main process will create a child.
The child prints something like: I am the child with pid .. and my parent has ppid .
Next, the child will sleep for 1 second.
Child exits.
The parent will print: I am the parent and my id is Next, the parent sleeps for 30 seconds.
Since the child ends first, and the parent didnt do wait( ), the child will be for a while in the zombie state. Run the parent in the background, so you can use the top command and identify the zombie, before the parent terminates.
Note: even if the parent terminates, the child is still a zombie. However the the init process reaps the zombies frequently.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started