Saturday 26 January 2013

Library Call VS. System Call

  The difference between library calls and system calls has confused even expert programmers. Library calls are part of the language or application, and system calls are part of the operating system. A system call gets into the kernel by issuing a "trap" or interrupt. The other main differences between library calls and system calls are listed below.
 
  • The C library is the same on every ANSI C implementation, but the Systems Calls are different in each Operating System.
  • Library Call is a call to a routine in a library, Whereas System Call is a call to the kernel for a service.
  • Library call is linked with the user program. System Call is an entry point to the OS.
  • Library call executed in the user address space, but System Call is Executed in the kernel address space.
  • Library Call execution time is Counted as part of the "user" time, whereas System Call execution time is counted as part of the "system" time.
  • Library Call has the lower overhead of a procedure call, whereas System Call has a high overhead context switch to kernel and back.
  • There are about 300 routines in the C library "libc". There are about 90 system calls in UNIX. WinAPI provides similar System Calls in Windows.
  • Typical C library calls are system, fprintf, malloc, etc. Typical system calls are chdir, fork, write, brk, etc.

No comments:

Post a Comment