Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
542 views
in Computer by (106k points)
closed by
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. strlen
2. malloc
3. exit
4. sleep

1 Answer

0 votes
by (103k points)
selected by
 
Best answer
Correct Answer - Option :

strlen:

This is a function defined in the standard C library and doesn’t require any system call to perform its function of calculating the string length.

malloc: 

This is a function defined in the standard C library and it does not always invoke the system call. When a process is created, a certain amount of heap memory is already allocated to it, when required to expand or shrink that memory, it internally uses sbrk/brk system call on Unix/Linux

exit:

This is a function defined in standard C library and it always invokes system call every time, flushes the streams, and terminates the caller.

sleep:

This is not even a standard C library function, it is a POSIX standard c library function. Unix and Windows use different header files for it.

Therefore option 3 and 4 are correct options

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...