当前位置:网站首页>[mit 6.s081] LEC 3: OS organization and system calls notes
[mit 6.s081] LEC 3: OS organization and system calls notes
2022-07-27 18:27: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 Isolation,
- Kernel/User mode kernel / User mode
- System Call system call
- xv6 Realization
Isolation Isolation,
Unix Interface - Realize reuse and physical memory isolation :
- abstract the HW resource Abstract hardware resources
- process: instead CPU process : The application communicates with the CPU In exchange for , Abstract the CPU
- exec: instead of memory Load the image , Memory isolation
- files: instead of disk block file system : Abstracted disk blocks
Defensive Defensive
App cannot crash the OS
App cannot break out of its isolation
Strong isolation through hardware 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 Set the page table register , Turn off clock interrupt
virtual memory
page table: virtual addr -> physical addr
process has own page table
memory isolation
User/Kernel mode Switch

RISC-V: ECALL Instructions : Control is transferred from the user to the kernel 
Each application initiates a system call through syscall function
Kernel = Trusted Computing Base(TCB) The kernel is called a trusted computing space
- Kernel must have no bugs
- Kernel must treat processes as malicious
Monolithic Kernel vs Micro Kernel Macro kernel vs Microkernel
- Macro kernel : All operating system services are in kernel mode
- shortcoming : There is a lot of code in the kernel , Bug hidden danger
- somewhat : Sub modules in the same program , Good performance
- Microkernel : The kernel has only a few modules
- advantage : Less Bug
- shortcoming : Performance loss of user mode and kernel mode switching ; Sharing difficulties
xv6: Macro kernel
Kernel compilation
- Makefile Read C file , call gcc compiler Generate .s Of RISC-V Assembly language files
- Call the assembly interpreter to generate .o Binary file
- All kernels C The document repeats 1, 2 The operation of
- System loader (Loader) Collect all .o file , Link together to generate kernel files

Pass to QEMU Several parameters of :
- kernel: What is passed here is the kernel file (kernel In the catalog kernel file ), This is what will happen in the future QEMU Program files running in .
- m: The message here is RISC-V The amount of memory that the virtual machine will use
- smp: What is passed here is what the virtual machine can use CPU Check the number
- drive: What is passed is the disk drive used by the virtual machine , What's coming in here is fs.img file

XV6 The boot process
kernel/entry.S -> kernel/start.c-start() -> kernel/main.c-main()-> kernel/proc.c-userinit() The first user process , Used to interact with the operating system
userinit() Will perform initcode Code , The system call will be executed SYS_exec, And execute user mode init Program (user/init.c), In the end shell Run up .
边栏推荐
- 【学习笔记】Redis中有序集合zset的实现原理——跳表
- 【学习笔记】数据库中锁的分类
- 数据库的常用命令2
- Golang Chan implements mutual exclusion
- 力压谷歌、英伟达!阿里含光800芯片再获权威测试世界第一
- Press Google and NVIDIA! Alibaba optical 800 chip won the world's first authoritative test again
- 浅论分布式训练中的recompute机制
- Together with Samsung, vivo will promote exynos980 dual-mode 5g mobile phone!
- 英伟达发布全球最小边缘AI超算:算力21TOPS,功耗仅10W!
- 超实用!阿里P9私藏的Kubernetes学习笔记,看完直呼NB
猜你喜欢
随机推荐
@Scheduled and quartz
Golang worker pool
超实用!阿里P9私藏的Kubernetes学习笔记,看完直呼NB
On recommend mechanism in distributed training
Golang customize once. When error occurs, reset it for the second time
深度学习:GAT
1. opencv图片基础操作
View port PID and end process
[MIT 6.S081] Lab8: locks
Nowcoder (5 choices)
[MIT 6.S081] Lec 10: Multiprocessors and locking 笔记
3. Opencv geometric transformation
Publish your own NPM component library
MySQL solves the problem of insert failure caused by duplicate unique indexes
Binary tree concept
技术分享| 快对讲综合调度系统
Disassembly of Xiaomi cc9 Pro: the cost of rear five shots is several times that of Xiaolong 855!
Common commands of database 1
Localization within Communities
Deep learning: GCN (graph convolution neural network) theory learning summary


![[MIT 6.S081] Lab 11: networking](/img/9d/cca59a662412f3c3c57c26c5987a24.png)





![[MIT 6.S081] Lec 9: Interrupts 笔记](/img/b6/a8d39aa7ede4eb1c5a74e6d15b3b1c.png)
