3 ms·
"Using a syscall directly avoids that cost." Quoting the author of the article, "That said, this is nothing compared to the cost of a SYSTEM CALL. System call
by Annatar 8y ago
"Using a syscall directly avoids that cost."
Quoting the author of the article,
"That said, this is nothing compared to the cost of a SYSTEM CALL. System calls are measured in usec, usually 10s of them, depending on the complexity of the system call you're calling. (In some cases, such as disk reads, it can even go to milliseconds.) I'd guess on average the cost of the transition is less than 1% of the system call you're making."
- amscanne 8y agoThe article is not accurate. Pre-KPTI, the cost of a system call might have been hundreds of cycles total. On a modern chip, that’s ~50ns. Add kernel code for relevant operation. A read on a pipe might be 500ns total. A read on a cached file would be similar. Add a few hundred cycles for KPTI. A typically function call will be tens of cycles, but with lots of copies and stack changes can easily be hundreds.