进程调度问题
例如,一个进程正在等待 磁盘 I/O 完成后将休眠 缓冲区头地址 对应的数据是 转入。 当中断时 磁盘驱动程序的例程注意到 传输完成,调用 缓冲区标头上的唤醒。 的 中断使用内核堆栈 无论发生什么过程 当时正在运行,唤醒是 从该系统进程完成。
您能解释一下我强调的段落中的最后一行吗? 它是关于唤醒一直在等待某些事件发生并因此处于休眠状态的进程。 这段话来自高尔文。 顺便问一下,你能推荐一些学习 UNIX 操作系统的好书或链接吗?
谢谢。
For example, a process waiting for
disk I/O to complete will sleep on the
address of the buffer header
corresponding to the data being
transferred. When the interrupt
routine for the disk driver notes that
the transfer is complete, it calls
wakeup on the buffer header. The
interrupt uses the kernel stack for
whatever process happened to be
running at the time, and the wakeup is
done from that system process.
Can you please explain the last line in the paragraph which I have emphasised. It is about waking up the process which has been waiting for some event to occur and thus has slept. This para is from Galvin. By the way can you suggest some good book or link for studying unix operating systems?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
收到中断时,某个进程正在运行。 内核不会切换到其他进程上下文来处理它——这需要时间——它只是在当前上下文中执行必要的操作,并让调度程序知道下次调度时,等待进程已准备好继续。
有很多很好的内部原理书籍。 我喜欢 McKusick 等人的各种书籍,例如 FreeBSD操作系统的设计与实现。
There is some process running at the time the interrupt is received. The kernel doesn't change over to some other process context to handle it -- that would take time -- it just does what's necessary in the current context, and lets the scheduler know that the next time it schedules, the waiting process is ready to proceed.
There are a number of good internals books around. I'm fond of the various McKusick et al books, like The Design and Implementation of the FreeBSD Operating System.
莫里斯·巴赫 (Maurice Bach) 的Unix 操作系统设计是最著名、最全面的有关该主题的书。
Maurice Bach's Design of the Unix Operating System is the most well-known and comprehensive book on the subject.
一旦磁盘发出传输结束信号,就会执行 I/O 完成中断。 无论内核当前正在做什么,都会完成此操作。 中断处理程序通常非常小并且独立。 因此,重用当前运行时环境(堆栈、CPU 状态等)比将完整的上下文切换到单独的线程要快。 不利的一面是,这意味着中断处理程序只允许做非常有限的事情,例如在其他地方设置标志,或者排队工作项。 此外,他们必须非常小心地清理干净,以免干扰运行过程。
The I/O completion interrupt will be executed as soon as the disk signals the end of the transfer. This is done regardless of what the kernel is currently doing. Interrupt handlers are usually very small and self-contained. Therefore it is faster to re-use the current runtime environment (stack, CPU state, etc) instead of doing a full context switch to a separate thread. On the down side this means that interrupt handlers are only allowed to do very limited things, like setting a flag somewhere else, or enqueing a work item. Also, they have to clean up very carefully after themselves, so that the running process is not disturbed.
Eric Raymond 的'Unix 编程的艺术',应该阅读以了解 Unix哲学和文化。真正了解和欣赏其设计背后的原因。
Eric Raymond's 'The Art of Unix Programming' , should be read to understand the Unix philosophy and culture.To actually know and appreciate the reasons behind its design.