《操作系统》库函数与系统调用的区别和联系?
庫函數(shù)是語言或應(yīng)用程序的一部分,可以運行在用戶空間中,而系統(tǒng)調(diào)用是操作系統(tǒng)的一部分,是內(nèi)核為用戶提供的程序接口,運行在內(nèi)核空間中,而且許多庫函數(shù)都會使用系統(tǒng)調(diào)用來實現(xiàn)功能。
Library function is a part of language or application program, which can run in user space. System call is a part of operating system and is the program interface provided by kernel for users. It runs in kernel space, and many library functions will use system call to realize functions.
未使用系統(tǒng)調(diào)用的庫函數(shù),其執(zhí)行效率通常要比系統(tǒng)調(diào)用的高,因為使用系統(tǒng)調(diào)用時,需要上下文的切換以及狀態(tài)的切換(由用戶態(tài)轉(zhuǎn)為內(nèi)核態(tài))。
The execution efficiency of library functions without system calls is usually higher than that of system calls, because context switching and state switching (from user mode to kernel mode) are required when system calls are used.
總結(jié)
以上是生活随笔為你收集整理的《操作系统》库函数与系统调用的区别和联系?的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 316. Remove Duplicat
- 下一篇: Windows 10每天定时执行脚本