Parallel disk writes C# -


update totally aware not going add benefit , disk going bottleneck (although disk can 20k iops of 32k chunks) please consider before decide down vote.

============

i need write same file 100 million times disk. have 2 cpus (16 threads each, 32 in total).

i use threads , in asynchronous manner. code simple. this:

for (int = 1; < 100000000; i++)         {             file.copy(@"c:\sourcefile.txt", @"c:\distinationfile" + + ".txt", true);         } 

what best way c#?

not sure "best", can use tpl

parallelloopresult result = parallel.for(0, 100000000, => {     file.copy(@"c:\sourcefile.txt", @"c:\destinationfile" + + ".txt", true); }); 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -