Re: [RFC] fast atomic ps

From: Albert D. Cahalan (acahalan@cs.uml.edu)
Date: Wed Apr 05 2000 - 21:46:05 EST


Borislav Deianov writes:

> In summary, I'd like something that is 1) small, 2) fast, 3) provides
> an atomic snapshot of all the information in /proc/<pid>/*. I propose
> a device /dev/procsnap that behaves as follows:
>
> - when you open the device, the driver allocates some memory and
> copies all the data from /proc atomically;

For full-blown ps on a busy system this could be over 4 GB.
(32 k processes * 128 k args + other stuff) Not that this works
today though, but please note that the data can be quite large.

So maybe you skip command lines...

I suggest that _everything_ be 64-bit for easy alignment and
expansion, especially considering ia64 with 32-bit apps.

> - you can read the data at your leisure, it doesn't change
> under you (in most cases a single read call is enough);
> - the memory for the snapshot is released when the device is closed;
> - many processes can open the device at the same time, they get
> separate snapshots.
>
> I've attached a very preliminary implementation of the kernel driver
> and a proof of concept ps that uses it. If there's interest I'll code
> a more complete patch.

You might grab the minimal.c source from procps. It currently does
a proc-based ps in under 8 kB total (no libs needed). Much of that
is proc-parsing bloat, which you would rip out of course. You'd get
a ps with the most important options, not just a dumb process list.

http://www.cs.uml.edu/~acahalan/linux/procps-000221.tar.gz

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Apr 07 2000 - 21:00:16 EST