hi,

what is the difference between a library function and a system call

Hi,
Liabrary fuction is fuction which are already compiled and stored in a
perticuler folder so that we can use is further, and system call is made by compiler.
System call is made by compiler to the operating system. whenever compiler face some problem to compile prolem it calls to OS for help
that is we call System call.

Comments
WRONG. "When compiler faces problems, it calls OS for help" !!????

Most system calls are also library functions because the compiler needs the libraries in order to resolve functions at link time. There are a few exceptions, but very rare.

As already described by AD library calls are calls to functions/APIs exposed /exported by libraries (*.dll+*.lib in windows, *.so and *.a in Unix).
System calls are calling basic OS functions/APIs.
As most system APIs are provided by OS in form of libraries most system calls are library calls. The library calls that are NOT system calls are called library calls. :).

ALL library calls finally result in (low-level) system calls. This is because finally everything is done by kernel.

Hi,
Liabrary fuction is fuction which are already compiled and stored in a perticuler folder so that we can use is further

Correct.

and system call is made by compiler.
System call is made by compiler to the operating system. whenever compiler face some problem to compile prolem it calls to OS for help that is we call System call.

Why single out compiler like this?! If at all this is extremely confusing, like playing with words.

Library calls execute within the process space of the `C or C++ runtime' whereas System calls spawn a separate process and the control is transferred from the current process to the newly spawned one. Each process has a stack of its own. Library calls result in the creation of a new stack frame whereas system call result in the creation of a new stack.

Looks like some confusion of terminology -- I assume the term system call means an api function, not the system() function. The system() function does as ~S.O.S~ said in his post. But most os api functions are implemented as library functions as previously mentioned also.

This article has been dead for over six months. Start a new discussion instead.