On Sat, Dec 16, 2023 at 9:37 AM Lavrentiev, Anton (NIH/NLM/NCBI) [C]
<l...@ncbi.nlm.nih.gov> wrote:
>
> > the process isn't allocated any CPU time until the timer expires.
>
> Almost so.  But the "sleep" functions are interruptible, so if a process (the 
> "sleep" command)
> is somehow signaled, it will wake up prematurely, and will have to either put 
> itself back to
> sleep (for the remaining unslept time) or terminate, whatever the 
> implementation is.  So in the
> former case, there is some CPU still consumed (and that would depend on how 
> often the signal
> arrives), and in the former case, the actual slept time can be quite 
> inaccurate (from what you
> think it should have been).
>
> Signaling with scripts can be quite tricky as the signal can propagate to the 
> entire process
> group, rather than a single process (depending on which process the signal 
> was sent to).
>
> Using cron (as others suggested) gives you a time accuracy up to a second 
> (give or take), but
> then again it depends on the load of the system, and may drift rather 
> significantly.
>
> My $.02,
>
> Anton Lavrentiev
> Contractor NIH/NLM/NCBI

Thank you for the answers. This is a personal computer and nothing my
"services" do cares much about the actual time between runs so the
uncertainty using 'sleep' isn't an issue. Back in the XP days, I used
a Windows version of 'cron' to run things, but it stopped working and
I just modified the small number of scripts it launched to time
themselves.

I was just curious as to how much of a penalty I was paying for my
laziness and you've confirmed that the answer is "not much." My
computer has been slowing down and I was looking for the culprit,
which is most likely just increasing software bloat (wheezy voice: "In
my day, 4 kB was a huge program:)

My current computer is not "Win 11 ready" and I'm not replacing
perfectly functional hardware, so I will be migrating to a Linux
desktop in 2025 (or sooner) and will have 'cron' available again.

Again, thanks for the answers.

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to