简体   繁体   English

磁盘io队列溢出

[英]Disk io queue overflow

From what I understand, the disk device has a queue that stores read/write requests from the linux kernel. 据我了解,磁盘设备有一个队列,用于存储来自Linux内核的读/写请求。 What happens when the device doesn't drain the queue fast enough (ie overflows)? 当设备没有足够快地耗尽队列(即溢出)时会发生什么?

Does this queue extend (logically) into DRAM? 这个队列是否(从逻辑上)扩展到DRAM中?

can some requests be lost? 某些请求会丢失吗?

Does this queue extend (logically) into DRAM? 这个队列是否(从逻辑上)扩展到DRAM中?

Where do you think that queue is in the first place? 您认为该队列排在何处? It's in RAM. 在RAM中。

The IO buffering infrastructure of any operating system can only serve the purpose of avoiding blocking whatever program tries to do an IO operation. 任何操作系统的IO缓冲基础结构都只能用于避免阻塞任何试图执行IO操作的程序。

Eg imagine you have a program that writes data to a file. 例如,假设您有一个将数据写入文件的程序。 For that reason, it calls a write system call. 因此,它调用write系统调用。 in the Operating System, that goes to the file system driver, which decides which disk sector gets changed. 在操作系统中,转到文件系统驱动程序,该文件系统驱动程序决定更改哪个磁盘扇区。

Now, that change command goes to the IO subsystem, which puts the command in a queue. 现在,该更改命令进入IO子系统,该子系统将命令放入队列中。 If that queue is full, the file system call blocks , ie. 如果该队列已满,则文件系统调用将阻塞 the call doesn't complete until there is space in the queue, which means that the write call blocks. 在队列中没有空间之前,调用不会完成,这意味着write调用会阻塞。

very simple: for as long as your writing device doesn't keep up, your writing program gets stopped in the write call. 非常简单:只要您的写入设备不跟上,您的写入程序就会在write调用中停止。 That's pretty logical. 这很合逻辑。 It's like trying to push mail into a full postbox. 这就像试图将邮件推送到完整的邮箱中。 Until someone takes out the mail at the other end, you can't push in new mail, so the postman will have to wait. 除非有人在另一端取出邮件,否则您不能发送新邮件,因此邮递员将不得不等待。

The queue doesn't extend to RAM. 队列不会扩展到RAM。 There's a disk cache with dirty pages. 磁盘缓存中有脏页。 The OS really would like to write those to disk. 操作系统确实希望将这些内容写入磁盘。 Some programs may even block while they're waiting for their dirty pages to be written. 一些程序甚至在等待写入脏页时可能会阻塞。 And as programs get blocked, they stop writing further data to disk. 随着程序被阻塞,它们停止将更多数据写入磁盘。 Pretty self-limiting, actually. 实际上,这是很自我限制的。

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

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