All Exams Test series for 1 year @ ₹349 only
Question

_________ and _________ are used in conjunction for making a complete process subroutine.

The correct answer is
fork(), join()

Question Type: This question tests knowledge of process management in operating systems, specifically focusing on the use of system calls for creating and managing processes.

Step-by-Step Logic:

  • fork(): The fork() system call is used to create a new process, which is a copy of the parent process. After a successful fork(), the parent and child processes both continue execution from the point of the fork() call.
  • join(): The join() system call (or a similar mechanism depending on the operating system) allows a parent process to wait for the termination of a child process before continuing its own execution. This ensures that the parent process doesn't proceed until the child process completes its task.
  • Complete Process Subroutine: A complete process subroutine implies that a parent process initiates a child process (using fork()) to perform a specific task, and the parent process waits for the child process to finish before continuing (using join() or an equivalent). This is a fundamental pattern in concurrent programming to ensure proper synchronization and order of execution.

Core Logic/Pattern: The core logic lies in the understanding of how fork() creates a new process and how join() synchronizes the parent and child process executions. They are used together to build complete process subroutines.

Eliminate Incorrect Options:

  • Option 2 (fork(), sleep()): sleep() pauses the execution of a process for a specified time. It doesn't coordinate the completion of a child process.
  • Option 3 (sleep(), join()): sleep() alone doesn't initiate a child process. join() needs a process to wait for.
  • Option 4 (join(), fork()): The order is incorrect. You need to create the child process (fork()) *before* waiting for its completion (join()).

Correct Answer: Option 1 (fork(), join()) is correct because it demonstrates the standard pattern for creating and synchronizing the execution of a child process within a parent process subroutine.

Was this answer helpful?

Important Questions from Process

  1. A computer system has 7 tape drives. There are ‘n’ processes competing for them. Each process may need 2 tape drives. What is the maximum value of ‘n’ for which the system is guaranteed to be deadlock free?

  2. Identify the circumstances under which pre-emptive CPU scheduling is used:

    (a) A process switches from Running state to Ready state

    (b) A process switches from Waiting state to Ready state

    (c) A process completes its execution

    (d) A process switches from Ready to Waiting state

    Choose the correct option:

  3. Match List I with List II

    List I

    List II

    System calls

    Description

    A.

    fork()

    I.

    Sends a signal from one process to another process

    B.

    exec()

    II.

    Indicates termination of the current process

    C.

    kill()

    III.

    Loads the specified program in the memory

    D.

    exit()

    IV.

    Creates a child process

    Choose the correct answer from the options given below :

  4. Assuming that the system call fork () never fails, consider the following C programs P1 and P2 executed on a UNIX / Linux system:

    /*P1*/

    Int main() {

    fork ():

    fork () ;

    fork () ;

    Printf(“Happy\n”);

    }

    /*P2*/

    Int main() {

    fork ();

    Printf(“Happy\n”);

    fork ()

    Printf(“Happy\n”);

    fork () ;

    Printf(“Happy\n”);

    }

    Statement I: P1 displays "Happy" 8 times.

    Statement II: P2 displays "Happy" 12 times.

    In the light of the above statements, choose the correct answer from the options given below

  5. ________ system call creates new process in Unix.

Need Expert Advice?

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App