我与Archlinux
不知不觉使用Archlinux已经五六年了,一直使用Archlinux+KDE桌面的组合,从之前的三天一小崩、五天一大崩,到现在已经基本不会出现崩溃的情况(除非很久不更新)。用心去维护一个自己的系统也挺有意思的,感觉就像养个孩子似的。
我的主题配置如下:
使用插件和配置如下:
12345678910111213141516Global Theme: MoePlasma Style: MoeKvantum: MoeWinows Decorations: MoeColor: MoeIcons: McMuse-circle-redCursors: McMojave Cursorsdock: latte-dock-gitLatte Dock Layout: MoeKonsole Theme: Moewidgets: System Tray, Application Luncher, Window Buttons, Window Title, Global Menu, Event Calendar, NetspeedWidget, separator, sidebarbuttonO ...
Linux文件系统之AUFS
AUFS(advanced multi-layered unification filesystem, 高级多层统一文件系统),用于为Linux文件系统实现联合挂载。AUFS没有合入Linux主线,但是ubuntu中有该文件系统
检查系统是否支持AUFS使用一下命令查看是否支持AUFS:
123$ grep aufs /proc/filesystems nodev aufs# 如果命令没有输出,表示内核不支持AUFS
创建AUFS实验准备创建实验目录
1mkdir aufs
然后在 aufs 中创建名称为 mnt 的目录作为文件系统的挂载点:
1mkdir aufs/mnt
接下来在 aufs 目录下创建 container-layer 文件夹(模拟容器的读写层),并且在文件夹中创建文件 container-layer.txt,文件的内容初始化为 “I am container layer”:
12mkdir aufs/container-layerecho "I am container layer" > aufs/container-layer/ ...
MIT6.S081 XV6 lab3 page tables
Speed up system calls
When each process is created, map one read-only page at USYSCALL (a VA defined in memlayout.h). At the start of this page, store a struct usyscall (also defined in memlayout.h), and initialize it to store the PID of the current process. For this lab, ugetpid() has been provided on the userspace side and will automatically use the USYSCALL mapping. You will receive full credit for this part of the lab if the ugetpid test case passes when running pgtbltest.
Some hints:
You ...
MIT6.S081 XV6 lab2 syscall
System call tracing
In this assignment you will add a system call tracing feature that may help you when debugging later labs. You’ll create a new trace system call that will control tracing. It should take one argument, an integer “mask”, whose bits specify which system calls to trace. For example, to trace the fork system call, a program calls trace(1 << SYS_fork), where SYS_fork is a syscall number from kernel/syscall.h. You have to modify the xv6 kernel to print out a line when each sy ...
MIT6.S081 XV6 lab1 util
pingpong
Write a program that uses UNIX system calls to ‘’ping-pong’’ a byte between two processes over a pair of pipes, one for each direction. The parent should send a byte to the child; the child should print “: received ping”, where is its process ID, write the byte on the pipe to the parent, and exit; the parent should read the byte from the child, print “: received pong”, and exit. Your solution should be in the file user/pingpong.c.
Use pipe to create a pipe.
Use fork to create a chil ...
MIT6.S081 XV6实验环境搭建
Docker 搭建ubuntu环境获取ubuntu镜像:
1docker pull ubuntu
启动一个容器:
1docker run -itw /root --name ubuntu ubuntu bash
连接ubuntu系统交互环境:
1docker start -i ubuntu
进入系统后更新以及安装vim:
12apt updateapt install vim
更换国内源:
1vim /etc/apt/source.list
将内容替换为(由于没有https,所以用http),注意安装ubuntu版本和源版本是否匹配,如果不匹配就无法自动安装软件相关的依赖。这里docker直接拉取ubuntu:latest,所以直接用最后一个版本的源即可:
12345678deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ impish main restricted universe multiversedeb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ impish main ...
Kernel中进程的管理和调度
进程ID的类型内核中的进程ID类型用pid_type来描述,定义在include/linux/pid.h
12345678910111213141516171819202122232425262728293031323334353637enum pid_type{ PIDTYPE_PID, PIDTYPE_TGID, PIDTYPE_PGID, PIDTYPE_SID, PIDTYPE_MAX,};/* * What is struct pid? * * A struct pid is the kernel's internal notion of a process identifier. * It refers to individual tasks, process groups, and sessions. While * there are processes attached to it the struct pid lives in a hash * table, so it and then the processes that it r ...
Kernel中的命名空间
命名空间Linux Namespace是Kernel的一个功能,它可以隔离一系列的系统资源,如PID、User Id、Network等等。
命名空间描述一个进程可以属于多个namespace,在task_struct结构体中有一个指向namespace结构体的指针。
123456struct task_struct { ... /* Namespaces: */ struct nsproxy *nsproxy; ...}
nsproxy在文件include/linux/nsproxy.h的定义如下:
123456789101112131415161718192021222324252627/* * A structure to contain pointers to all per-process * namespaces - fs (mount), uts, network, sysvipc, etc. * * The pid namespace is an exception -- it's accessed using * task ...
Kernel进程描述符task_struct结构
task_structtask_struct结构体定义在include/linux/sched.h
任务状态1234unsigned int __state;int exit_state;int exit_code;int exit_signal;
__state成员可能的取值如下:
123456789101112131415161718192021222324252627282930313233343536373839404142434445/* * Task state bitmask. NOTE! These bits are also * encoded in fs/proc/array.c: get_task_state(). * * We have two separate sets of flags: task->state * is about runnability, while task->exit_state are * about the task exiting. Confusing, but this way * modi ...
cmake学习
变量预定义变量12345678910PROJECT_SOURCE_DIR # 工程的根目录PROJECT_BINARY_DIR # 运行 cmake 命令的目录,通常是 ${PROJECT_SOURCE_DIR}/build PROJECT_NAME # 返回通过 project 命令定义的项目名称CMAKE_CURRENT_SOURCE_DIR # 当前处理的 CMakeLists.txt 所在的路径CMAKE_CURRENT_BINARY_DIR # target 编译目录CMAKE_CURRENT_LIST_DIR # CMakeLists.txt 的完整路径CMAKE_CURRENT_LIST_LINE # 当前所在的行CMAKE_MODULE_PATH # 定义自己的 cmake 模块所在的路径,SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake),然后可以用INCLUDE命令来调用自己的模块EXECUTABLE_OUTP ...







