[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[coreutils] slimmer alternative to sleep command?

From: Chris Jones
Subject: [coreutils] slimmer alternative to sleep command?
Date: Sat, 24 Jan 2009 12:36:32 -0500
User-agent: Mutt/1.5.13 (2006-08-11)

Given a bash script that runs an infinite loop such as:

  do forever:
    get data
    print data
    sleep 1

I was wondering if I could avoid the overhead of starting and
terminating the sleep child process by using a different strategy. 

All I need to do is ask the kernel not to dispatch the process running
my script for a second or so. 

Instead of that, I'm having the kernel go through the motions of
creating an address space (whose only purpose is to "sleep" - i.e. do
nothing for one second) - and then terminate this address space.

Isn't that a rather disproportionate use of resources relative to what I
want to do?

Isn't there a way I could do this via a system call that would probably
be orders of magnitude faster and less resource-hungry?

Or am I barking the wrong tree?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]