Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8416347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:43:36+00:00 2026-06-10T01:43:36+00:00

In Linux, when you can choose between a system call or a function call

  • 0

In Linux, when you can choose between a system call or a function call to do a task, which option is the better one due to a better performance?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T01:43:38+00:00Added an answer on June 10, 2026 at 1:43 am

    We should note that in most of the cases we do not directly use system call. We use the interface provided by glibc.

    http://www.kernel.org/doc/man-pages/online/pages/man2/syscalls.2.html

    http://www.gnu.org/software/libc/manual/html_node/System-Calls.html

    Now in cases like File Mangement/IPC/ process management etc which are the core resource management activities of the Operating System the only option is system call and not library functions.

    In these cases, typically we use Library function which works as a wrapper over a system call. That is say for reading a file, we have many library functions like

    fgetc/fgets/fscanf/fread -  all should invoke read system call.
    

    So shall we use read system call? or the other library functions?
    This should depend on the particular application.If we are using read, then we again need to change the code to run this, on some other operating system where read is not available.

    We are losing some flexibilty. It may be useful when we are sure of the platform and we can do some optimisations by using read only or may be the application must use only file descriptors and not file pointer etc.

    Now in cases where we need to consider only say user level operations and invoke 
    no    service from operating system , like say copying a string.(strcpy).
    In this case definitely we shall not use any system call unnecessarily, if at
    all something is  there, since it should be an extra overhead due to operating 
    system intervention, which is not needed in this case.
    

    So I feel choosing between a system call and a library function only occurs for cases where we have a library function built on top of a system call.

    (like adding to examples above we can have say malloc which calls system call brk).

    Here the choice will depend on the particular type of software, the platform on which it should run, the precise non functional requirements like speed (Though you cannot say with certainty that your code will run faster if you are using brk instead of malloc), portability etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need an editor (preferably Linux) which can load OSM maps and allows me
I'm creating a utility in C++ to be run on Linux which can convert
Can sendfile() linux syscall be used to send part of file from one mmaped
I m running iperf between two machines (linux) and I can observe the mtu
Can I produce an RPM package where several dependencies are listed in a choose-one-from-those
Under Linux I can issue a gcc -Wl,--defsym,main=main_x .. However in Mac OSX 10
Currently In my embedded linux I can not open multiple ALSA sound stream. What
After installing gcc and mpich library in my linux I can compile my codes
What values in the inode struct of the linux kernel can I look at
Is there a standard Linux command i can use to read a file chunk

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.