[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Feature requests for sleep and a new program
From: |
Johannes Nieß |
Subject: |
Feature requests for sleep and a new program |
Date: |
Thu, 29 Nov 2001 08:19:43 +0100 |
Hi,
I'd like to propose two new features to "sleep":
1) Sub-Second resolution
I understand that shell scripts never won't get real time precision, but with
today's processing speed something in the order of several 10 ms should be
possible. It could be implemented by allowing floats for time arguments or
(may be easier) with a new unit of "ms" (miliseconds). I'm quite sure the
structures are already there.
2) Wait for ms multiple
You can't control loop cycle times with sleep: If you "sleep 1" and your loop
payload takes 0.1 second you end up with a 1.1+X second cycle time. If we
wait for a timer modulo interval to flip over, we have exact control over
loop cycle time. An implementation could look like:
a=timerfunction mod interval
aa=a
while a>= aa
sleep 10 ms
a=aa
a=timerfunction mod interval
wend
We could use a "-m" parameter for this changed behavior
A new program could supplement "nice". In some (rare) cases you want to
control the maximum CPU load a program can generate. It could be dome via
signals. To allow a maximum CPU load of 0.5 for a program you can send a
TSTOP signal , wait 0.5 seconds, send CONT and wait 0.5 seconds and so on.
I know that programs can intercept signals but it'll work for most programs.
Thank you very much
Johannes Nieß
- Feature requests for sleep and a new program,
Johannes Nieß <=