Home > Articles > Operating Systems, Server > Linux/UNIX/Open Source

  • Print
  • + Share This
Like this article? We recommend

Synchronous System Calls

Every time you do a system call in a UNIX system, you have to swap into kernel space—a relatively expensive operation. You have to wait until the kernel completes the operation, and then continue. In some cases, the kernel just copies your parameters and processes later. Consider the case of writing some bytes to a stream. In a UNIX system, you would use the write system call. This would switch to kernel space, copy the buffer, and then transmit it later. If you're lucky, later you'll get a notification that the write succeeded (or failed).

If you're writing a lot of data, you end up making a lot of system calls and spending a significant amount of your time switching between privileged and unprivileged modes on your CPU. If you're on an SMP system, as is increasingly common these days, you'll have to wait for all sorts of kernel synchronization code to run first.

On a microkernel system such as QNX, system calls are asynchronous. This means that you can queue them up in a user space buffer and have them all swapped into kernel space when your quantum expires and the kernel interrupts your process. This approach is a lot more scalable on SMP systems and provides a performance boost on single-processor systems by reducing the amount of mode-switching required.

  • + Share This
  • 🔖 Save To Your Account