The GATE Grind

GATE 2021 CS – Question 24

Operating System · System Calls, Processes, Threads and IPC · 1 mark · Multiple select

Which of the following standard C library functions will always invoke a system call when executed from a single-threaded process in a UNIX/Linux operating system?

  1. exit
  2. malloc
  3. sleep
  4. strlen

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (A) exit; (C) sleep

Explanation

exit ends with the _exit system call and sleep uses nanosleep/alarm-type calls. malloc may serve requests from already-mapped heap memory, and strlen is pure user-space code.