logo

Crowdly

Browser

Add to Chrome

Q1. Write a program to simulate Zombie process creation.  Create a child p...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

Q1. Write a program to simulate Zombie process creation. 

  • Create a child process that executes a simple task (e.g., a loop for a few seconds printing something) and then terminates using exit().

  • The parent process should not immediately call wait() or waitpid(). Instead, it should sleep for a longer duration, allowing the child to terminate first.

  • During this interval, use the system("ps -l") command to display the process states, demonstrating that the terminated child has become a zombie process (marked with Z or <defunct>).

  • After observing the zombie state, the parent should call wait() to reap the child process and print a confirmation message. 

Q2. Consider the following set of processes.

Process IDArrival Time (ms)PriorityCPU Burst TimeIO Burst Time
P102527
P214448
P321833
P4331242
P540336

Write a program to simulate Non-Preemptive Shortest Job First (SJF) scheduling algorithm . The program must output the following:

  • A Gantt chart or a chronological log showing the execution sequence of processes on the CPU or order of Process execution.

  • For each process (P1 to P5), calculate and display:

    • Finish Time: The time at which the process completes its final CPU burst.

    • Turnaround Time: (Finish Time - Arrival Time).

    • Waiting Time: The total time a process spends in the ready queue waiting for the CPU.

    • CPU Utilization

  • Finally, calculate and display the average Turnaround Time and average Waiting Time and no. of context switches. 

More questions like this

Want instant access to all verified answers on moovit.vit.ac.in?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome