Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to know what is the difference between a Library call and a System call in Linux. Any pointers for a good understanding of the concepts behind both will be greatly appreciated.

share|improve this question
up vote 8 down vote accepted

There's not really such a thing as a "library call". You can call a function that's linked to a shared library. And that just means that the library path is looked up at runtime to determine the location of the function to call.

System calls are low level kernel calls handled by the kernel.

share|improve this answer
So if somebody ask the above question i can interpret it as the difference between a System call and a Function Call. – Sen Feb 5 '11 at 10:16
"man ltrace" gives my "A library call tracer" :) – ysdx Aug 31 '15 at 13:09

If you type man man in your shell, you will see the list of the manual sections

2 System calls (functions provided by the kernel)

3 Library calls (functions within program libraries)

For instance, you will find chmod in the section 2 of the manual when typing man chmod. And fprintf in the section 3.

share|improve this answer

System calls are handled directly by the kernel.

Library calls are handled by a dynamic library. The program making the library call must first import that library, before the call will work. The library calls themselves may use system calls.

Sometimes libraries are provided as "front-ends" to system calls, to provide extra functionality or ease of use not provided by the kernel.

share|improve this answer

System calls are functions that the operating system provides for applications to use. Whereas functions like the ones in math.h, string.h, etc are those that doesn't have anything to do with interfacing with the operating system.

share|improve this answer

Basically there are two modes of linux kernel viz.

  1. User mode,
  2. Kernel mode.

Any linux kernel switches itself back and forth between these two modes. Generally, Library calls get executed in User mode and System calls get executed in Kernel mode. In operating system terms, Kernel mode is Atomic in nature and its in Supervisory mode. Almost all Library calls need help from the kernel to perform its tasks. Each library call in turn calls underlying system call. Let us make idea more clearer using following example

  1. fopen() : is a Library call,
  2. open() : is a System call.

Whenever in c program, you use fopen() from header file. Programming environment calls system call open() from kernel and perform its file opening task. Again after executing, control flow return to user mode.

To illustrate this perform following tasks

  1. man man: here you will find manual section from 1-8 each has specific purpose.
  2. Do man fopen : you will see respose as FOPEN(3), here 3 indicate manual section 3 of man pages which is c-library calls section.
  3. Do man open : you will see respose as OPEN(2), here 2 indicate manual section 2 of man pages which is system calls section.

    Hope you understood the concept.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.