I have read many articles on multithreading over the past few days and so far I'm fairly comfortable with how it works. I am now working on my actual application, and have come across a few design issues that I'm hoping somebody has experience with.
The basic premise of the application is simple. A database filled with files names and a "converted" field that has a 1 or a 2 in it (1 for unconverted, 2 for converted). The application loops through every record where "converted" = 1, retrieve the file and convert it.
My single threaded application works fine, except its far too slow. Due to the huge amount of rows in the database (4 million+) and the time constraints on the project, I have decided to run as many threads as the hardware can allow to cut down on the timings.
So, the dilemma is accessing database records and which threads should grab which record and how. I have been thinking of all kinds of wierd and wacky ways to do this (Thread 1 - Odd number id's, thread 2, even id's, etc) but I'm thinking there must be a correct way to go about this, but so far, I have not uncovered anything that might guide me the right way.
Any help would be very much appreciated.
Kindest regards
- DBridle
The basic premise of the application is simple. A database filled with files names and a "converted" field that has a 1 or a 2 in it (1 for unconverted, 2 for converted). The application loops through every record where "converted" = 1, retrieve the file and convert it.
My single threaded application works fine, except its far too slow. Due to the huge amount of rows in the database (4 million+) and the time constraints on the project, I have decided to run as many threads as the hardware can allow to cut down on the timings.
So, the dilemma is accessing database records and which threads should grab which record and how. I have been thinking of all kinds of wierd and wacky ways to do this (Thread 1 - Odd number id's, thread 2, even id's, etc) but I'm thinking there must be a correct way to go about this, but so far, I have not uncovered anything that might guide me the right way.
Any help would be very much appreciated.
Kindest regards
- DBridle