Re: Gack, this shouldn't happen under a stable OS I think

Keith Owens (kaos@audio.apana.org.au)
Mon, 23 Sep 1996 16:11:34 +1000 (EST)


On Sun, 22 Sep 1996, Chris Fearnley wrote:

> Alan had me on the look out for dropping bytes regarding my recent
> "TCP bug" report. I'm not sure I found that, but this inconsistency
> seems "bad" to me. The worse part is the behaviour is
> non-deterministic! Note: the system was mostly idle at the time.
>
> root@syntropy # ps aux|grep 27231
> root 27231 0.0 2.1 828 324 p7 S 23:28 0:00 /usr/sbin/radiusd
> root@syntropy # ps aux|grep 27231
> root 27231 0.0 2.1 828 324 p7 S 23:28 0:00 /usr/sbin/radiusd
> root@syntropy # ps aux|grep 27231
> root 27231 0.0 2.1 828 324 p7 S 23:28 0:00 /usr/sbin/radiusd
> root 27239 0.0 2.5 916 376 p7 S 23:28 0:00 grep 27231
>
> Why doesn't the grep process show up each time???
>
> Can others reproduce this?

Happens all the time. The shell starts the ps task running then starts grep
running, i.e. ps is started and can be processing its input before grep
exists. In addition, ps uses readdir to access the entries in /proc and the
"directory entries" for tasks are in no defined order (try "ls -fl /proc") so
it also depends on whether the /proc entry for the grep task is inserted
before or after the point that ps has got to in its readdir loop. Nobody has
ever claimed that concurrent tasks are deterministic (except in DOS where
they are not really concurrent).