简体   繁体   English

Windows 操作系统的 I/O 优先级

[英]I/O Prioritization of Windows OS

I was studying Jeffrey Richter Book (Windows via C/C++).我正在学习 Jeffrey Richter Book(Windows via C/C++)。 In one section, he is talking about I/O prioritization.在一节中,他谈论了 I/O 优先级。 I know what is prioritization and what are priority class, priority level, and also a base priority now.我现在知道什么是优先级,什么是优先级、优先级以及基本优先级。

I know, I can change the priority of processes and threads with SetPriorityClass and SetThreadPriority but I can't get understand how I/O priority work in Windows 10 or how priority can help us to fine-tune an app which works with storage based devices that has slow performance.我知道,我可以使用 SetPriorityClass 和 SetThreadPriority 更改进程和线程的优先级,但我无法理解 Windows 10 中的 I/O 优先级如何工作,或者优先级如何帮助我们微调与基于存储的设备一起使用的应用程序性能缓慢。

For example, when I have a thread that works with a storage device, what will happen when I set its priority THREAD_MODE_BACKGROUND_BEGIN?例如,当我有一个与存储设备一起工作的线程时,当我设置它的优先级 THREAD_MODE_BACKGROUND_BEGIN 时会发生什么? Is that possible to explain it simply?能不能简单解释一下? I read this paper completely ( link ) too, but I can't understand the prioritization of I/O.我也完全阅读了这篇论文( 链接),但我无法理解 I/O 的优先级。

As noted in that paper, it's up to the I/O device driver to handle priority based on the thread priority, and at the time of that paper, there are only two levels, normal and background, which a device driver may ignore.正如那篇论文中所指出的,由 I/O 设备驱动程序根据线程优先级来处理优先级,在该论文中,只有两个级别,正常和后台,设备驱动程序可能会忽略它们。

A device driver could implement the two levels of priority with two I/O request queues, one for normal priority, the other for background priority.设备驱动程序可以通过两个 I/O 请求队列实现两个级别的优先级,一个用于普通优先级,另一个用于后台优先级。 The driver could also include logic to prevent the normal queue from completely locking out the background queue by occasionally handling a request from the background queue based on time or request count, even though the normal queue is not empty.驱动程序还可以包括通过偶尔根据时间或请求计数处理来自后台队列的请求来防止正常队列完全锁定后台队列的逻辑,即使正常队列不为空。

The paper is an old paper, referring to Vista.论文是旧论文,指的是Vista。 By now with Windows 10, there may be more than two levels of I/O priority.到目前为止,对于 Windows 10,可能有两个以上的 I/O 优先级级别。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM