GATE / CS ARCHIVE

GATE CSE 2021 SET 1 / QUESTION 14

GATE CSE 2021 Set 1 Q14

Operating Systems · Processes, Threads & System Calls · Full GATE CSE 2021 Set 1 paper

GATE 2021 Set 1, Q14 1 mark · MSQ
Report issue

Processes, Threads & System Calls

Question 14, GATE 2021: Which standard C library functions always invoke a system call when executed by a single-threaded UNIX/Linux process? Select all: A exit; B malloc; C sleep; D strlen.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A; C

Normal process termination through exit eventually asks the kernel to terminate the process. A blocking sleep asks the kernel to suspend execution and arrange resumption. malloc can satisfy a request from existing user-space heap storage, and strlen scans user-space memory, so neither always needs a system call. Thus A, C in the ordinary UNIX/Linux library execution model. This is a systems-interface question, not a claim about abnormal nonreturning exit handlers or arbitrary replacement libraries.

Library routines are not synonymous with system calls. strlen needs only reads of its argument up to the terminating zero byte. malloc commonly obtains a larger region once, then fulfills many allocations from its own free lists without entering the kernel. In contrast, normal process exit changes kernel process state, and a blocking sleep requires kernel scheduling/timer support. The exam's 'always' language is interpreted under these normal library semantics.

Original paper, page 18 · Answer key