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

Re: ps axu|grep grep doesn't output always



Dan Jacobson wrote:
Just curious, why doesn't this make output every run:
$ ps axu|grep grep
jidanni   1163  0.0  0.2  2376  608 pts/1    R    02:26   0:00 grep grep
$ ps axu|grep grep
$ ps axu|grep grep
$ ps axu|grep grep
$ ps axu|grep grep
jidanni   1171  0.0  0.2  2376  608 pts/1    R    02:26   0:00 grep grep

Is it some kind of race condition?

I think so, it depends when exactly is grep started, the process snapshot that ps outputs might be from time right before grep is written to it... it might also depend on shell (how much time is there between starting ps and grep)

	erik




Reply to: