On Fri, Sep 5, 2008 at 19:57, Monty J. Harder [email protected] wrote:
Wow. I had no idea. Here I thought ps got that info from an internal kernel data structure that wasn't manipulable by userland. That suggests some really ugly possibilities. Don't know how 'ugly' it would be (aside from processes making it difficult to tell what their PID was if you weren't watching when they were launched)
Here's some code from Hal Dustin (attached). You can demonstrate on your own computer that it is possible for a process to change its process name in ps without having to terminate, and create a new process. So chrome could easily do this. (If it's what the user wanted.) On computers with a single user, I think it could be rather handy to have at least an option for this. Wouldn't it be neat to look, and see 'oh, *that* site has used a good hour of CPU time!'. If it were so trivial to see resource utilization per-website, it would put pressure on web developers to be more efficient, and that is a win for users and browser developers. Side note: It appears gnome's 'System Monitor' still displays the file name.
Download it, then compile it with: [bcrook@One Desktop]$ gcc time.c -o time
Run it and get a shell back: [bcrook@One Desktop]$ ./time & [1] 15146
Then using the PID number bash just gave you, grep ps' output for it, and watch the PID stay the same, but the title (usually the binary's name) change: [bcrook@One Desktop]$ while true; do ps aux | grep 15146 | grep -v grep ; sleep 2; done bcrook 15146 0.0 0.0 3924 516 pts/2 S 22:07 0:00 You would see my binary's name here, but instead, I'll tell you the time is: 2008-09-05 22:08:27 bcrook 15146 0.0 0.0 3924 516 pts/2 S 22:07 0:00 You would see my binary's name here, but instead, I'll tell you the time is: 2008-09-05 22:08:29 bcrook 15146 0.0 0.0 3924 516 pts/2 S 22:07 0:00 You would see my binary's name here, but instead, I'll tell you the time is: 2008-09-05 22:08:31 bcrook 15146 0.0 0.0 3924 516 pts/2 S 22:07 0:00 You would see my binary's name here, but instead, I'll tell you the time is: 2008-09-05 22:08:33 bcrook 15146 0.0 0.0 3924 516 pts/2 S 22:07 0:00 You would see my binary's name here, but instead, I'll tell you the time is: 2008-09-05 22:08:35 ^C
[Ctrl]+[c] when done. Then kill ./time by its PID [bcrook@One Desktop]$ kill 15146