Step 1: Identify operations that require kernel services.
A system call is invoked when a function must interact with the operating
system kernel, such as for process control, scheduling, or resource management.
Step 2: Examine each function.
exit:
Terminating a process requires notifying the kernel and releasing process
resources. Hence, exit always invokes a system call.
sleep:
Suspending a process and rescheduling it after a time interval requires kernel
involvement. Therefore, sleep always invokes a system call.
malloc:
Memory allocation is typically handled in user space using the heap.
A system call is made only when additional memory is required from the OS,
so it does not always invoke a system call.
strlen:
This function simply computes the length of a string in user space and never
requires kernel interaction.
Final Conclusion:
The functions that always invoke system calls are:
exit and sleep