当前位置:网站首页>19、 Xv6 context switching (implementation of context switching; encapsulation and recovery of state machine)
19、 Xv6 context switching (implementation of context switching; encapsulation and recovery of state machine)
2022-06-22 16:06:00 【[T]】
One 、 Processor virtualization
Why can't an infinite loop cause the computer to jam completely ?
On the principle of :
1、 The hardware will be interrupted ( Be similar to “ Forced insertion ” Of ecall(rics-v System call , Similar to x86 Of syscall))
2、 Switch to operating system code execution
3、 The operating system code can switch to another process for execution
Process library :
co_yield(); // Switch coroutines
Two 、 virtualization : State machine management
Register group ($x0...$x31,$pc), There is only one copy of physical memory
1、 Register virtualization : Save register state to memory
2、 Memory virtualization :$satp Data structure of (Supervisor Address Translation and Protection Register,supervisor Address translation and protection register in mode )
Operating system code is the most important invariant( Single processor )
1、 The operating system starts processing system calls / interrupt , The state of all processes will be saved to memory
struct page{int prot, void *va, *pa;}
struct proc
{
uint64_t x1, x2, ..., x31;
struct page pages[MAXPAGS];
};(1) preservation
hold x1, x2, ..., x31 Save to the current proc that will do
(2) recovery
hold pags Deliver to $stap In the corresponding data structure
3、 ... and 、 Status sealing : Architecture related processing
x86-64
1、 interrupt / Exceptions are accompanied by stack switching
(1) adopt TSS To specify a ” Kernel stack “
The register before interrupt is saved on the stack ( Typical CISC Behavior )
xv6( Not limited to, RISC-V)
1、 Put the process of trap trame Assigned to a fixed address ( adopt $stap)
(1)trap frame Save to $sscratch
2、 After saving, switch to the kernel thread for execution ( Including stack switching )
边栏推荐
猜你喜欢

【VTK】模型旋转平移

Focus on creating a net red product. The xinjietu x70s is newly launched, starting from 87900

B树和B+树

阿里云中间件的开源往事

Scala language learning-05-a comparison of the efficiency of recursion and tail recursion

【山大会议】应用设置模块

#进程地址空间

跨界融合创意创新,助力提高文旅夜游影响力

Scala语言学习-05-递归和尾递归效率对比

(pytorch advanced path 2) word embedding and position embedding
随机推荐
CVE-2022-0847(提权内核漏洞)
【VTK】模型旋转平移
84. (cesium chapter) movement of cesium model on terrain
标准化、最值归一化、均值归一化应用场景的进阶思考
推進兼容適配,使能協同發展 GBase 5月適配速遞
让pycharm项目里面的文本模板支持jinjia2语法
排序之归并排序
"Software defines the world, open source builds the future" 2022 open atom global open source summit will open at the end of July
信创研究:国产数据库聚焦信创市场,华为Gauss有望成为最强
Promouvoir l'adaptation compatible et permettre le développement collaboratif du Service Express adaptatif gbase en mai
Wechat applet avatar pendant production
高精度计算
C language learning -17- function is passed in as a parameter
[Shanda conference] project initialization
nvarchar和varchar的区别
[Shanda conference] project introduces Redux
Navicat Premium 连接Oracle 数据库(图文教程)
Devsecops: best practices for ci/cd pipeline security
Trust level of discover
Pymssql Module User Guide