GATE CS 2021 Set 1 — Question 24
Go beyond PYQs with Success TrackerAI-powered personalised practice and doubt support. Unlimited practice on eligible plans; AI usage limits apply.MSQ+1 / -0MediumSystem CallsOS Structure & System CallsOperating System
Operating System → OS Structure & System Calls → System Calls
Last updated
Question
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?
Correct answer
(A) exit; (C) sleep
Solution
A system call is a mechanism for a user-level process to request a service from the operating system's kernel.
- (A) exit: The
exit()function terminates the process. This requires kernel intervention to deallocate resources (memory, file descriptors, process control block, etc.) and update system-wide data structures. Therefore,exit()must make a system call (e.g.,exitorexit_groupin Linux). - (B) malloc: The
malloc()function is a C library function for dynamic memory allocation. It manages a region of memory on the heap for the process. It requests large chunks of memory from the kernel using system calls likebrkormmapand then dispenses smaller pieces to the application from this pool. If a suitable free block is already available in its managed pool,malloc()can satisfy a request without making a system call. A system call is only made when the library's internal pool is exhausted and needs to be expanded. Thus,malloc()does not always invoke a system call. - (C) sleep: The
sleep()function suspends the process's execution for a specified duration. Process scheduling (putting a process to sleep and waking it up) is a fundamental kernel responsibility. The process must make a request to the kernel to be removed from the ready queue and be woken up later. This always requires a system call (e.g.,nanosleep). - (D) strlen: The
strlen()function computes the length of a string. The string resides in the process's own address space. The function simply reads memory from the starting address until it finds a null terminator. This entire operation is performed in user space and does not require any kernel services. Thus,strlen()never invokes a system call.
exit and sleep are the functions that will always invoke a system call.Continue learning with Success Tracker
A step still unclear? Work through it with support
Use Success Tracker to ask about the reasoning, then try another GATE CS question to check your understanding.
AI-powered practice· Unlimited practice on eligible plans
- PYQs with solutions
- Attempt available previous-year questions, then compare your reasoning with the worked solution. Coverage varies by stream.
- Practice that adapts
- Choose a topic, work on weaker areas and bookmark questions to revisit. Your attempts feed your progress tracking.
- AI doubt support
- Ask follow-up questions about a step or concept while practising, instead of stopping at the final answer.
Unlimited practice is available on eligible plans. Free practice and AI usage have limits; check the current plan allowances before choosing.
This page stays readable without an account. AI responses can be wrong; check them against the solution and source material.
More questions on OS Structure & System Calls
2026 Set 2 Q23Which one of the following CPU scheduling algorithms cannot be preemptive?2026 Set 1 Q29With respect to deadlocks in an operating system, which of the following statements is/are FALSE?2026 Set 1 Q31In the context of relational database normalization, which of the following statements is/are true?2026 Set 1 Q35Consider a system consisting of instances of a resource , being shared by 5 processes.…2026 Set 2 Q51Consider three processes P1, P2, and P3 running identical code, as shown in the pseudocode below. A…