in reply to get name of process with pid
A quick google found this. Program looks like it stores all current process data into a hash.
Although it's for solaris it should still work for *nix systems. hope this helps