linux基础 | 青训营笔记

43 阅读2分钟

计算机硬件

计算机组成单元

控制器
运算器
存储器
输入单元
输出单元

操作系统

控制管理计算机硬件软件资源,在用户和系统之间传递信息

操作系统作为软件的启动方式

1.BIOS 在主板上的一段程序,开机的时候找到操作系统
2.UEFI 是BIOS的优化,优化自检过程
UEFI可以引导更大的磁盘启动

linux版本

内核版本:由linux本人维护的基本linux
发行版本: 内核版本+常用软件 Ubuntu Redhat。。。

linux基本组成

1.内核
2.shell
3.文件系统
4.应用程序

linux体系结构

用户空间
内核空间
隔离的,应用程序崩溃不影响内核空间
权限部分:内核空间有更高的权限,确保系统稳定可靠
程序调用:从用户态进入内核态调用硬件,再回到用户态返回结果

进程管理

进程是以进程为模板拉起的,不是直接被创建的,要从父进程拉起
进程调度是cpu按照某种规则选择进程占用cpu

进程的状态

   R:可执行状态
   S:可中断的睡眠状态
   D:不可中断的睡眠状态
   T:暂停或者跟踪debug
   Z:退出状态,僵尸
   X:退出状态
 每个进程几乎相等执行时间

文件系统

普通文件,目录,设备,套接字等都是文件
保证操作和接口调用的统一
*虚拟文件系统VFS*
将不同文件类型抽象出同样的接口

软件包管理

例如RPM和DPKG

贴一段写的特别好笑的代码哈哈哈哈哈

def extern_region(p1:point,p2:point,k:float):
#传入两个点,先左上角再右下角,返回一个包含八个左上角坐标和右下角坐标对的list
ans_list = []
dist = location_math.get_distance(p1.lat,p1.lng,p2.lat,p2.lng)
k2 = point()
k2.lat = p1.lat
k2.lng = p1.lng
k1 = location_math.get_location(p1,7 * math.pi / 4,dist)
ans_list.append([k1,k2])
k1 = location_math.get_location(p1,0,k)
k2 = location_math.get_location(p1,math.pi/2,k)
ans_list.append([k1,k2])
k1 = location_math.get_location(location_math.get_location(p1,math.pi/2,k),0,k)
k2 = location_math.get_location(location_math.get_location(p1,math.pi/2,k),math.pi/2,k)
ans_list.append([k1,k2])
k1 = location_math.get_location(p1,math.pi/2,k)
k2 = location_math.get_location(p2,math.pi/2,k)
ans_list.append([k1,k2])
k1 = p2
k2 = location_math.get_location(p2,3 * math.pi / 4,dist)
ans_list.append([k1,k2])
k1 = location_math.get_location(p2,3 * math.pi / 2,k)
k2 = location_math.get_location(p2,math.pi,k)
ans_list.append([k1,k2])
k1 = location_math.get_location(location_math.get_location(p2,3 * math.pi / 2,k),3 * math.pi / 2,k)
k2 = location_math.get_location(location_math.get_location(p2,3 * math.pi / 2,k),math.pi,k)
ans_list.append([k1,k2])
k2 = location_math.get_location(p2,3 * math.pi / 2,k)
k1 = location_math.get_location(p1,3 * math.pi / 2,k)
ans_list.append([k1,k2])
return ans_list