CPS 444/544 Lecture notes: Introduction to Systems Programming

Coverage: [OSC8] Chapter 1 (pp. 3-47) and [UPE] Preface

Introduction to CPS 444/544

  • logistics, evaluation, and policies
  • this is a class on UNIX and C

What is systems programming?

  • generally, developing programs which support the development of other programs
  • the process of developing systems software

What is systems software?

  • software which supports software development, or a computer system in general
  • software which allocates and manages computer resources (e.g., CPU, memory, devices)

Examples of systems software

  • assemblers
  • compilers (e.g., gcc)
  • linkers
  • loaders
  • command interpreters (i.e., shells, e.g., bash)
  • system libraries (e.g., libc)
  • device drivers
  • debuggers (e.g., gdb)
  • system utilities (e.g., env)
  • configuration managers (e.g., git)
  • compilation managers (e.g., make)

One dichotomy of programming

  • application programming: targeted toward developing systems to support the end-user
  • systems programming: targeted toward developing systems to support the programmer
  • Recently, this boundary has become fuzzy. Building a web browser, such as Google Chrome might once have been considered application programming. However, nowadays developing such applications requires attention to system details such as resources and efficiency (e.g., Google Chrome is multi-processed).

    Historically, systems programming meant programming the system (i.e., building compilers, shells, loaders, and so on). However, nowadays, systems programming has come to mean programming with the system (i.e., making system calls, managing threads, and so on).

    We could also say that computer science students study programming software while computer engineering students study programming the interface between hardware and software (historically, they studied programming hardware).

Another viewpoint (course themes)

  • systems programming requires a greater awareness of issues of hardware and efficiency than application programming;
    what does the following C code do? while (*p++ = *q++);
  • since systems programs typically run for a long time and, therefore, must be robust and fault tolerant, systems programmers must be diligent to release resources and check for errors (e.g., a NULL pointer as a return value) in more than just the typical places in a program; why is the following code unportable or unsafe?
    char c;
    while ((c = getchar()) != EOF)
  • systems programming is characterized by the use of languages at a lower level than those used in application programming; one that provides the programmer direct access to and control of system resources; leads us to UNIX and C

Review of operating system nomenclature

  • program vs. (heavyweight) process

  • thread (lightweight process):
    • an ADT within a process
    • has its own stack, program counter value, register set, and state
    • share process resources (e.g., open files)

  • (heavyweight) process vs. (lightweight) thread

  • process control block
  • bootstrapping
  • batch process
  • resident monitor
  • multiprogramming
  • timesharing (or preemptive multi-tasking)
  • non-preemptive multi-tasking = multiprogramming without timesharing
  • job scheduling
  • ready queue
  • process scheduling
  • process scheduling (or CPU scheduling)
  • context switch
  • context switch time
  • quantum (or time slice)
  • system call
  • interrupt (hardware)
  • interrupt service routine
  • (asynchronous or synchronous) signal (software)
  • asynchronous event
  • synchronous event
  • device driver
  • paging
  • segmentation
  • paged segmentation
  • UNIX is a multiprogramming, timeshared OS.

Why study this stuff anyway?

  • an improved understanding/appreciation of the internals of your system and systems software will make you a better application programmer
  • UNIX and C are an enabling environment/language for wide
  • since UNIX and C are ubiquitous in our field, in general, to be a well-rounded computer scientist
  • communication and concurrency are everything in today's software
  • ability to write reliable and secure code is indispensable (counter-terrorism)
  • gateway to studies in distributed computing and networking

Course objectives

  • Develop a proficiency in UNIX and C as a systems programming language/environment.
  • Survey various system-oriented software tools, including debuggers, and compilation and configuration managers.
  • Establish an understanding of the design and development of systems software, such as command interpreters and compilers, through the study of pattern matching and filters, interprocess communication, system libraries, signals, and automatic program generation.
  • Explore UNIX internals and establish an understanding of UNIX system calls.
  • Introduce the client/server model of computation.

Overview of CPS 444/544 course outline


    [OSC8] A. Silberschatz, P.B. Galvin, and G. Gagne. Operating Systems Concepts. John Wiley and Sons, Inc., Eighth edition, 2009.
    [UPE] B.W. Kernighan and R. Pike. The UNIX Programming Environment. Prentice Hall, Upper Saddle River, NJ, Second edition, 1984.

Return Home