首页 > 解决方案 > 在 1 个 io_submit 调用中的 N 个请求中排序

问题描述

  1. 如果 1 次 io_submit 调用包含对相同(偏移量,Len)的读取和写入请求,读取是否保证看到写入写入的值?
  2. 如果 1 个单个 io_submit 调用包含 2 个对相同(偏移量、Len)的写操作,哪个将首先执行?

在这两个示例中, io_submit 调用中的 NR = 2。

我的理解是,在这两个示例中,NR 子请求都可以按任意顺序处理。

正确的?

标签: linux

解决方案


如果 1 次 io_submit 调用包含对相同(偏移量,Len)的读取和写入请求,读取是否保证看到写入写入的值?


No, 

如果 1 个单个 io_submit 调用包含 2 个对相同(偏移量、Len)的写操作,哪个将首先执行?

The one having lower index in array of pointers to struct iocb.
The requests are submitted to the internal queue of the io_context_t  which are then read for completions. So ordering is of a queue and the algorithm used.

推荐阅读