>>> why do you need to fork before creating threads ?
Well the kind of model that i have thought off is that the application starts , based on the no of children i can fork( the app starter defines it based on the server load), i fork that many children. Each child notes the index of the query that has been passed to it by the parent and increments it with the total no of children spawned to come to its batch of next query.Each child now has to do the following tasks : pick the query + build ( replace client placeholders with real values) + fire to prod/test and then compare the results(time taking)
So each child constructs 3 threads ( user defined) and divides the client array into 3 equal parts and distributes to each, along with the query that they must build(replace client placeholders with real values) and fire.Now each thread is looping on the total no of client s(1/3 of the total).In each loop it builds the query , fires it and stores the results in some Data structure and lets its main process know that it has got the result of one query+client , then supsends itself( if i do not suspend the thread all the results would slurp in the memory). The main process now knows that it has some result on which either it can work on or launch a new thread to work parallely and not block until the comparison finshes. In each comparison thread if some differences are found in prod and test results they are appended to a file and the memory deallocated.
>>>>Are you running this on win32? some nix flavor?
linux
>>>>Note, in the code you've posted, you have a scope problem
yeah i know , i was trying to do the suspend/resume via semaphore and i didn't succeed. :-((
>>>>note that i don't quite understand why you need to thread your compares
i guess i have answered that above
In reply to Re^4: Problem in Inter Process Communication
by libvenus
in thread Problem in Inter Process Communication
by libvenus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |