Homeworks
Programming assignments for the Systems Programming course, grouped by topic.
Programming assignments for the course, grouped by topic.
Environment
File Systems
FS-1: Read from the file
You need to implement a program that does the same thing as the cat command in the Linux.
FS-2: Copy a file
Learn to copy files in C++ on Linux with proper error handling. Overwrite destination files effortlessly. Perfect for System Programming beginners.
FS-3: Secure file deletion
Implement a C++ program that securely deletes a file by overwriting every byte with '\0' before removing it from the filesystem.
FS-4: Redirect standard input
Redirect a program's standard input to read from a file instead of the keyboard, without changing its std::cin or scanf calls.
FS-5: Manual append
Your task is to write a program on C/C++ that writes two lines in the files "first line" and "second line".
FS-10: Copy a file with holes
Copy a file in C++ on Linux while preserving its holes (sparse regions), overwriting the destination and reporting data and hole byte counts.
Processes
PS-1: Do command
Your task is to implement a C++ program that accepts a command name and command arguments with command-line arguments and executes it in a new process.
PS-2: Interactive shell
Build an interactive C++ shell that spawns a process per command, adds the current directory to PATH, and redirects 'silent' commands to a PID.log file.
Threads
TH-1: Array Summary
Sum a large array in C++ with and without multithreading, taking array size and thread count from the command line, and compare the timings.
TH-2: Thread Pool
Build a C++ parallel_scheduler thread pool with a fixed capacity, enqueue functions for execution, and ship it as a shared library with a demo app.
IPC
IPC-1: Signal Echo
Write a C++ program that prints its PID and handles SIGUSR1, reporting the sender's PID, UID and username, and CPU register values.
IPC-2: Prime Calculator
Write a C++ program that passes a number to a child process via an anonymous pipe, computes the m-th prime, and returns it to the parent.
IPC-3: Shared Array
Implement a C++ shared_array class that shares an integer array between processes by name and size, with operator[] access and semaphore synchronization.
Networking
NET-1: Echo Server
Build a TCP echo server and client in C/C++ on Linux using the BSD socket API, handling client connections and basic network communication.
NET-2: Multiplexed Sqrt Server
Build a non-blocking multiplexed TCP server in C/C++ using epoll that returns sqrt(abs(x)) for 4-byte integers from many simultaneous clients.