What is the difference among the various event schedulers for OS X / Darwin? I'm confused about the differences among the three (that I know of) tools for scheduling running of code on OS X / Darwin:


cron
launchcd
pmset


I understand that cron is largely deprecated, but it is still used by some utilities (like Super Super!, for some reason), and that pmset has the ability to wake the computer to run specific jobs. But I'm not clear what would guide the selection of one over the other in general.

How do these three methods OS scheduling differ (especially on Mavericks, if things are different there), especially in the kids of tasks they are suited to, and how they behave during sleep or hibernation?
Use launchd instead of cron, at, or other legacy UNIX tools for Mac OS X.

pmset

pmset is a built-in command line tool for getting and setting power related values on Mac OS X. One of pmset's abilities is to add and remove entries from the IOPMQueue; the IOPMQueue is the IOKit level queue that allows your Mac to power on and wake up at a specific time. IOPMQueue also supports scheduling of shut downs and restarts.

Arbitrary code can not be scheduled using pmset or through the IOPMQueue.

cron

cron is a stalwart of the task scheduling world. However on Mac OS X, using cron is not recommended. Use launchd.

cron is implemented by checking each minute for tasks that are due. This allows for a powerful and expressive scheduling format but at the cost of needing to wake the processor up every minute.

cron does not know about your Mac sleeping. If a task is due while your Mac is asleep or powered off, the task will not occur. When your Mac powers back on, the task will not be performed because the minute in which it should have run has passed.

There are other tools that build upon cron and can run missed tasks upon waking. None are included by default with Mac OS X.

launchd

launchd (launch daemon) is Apple's system starter, scheduling tool, and process watchdog. launchd is written for the needs of the operating system first and users second. It is a powerful and capable process used to manage or launch almost every other process on your Mac.

launchd is an improvement on cron for scheduling because it does not need to poll to perform tasks. Instead launchd can remain inactive until the moment a task needs performing. In an era of energy aware and mobile computing, this is important.

launchd will not wake a sleeping Mac to perform tasks.

launchd job tickets are property list (plist) files. These files can be edited with a text editor or with a number of third party applications.

launchd is recommended for, and is suitable for, most scheduling situations.

Third Party

There are number of third party scheduling tools available on Mac OS X. They often provide a graphical interface or offer more features than are included in the standard Mac OS X command line tools. The tool I am associated with is Power Manager.