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

________ system call creates new process in Unix.

The correct answer is

fork

Understanding Unix Process Creation System Calls

In Unix-like operating systems, processes are fundamental units of execution. Creating a new process is a common operation, and it is typically done through a specific system call provided by the kernel. A system call is the mechanism used by a program to request a service from the operating system's kernel.

Let's examine the options provided in the question about the system call used to create a new process in Unix.

Analyzing the Options for Unix Process Creation

  • fork: This is a standard system call in Unix-like systems. The fork() system call creates a new process by duplicating the calling process. The new process, called the child process, is an exact copy of the parent process, except for a few distinctions.
  • fork new: This is not a standard or recognized system call in Unix for process creation. The primary system call is simply fork.
  • create: While the concept of "create" exists in operating systems, create is not the standard Unix system call name for creating a process. System calls often have specific, sometimes less intuitive, names.
  • create new: Similar to the previous option, this is not a standard Unix system call name for creating a new process.

The Role of the fork() System Call

The fork() system call is the primary method for creating new processes in Unix. When fork() is called:

  • A new process (the child) is created.
  • The child process is a copy of the parent process. It inherits the parent's memory image, open files, environment variables, and other attributes.
  • After a successful fork() call, both the parent and child processes continue execution from the instruction immediately following the fork() call.
  • fork() returns a value to distinguish between the parent and child processes. It returns 0 to the child process and the process ID (PID) of the child process to the parent process. A negative value indicates an error.

Often, a fork() call is followed by an exec() system call in the child process. The exec() family of system calls replaces the current process image with a new program, allowing the child process to run a different program than the parent.

Conclusion on Unix Process Creation

Based on the standard Unix operating system functionalities, the system call specifically designed to create a new process by duplicating the existing one is fork().

Unix Process Creation System Call
System Call Purpose Standard in Unix?
fork() Creates a new process (child) as a copy of the caller (parent). Yes
fork new N/A No
create N/A (Not standard name for process creation) No
create new N/A No

Revision Table: Key Unix System Calls

Common Unix System Calls
System Call Description
fork() Create a new process.
exec() Replace the current process image with a new program.
wait()/waitpid() Wait for a child process to terminate.
exit() Terminate the current process.
getpid() Get the process ID of the current process.
getppid() Get the process ID of the parent process.

Additional Information: Process Concept in Unix

A process in Unix is an instance of a program in execution. It includes the program code, data, stack, and other resources like open files and signal handlers. Each process has a unique Process ID (PID). Processes form a hierarchy, typically starting with the init process (or systemd in modern systems), which is the ancestor of all other processes. The fork() system call is the primary way this hierarchy is extended.

The separation of fork() (creating a copy) and exec() (loading a new program) is a unique and powerful design feature of Unix, allowing for operations like shell scripting, process pipelines, and daemon creation.

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. The processes that are residing in main memory and are ready and waiting to be executed, are kept on a list called

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