Re: [GD-Windows] Background loading thread
Brought to you by:
vexxed72
From: Jon W. <hp...@mi...> - 2006-09-08 23:16:43
|
Ivan-Assen Ivanov wrote: > I hope Windows has the common sense to switch away from a thread which > is performing a lengthy synchronuous IO operation? Yes, it does. The main gain in overlapped I/O is that the amount of device parallelism, and the degree of completion parallelism, can be separated. With ReadFile() in threads, you need to create as many threads as you want to have simultaneous disk loads outstanding; with IOCP, you only need to create as many threads as you want simultaneous completions. The typical number for a hard disk is 4 or 5 for the former, but only one for the latter (unless you have a massively parallel I/O subsystem, which means you're not doing a typical game asset load thing anymore). If you can pay the cost of the thread safety, and the stacks of the threads, then you can go with some number of threads for your I/O needs. Just don't call CreateThread() for each I/O operation... Cheers, / h+ |