System call and library call

Discussion in 'C++' started by leoman730, May 3, 2007.

  1. leoman730

    leoman730 Guest

    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?
     
    leoman730, May 3, 2007
    #1
    1. Advertising

  2. leoman730

    red floyd Guest

    leoman730 wrote:
    > 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.
     
    red floyd, May 3, 2007
    #2
    1. Advertising

  3. leoman730

    jg Guest

    On May 3, 3:32 pm, leoman730 <> wrote:
    > What is the different between System call and library call?


    A system call is a call to OS, whereas a library call is a call
    to a library.

    JG
     
    jg, May 3, 2007
    #3
  4. leoman730

    blytkerchan Guest

    On May 3, 6:32 pm, leoman730 <> wrote:
    > 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
     
    blytkerchan, May 4, 2007
    #4
  5. leoman730

    Jim Langston Guest

    Re: [OT answer] System call and library call

    "leoman730" <> wrote in message
    news:...
    > 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.
     
    Jim Langston, May 5, 2007
    #5
  6. leoman730

    James Kanze Guest

    On May 5, 11:16 pm, "Jim Langston" <> wrote:
    > "leoman730" <> wrote in message


    > news:...


    > > 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.


    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.

    --
    James Kanze (Gabi Software) email:
    Conseils en informatique orientée objet/
    Beratung in objektorientierter Datenverarbeitung
    9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
     
    James Kanze, May 6, 2007
    #6
  7. leoman730

    Jim Langston Guest

    "James Kanze" <> wrote in message
    news:...
    On May 5, 11:16 pm, "Jim Langston" <> wrote:
    > "leoman730" <> wrote in message


    > news:...


    > > 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.


    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.

    -------------

    Which may of been exactly the answer the interviewer was looking for.
    General computer/os/program/compiler knowledge.
     
    Jim Langston, May 6, 2007
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mythran
    Replies:
    0
    Views:
    2,429
    Mythran
    Aug 24, 2004
  2. system call and library call

    , Aug 22, 2005, in forum: C Programming
    Replies:
    7
    Views:
    3,017
    Jonathan Bartlett
    Aug 23, 2005
  3. David Pratt
    Replies:
    0
    Views:
    264
    David Pratt
    Apr 7, 2008
  4. David Pratt
    Replies:
    0
    Views:
    406
    David Pratt
    Apr 7, 2008
  5. Will Lichtenberger
    Replies:
    3
    Views:
    3,233
    dener
    Nov 5, 2008
Loading...

Share This Page