Re: top delay value
- From: "Dr. Markus Waldeck" <waldeck@xxxxxx>
- Date: Wed, 31 Jan 2007 18:02:41 +0100
> > typing "while :; do :; done". There are a thousand ways
No. What I write above is not a "fork bomb", it's a single
process which is wasting CPU in a busy loop. It's exactly
equivalent to top(1) with zero delay, except that top
produces some output, while a busy loop does nothing useful
at all.
I tested different shells and I found out that an exlicit sub shell
is required to let the shell fork:
while :; do (:); done
By the way, you can "emulate" top(1) with run ps(1) in a
shell loop like this (sh/zsh/ksh/bash syntax):
while :; do clear; ps -a; sleep 1; done
Do get zero delay, simply remove the sleep command from the
loop ... That's actually _worse_ than top(1) with zero
delay, because kernel cycles are wasted for the fork() and
exec() calls, not to mention I/O and other syscalls. An
empty shell loop ("while :; do :; done") doesn't perform
any syscalls into the kernel.
Bottom line: Disabling zero-delay in top doesn't buy you
anything at all. In fact, it might cause your users to
invent work-arounds (for example shell loops) that waste
even more resources.
So I have to limit the CPU time in /etc/login.conf and
:cputime=300:\
invoke cap_mkdb /etc/login.conf.
--
"Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
Jetzt GMX ProMail testen: http://www.gmx.net/de/go/promail
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"
- Follow-Ups:
- Re: top delay value
- From: Mike Meyer
- Re: top delay value
- References:
- Re: top delay value
- From: Oliver Fromme
- Re: top delay value
- Prev by Date: Re: Updated Driver for 3945ABG Intel 3945ABG Wireless LAN controller
- Next by Date: Re: top delay value
- Previous by thread: Re: top delay value
- Next by thread: Re: top delay value
- Index(es):