________ system call creates new process in Unix.
fork
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.
The fork() system call is the primary method for creating new processes in Unix. When fork() is called:
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.
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().
| 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 |
| 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. |
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.
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?
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:
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 :
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
The processes that are residing in main memory and are ready and waiting to be executed, are kept on a list called