Compare the Difference Between Similar Terms

Difference Between

Home / Technology / IT / Systems / Difference Between System Call and Function Call

Difference Between System Call and Function Call

June 27, 2011 Posted by Indika

System Call vs Function Call

A typical processor executes instructions one by one. But there may be occasions where the processor has to stop current instruction and execute some other program or code segment (residing in some other place). After doing this the processor returns to normal execution and continues from where it left off. A system call and a function call are such occasions. A system call is a call to a subroutine built in to the system. A function call is a call to a subroutine within the program itself.

What is a System Call?

System calls provide programs running on the computer an interface to talk with the operating system. When a program needs to ask for a service (for which it does not have permission to do that by itself) from the kernel of the operating system, it uses a system call. User level processes do not have the same permissions as the processes directly interacting with the operating system. For example, to communicate with and external I/O device or to interact with any other processes, a program uses system calls.

What is a Function Call?

A function call is also called a subroutine call. A subroutine (also known as a procedure, function, method or routine) is part of a larger program that is responsible for carrying out a specific task. The larger program may execute a heavy workload, and the subroutine may be performing just a simple task, which is also independent of the remaining program coding. A function is coded in such a way that it may be called multiple times and from different places (even from within other functions). When a function is called, the processor may go to where the code for the function is residing and execute the instructions of the function one by one. After completing the functions, the processor will return to exactly where it left off and continue the execution starting from the next instruction. Functions are a great tool for code reuse. Many modern programming languages support functions. A collection of functions is called a library. Libraries are often used as means of sharing and trading software. In some cases, the whole program could be a sequence of subroutines (e.g. threaded code compilation).

What is the difference between System Call and Function Call?

System call is a call to a subroutine built in to the system, while a function call is a call to a subroutine within the program. Unlike function calls, system calls are used when a program needs to perform some task, which it does not have privilege for. System calls are entry points in to the operating system kernel and are not linked to the program (like function calls). Unlike, system calls, function calls are portable. Time overhead of a system call is more than the overhead for a function call because a transition between the user mode and the kernel mode must take place. System calls are executed in kernel address space, while function calls are executed in user address space.

Related posts:

Difference Between Procedures and Functions in Programming Difference Between Internal Hard Drive and External Hard Drive Difference Between CMOS and BIOS Difference between Hardware and Software Difference Between Physical and Virtual Memory

Filed Under: Systems Tagged With: execution, Function, function call, instruction, kernel, kernel mode, library, operating system, Processor, subroutine, subroutine call, system call, user mode

About the Author: Indika

Indika, BSc.Eng, MSECE Computer Engineering, PhD. Computer Science, is an Assistant Professor and has research interests in the areas of Bioinformatics, Computational Biology, and Biomedical Natural Language Processing.

Comments

  1. manzoor hussain says

    November 6, 2019 at 9:20 am

    Thanks sir,it helpmed me alot.Keep it up your nice job and sharing knowledge.
    Bless you.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Request Article

Featured Posts

Difference Between Coronavirus and Cold Symptoms

Difference Between Coronavirus and Cold Symptoms

Difference Between Coronavirus and SARS

Difference Between Coronavirus and SARS

Difference Between Coronavirus and Influenza

Difference Between Coronavirus and Influenza

Difference Between Coronavirus and Covid 19

Difference Between Coronavirus and Covid 19

You May Like

Difference Between Early Blight and Late Blight of Potato

Difference Between Early Blight and Late Blight of Potato

Difference Between Quick Ratio and Current Ratio

Difference Between Windcheater Windbreaker Rain Jacket and Raincoat

Difference Between Windcheater Windbreaker Rain Jacket and Raincoat

Difference Between Mexico and United States

Difference Between Mexico and United States

Difference Between WW1 and WW2

Latest Posts

  • What is the Difference Between Osteoporosis and Scoliosis
  • What is the Difference Between Saree and Half Saree
  • What is the Difference Between Hypernatremia and Hyponatremia
  • What is the Difference Between Diabetes Mellitus and Diabetic Ketoacidosis
  • What is the Difference Between Sciatica and Spinal Stenosis
  • What is the Difference Between Metatarsalgia and Morton’s Neuroma
  • Home
  • Vacancies
  • About
  • Request Article
  • Contact Us

Copyright © 2010-2018 Difference Between. All rights reserved. Terms of Use and Privacy Policy: Legal.