f



System call and library call

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?

0
leoman730 (4)
5/3/2007 10:32:57 PM
comp.lang.c++ 49423 articles. 7 followers. Post Follow

6 Replies
841 Views

Similar Articles

[PageSpeed] 9

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.

0
no.spam9 (2339)
5/3/2007 10:35:53 PM
On May 3, 3:32 pm, leoman730 <leoman...@gmail.com> 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

0
jgu222 (34)
5/3/2007 10:37:05 PM
On May 3, 6:32 pm, leoman730 <leoman...@gmail.com> 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

0
5/3/2007 11:28:50 PM
"leoman730" <leoman730@gmail.com> wrote in message 
news:1178231577.159315.62880@l77g2000hsb.googlegroups.com...
> 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.


0
tazmaster (2359)
5/5/2007 9:16:24 PM
On May 5, 11:16 pm, "Jim Langston" <tazmas...@rocketmail.com> wrote:
> "leoman730" <leoman...@gmail.com> wrote in message

> news:1178231577.159315.62880@l77g2000hsb.googlegroups.com...

> > 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 librar=
y=2E
> 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: james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
                   Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34

0
james.kanze (9769)
5/6/2007 12:23:07 AM
"James Kanze" <james.kanze@gmail.com> wrote in message 
news:1178410987.112141.136540@h2g2000hsg.googlegroups.com...
On May 5, 11:16 pm, "Jim Langston" <tazmas...@rocketmail.com> wrote:
> "leoman730" <leoman...@gmail.com> wrote in message

> news:1178231577.159315.62880@l77g2000hsb.googlegroups.com...

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


0
tazmaster (2359)
5/6/2007 12:37:49 AM
Reply:

Similar Artilces:

