System call and library call

L

leoman730

This is one of the interview question this morning, hope someone can
help out with this. Thanks.
What is the different between System call and library call?
 
R

red floyd

leoman730 said:
This is one of the interview question this morning, hope someone can
help out with this. Thanks.
What is the different between System call and library call?

Here's another question. What's your C++ *language* question?

As to your first, try Google or Wikipedia.
 
B

blytkerchan

This is one of the interview question this morning, hope someone can
help out with this. Thanks.
What is the different between System call and library call?
C++ doesn't know about a "system". It knows about an abstract machine,
though, and as such knows about volatile variables and I/O operations.
In that sense, you could call "something that has an effect on the
abstract machine" (i.e reading or writing a volatile variable or
performing an I/O operation) a "system call", whereas any other
function call could be coined "library call" assuming the function in
question is implemented in a library of some sort.
For one thing, as the effects of a program are defined in terms of
effects on the abstract machine, "system" calls as described above
cannot be optimized away whereas anything else could.

rlc
 
J

Jim Langston

leoman730 said:
This is one of the interview question this morning, hope someone can
help out with this. Thanks.
What is the different between System call and library call?

A system call is calling a function or API that interfaces with the
operating system.
A library call is calling a function or API that interfaces with a library.
The library itself may make system calls.
 
J

James Kanze

A system call is calling a function or API that interfaces with the
operating system.
A library call is calling a function or API that interfaces with a library.
The library itself may make system calls.

As far as the application programmer is concerned, there is no
difference. He links against a "system library" (integrated
with the C runtime in libc under Unix, one of four or more
different variants under Windows). How that library achieves
what it achieves is really an implementation detail. On the
systems I've worked on, that actual system interface involved a
hardware level trap or interrupt, and couldn't be directly
called from C++; some of the functions in the "system library"
did nothing more than map the C++ (or C) calling sequence to
these conventions; others did more.

It's possible that something like that is what the interviewer
was looking for; that a system call went through some special
hardware mechanism, e.g. to change context, pass into system
mode, etc., where as other library calls don't. Then again,
it's possible that he was looking for something else. Unless
the job was for some sort of kernel level work, it's a worthless
question.
 
J

Jim Langston

A system call is calling a function or API that interfaces with the
operating system.
A library call is calling a function or API that interfaces with a
library.
The library itself may make system calls.

As far as the application programmer is concerned, there is no
difference. He links against a "system library" (integrated
with the C runtime in libc under Unix, one of four or more
different variants under Windows). How that library achieves
what it achieves is really an implementation detail. On the
systems I've worked on, that actual system interface involved a
hardware level trap or interrupt, and couldn't be directly
called from C++; some of the functions in the "system library"
did nothing more than map the C++ (or C) calling sequence to
these conventions; others did more.

It's possible that something like that is what the interviewer
was looking for; that a system call went through some special
hardware mechanism, e.g. to change context, pass into system
mode, etc., where as other library calls don't. Then again,
it's possible that he was looking for something else. Unless
the job was for some sort of kernel level work, it's a worthless
question.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top