Kernel Development – APIs Without System Calls

kernelsystem-calls

The book 'Understanding Linux Kernel' says that 'for something abstract such as math functions, there may be no reason to make system calls'. Can any one please explain how is a system call not required in math functions? Isn't the CPU involved in mathematical operations? Can anyone give an example of such a program?

Best Answer

I don't have that book to check, but I assuming its using the normal meaning of system calls, then a system call is a call into the kernel to perform some operation the hardware considers privileged, or is unaware of. This is used to enforce permissions, etc. on the system. So you need to make a system call to (among many other things):

  • read from a file (the kernel must check that the permissions allow you to read from said file, and then the kernel carries out the actual instructions to the disk to read the file)
  • signal a process (processes do not exist as far as the hardware is concerned, they are an abstraction provided by the kernel, etc.)
  • obtain additional memory (the kernel must make sure you don't exceed the ulimit, make sure two processes don't claim the same RAM, etc.)

Math is not one of those things. Typically, it requires no intervention from the kernel.

Related Question