编译安装一个linux
Linux内核下载
https://zhuanlan.zhihu.com/p/424240082
从kernel.org安装源代码到/user/src/linux目录下面
我下载了linux-5.15.62,解压缩预计15分钟。。。
代码目录:https://zhuanlan.zhihu.com/p/375238002
官方文档:The Linux Kernel documentation — The Linux Kernel documentation
Linux内核源码分析:基于最新的Linux 4.0内核(学习路线总结)_后端_Linux服务器开发_InfoQ写作社区
1. 学习站点:
https://elixir.bootlin.com/linux/0.12/source/ 在线源码阅读
Linux_Kernel_Newbies - Linux Kernel Newbies 新手引导
What every computer science major should know (might.net)
2.参考书籍:
Linux Kernel Development
Understanding the Linux Kernel
进程管理
linux的进程再/proc文件内,这个文件不是在硬盘上面,是在内存中。
查看进程命令
ps
qemu
https://www.iteye.com/blog/lobin-2047130
wang@ubuntu:~/Desktop/c$ tree
.
├── main
├── main.c
├── test
└── test.c
main.c
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<unistd.h>
#include <sys/prctl.h>
int main()
{
printf("fork...\n");
prctl(PR_SET_NAME, "mymain", NULL, NULL, NULL);
int i =0;
if(fork()==0)
{
execlp("/home/wang/Desktop/c/test",NULL);
printf("creat test ...\n");
}
while(1)
{
printf("main gitpid() = %d\n",getpid());
sleep(1);
}
return 0;
}
test.c
#include<stdio.h>
#include<unistd.h>
#include <sys/prctl.h>
int main()
{
int i=0;
prctl(PR_SET_NAME, "mytest", NULL, NULL, NULL);
while(1){
printf("test.c pid = %d\n",getpid());
sleep(1);
}
return 0;
}
管道
管道运算符 |
ls | grep :把第一个程序运行的结果作为第二个程序的输入