I'm trying to understand the difference between "old" syscall mechanism using interrupt and the current one relying on specific processor instruction.

AFAIK both are working in the same way in terms of C program: ie a kernel C function gets called and then a dispatch to the correct syscall handler is made. Then, what is it that makes the "new" syscall system more effecient?

Is it just due to more efficient processor instructions that make calling "syscall" faster than an "interrupt" ? Is this difference in time enough to be significant compared to the amount of work the syscall itself has to do (ie writing to file) ?

  • Some more details on this are on the OSDev wiki. Basically, as long as you're doing a "flat" memory model (which pretty much everyone is these days, especially on 64-bit) there's less context (segment registers etc.) that you have to save and restore.
    – user21105
    May 3, 2020 at 18:29

1 Answer 1


They’re faster because they have much less work to do, and because they don’t need to read from memory.

When you use a software interrupt to issue a system call, the CPU doesn’t know that that’s what you’re doing. It needs to read the target CS and EIP values from the interrupt descriptor table. The value of CS specifies what the target privilege level is; once the CPU figures that out, it needs to determine what the target state is, which involves more reading from memory.

SYSCALL on the other hand is entirely register based; the target privilege level is known ahead of time, and the target state is specified by MSRs set up by the kernel.

The difference in speed is small when compared to some syscalls’ duration, but there are many fast syscalls. Of course, the whole KPTI business means all syscalls are slow, but the speed gain from SYSCALL is still worth having.

  • Have you seen measurements to support this? I ask, because I tried to profile this recently and came up blank. I presume that because both syscall and int $n are implicit fences, that if any real work is occurring, the fence pause dominates the savings. I would love to see other real world data and analysis.
    – mevets
    May 12, 2022 at 1:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .