In Linux Operating System, when ___________is invoked, it is passed a set of…
2022
In Linux Operating System, when ___________is invoked, it is passed a set of flags that determine how much sharing is to take place between the parent and child tasks.
- A.
fork()
- B.
clone()
- C.
pthread()
- D.
thread ()
Attempted by 115 students.
Show answer & explanation
Correct answer: B
Answer: clone() — the Linux kernel call that accepts flags to control resource sharing between parent and child.
Why clone() is correct:
clone() accepts flags (for example CLONE_VM, CLONE_FILES, CLONE_FS, CLONE_SIGHAND, CLONE_THREAD) that determine which resources are shared or copied between the parent and child.
By combining these flags, the caller can create a full separate process or create a thread-like entity that shares memory, file descriptors, or other attributes.
Why the other choices are incorrect:
fork() duplicates the calling process to create a child with its own separate memory and resources; it does not take the clone-style flags to selectively share resources.
pthread() is not a standard POSIX function name. The POSIX threads API uses functions such as pthread_create at the library level; these are not kernel calls that take clone-like sharing flags.
thread() is not a standard Linux or POSIX system call name for creating processes or threads and is therefore not the correct kernel interface that accepts sharing flags.
Summary: use clone() when you need fine-grained control over what the child shares with the parent; fork() creates a separate process without those flags, and pthread/thread names refer to higher-level or nonstandard interfaces.
A video solution is available for this question — log in and enroll to watch it.