CIS-4020 Homework #1: System Calls

Due: Friday, September 6, 2024

Reading: Review/skim Chapter 1 and Chapter 2 in Love to familiarize yourself with the material they contain. You don't need to read those chapters in detail. Our first topic is system calls, covered in Chapter 5. Note that Love's book is a little dated (2010), so be wary. Some of the questions below require you to browse the kernel source code. You can use the cscope-linux command on DevBox.

  1. Can a process accidentally try to invoke a system call that does not exist? If not, why is it impossible? If so, how could it happen and what does the kernel do in response?

  2. The system call numbers assigned to each system call can, in effect, never be changed once they are assigned. Why not?

  3. What does the ptrace system call do? If you consult online resources, give appropriate references in your answer.

  4. Traditionally, Unix has a system call creat for creating new files and a separate system call open for opening existing files. The POSIX standard requires that open be able to also create files given appropriate flags, making creat technically unnecessary. In Linux how does creat differ from open?

    Hint: Look up the implementation of creat in the kernel source using cscope. Because system calls are defined in a special way, you should search for uses of SYSCALL_DEFINE2 and SYSCALL_DEFINE3 to find all system calls with two or three parameters respectively. Then search those lists manually for the calls you are interested in studying.


Last Revised: 2024-08-05
© Copyright 2024 by Peter Chapin <peter.chapin@vermontstate.edu>