This is the repository of my labs in Introduction to Computer System course, 2025 Fall.
This repository contains implementations and solutions for the CS:APP (Computer Systems: A Programmer's Perspective) labs from Carnegie Mellon University, which have been modified by Peking University. These labs are designed to help students understand the fundamental concepts of computer systems, including data representation, machine-level programming, processor architecture, program optimization, memory hierarchy, and network programming.
Topic: Bit Manipulation and Integer/Floating-Point Operations
- Implement various bit-level operations and integer/floating-point manipulations
- Understand two's complement representation and IEEE 754 floating-point format
- Practice with bitwise operators and logical operations
Topic: Reverse Engineering and Assembly Language
- Defuse a "binary bomb" by analyzing assembly code
- Understand x86-64 assembly language and calling conventions
- Practice with debugging tools (GDB) and reverse engineering techniques
Topic: Buffer Overflow and Code Injection Attacks
- Understand stack-based buffer overflow vulnerabilities
- Implement code injection attacks
- Learn about return-oriented programming (ROP) techniques
- Understand stack protection mechanisms
Topic: Cache Memory Hierarchy and Optimization
- Implement a cache simulator
- Optimize matrix transpose operations for cache performance
- Understand cache organization, associativity, and replacement policies
- Analyze cache hit/miss patterns
Topic: Processor Architecture and Y86-64 Instruction Set
- Implement Y86-64 instruction set architecture
- Build a pipelined processor simulator
- Understand instruction execution stages and pipeline hazards
- Optimize processor performance
Topic: Process Control and Signal Handling
- Implement a Unix shell with job control
- Handle process creation, termination, and signal management
- Implement foreground/background job execution
- Understand process groups and terminal control
Topic: Dynamic Memory Allocation
- Implement a dynamic memory allocator (malloc, free, realloc)
- Design and implement explicit or implicit free list allocators
- Optimize for throughput and memory utilization
- Handle heap fragmentation
Topic: Network Programming and Concurrent Web Proxy
- Implement a concurrent HTTP/1.0 web proxy server
- Handle multiple concurrent connections using threads
- Implement LRU (Least Recently Used) cache for web objects
- Parse and forward HTTP requests and responses
- Support binary data and proper error handling
Each lab directory contains:
- Lab handout files (PDF instructions)
- Source code and skeleton files
- Test scripts and drivers
- README files with specific instructions
To work on a lab:
- Navigate to the lab directory
- Read the lab PDF for detailed instructions
- Implement the required functionality
- Test using provided test scripts
- Submit according to course requirements
- Languages: C, x86-64 Assembly, Y86-64 Assembly
- Tools: GCC, GDB, Valgrind, Make
- Concepts:
- Bit manipulation
- Assembly language
- Process control
- Memory management
- Network programming
- Concurrent programming
- Cache optimization
- All code follows the CS:APP textbook conventions
- Solutions are implemented from scratch based on lab requirements
- Code includes proper error handling and robustness considerations
- Some labs may include additional optimizations beyond basic requirements
See LICENSE file for details.
- Course: Introduction to Computer System, Peking University, 2025 Fall
- Textbook: Computer Systems: A Programmer's Perspective (3rd Edition)
- Labs: Peking University ICS Labs
I would like to express my sincere gratitude to:
- Instructors: Junlin Lu - for his excellent teaching and guidance throughout the course
- Teaching Assistants: Enbo Wang - for his patient help, detailed feedback, and support during the labs
Their dedication and expertise have been invaluable in helping me understand the fundamental concepts of computer systems.
Last updated: 2025