用户进程 运行 内核函数或用户进程在系统调用后等待

User process running kernel functions OR User process wait after system call

我在听OS讲座,被这两个词弄糊涂了。

  1. "When a user process calls IO, it invokes a system call and waits until system call is finished"
  2. "When a user process invokes a system call, the user process itself executes the kernel function in the kernel mode"

我认为用户进程调用系统调用来使用IO,内核执行内核指令,而内核是运行用户进程等待IO进程完成。所以我认为短语 2 一定是错误的。但是教授说两者都是正确的。谁能帮我理解为什么?

其实,两者只是有时是正确的。

"When a user process calls IO, it invokes a system call and waits until system call is finished"

只有当系统服务进行同步时才会如此I/O。某些操作系统具有不会导致等待的异步 I/O 调用。

"When a user process invokes a system call, the user process itself executes the kernel function in the kernel mode"

当系统在内核模式下实现其所有系统服务时,情况就是如此。一些系统有多种模式(通常是 4 种),允许实现不可能使系统崩溃的系统服务。

无论如何,这可能不是同步 I/O 系统服务调用。在那种情况下,它可能不会等待。如果您调用时间系统服务,您的进程不太可能等待。