Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

For a few days now I've noticed that the PID keeps going up quickly, at a rate of over 200 or so an hour.

I'd like to make a log entry of every process that starts (and quits) so I can figure out what is happening.

I've looked in the logs and with Activity Monitor but I haven't seen anything obvious.

Whatever is happening doesn't appear to stop the MBP from going to sleep though.

Currently using Mountain Lion 10.8.0 on a late 2008 MacBook Pro

share|improve this question
    
Most likely, nothing unusual is going on. Just a bunch of little housekeeping tasks that need doing. –  Harald Hanche-Olsen Aug 22 '12 at 15:37

1 Answer 1

There is a command execsnoop that you can run in a terminal window. Like so:

sudo execsnoop -v

A more detailed log of all that is going on requires a bit of dtrace hacking, as you need to track the fork and _exit system calls as well.

Edited to add a bit of explanation: Processes don't “start” on a unix system. New processes are created by the fork system call, which results in the calling process being split into two (almost) identical processes. One (the parent) keeps its PID, while the other (the childe) given a new PID. The most common reason for a fork is for the child to exec a new program; it's this fork+exec combination that you most commonly think of as a new process starting up. This is why you need to track three system calls (fork, exec, _exit) for the complete view. But just tracking exec, as execsnoop will do, seems sufficient for your purposes.

share|improve this answer
    
Sorry, didn't have time for more detail. Maybe someone else can supply some. –  Harald Hanche-Olsen Aug 22 '12 at 14:53
    
Thanks, that seems to work for me. I've been running it for 20 minutes or so, and so far I've noticed that mdworker seem to be involved. It appears twice every minute or so, both with launchd as the parent with the owner being my user and _spotlight for the other. For most of the day the only open app has been Activity Monitor and in the past 20 minutes, Firefox. I've check the logs but I haven't seen any messages from mdworker or spotlight. Where should I look for logs for these? –  D A Aug 22 '12 at 16:09
    
I guess mdworker and spotlight don't log anything unless they run into trouble. That's the unix way, after all. ☺ –  Harald Hanche-Olsen Aug 22 '12 at 22:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.