CS 3560 Introduction to Systems Programming (4) 2005

Catalog description:

Introduction to systems programming in a modern environment. Introduction to fundamental concepts of operating systems: analysis of a particular operating system (organization, interfaces, system calls, files, process control and communication, resource sharing). Shell and C programming. Development tools. Prerequisite: CS 2360
[FORMER PREREQUISITES: Prerequisites: CS 2430 (2710), CS 2170 (2715)]

Overview:

The course studies Unix at the system call level. It involves an overview of Unix, but it concentrates on file handling, process management, and interprocess communication.

Topics (Not necessarily in this order)

History and Design Goals of Unix

Dialects of Unix: BSD, SysV, POSIX, etc.

Overall Structure: Applications, Utilities, Shells, Kernel, Processes, File System

Brief introduction to Unix (for those lacking previous experience): logging in and out, basic commands, how to learn more, etc. Basic use of some shell (csh, tcsh, ksh, sh, bash, etc.) Shell programming (best introduced a little at a time through the course, lest the course become just another "language course")

Files: Overview of the Unix directory structure. Where to find "important" files: e.g., /usr/include, /etc/passwd, man files, libraries, etc. Manipulation and traversal of this structure. File permissions, etc.

Unix File System: "array of blocks", inodes, etc. Examining file information using system calls such as stat.

Dealing with files: open, read, write, dup, dup2, lseek, fcntl, link, unlink, opendir, etc. Symbolic and hard links. Properties of file descriptor table, open file table, vnode (inode) table. Devices as files (/dev).

I/O streams: fopen, fread, etc. Standard I/O functions.

Processes: Process information (from ps), process table, creation of processes (fork()), replacement of processes (exec). Process "genealogy": process id, parent process id, group (-owner) id, process group id, session id. wait, waitpid, sleep, getpid, etc.

Interprocess Communications:

Pipes: traditional half-duplex, perhaps named pipes (FIFO) Signals and signal handling: differing dialects, use of kill, signal, sigaction, signal masking or ignoring, etc. SysV IPC (optional: not activated on most of our systems): shared memory, semaphores, messages.

Terminal Control: terminal, termninal handling from the shell (using stty), terminal data structures (termios, and (optionally) termio, sgtty, etc.) Controlling Terminal (/dev/tty), Terminal Process Group. Related system calls: tcgetattr, tcsetattr, ioctl, etc. etc.

Advanced file handling (optional): File locking, mandatory vs. advisory locks. fcntl locks vs. other mechanisms. Location in the kernel of locks (vnode table) and their visibility.

Text:

  • Stevens, Advanced Programming in the UNIX Environment.
  • Bruce Molay, Understanding Unix/Linux Programming