南大计算机系统基础实验PA0笔记

更新时间:2023-07-28 07:23:32 阅读: 评论:0

南⼤计算机系统基础实验PA0笔记
技能学习
最近开始学习南京⼤学计算机系统实验,刚刚完成PA0——开发环境配置。从安装 GNU/Linux 系统,熟悉Linux常⽤命令,学习Makefile,GDB,Git,TMux⼯具的的使⽤,编译并运⾏NEMU(全系统模拟器)。
PA0实验中遇到印象⾮常深刻的问题是:
1. 在Installing Tools环节,系统崩溃⾃动重启⽆法开机,安装的是双系统,ubuntu 20.04 LTS。第⼀次系统崩溃不知道是什么问题,
以为⾃⼰指令操作不当导致。只好重新安装系统(仍然是⽤之前做好的Ubuntu20.04LTS U盘),安装输⼊法、翻墙⼯具然后⼜是Installing Tools环节,⽆法关机(右上⾓的Poweroff按钮消失)后使⽤终端poweroff关机,此时已经凌晨2点以为解决了。早上起来⽆法开机(⼼态有点崩),在怀疑是系统与软件兼容问题?不过不是LTS版本吗?带着疑惑试了第三次重装,果然是⼀样的结果。
后重新下载ubuntu 21.04,后来没有故障。由于⾃⼰对linux的不熟悉导致了浪费了很多时间,不过也熟悉了不少。
2. 在Compiling and Running NEMU环节,在执⾏make menuconfig命令后出现报错,官⽅给的⽅案是⾃⼰解决。⼀开始看着报错摸不
着头脑,分析报错信息,查看nemu⽂件构成,功能等,半个⼩时过去了没解决(就开始作弊了,百度搜索…不过还好也没搜到解决⽅案),只能接着想后来在报错信息发现了端倪和官⽅的提⽰(缺少的⼯具装上),根据信息装上了两个⼯具后成功解决这个报错。虽然是个⼩问题,但⽆不反应普通⾼校学校的同学对学术欺骗的态度,和⾯对问题的独⽴解决能⼒差和不耐⼼,值得⾃⼰反思。
自我评价怎么写简短这是实验的开端,官⽅预计解决时间是10h,我花了23h,可见与南⼤学⼦的差距。此次实验也是对⾃⼰能⼒的调整与突破:尝试全英⽂学习,使⽤英⽂doc,全英⽂版ubuntu,全英⽂查阅问题
尽可能做到学术诚信,不抄袭,不参考他⼈代码,独⽴解决
PA0
First Exploration with GNU/Linux
GUI and CLI
狗猫鼠的读后感
if you stick to GUI, you can only do what it can; but in CLI(Command Line Interface), it can do what you want. Difference Between “su” and “su -” Commands
Linux Ur Environment: Linux’s systems are multi-ur environments. Whenever Linux operating system creates a new shell ssion(a new terminal) it started preparing an environment for itlf. This environment basically holds the Environment variable(Environment depends on shell type, Bash is generally ud by most of the Linux distribution).
For example, pwd command is an environmental variable.
su command is an abbreviation(缩写) for “substitute ur” becau it is ud for switching to another ur during a normal login ssion, but it is often mistaken as an abbreviation for “super ur” as mainly su command is ud for getting “super ur” privileges.
Su Command
绝地球生
$whoami简笔画猴子
ryan #show current ur
$pwd
/home/ryan #show cuurent directory
$su root #not create a new Ur Environment
#whoami
root
#pwd
/home/ryan #the same
Su - Command
英语的手抄报
$whoami
ryan #show current ur
$pwd
/home/ryan #show current directory
$su - root #Create a new Ur Environment
#whoami
root
#pwd
/root
su command does not create a new Ur Environment (in the simple term they pretend to be the target ur) but su -
**creates a totally new **Ur Environment(in the simple term they are actually the target ur).
Sudo Command
sudo command executes instructions as a system administrator, that is to say, the instructions executed via sudo are as if they were executed by root himlf.
More Exploration
Man Command
man an interface to the system reference manuals.
体育锻炼的方法
Input man ls, “LS(1)” is displayed in the upper left corner, “LS” means manual’s name and “(1)” means this in the first chapter.
Makefile
Makefile is a program-building tool that runs on Unix, Linux, and their flavors. It aids in simplifying building program executables that may need various modules. To determine how the modules need to be compiled or recompiled, make takes the help of ur-defined makefiles. Makefile guides the make utility while compiling and linking program modules.
Compiling the source code files can be tiring, especially when you have to include veral source files and type the compiling command every time you need to compile. Makefiles are the solution to simplify this task.
Makefiles are speical format files that help build and manage the projects automatically.
世界三大河流
The make command allows you to manage large programs or groups of programs. As you begin to write large programs, you notice that re-compiling large programs take a longer time than re-compiling short programs. Moreover, you notice that you usually only work on a small ction of the program, and much of reaming program is unchanged.
Difference between g++ & gcc
g++gcc
g++ is ud to compile C++ is ud to compile C program
g++ can compile any .c or .cpp files but they will be treated as
C++ can compile any .c or .cpp files but they will be treated as C and
C++ respectively.
g++ fileName.cpp -o binary gcc fileName.c -o binary
Using g++ to link the object files, file automatically links in the
std C++ libraries.
gcc does not do this.
Defining Rules in Makefile
target [] : []
[]
In the above code, the arguments in brackets are optional and ellipsis means one or more.Here, note that the tab to preface each command is required.
Make How to Execute
Find “Makefile” or “makefile” files in the current directory.
If you find it, make will arch the first target of the makefile, such as the main file(executable file).
If the main file is not found or the .o files that the main file depends on are newer than it, execute the command to generate the main file.
If the .o files are not found, make will find the dependent files of the .o files and execute the command to generate .o files(It likes the process of the stack).
If the .o files and .h files are both found, make will generate .o files then u .o files to achieve the final task - - -generate the main file.
Special Macros
$@The file name of the target.
$<The name of the first dependency.
$*The part of filename which matched a suffix rule.
$?The names of all the dependencies newer than the target parated by spaces.
$^The names of all the dependencies parated by spaces, but with duplicate names removed.
GDB
GDB, short for GNU Debugger, is the most popular debugger for UNIX systems to debug C and C++
programs. A debugger is a program that runs other programs, allowing the ur to exerci control over the programs, and to examine variables when problems ari.
GDB Command
Getting Started: Starting and Stopping
gcc -g main.c - Compiles main.c with the debugging option (-g). You still get an a.out, but it contains debugging
information that lets you u variables and function names inside GDB.
gdb a.out - Opens GDB with file a.out, but does not run the program.
r - Runs the program until a breakpoint or error
q - Quit GDB
l - List 10 lines of source code for current line.
Stepping through Code
next - Runs the program until next line, then paus. If the current line is a function, it executes the entire function , the paus. next is good for walking through your code quickly.
step - Runs the next instruction, not line.If the current instruction is tting a variable, it is the same as next. If it’s a function, it will jump into the function, execute the first statement, then pau. step is good for diving into the detail of your code.
finish - Finishes executing the current function, then pau (also called step out).
Breakpoints or Watchpoints
print x - Prints current value of variable x.
display x - Constantly displays the value of variable x, which is shown after every step of pau.
Getting Source Code for PAs
Git usage
张云逸大将
U the branch feature of git to manage the process of development. A branch is an ordered list of commits , where a commit refers to some modifications in the project.
git branch - List all branches.
** git checkout -b newbranch** - Create a new branch and check out to it.
git status - See tho files modified from the last commit.
git diff - List modifications from the last commit.
git add . - Add the changes to commit.
git commit - Finish a commit.
git checkout branch - Check out to branch.
git log - The changes is traced.
Compiling and Running NEMU
NEMU (NJU Emulator) is a simple but complete full-system emulator designed for teaching purpos. Currently, it supports x86, mips32, riscv32, and riscv64. To build programs run above NEMU, refer to the .

本文发布于:2023-07-28 07:23:32,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/1121400.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:实验   解决   系统   报错   学术   信息   开始
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图