当前位置:网站首页>[MIT 6.S081] Lec 3: OS organization and system calls 笔记
[MIT 6.S081] Lec 3: OS organization and system calls 笔记
2022-07-27 16:09:00 【PeakCrosser】
Lec 3: OS organization and system calls
- Ref: https://github.com/huihongxiao/MIT6.S081/tree/master/lec03-os-organization-and-system-calls
- Preparation: xv6 book Chapter 2
Topic
- Isolation 隔离性
- Kernel/User mode 内核/用户模式
- System Call 系统调用
- xv6 实现
Isolation 隔离性
Unix Interface - 实现复用和物理内存隔离:
- abstract the HW resource 抽象硬件资源
- process: instead CPU 进程:应用程序通过进程与 CPU 交换, 抽象了 CPU
- exec: instead of memory 加载镜像, 内存隔离
- files: instead of disk block 文件系统: 抽象了磁盘块
Defensive 防御性
App cannot crash the OS
App cannot break out of its isolation
通过硬件实现强隔离性 Strong Isolation between apps + OS
typical: HW support:
- user/kernel mode
- virtual memory
user/kernel mode
user: unprivileged instructions - ADD, SUB, JRC, BRANCH
kernel: privileged instructions - setup page table设置页表寄存器, 关闭时钟中断
virtual memory
page table: virtual addr -> physical addr
process has own page table
memory isolation
User/Kernel mode Switch

RISC-V: ECALL 指令: 控制权由用户转移至内核
每个应用程序发起系统调用通过 syscall 函数
Kernel = Trusted Computing Base(TCB) 内核被称为可被信任的计算空间
- Kernel must have no bugs
- Kernel must treat processes as malicious
Monolithic Kernel vs Micro Kernel 宏内核 vs 微内核
- 宏内核: 所有操作系统服务都在内核态
- 缺点: 内核中有大量代码, Bug 隐患
- 有点: 子模块在同一程序, 性能好
- 微内核: 内核仅有较少模块
- 优点: 较少的 Bug
- 缺点: 用户态内核态切换的性能损耗; 共享困难
xv6: 宏内核
内核编译
- Makefile 读取 C 文件, 调用 gcc 编译器 生成 .s 的 RISC-V 汇编语言文件
- 调用汇编解释器生成 .o 的二进制文件
- 所有内核 C 文件重复 1, 2 的操作
- 系统加载器(Loader)收集所有 .o 文件, 链接在一起生成内核文件

传给QEMU的几个参数:
- kernel:这里传递的是内核文件(kernel目录下的kernel文件),这是将在QEMU中运行的程序文件。
- m:这里传递的是RISC-V虚拟机将会使用的内存数量
- smp:这里传递的是虚拟机可以使用的CPU核数
- drive:传递的是虚拟机使用的磁盘驱动,这里传入的是fs.img文件

XV6 启动过程
kernel/entry.S -> kernel/start.c-start() -> kernel/main.c-main()-> kernel/proc.c-userinit() 第一个用户进程, 用于与操作系统交互
userinit() 中会执行 initcode 代码, 其中会执行系统调用 SYS_exec, 并执行用户态的 init 程序(user/init.c), 最终将 shell 运行起来.
边栏推荐
- Es query limit 10000 data solutions
- Deep learning: Gan optimization method dcgan case
- Three consecutive high-frequency interview questions of redis online celebrity: cache penetration? Cache breakdown? Cache avalanche?
- Interview FAQs 12
- Technology sharing | quick intercom integrated dispatching system
- WPF做登陆界面
- 二叉树概念
- 深度学习:GAN案例练习-minst手写数字
- MySQL solves the problem of insert failure caused by duplicate unique indexes
- 贴牌“美国制造”,国产安防设备竟被装上了美航母!
猜你喜欢

CFA exam registration instructions

Set up SSO based on SAML 2.0 in salesforce and enable JIT user provisioning (between SF orgs / between SF org and experience cloud / other IDPs)

Salesforce runs all test classes and gets coverage reports

【学习笔记】Redis中有序集合zset的实现原理——跳表

Deep learning: GCN (graph convolution neural network) theory learning summary

深度学习:GAN优化方法-DCGAN案例

【学习笔记】MySQL数据库高级版 - 索引优化、慢查询、锁机制等

Interview FAQs 12
![[learning notes] the implementation principle of the ordered set Zset in redis - skip table](/img/c6/5d9f48fce1dc1c78b8c7dbcf046fc7.png)
[learning notes] the implementation principle of the ordered set Zset in redis - skip table

动态链表4单向循环链表(LoopSingle实现)
随机推荐
After being "expelled" from bitland, the Jank group said for the first time: it will return as soon as possible through legal channels!
Set up SSO based on SAML 2.0 in salesforce and enable JIT user provisioning (between SF orgs / between SF org and experience cloud / other IDPs)
美团二面:为什么Redis会有哨兵?
贴牌“美国制造”,国产安防设备竟被装上了美航母!
[learning notes] solutions to hot account problems
On recommend mechanism in distributed training
江苏华存首发PCIe 5.0 SSD主控:台积电12nm工艺,2020年量产
The first PCIe 5.0 SSD master of Jiangsu Huacun: TSMC 12NM process, mass production in 2020
Profiles vs Permission Sets
力压谷歌、英伟达!阿里含光800芯片再获权威测试世界第一
Dbeaver connection MySQL error: the server time zone value 'Ö Ð¹ ú±ê ×¼ ʱ ¼ ä‘ is unrecognized or represents more than
Deep learning: GCN case
XStream reports an error abstractreflectionconverter$unknownfield exception when parsing XML
Golang Chan implements mutual exclusion
Local development using LWC in salesforce
Technology sharing | quick intercom integrated dispatching system
"Who is Huawei" documentary film series landing on BBC: exposing a large number of Ren Zhengfei's unknown experience
Introduction to ef framework
3. opencv几何变换
动态链表3队列的链式存储结构(LinkedQueue实现)