知识卡片
系统调用跨边界有成本
应用主要运行在用户态,I/O等需要内核参与的操作要进入内核,产生额外执行和状态维护成本。减少不必要系统调用,可少做非业务工作;批量I/O是后续可用方向。这里区分用户/内核模式切换与调度切换,不把二者视为每次都完全相同的过程;原章用context switch统称,未细化机制。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 理解性能的心智模型 · 查看原书依据
A computer OS has two modes: user and kernel. The code we write runs in user mode, but the privileged operations such as performing input/output, accessing memory, and changing kernel data structures run in kernel mode. Every time an application enters kernel mode, a context switch occurs, which adds nonessential costs to the system, such as time to save the stack and to rest the cache. To improve performance, we need to reduce the number of system calls.
参考来源
- 位置:《Software Architecture and Decision-Making》第3章《理解性能的心智模型》(来源项目:book-sources;源文件:extracted/Software Architecture and Decision-Making Leveraging Leadership, Technology, and Product Management to Build Great Products… (Srinath Perera)/_epub-src/ch03.xhtml)
- 结论依据:原文的定义、比较或例子支持“应用主要运行在用户态,I/O等需要内核参与的操作要进入内核,产生额外执行和状态维护成本”;正文据此说明用途和边界。
- 原始内容:A computer OS has two modes: user and kernel. The code we write runs in user mode, but the privileged operations such as performing input/output, accessing memory, and changing kernel data structures run in kernel mode. Every time an application enters kernel mode, a context switch occurs, which adds nonessential costs to the system, such as time to save the stack and to rest the cache. To improve performance, we need to reduce the number of system calls.