From: martin f krafft <madduck@madduck.net>
To: linux kernel mailing list <linux-kernel@vger.kernel.org>
Subject: checking if a job still uses the CPU
Date: Wed, 17 Nov 2004 00:56:03 +0100 [thread overview]
Message-ID: <20041116235603.GA8120@cirrus.madduck.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 1335 bytes --]
I want to check a job periodically whether it still uses the CPU. If
not, I want to kill it. The latest solution I found is at
http://madduck.net/~madduck/scratch/worker.sh
http://madduck.net/~madduck/scratch/job.sh
worker.sh starts job.sh and polls /proc/$PID/stat:16 (the 16th
field: cutime) regularly. As soon as it stopped changing, the job is
killed.
This works fine as long as job.sh does not start jobs itself which
run longer than the period used to check in the worker (7 seconds in
my example). If job.sh's children take longer than 7 seconds to
complete, job.sh might get killed because the cutime value of
a process in /proc is only updated whenever a child returns.
Is there another way to achieve what I am trying to do? How can
I kill jobs that are idling and have not used the CPU in $DELAY
time?
Thanks,
--
martin; (greetings from the heart of the sun.)
\____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck
invalid/expired pgp subkeys? use subkeys.pgp.net as keyserver!
spamtraps: madduck.bogus@madduck.net
"we are like shop windows in which we are continually arranging,
concealing or illuminating the supposed qualities other ascribe to us
-- in order to deceive ourselves."
- friedrich nietzsche
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next reply other threads:[~2004-11-17 0:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-16 23:56 martin f krafft [this message]
2004-11-17 8:41 ` martin f krafft
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20041116235603.GA8120@cirrus.madduck.net \
--to=madduck@madduck.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®