LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-12-2008, 11:41 PM   #1
kzr_merchant
LQ Newbie
 
Registered: Dec 2006
Posts: 10

Rep: Reputation: 0
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.
 
Old 05-13-2008, 12:08 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,355

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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.
 
Old 05-13-2008, 11:09 PM   #3
kzr_merchant
LQ Newbie
 
Registered: Dec 2006
Posts: 10

Original Poster
Rep: Reputation: 0
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?
 
Old 05-14-2008, 12:09 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,355

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Task bar no longer shows task Richard Rahl Linux - Newbie 3 04-12-2010 09:39 AM
EDUBUNTU Terminal Server (Timely Question) GNewbie Ubuntu 3 01-15-2008 08:34 PM
LXer: Slackware: the classic distro that's as timely as ever. LXer Syndicated Linux News 0 09-28-2007 12:20 PM
How to make USB drivers timely kennithwang Linux - Kernel 1 08-20-2007 06:19 PM
LXer: Canadian anti-DRM coalition makes timely debut LXer Syndicated Linux News 0 06-27-2006 02:54 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration