I have written a rather complex dll for processing a large volume of data (~4,000,000 records) from an Oracle database. It works well, but takes about 23 hours to run. Since I wrote the code fairly compartmentalized I realized that there are 6 routines that should be able to run concurrently, and I have a multi core processor, I decided to try my first multi-threaded implementation.
In the routine I am working on I am doing no I/O everything is in memory in variables. My data is already in dataTables and hashTables. Most of the data is defined as private in the class scope, but no conflicting updates should happen because the code segments works very distinct portions of the dataTables.
The concept is simple, I have 2 routines that need to complete before launching my threads, and one routine that needs to run after all of the threads have completed. Here is what I am trying;
My understanding, incorrect it would appear, is that the ".join()" is supposed to pause processing until the thread has completed. It appears that all the threads do not complete before running "ProcessSurgery()."
How should I be doing this?
Paul
In the routine I am working on I am doing no I/O everything is in memory in variables. My data is already in dataTables and hashTables. Most of the data is defined as private in the class scope, but no conflicting updates should happen because the code segments works very distinct portions of the dataTables.
The concept is simple, I have 2 routines that need to complete before launching my threads, and one routine that needs to run after all of the threads have completed. Here is what I am trying;
ProcessDXDate()
ProcessHistology()
aryThreads(0) = New Threading.Thread(AddressOf ProcessLaterality)
aryThreads(0).Start()
aryThreads(1) = New Threading.Thread(AddressOf ProcessTreatments)
aryThreads(1).Start()
aryThreads(2) = New Threading.Thread(AddressOf ProcessRadTherapy)
aryThreads(2).Start()
aryThreads(3) = New Threading.Thread(AddressOf ProcessSummaryStage)
aryThreads(3).Start()
aryThreads(4) = New Threading.Thread(AddressOf ProcessReportingSource)
aryThreads(4).Start()
aryThreads(5) = New Threading.Thread(AddressOf ProcessDXAddress)
aryThreads(5).Start()
aryThreads(0).Join()
aryThreads(1).Join()
aryThreads(2).Join()
aryThreads(3).Join()
aryThreads(4).Join()
aryThreads(5).Join()
ProcessSurgery()
My understanding, incorrect it would appear, is that the ".join()" is supposed to pause processing until the thread has completed. It appears that all the threads do not complete before running "ProcessSurgery()."
How should I be doing this?
Paul