I noticed that all my programs compiled to gcc are linked to vdso library. Is this the library that contain the system calls to the kernel, like mmap() and fork() and other system calls?

I know that system calls are not functions of the GNU C standard library so their object code must be in some library that is linked with the application at the compilation?

So is the vdso that library?

  • It may be. What issues are you trying to solve? – Kusalananda Oct 9 '17 at 11:24
  • 1
    @Kusalananda I do not have any issue whatsoever. I am trying to learn more about how the C compiler works how the linker works and to basically be a better programmer and computer scientist. – yoyo_fun Oct 9 '17 at 11:32

System calls are implemented in the kernel, as mentioned in the answer to your followup question. vDSO, the virtual dynamic shared object, is a small virtual library, also implemented by the kernel, which the kernel maps into all processes. Like syscalls it is wrapped by the C library.

The main difference between syscalls and the vDSO is one of privilege. System calls are executed in kernel space, and switching between user space and kernel space is expensive. As an optimisation, some system calls which don’t actually need to run in kernel space are provided in the vDSO, which runs in user space. An example is gettimeofday which tends to be called quite often and can be implemented by the kernel without switching to kernel space.

The vdso manpage has more details. For a detailed discussion of system calls on Linux in general, including vDSO, see Anatomy of a system call part 1 and part 2.

| improve this answer | |
  • Very good answer! The whole vDSO concept is something introduced in kernel at cirka 2.6 time. Older (= ancient) kernel versions did not do it this way. – Per Lundberg Jan 23 '19 at 8:48
  • 1
    Came here after clicking promising first Google link ... linux-vdso.so – earcam Feb 4 '19 at 17:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.