Course home · 15 lectures in 26 parts · 15 labs

System Programming

CSE 4105 · Md Mahbub E Noor · Assistant Professor, Department of CSE, University of Barishal

$ gcc hello.c && ./a.out → assembler · linker · loader · ELF · kernel · system calls · memory · files · interrupts · drivers

How to use

Slides: →/Space next step, ← back, F full screen, a number and Enter to jump, S slide list. The bar on top switches lectures ([ ]) and opens the lab (L). Press ? for all keys.

Labs: every lab page has the tasks, all the files and tools that run in the browser. Its bar goes back to the slides, or to the previous or next lab. Then do the lab on a Linux PC.

Offline: everything is in this folder: fonts, videos, slides and labs. Copy it to a lab PC and open index.html in any browser, no internet needed.

This semesterShort course · 10 classes

The most important ideas of the course, one class per meeting, made from the same slides. Every class ends with its key ideas, three homework questions and a tool to try. The full course below has every detail and all the labs.

  1. 01
    What System Programming Isfrom hello.c to a running program, and the machine underneath17 slides · from lecture 1
  2. 02
    Machine Language and the SIC Machineinstructions, formats and addressing, seen through C19 slides · from lecture 2
  3. 03
    Assemblerstwo passes, the symbol table, the object program, relocation20 slides · from lectures 3.1, 3.2
  4. 04
    Macros and Loaderstext substitution before assembly; loading and relocating after it19 slides · from lectures 4, 5.1
  5. 05
    Linking and the ELF Formatshared libraries, and what is inside an object file20 slides · from lectures 5.2, 6
  6. 06
    The Linux Kernel and Bootingwhat a kernel is, and how it gets started19 slides · from lectures 7.1, 7.2
  7. 07
    Processes and Schedulingfork, exec, exit, wait, and who gets the CPU17 slides · from lectures 8.1, 8.2
  8. 08
    System Calls, Pipes and Signalshow a program asks the kernel, and how processes talk19 slides · from lectures 9, 10.1, 10.2
  9. 09
    Memory and Filesvirtual memory, page faults, malloc, and the file system19 slides · from lectures 11.1, 11.2, 12.1
  10. 10
    Interrupts, Modules and Drivershow hardware gets the kernel's attention, and your own code inside the kernel21 slides · from lectures 13, 14.1, 15.1, 15.3

System softwarePart A · Lectures 1–6

  1. 1
    Introduction to System Programming and Machine Structures34 slides · Lab 1: C programs that probe the machine
  2. 2
    Machine and Assembly LanguageSIC, SIC/XE and x86-64, seen through C35 slides · Lab 2: nasm programs; reading gcc's assembly
  3. 3.1
    Basic Assembler Functionsfrom source program to object program29 slides · Lab 3: a two-pass SIC assembler in C
  4. 3.2
    Machine-Dependent Assembler FeaturesSIC/XE formats, displacements, relocation28 slides · Lab 3, part 3.2
  5. 3.3
    Machine-Independent Features and assembler design options26 slides · Lab 3, part 3.3
  6. 4
    Macro Processorsfrom SIC macros to the C preprocessor33 slides · Lab 4: a macro processor in C
  7. 5.1
    Loadersabsolute, relocating and linking34 slides · Lab 5: a SIC loader: absolute, relocating, linking
  8. 5.2
    Loader Design Options and dynamic linking31 slides · Lab 5, part 5.2
  9. 6
    Object File Formatsreading ELF byte by byte33 slides · Lab 6: elfread, a small readelf

The Linux kernelPart B · Lectures 7–13

  1. 7.1
    The Linux Kernelan overview from the inside26 slides · Lab 7: kinfo and your own PID 1 in QEMU
  2. 7.2
    Booting Linuxfrom power-on to your own PID 127 slides · Lab 7, part 7.2
  3. 8.1
    Processesfork, exec, exit and wait27 slides · Lab 8: mysh, a small shell; scheduling
  4. 8.2
    execve and Schedulinghow a file becomes a process, and who gets the CPU25 slides · Lab 8, part 8.2
  5. 9
    System Callsthe only door into the kernel29 slides · Lab 9: a C program with no C library
  6. 10.1
    Inter-process Communicationpipes, FIFOs and shared memory26 slides · Lab 10: pipes in mysh; mytimeout with signals
  7. 10.2
    Signalsthe kernel's doorbell28 slides · Lab 10, part 10.2
  8. 11.1
    Virtual Memorypages, page tables and page faults27 slides · Lab 11: vtop and mymalloc
  9. 11.2
    Memory Allocationmalloc, the heap, and the kernel's allocators25 slides · Lab 11, part 11.2
  10. 12.1
    Files and the VFSdescriptors, inodes, directories30 slides · Lab 12: myls and ext2cat
  11. 12.2
    File Systems on Diskblocks, inodes, the page cache, journaling29 slides · Lab 12, part 12.2
  12. 13
    Interrupts and Exceptionsthe IDT, IRQs, bottom halves, timers32 slides · Lab 13: irqtop: interrupts per second

Modules and driversPart C · Lectures 14–15

  1. 14.1
    Loadable Kernel Modulesyour first code inside the kernel30 slides · Lab 14: a /proc module and a platform driver
  2. 14.2
    The Device Driver Modelbuses, devices, drivers, sysfs27 slides · Lab 14, part 14.2
  3. 15.1
    Character Device Driversyour own file in /dev29 slides · Lab 15: char, block and USB drivers
  4. 15.2
    Block Device Driversa disk made of RAM25 slides · Lab 15, part 15.2
  5. 15.3
    USB Device Driversa keyboard, a URB, and the end of the course28 slides · Lab 15, part 15.3