logo

Crowdly

Browser

Додати до Chrome

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

✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.

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. 

Більше питань подібних до цього

Хочете миттєвий доступ до всіх перевірених відповідей на moovit.vit.ac.in?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!

Browser

Додати до Chrome