Courses/Computer Science/CPSC 457.F2014/Lecture Notes/SystemCalls

Jump to: navigation, search

System Calls

System calls are one of the most important constructs in OS. More generally, the represent a way to transition in a standard, safe, and well-understood fashion between unprivileged code and privileged code.

We will start from a discussion of x86 assembly language programming and see how system calls are made (i.e., their calling convention on x86/Linux), how they are defined, how they can be traced, and how they differ from "normal" function calls.


We looked at assembly-level function invocation (as a reminder).

We saw how we could talk directly to the kernel via the syscall interface

  • now let's write a program using write(2)
  • compare this with our assembly version mywrite.asm
  • what is the nature of this interface? (combined API and privilege transition mechanism)
  • where are the parts documented?
    • manual pages for syscall definitions (syntax and semantics)
    • show locations of syscall number definitions: /usr/include/asm/unistd_32.h
  • what is the actual mechanism?

Links to kernel code:

Scribe Notes


  • MOS: 1.6: System Calls (you should have read this already)
  • LKD: Chapter 5. System Calls (this describes how to add a system call to your OS, something you'll have an opportunity to practice in your tutorials later and in homeworks)