Last post Apr 26, 2010 10:35 AM by atconway
Apr 26, 2010 09:33 AM|dave2118|LINK
I have a large amount of data that I want to parse through, each in a seperate file. I'd like to create a multi-threaded application to parse these files, but I'm brain dead on a general approach on how to do this.
I've already written the code to do the parsing, however, it's taking about 1-5 seconds per file. How can I make sure that each thread doesn't interfere with the other? Simply move the folder before parsing?
Apr 26, 2010 09:59 AM|atconway|LINK
Take a look to this thread:
C#-APP: Multi-threading file processing:
...and this MSFT article has some recommendations as well:
How to synchronize access to a shared resource in a multithreading environment by using Visual C#:
Apr 26, 2010 10:20 AM|SGWellens|LINK
I'd like to create a multi-threaded application to parse these files,
Why? On a single processor machine, it will take longer to complete the task.
Apr 26, 2010 10:30 AM|dave2118|LINK
This is a multi processor machine. I've done this in the past, but it was 3 years ago and it doesn't pop out.
I'll look at the links, thank you.
Apr 26, 2010 10:35 AM|atconway|LINK
Good point brought up by Steve (I did not see any hardware details in op). Unless you have a dual core+ setup or multiple single core processors, you are probably going down the wrong path with multithreading. In a single core processor, only one task
runs at any point in time. Just make sure you have the hardware to support an actual performance gain from multithreading an application. If you have more than (1) single core processor (i.e. server) than this would be ok as well. From purely a hardware
view, take a look at the 'Single Core' and 'Multi Core' sections of the following link for more info: