《操作系统》CPU如何区分正在运行的是内核程序or应用程序?
The running process of a program is actually the process that the CPU executes a machine instruction.
程序的運(yùn)行過程實(shí)際上是CPU執(zhí)行機(jī)器指令的過程。
The CPU is divided into two state: “kernel mode” and “user mode”.
CPU分為兩種狀態(tài):“內(nèi)核模式”和“用戶模式”。
When it is in kernel mode, it means that the kernel program is running and can execute privieged instructions. When in user mode, it means that the application program is running and can only execute non privileged instructions.
當(dāng)它處于內(nèi)核模式時(shí),意味著內(nèi)核程序正在運(yùn)行并且可以執(zhí)行特權(quán)指令。在用戶模式下,這意味著應(yīng)用程序正在運(yùn)行,并且只能執(zhí)行非特權(quán)指令。
In fact, there is a register in the CPU called Program Status Word(PSW) register, in which there is a binary bit 1 represents “kernel mode”, 0 represents “user mode”(some operating system are the opposite).
實(shí)際上,CPU中有一個(gè)寄存器叫做程序狀態(tài)字(PSW)寄存器,其中有一個(gè)二進(jìn)制位1表示“內(nèi)核模式”,0表示“用戶模式”(有些操作系統(tǒng)則相反)。
總結(jié)
以上是生活随笔為你收集整理的《操作系统》CPU如何区分正在运行的是内核程序or应用程序?的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 《每日一题》48. Rotate Ima
- 下一篇: 《操作系统》库函数与系统调用的区别和联系