![]() |
Restrict a task in timely manner
How can we restrict n TASK in n minutes? i.e. I want to execute 100/200/300 iterations in N minutes. Either in Perl or Shell.
|
Is this a single thread/process?
If so, usually you take a timestamp before the loop, then at the bottom of the loop you check the time until you either 1. complete all the iterations anyway OR 2. run out of time and exit the loop. Alternately, you can run multiple copies of a prog simultaneously using something like nohup myprog & inside a loop Really need more info, there are many ways of multi-tasking. |
Thanks for your suggesions. But this will resolve only time thing. in my problem iteration s are also variable. The iteraions are also given from comand line. How do I will control iterations in 1, 2 or 3 minutes?
|
The point is that unless you can guarantee that the system you are on is fast enough to do any num of iterations you want in any time you specify, then you have to decide which is the most important, and build the code from point of view.
So, which is your preference? |
| All times are GMT -5. The time now is 12:13 AM. |