Asynchronous IO virtual disk operations

Feb 14, 2012 at 12:29 PM

Hello,

I need to perform low-level IO on VHD virtual disk ignoring actual file system. In order to do this I am trying to use methods of Disk.Content stream property. Unfortunately I did not notice any mentions about asynchronous IO (providing offset and length without changing a position in a stream). In particular I would like to perform them in parallel in order to get some performance increase.

Any ideas?

Thanks

Feb 15, 2012 at 10:17 AM

DiscUtils is single threaded internally so asyncIO is not supported.  If you have some calculations to do depending on a read I'd recommend setting up a write queue and added the writes you want done to it for a worker thread to execute or use the 4.0 tasks.  However, only one thread can be inside of Discutils at any one time.  

When you do a write lots of meta data is also written (or I should say may be written depending on the disk image).  All of that state information is not multithread aware and you will cause havoc if you enter the library from multiple threads (I know this, as I've done this, my code actually has a debug mode that asserts if more than one thread is in discutils as the side effects MAY be minor but most often are spectacular in the failure)

Best,

Bill

Feb 15, 2012 at 1:46 PM

Thank you very much!