All Topics
All Topics
Technology
Technology
Design
Design
Programming
Programming
Science
Science
News
News
Gaming
Gaming
Entertainment
Entertainment
Business
Business
Finance
Finance
Sports
Sports
Health
Health
Food
Food
Travel
Travel
Art
Art
Music
Music
Books
Books
Education
Education
Politics
Politics
Personal
Personal
No algorithm. No AI slop. No ads. Just RSS. Pro-human. Indie writers. Real journalism. Open web. Chronological. Hand toasted.

Understanding Linux System Call Performance Overhead on x86-64 Architecture

By

rbanffy

8mo ago· 24 min readenInsight

Summary

This technical deep dive examines why system calls are expensive operations in Linux, particularly on x86-64 architecture. The article explains that system calls require context switching between user and kernel space, which involves saving/restoring CPU state, changing memory protection, and flushing CPU caches. It covers how modern processors handle system calls through mechanisms like syscall/sysret instructions, the role of the vsyscall page for optimization, and why even with hardware optimizations, system calls remain performance bottlenecks that engineers work to minimize through techniques like io_uring for I/O batching and eBPF for running code in kernel space.

Key quotes

· 4 pulled
System calls are how user programs talk to the operating system. They include opening files, reading the current time, creating processes, and more. They're unavoidable, but they're also not cheap.
If you've ever looked at a flame graph, you'll notice system calls often show up as hot spots. Engineers spend a lot of effort cutting them down.
Whole features such as io_uring for batching I/O or eBPF for running code inside the kernel exist just to reduce how often programs have to cross into kernel mode.
Why are they so expensive? The answer lies in what happens when a program makes a system call and the CPU has to switch from user mode to kernel mode.
Snippet from the RSS feed
An explanation of how Linux handles system calls on x86-64 and why they show up as expensive operations in performance profiles

You might also wanna read