system call and library call
hello, what is difference between system call and library function call? Does library function call can have context switch to kernel mode? regards, rahul > what is difference between system call and library function >call? Unless you are talking about a specific implementation, the spelling of the name. What is a system call on one machine may be a library function on another, and it can easily change between versions (e.g. when a legacy system call is now implemented as a library function that calls the new system call, re-arranging the arguments and results so it w...

Calling AIX System Calls From C
Under AIX the smallest binary I've been able to generate from the standard "Hello World" program is about 1648 bytes. I would like to try and get the executable even smaller, and I believe a large portion of that 1648 bytes is the libc setup code (crt.o?) and dynamic linker. Can anyone show me how to compile/link an executable under AIX that makes no reference to libc but instead calls the kreadv (?) system call directly to write "Hello World" to stdout? I have searched extensively with Google and there is very little information on making system calls directly from C ...

methods to call matlab in C C++ and call C C++ in matlab
Hi, I am reading the help documents about how to program matlab and C C++ together and my questions are a little bit general. It seems that are several ways to call matlab in C C++ and another several ways to call C C++ in matlab. Please correct me if I am wrong or missing something when I try to list them. To call matlab code in C C++, are there two methods available? The first one is Matlab engine and the second one is to use MATLAB Compiler mcc to create C or C++ shared libraries from your MATLAB code. To call C C++ in matlab, are there also two methods? The first one is to call funct...

System Call Vs Library Function Call
Hi, What are the differences between a system call and library function call except for the fact that the former is executed in kernel mode while the latter in user mode ? ( does this by itself have its own implications ? ) Thanks, Prakash > What are the differences between a system call and library function > call except for the fact that the former is executed in kernel mode > while the latter in user mode ? ( does this by itself have its own > implications ? ) That a little bit like asking "What are the differences between Paris and Kalamazoo except for the fact that ...

Are system calls sometimes costlier than library calls?
Hi all, I have two simple hello world programs one using printf()[a library func] and other using write() [syscall] --prog 1-- #include<stdio.h> #include<stdlib.h> int main() { printf("Hello"); /* up to here write() isn't called, if u * give \n here then two write()s will * be called (?)*/ printf("World\n"); return 0; } --end-- --prog2-- #include<unistd.h> int main() { write(1, "Hello", 5); write(1, "world\n", 6); return 0; } --end-- If u see the output of strace for prog1 --truncated-- .... munmap(0xb7f...

c++ calling java calling c++ ...
Hi, i'm currently working on a plugin for Adobe InDesign and i have some problems with that. I'm not really a c++ guru, maybe somebody here has an idea how to solve this. The plugin is written in C++ and it's calling a java application. This application displays a window and pushing a button is calling back the c++-plugin again. // The plugin class. CActionComponent is part of the InDesign SDK class MyJNIComponent : public CActionComponent { public: ... static void onCreateDocument(); ... private: ... void registerCallbacks(); ... } // this is called fr...

difference b/w system call and library call...
Hi all, I have a basic question regarding the difference b/w a system call and a library call. In terms of CPU ususage, calling a system call is an expensive operation as compared to calling a library call but how big is the differnce. Further how are these two different in terms of usuage, properties etc. shiva > In terms of CPU ususage, calling a system call is an > expensive operation as compared to calling a library call but how big > is the differnce. It depends. Recently a great deal of effort has been expended to make a few system calls such as __NR_getti...

How to call a C pointer from call library function node
I have a client/server application which the client I am trying to develop using Labview.&nbsp; When I use to communicate the server and the client using the&nbsp;program provided by the manufacter, the system works perfectly. &nbsp; Now, I am trying to develop a system using labview, because I need to get another things. &nbsp; I have the DLL provided by the manufacter and the .h too, so I can check the functions parameters. One of these functions needs to be called using a struct element. Probably, the function's&nbsp;DLL instantiates the elements of this struct.&...

Anybody knows how to use system call in c++ to call ocean?
I want to call "oean" in c++ program. Since in ocean, you have to use load("filename.ocn") i n ocean prompts to run the simulation. In c++, I use system("ocean -b load("file.ocn") > file.out"); There is syntax error. how to use system call ? thanks a lot! escape the quotes system("ocean -b load(\"file.ocn\") > file.out"); Stefano vivian wrote: > I want to call "oean" in c++ program. Since in ocean, you have to use > load("filename.ocn") i n ocean prompts to run the simulation. > > In c+...

c++ calling fortran and fortran calling C++
Hi, For my application in C++, I need to call a subtroutine in fortran. This subroutine must call a function of my program. I'm trying to use pointer of my function but I have segmentation fault. the fortran code is: subroutine dlltest [dllexport] (c_msg,e1,e2,e3,i,r,d,str) c implicit none integer i,l,m,length real*4 r double precision d character*128 e1,e2,e3,str,aux,aux2 external c_msg,length c first, write parameters to a file open(1,file='test.out',status='unknown') rewind(1) c write(1,*) 'function pointer: ',c_msg write(1,*) 'integer: ...

Should I call C from LabVIEW or call LabVIEW from C?
I need to write some software and am trying to choose the best development environment. I currently use Borland C++ Builder to develop most of my software and have also used some LabVIEW occasionally. The new package I need to write has to provide several functions, some of which would be better in C++, some in LabVIEW and I am wondering whether to combine the two. So far, I have had a quick play around and called a very basic piece LabVIEW code, built into a dll, from some C++ code. I am about to try to reverse (create dll in C++ and call from LabVIEW) but would appreciate some advice on the ...

Call call
Hello! I have a small question concerning to the procedure call. I have the following procedure: private sub procedure_name (ByVal name1 as string) .... end sub When I call it I just write: .... procedure_name("something") ..... When I add some extra parameters into the procedure that is: private sub procedure_name (ByVal name1 as string, ByVal name2 as boolean) .... end sub then the procedure call would look like this: call procedure_name("something",True) Why???? Why there are some cases when word "call" is needed (because excluding it, it will give us ...

C++ DLL calling and being called by C propgram?
Hi, I Extend a program that us C . It allows us to etxtend it thru DLLs. How can i write a C++ DLL that can interface with the C main program . the DLL must provide a few call back function for the main program to call. How can it be done? seewan Here it is. in DLL: MyDllFunc.h .... extern "C" { int DllFunc1(int,int); /* whatever params */ void DllFunc2(int); /* whatever params */ }; .... MyDllFunc.cpp #include "MyDllFunc.h" int DllFunc1(int arg1,int arg2) { /* function body */ } void DllFunc2(int...

C system() call failing in print app called by Samba
Hi, I have an embedded Linux device running on a Cirrus Logic EP9301 ARM, Linux kernel version 2.6.20.4m1. It is configured as a Samba print share. Instead of printing a file from a Windows client, we have print command set to call a custom application that is supposed to upload the file to an SFTP server. In my C++ application, I wrapped the appropriate command in a system() call. The application works perfectly when I call it from a command line terminal. The problem arises when I have it called from Samba. The problem is that the system call always fails. I can see my application run...

Web resources about - System call and library call - comp.lang.c++

Library - Wikipedia, the free encyclopedia
A library is an organized collection of sources of information and similar resources, made accessible to a defined community for reference or ...

Library - Wikipedia, the free encyclopedia
A library is an organized collection of sources of information and similar resources, made accessible to a defined community for reference or ...

Library - Wikipedia, the free encyclopedia
A library's collection can include books , periodicals , newspapers , manuscripts , films , maps , prints , documents , microform , CDs , cassettes ...

$27m Toowoomba library delayed by fire issues
Toowoomba Regional Council's new $27 million library has been delayed after inspections revealed it was not fire compliant, shortly before it ...

Food bank plan for Canberra's overdue library fees
... fines for overdue books in exchange for food donations to OzHarvest. Minister for Municipal Services Meegan Fitzharris at the Gungahlin Library. ...

Library director should have been sacked: report
The State Library of Queensland's former director of corporate affairs should have been sacked three years ago for having thousands of pornographic ...

Library director should have been sacked: report
The State Library of Queensland's former director of corporate affairs should have been sacked three years ago for having thousands of pornographic ...

Supporters helping Gander library stock shelves for Syrian refugees
Employees with the Gander Public Library are doing their best to make sure the shelves are stocked for the five refugee families who are coming ...

Feature Request: iCloud Photo Library needs a purge downloads button à la Google Photos
I’ve been all in on iCloud Photo Library since Apple replaced iPhoto with the new Photos app on the Mac last year and I haven’t looked back since. ...

Law School Turns Library Back Office Into Doc-Review Dungeon
Which law school is turning part of its library into a "legal delivery center"?

Resources last updated: 2/11/2016 12:08:53 PM