Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

4 Answers 4

up vote 7 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

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

Your Answer

 
discard

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.