Difference between User vs Kernel System call

1.3k views Asked by At

A system call is how a program requests a service from an operating system's kernel.

They can occur in user-mode and kernel-mode.

What are differences?

For example:

  • Overhead
  • System time
2

There are 2 answers

2
Will On

A system call is the way you transition between the application ("user mode") and the kernel.

Syscalls are slower than normal function calls, but newer x86 chips from Intel and AMD have a special sysenter/syscall opcode to make it take just a hundred nanoseconds or so, give or take.

1
dshil On

@Leo,

Could you elaborate on how system calls vary when made from within kernel space? For better understanding of the Linux kernel, which is written in C and assembly

Notice, that system calls are just an interface between user space and kernel space. When you need some computer resources (files, networks, ...), you ask the kernel to give it to you (under the hood you ask the kernel to run kernel code, that is responsible for it).

Overhead of system calls is that you need to perform a CPU interrupt. As Will mentioned the time for it is very depends of a CPU type.