I have four methods(threads ) in my application that must work syncronized sharing an 8 element circular buffer array. Each method should work in the data only after its previous thread had completed its task, in the following order:
1st.: Reads data from file and place in one free element of the array;
2nd.:Read data produced by thread 1, change and save;
3rd.: Read data produced by thread 2, change and save;
4th.: Get processed data from 3rd thread, write to disk and free element of the array so that thread 1 can now write there again.
Is it possible that all threads access and manipulate the data concurrently without causing monitor overhead?
What is the best way to achieve this so that they all could work together but in the correct order / syncronized? any tips/examples?
thank you.
1st.: Reads data from file and place in one free element of the array;
2nd.:Read data produced by thread 1, change and save;
3rd.: Read data produced by thread 2, change and save;
4th.: Get processed data from 3rd thread, write to disk and free element of the array so that thread 1 can now write there again.
Is it possible that all threads access and manipulate the data concurrently without causing monitor overhead?
What is the best way to achieve this so that they all could work together but in the correct order / syncronized? any tips/examples?
thank you.
Comment