Usage of direct IO with virtual threads

Alan Bateman Alan.Bateman at
Sat Jul 9 16:24:48 UTC 2022

On 09/07/2022 13:49, Andrey Lomakin wrote:
> Hi guys.
> Could you clarify is it OK to 
> use com.sun.nio.file.ExtendedOpenOption#DIRECT  open option with 
> virtual threads or in other words, will reading/writing to the file 
> which uses direct IO be converted into the non-blocking call ?
> And second question, what is the general status of integration of 
> FileChannel API with virtual threads

You can use direct I/O, "force", or any other FileChannel method from 
virtual threads. Right now they pin the thread but they increase 
parallelism for the duration of the I/O operation so the temporary 
pinning should be mostly transparent. In time they make make use of 
io_uring and other facilities but there is significantly low level 
refactoring require before that will plug in, so not JDK 19.


More information about the loom-dev mailing list