Department of Computer Science and Technology, Nanjing University, Programming assignments of Introduction to Computer System, 2024
Pre-Laboratory Reading
Latest News (please check at least once a day)
- Academic Integrity (What is permissible and what is not)
- FAQ (Various questions about PA)
- How to Seek Help Properly: How To Ask Questions The Smart Way和Stop-Ask-Questions-The-Stupid-Ways
- External Resources
- PA tutorials (Fall 2023, Wang Huiyan Instructor): Course Materials
- ICS Theory Course on China University MOOC (Instructor Yuan Chunfeng): Part 1, Part 2, Part 3
- SICP of Nanjing University
- If you feel your programming foundation is not strong enough, it is highly recommended to self-study this course
- Although it teaches Python, the syntax of the language is secondary; the most important aspect is the training of programming thinking
- OS (Spring 2023, Instructor: Jiang Yanyan)
- Past PA tutorials
- Fall 2022, Wang Huiyan Instructor: Course Materials
- Fall 2021, Wang Huiyan Instructor: Course Materials
- Fall 2020, Jiang Yanyan Instructor: Course Materials, Bilibili Recordings
- 2024/01/25
- This handout is currently in the testing phase and will be considered as past handout material before the start of the Fall 2024 semester. If you are a student enrolled in the Fall 2024 ICS course, please do not use this handout as a substitute for the Fall 2024 ICS course PA lab handout. Submitting this experiment content will be considered as not submitted.
Read the handout offline
Handout pages of this lab are published through GitHub Pages, but the network may be unstable. You can clone this repository to your local machine, and read the handouts offline through your browser.
However, as the handout content is updated, you will not be able to automatically access the latest version. You need to manually execute bash update.sh
in the repository path to synchronize the latest version of the content to your local machine. Again, if you choose the offline reading method, then it is your responsibility to obtain the latest handout content.
How to Seek Help
- Please read this page and Why Study the Fundamentals of Computer Systems carefully before the lab.
- If you encounter difficulties during the lab and plan to seek our help, please first read How to Ask Questions the Smart Way and How Not to Ask Stupid Questions.
- If you find errors in the lab handouts and materials or have questions or suggestions about the lab content, please contact Zihao Yu via email (zihaoyu.x#gmail.com).
Some quotes
::::> * We are all living beings, taught from a young age to get the most out of the least effort, often forgetting what we truly want.
I admit I am a perfectionist, but I believe everyone has a thirst for knowledge and a longing for truth in their hearts. The soul of "university" lies in transcending the mundane and timeless innocence and ideals. -- We are not here to please corporate graduates, but to seek the power to change the world. -- jyy
- Education, beyond the memorization of knowledge, is essentially the training of abilities, the so-called training. And any training must overcome certain difficulties; otherwise, you are merely doing repetitive work, and your abilities will not improve. If you choose to retreat when encountering difficulties or let others overcome the difficulties you should overcome yourself, you are essentially giving up the opportunity for training, which is actually the most valuable part of professional education in university. -- etone
- The idea that "as long as it doesn't affect my current survival, it's not a problem" is actually very selfish and short-sighted: Your lack of skills in your profession will eventually catch up to you and affect the long-term development of your career. More seriously, students who approach their profession with a passable attitude, their survival is at the expense of the reputation of Nanjing University's education -- if a significant proportion of our graduates are like this, it won't be long before not only those who muddle through to graduation find it hard to survive, but also those who truly work hard will see their prospects affected. -- etone
Syllabus
The fundamental way to understand the idea that "how programs run on a computer" is to build a complete computer system from scratch. The small projects (Programming Assignment, PA) of the "Fundamentals of Computer Systems" course at the Department of Computer Science and Technology, Nanjing University, will present a corresponding teaching subset of the x86/mips32/riscv32(64) architecture. Students will be guided to implement a simplified yet functionally complete x86/mips32/riscv32(64) emulator, NEMU (NJU EMUlator). Ultimately, students will run the game "仙剑奇侠传" on NEMU to explore the basic principles of "how programs run on a computer." NEMU is inspired by QEMU and removes many parts that differ significantly from the course content. The PA includes a preparatory lab (setting up the lab environment) and five coherent parts:
- Turing Machine and Simple Debugger
- Von Neumann Computer System
- Batch Processing System
- Time-sharing Multitasking
- Program Performance Optimization
Environment of the Programming Assignment
- CPU Architecture: x64
- Operating System: GNU/Linux
- Compiler: GCC
- Programming language: C Programming Language
How to Get Help
During your study and experiments, you will encounter numerous problems. In addition to referring to the textbook, you need to know how to access other reference materials.
However, before doing so, you need to adapt to searching for English materials. Unlike the problems encountered in previous programming courses, you will find it difficult to find relevant Chinese materials. Reviewing the hierarchy of computer science abstractions, the introduction to computer system is at a lower level than programming language course. This means that there are fewer people who understand system fundamentals compared to those who understand programming, and accordingly, there are fewer Chinese materials on system fundamentals.
How do you adapt to searching for English materials? The method is to try and persist in searching for English materials.
Search Engines, Encyclopedias and Q&A Websites
To find English materials, you should use the websites recommended in the table below:
Search Engine | Encyclopedia | Q&A Website | |
---|---|---|---|
Recommended | Here for a mirror of Google search | http://en.wikipedia.org | http://stackoverflow.com |
Not Recommended |
Some explanations:
- Generally, Baidu's ability to handle English keywords is not as good as Google's.
- Typically, English Wikipedia contains richer content compared to Chinese Wikipedia and Baidu Baike. To illustrate why you should use English Wikipedia, please compare the entry "前束范式" (quantifier phrase) in Baidu Baike, Chinese Wikipedia, and English Wikipedia.
- Stack Overflow is a Q&A website in the field of programming, where besides technical questions (What is ":-!!" in C code?), there are also some academic (Is there a regular expression to detect a valid regular expression?) and interesting questions (What is the “-->” operator in C++?).
Official Manuals
The official manuals contain all the information about the objects you are searching for, and all questions about the objects can be found in the official manuals. Usually, the content of official manuals is very detailed, and it is unlikely that you can read through it all in a short time. Therefore, you need to know "how to use the table of contents to locate the issues you care about." If you are looking for some examples for quick reference, you should use a search engine.
Here are some manuals that may be used in this course:
- x86
- Intel 80386 Programmer's Reference Manual (PDF)(HTML)
- System V ABI for i386
- mips32
- MIPS32 Architecture For Programmers (Volume I, Volume II, Volume III)
- System V ABI for mips32
- riscv32(64)
- The RISC-V Instruction Set Manual (Volume I, Volume II)
- ABI for riscv
- manuals that is unrelated to ISA
- System V generic ABI
- C99 Standard
- GCC 10.3.0 Manual
- GDB User Manual
- GNU Make Manual
- On-line Manual Pager (known as man, there is a beginner's tutorial here)
GNU/Linux introductory tutorial
jyy has prepared some introductory tutorials on GNU/Linux for us. If you are using GNU/Linux for the first time, please read the following materials:
- Linux introductory tutorial from the OS experiment course website, passed down from ancient times
- The Missing Semester of Your CS Education (highly recommended)
License Agreement
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Mainland China License
. To view this license agreement, you can visit here, or write to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.