70 lines
1.9 KiB
Markdown
70 lines
1.9 KiB
Markdown
# Systems Programming Projects
|
||
|
||
Low-level work: operating systems, compilers, networking, and performance engineering.
|
||
|
||
---
|
||
|
||
## Tiny HTTP/1.1 Server (C)
|
||
|
||
A from-scratch HTTP server written in C that handles concurrent connections using `epoll` on Linux.
|
||
|
||
**What it does:**
|
||
|
||
- Serves static files with correct MIME types
|
||
- Handles `keep-alive` connections
|
||
- Parses request headers manually (no third-party parser)
|
||
- ~1,200 lines of C — intentionally minimal
|
||
|
||
**Interesting problems solved:**
|
||
|
||
- Non-blocking I/O with an event loop
|
||
- Incremental parsing of chunked request bodies
|
||
- Safe path traversal (no `../` escapes from the document root)
|
||
|
||
---
|
||
|
||
## Shell Implementation (C)
|
||
|
||
A POSIX-compatible shell (`mysh`) supporting pipelines, redirections, background jobs, and a small built-in set.
|
||
|
||
**Supported features:**
|
||
|
||
- Pipelines: `cmd1 | cmd2 | cmd3`
|
||
- I/O redirections: `>`, `>>`, `<`, `2>`
|
||
- Background jobs: `cmd &`
|
||
- Job control: `fg`, `bg`, `jobs`
|
||
- Signal handling (SIGINT, SIGTSTP, SIGHUP)
|
||
|
||
**Focus areas:** `fork/exec` model, `waitpid`, file descriptor management, signal masking.
|
||
|
||
---
|
||
|
||
## Memory Allocator
|
||
|
||
A drop-in `malloc` replacement using `mmap`-backed free lists with coalescing.
|
||
|
||
**Algorithms implemented:**
|
||
|
||
- First-fit and best-fit strategies (switchable at compile time)
|
||
- Boundary-tag coalescing to reduce fragmentation
|
||
- Thread-local caches for small allocations (reduces lock contention)
|
||
|
||
**Benchmarked** against `glibc malloc` on synthetic workloads — within 2× for mixed-size allocations.
|
||
|
||
---
|
||
|
||
## Bytecode Interpreter (Python → C)
|
||
|
||
A small virtual machine that executes a simple bytecode format, written in C. The front-end compiler is written in Python and produces `.bco` files.
|
||
|
||
**VM features:**
|
||
|
||
- Stack-based architecture (inspired by CPython)
|
||
- 30 opcodes: arithmetic, comparisons, jumps, function calls, closures
|
||
- Mark-and-sweep garbage collector
|
||
- Disassembler for debugging (`--disasm` flag)
|
||
|
||
---
|
||
|
||
*Press Q or ESC to return.*
|