0

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
Leo
  • 10,407
  • 3
  • 45
  • 62

2 Answers2

1

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.

Will
  • 73,905
  • 40
  • 169
  • 246
  • 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. – Leo May 24 '14 at 18:59
  • @Leo The answer emphasize the correct way of using syscall - from userspace. But if you want to bypass this and call syscall from the kernel, it can be done, but you will have to take care of the privilege mode yourself - not forgetting you are highly privileged from kernel going into syscall. https://stackoverflow.com/questions/15841327/can-we-call-system-call-in-kernel-space – Peter Teoh Jan 15 '19 at 01:43
0

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

dshil
  • 381
  • 2
  • 10
  • you can find more details here: https://stackoverflow.com/questions/12658263/how-quick-can-the-processor-handle-the-interrupts – dshil Aug 17 '17 at 06:48