[LCP]Which one is faster - program with unix system calls or direct c code

David Lloyd lloy0076 at rebel.net.au
Fri Jul 13 19:52:05 UTC 2001


Hi There!

>      I faced this question in an interview, Can some body explain me
> the answer......
> Which one is faster - program with unix system calls or direct c code.

That depends.

If you want to write code that is:

* quick to write
* quick to understand
* quick to port

Use system calls. Why?

* better documentation
* standardised set if you use POSIX or conform, for example, to the
Win32 API (if you're using that platform)
* because it's fairly standard, you're less likely to rely on
architecture specific stuff

If you want code that is:

* slower to write and port
* more difficult for someone not familiar with the architecture to
understand
* faster to execute

Use direct c. That is, use C to actually circumvent the system calls
itself and use whatever knowledge you have of the architecture to your
advantage even if it means not using standard documented API's.


Incidentally, I'm a little confused what you mean by "direct C". If you
mean the standard libraries then the above answer might not be wholly
correct.

DSL
-- 
"The greatest thing you'll ever learn is
  just to love and to be loved in return."
  - David Bowie (Nature Boy from Moulin Rouge)



More information about the linuxCprogramming mailing list