Use multithreading for multiple copies of files

I need to copy a large number of files (10,000 files)

because copying takes a lot of time. I tried using two streams instead of one stream, one to copy files with odd numbers in the list and the other to copy even numbers from the list

I used this code:

ThreadPool.QueueUserWorkItem(new WaitCallback(this.RunFileCopy),object)

but there are no significant time differences when using one stream and when using two streams.

What could be the reason for this?

+4
source share
2 answers

CPU, -, multithreding parallelism .

. SSD r/w, . parallelism, , HDD

, .

. Zipping , zip ,

using System.IO;
using System.IO.Compression;

.....

string startPath = @"c:\example\start";
string zipPath = @"c:\example\result.zip";
string extractPath = @"c:\example\extract";

ZipFile.CreateFromDirectory(startPath, zipPath, CompressionLevel.Fastest, true);

ZipFile.ExtractToDirectory(zipPath, extractPath);

.

+5

. , Disk I/O . ... ... , ...

, , , ( ) ( 10 ) . , , ( ) .

, CPU, , , , - . , , " " .

: , , , , ( , ), , + . 1000 1000 . .

, N , , , . 1000 , ( ), , . , , .

, .

OP , , , . , - , , , ( , , ).

OP , . 8Gb 4 unbusy , , 4 . 100Kb ( ) "" 10 000 . , ; . .

. (Windows, , , . ).

. ( , ), zipping. ; - , . , .

. SSD, , , . . .

0

All Articles