Computer Science, asked by Dion8702, 1 year ago

In UNIX(), the fork () system call returns
(1) a value of () to the child process
(2) he process ID of the child process to the parent process
(3) a value of -l to the parent process if no child process is created
(4) all of the above

Answers

Answered by hemangihhh
2

The fork() creates a copy of the process that was executing. The fork() is called once but returns twice (once in the parent and once in the child). The line PID = fork(); returns the value of the fork() system call. The if (PID == 0) evaluates the return value.

Answered by Jasleen0599
0

(4) all of the above

  • The fork system call in Unix returns a value of zero for the child process and a non-zero value for the parent process, according to the description. A fork system call gives the parent the PID of a newly generated (child) process and gives the newly created (child) process a return value of 0.
  • Just as the name suggests, a system call asks the operating system to carry out a task on behalf of the user's software. The kernel itself uses the system calls as functions. The system call looks to the programmer as a typical C function call.
  • There must be a method to switch a process from user mode to kernel mode, though, as a system call runs code in the kernel.
  • The system call names are predefined functions in the C library that are used by the C compiler.
  • A new process known as a "child process" is created with the fork system function and runs concurrently with the process that invoked fork() (parent process). Both processes will carry out the subsequent instruction following the fork() system call once a new child process has been formed.

#SPJ3

Similar questions