-2
$\begingroup$

Lets take POSIX, whats the difference between POSIX API, libc and actual system calls?

$\endgroup$

closed as off-topic by David Richerby, vonbrand, Luke Mathieson, Juho, hengxin Feb 22 '16 at 6:59

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be about computer science, within the scope defined in the help center." – David Richerby, vonbrand, Luke Mathieson, Juho, hengxin
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    $\begingroup$ What have you tried? Where did you get stuck? We do not want to just do your (home-)work for you; we want you to gain understanding. However, as it is we do not know what your underlying problem is, so we can not begin to help. See here for a relevant discussion. If you are uncertain how to improve your question, why not ask around in Computer Science Chat? You may also want to check out our reference questions. $\endgroup$ – Raphael Feb 8 '16 at 15:22
  • 2
    $\begingroup$ I don't think this is necessarily ontopic since this seems to be less a conceptual computer science question, but more one of technology terminology. Community votes, please! $\endgroup$ – Raphael Feb 8 '16 at 15:23
2
$\begingroup$

I'll start with system call.

a system call is how a program requests a service from an operating system's kernel. This may include hardware-related services (for example, accessing a hard disk drive), creation and execution of new processes, and communication with integral kernel services such as process scheduling. System calls provide an essential interface between a process and the operating system. Wiki

Another definition.

A system call, sometimes referred to as a kernel call, is a request by an active process made via a software interrupt for a service performed by the kernel. (Source)

The library as an intermediary

Generally, systems provide a library or API that sits between normal programs and the operating system. On Unix-like systems, that API is usually part of an implementation of the C library (libc), such as glibc, that provides wrapper functions for the system calls, often named the same as the system calls they invoke.....For example, in Unix-like systems, fork and execve are C library functions that in turn execute instructions that invoke the fork and exec system calls. Making the system call directly in the application code is more complicated and may require embedded assembly code to be used (in C and C++) as well as knowledge of the low-level binary interface for the system call operation, which may be subject to change over time and thus not be part of the application binary interface; the library functions are meant to abstract this away. Wiki

You may find a couple of popular POSIX system calls here.

TL;DR

So, to summarize, a system call is a request to the kernel for a service. The system call interface is the basic interface between a program and the kernel. The programming library, e.g. libc, has APIs on top of the basic system calls, provided by the kernel, which further ease the job of the developer.

$\endgroup$
  • 1
    $\begingroup$ An API (Application Programming Interface) is an interface, a specification of functions and variables the application can use. It can be and usually is) implemented as a library for a specific programming language (which in itself will determine certain details of the API). $\endgroup$ – vonbrand Feb 8 '16 at 15:31

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