How can I split the workload of records across multiple threads specifically Accuracer DB that has 169 records with 7 threads for example.
Because I could just split the number of records in ranges and let each thread process the range. But if user deletes or adds record it will not work good.
You can use OmniThreadLibrary to process records from a database in parallel without much hassle.
I wrote an example using the Pipeline abstraction. The pipeline consts of 3 stages:
The second stage processes the incoming data.
DoSomethingWith
procedure that simply wastes around 100 ms. to simulate the processing of the data1
to the output queue to inform the final stage that another record has been processed.This stage is configured to run in parallel in 7 threads.
The example is a console application to allow you just copy/paste to see it working live in your machine.
The main advantages of doing it this way, IMHO, are: