

Most scheduled background activities in macOS are now managed by this combination of DAS and CTS, which has proved itself to be superior to fixed time intervals managed by launchd. This and other processes are summarised in the following diagram, based on what happens when scheduling routine hourly backups using Time Machine. Once that’s complete, the next run will be scheduled with DAS, which puts that activity back into its scheduling list. Those are combined to produce a score: when that exceeds a threshold, DAS decides to run that activity, and will in turn tell Centralized Task Scheduling (CTS) via XPC to do so. It does that by scoring them, taking into account the window in which the activity should occur, its priority expressed in terms of Quality of Service (QoS), current load on CPU cores, and environmental conditions. DAS maintains a list of scheduled activities, and frequently evaluates those activities to determine which should be run next. This is related to CoreDuet, a subsystem concerned with monitoring environmental and process load conditions. With OS X 10.10 Yosemite, in 2014, Apple introduced a whole new system designed to schedule background activities more flexibly, Duet Activity Scheduler (DAS).

The disadvantage of that was that, like cron, launchd isn’t flexible on timing: the moment it decides to run a large backup could coincide with intense user activity, resulting in noticeably slowed response and prolonged backup duration. Just over two years later, when Apple released Time Machine in Mac OS X 10.5, its hourly backups were scheduled using launchd. The first couple of years with launchd had their moments, as it took a while before it became reliable. In replacing cron, launchd took on the responsibility of running scheduled background activities too. In this new model, one of the early tasks of the kernel after it has been booted is to load launchd, which then becomes the master launcher and launches everything else, in conjunction with launchctl and property lists in LaunchDaemons and LaunchAgents folders in Library folders. But Dave Zarzycki was busy designing and coding a replacement service for cron and much more: launchd, which first shipped in Mac OS X 10.4 Tiger, in 2005. The traditional service for running scheduled background activities in Unix is cron, and that’s what the first versions of Mac OS X used. This article outlines how those background activities are scheduled. The most prominent example of the latter are Time Machine backups performed by backupd, which usually occur every hour, although you have other options available in Ventura. Some like logd run in the background all the time, while others are scheduled to run every now and then.
