Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ch9 2device-driver-3.rst #239

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions source/chapter9/2device-driver-3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ virtio-blk设备的初始化过程与virtio规范中描述的一般virtio设备
[ INFO] found a block device of size 16KB
...

virtio-blk设备驱动程序了解了virtio-blk设备的扇区个数,扇区大小和总体容量后,还需调用 `` VirtQueue::new`` 成员函数来创建虚拟队列 ``VirtQueue`` 数据结构的实例,这样才能进行后续的磁盘读写操作。这个函数主要完成的事情是分配虚拟队列的内存空间,并进行初始化:
virtio-blk设备驱动程序了解了virtio-blk设备的扇区个数,扇区大小和总体容量后,还需调用 ``VirtQueue::new`` 成员函数来创建虚拟队列 ``VirtQueue`` 数据结构的实例,这样才能进行后续的磁盘读写操作。这个函数主要完成的事情是分配虚拟队列的内存空间,并进行初始化:

- 设定 ``queue_size`` (即虚拟队列的描述符条目数)为16;
- 计算满足 ``queue_size`` 的描述符表 ``desc`` ,可用环 ``avail`` 和已用环 ``used`` 所需的物理空间的大小 -- ``size`` ;
Expand Down Expand Up @@ -461,4 +461,4 @@ I/O读请求的处理过程与I/O写请求的处理过程几乎一样,仅仅

``BLOCK_DEVICE.handle_irq()`` 执行的就是 ``VirtIOBlock`` 实现的中断处理方法 ``handle_irq()`` ,从而让等待在块读写的进程/线程得以继续执行。

有了基于中断方式的块读写操作后,当某个线程/进程由于块读写操作无法继续执行时,操作系统可以切换到其它处于就绪态的线程/进程执行,从而让计算机系统的整体执行效率得到提升。
有了基于中断方式的块读写操作后,当某个线程/进程由于块读写操作无法继续执行时,操作系统可以切换到其它处于就绪态的线程/进程执行,从而让计算机系统的整体执行效率得到提升。
Loading