Question

    Standard C library functions will always invoke a system call when executed from a single-threaded process in a UNIX/Linux operating system?

    A Sleep Correct Answer Incorrect Answer
    B Malloc Correct Answer Incorrect Answer
    C Exit Correct Answer Incorrect Answer
    D Both 1 and 3 Correct Answer Incorrect Answer
    E None of these Correct Answer Incorrect Answer

    Solution

    exit C library functions - Terminates the process normally, performing the regular cleanup for terminating programs. malloc - This is a function defined in standard C library and it does not always invoke the system call. When a process is created, 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. sleep - This is not even standard C library function, it is a POSIX standard c library function which always invokes the system call.

    Practice Next
    ×
    ×