Background activity scheduling with CTS in Catalina

Over the last week, I’ve been looking at how macOS now runs background ‘activities’ using Centralized Task Scheduling (CTS). To round this off, this article outlines what happens in macOS Catalina 10.15.7, in particular listing the services which are now scheduled and dispatched by CTS. In summary, these include the following:

  • Calendar – syncing, iCal service and subscriptions
  • Contacts – syncing
  • Differential Privacy
  • eficheck – weekly firmware check
  • Find My services
  • iCloud – bird service, CloudKit
  • Maps – announcements
  • Messages – syncing
  • Periodic maintenance – daily, weekly, monthly housekeeping
  • Photos – analysis and library maintenance
  • QuickLook – maintenance of thumbnails
  • Security – signature revocations, KEXT deprecations
  • Software Update – routine checks for security and other updates
  • Spotlight indexing – maintenance
  • Suggestions – updates
  • Time – periodic time recalibration using NTP
  • Time Machine – automatic backups.

Full lists are given in the appendix.

Once CTS and DAS have initialised after Catalina has started up, they proceed to check in their many activities, initially with CTS. This seems to be the result of their being loaded via LaunchAgents and LaunchDemons. These are marked by log entries such as
xpc_activity_register: com.apple.syncdefaultsd, criteria: check-in

Once the user has logged in, these proceed with user activities as well as those run as root. Later, CTS starts submitting these to DAS for entry into its managed lists. These are shown in log messages which contain details of the schedule dictionary, such as
Submitting DASActivity:
com.apple.applessdbgrefresh.activity: <dictionary: 0x7fc81020a3b0> { count = 7, transaction: 0, voucher = 0x0, contents =
"Repeating" => <bool: 0x7fff967b2490>: true
"Interval" => <int64: 0xa133add99d3f401f>: 259200
"RequireScreenSleep" => <bool: 0x7fff967b2490>: true
"GracePeriod" => <int64: 0xa133add9b76f401f>: 86400
"RequireBatteryLevel" => <int64: 0xa133add9a273201f>: 70
"AllowBattery" => <bool: 0x7fff967b2490>: true
"Priority" => <string: 0x7fc81020a450> { length = 11, contents = "Maintenance" }

If you want to inspect the schedule settings for any activity, these are the best place to look.

Eventually, DAS runs up with messages such as
Low Likelihood is from (null) to (null)
Using restart times of <private>
Creating shared memory for budgeting (likely after reboot)
SystemStats: Initializing budget manager

Log entries following that provide insight into the data structures which DAS uses, and you’ll also see it refer to activity lists, groups of activities which are scheduled to run together in a coordinated manner. DAS soon gets on with evaluating individual activities in its exchanges with CTS. A simple example is
Submitted Activity: 0:com.apple.backupd-auto:9E6405 at priority 30 with interval 3600 <private>
Activity <private>: Optimal Score 0.8451 at <private> (Valid Until: <private>)

Longer examples give insight into the many factors which DAS takes into account when dispatching activities for CTS. Those include thermal and memory pressure, as well as time. There’s a great deal to explore in the log excerpts provided by Mints which provides better insight into these sophisticated scheduling systems.

Appendix: Main activities scheduled by CTS in Catalina 10.15.7

1. Run as root

com.apple.applessdbgrefresh.activity
com.apple.applessdstatistics.activity
com.apple.apsd.apprefresh
com.apple.awdd.publication
com.apple.awdd.trigger (two)
com.apple.backupd-auto Time Machine automated backups, every hour
com.apple.backupd-auto.dryspell Time Machine, every day
com.apple.backupd-auto.dryspell.test
com.apple.bridgeOSUpdateProxy.StatsSubmission
com.apple.CFNetwork (multiple)
com.apple.CoreAnalytics.2Hours
com.apple.CoreAnalytics.Daily
com.apple.coreduetd.datacollection.task
com.apple.coreduetd.knowledge
com.apple.coreduetd.people
com.apple.dasd.dataCollection DAS (daily)
com.apple.dasd.overdueCheck DAS (daily)
com.apple.DifferentialPrivacy (multiple tasks)
com.apple.driver.eficheck eficheck firmware check, every week
com.apple.icloud.findmydeviced.launch-on-reboot
com.apple.icloud.searchpartyd (multiple tasks)
com.apple.locationd.MetricHeartbeat
com.apple.lskdd
com.apple.mds.Deferable Fixup (multiple tasks)
com.apple.mds.Health check (2) (multiple tasks)
com.apple.mds.Migration (multiple tasks)
com.apple.metrickitd.setup
com.apple.mobile.keybagd.data-analytics
com.apple.MobileAccessoryUpdater.deviceIdleCheck
com.apple.MobileAccessoryUpdater.periodicFirmwareCheck
com.apple.mobileactivationd (multiple tasks)
com.apple.mobileassetd.metadata-update
com.apple.noticeboard.update
com.apple.OSUpdate.PeriodicAutoUpdateActions every 6 hours
com.apple.periodic-daily daily housekeeping
com.apple.periodic-monthly monthly housekeeping
com.apple.periodic-weekly weekly housekeeping
com.apple.revisiond.CacheDelete.purgeable-xpc
com.apple.revisiond.requeue_chunking
com.apple.security.syspolicy.check.revocation
com.apple.security.syspolicy.find.bundles
com.apple.security.syspolicy.gatekeeper.policy-metrics
com.apple.security.syspolicy.invalidate
com.apple.security.syspolicy.kext.deprecation
com.apple.security.syspolicy.kext.mt
com.apple.security.syspolicy.legacypolicy
com.apple.security.syspolicy.measure
com.apple.security.syspolicy.rearm
com.apple.security.syspolicy.report
com.apple.signpost.signpost_reporter_activity
com.apple.SoftwareUpdate.Activity every 6 hours
com.apple.SymptomFramework.MaintenanceActivity.Daily
com.apple.systemstats.microstackshot_periodic
com.apple.timed.ntp.wanted (two)
com.apple.timezoneupdates.local-asset-check

2. Run as user

com.apple.AddressBook.ScheduledSync Contacts sync over iCloud, hourly
com.apple.ak (three)
com.apple.AOSHeartbeat.daily
com.apple.ap.adprivacyd.reconcile
com.apple.appstoreagent.scheduleTasks
com.apple.bird iCloud, six
com.apple.CacheDelete.daily
com.apple.calendar three
com.apple.cloudkit iCloud, six
com.apple.coreduet three
com.apple.DataDetectorsLocalSource
com.apple.devicecheck.notify
com.apple.EscrowSecurityAlert.daily
com.apple.followup.notify
com.apple.fudHelperLaunchdActivity
com.apple.geo.analytics
com.apple.geod.updateNetworkDefaults
com.apple.GeoServices.UpdateExperiment
com.apple.helpd.sdmmap_building
com.apple.ical.sync.x-coredata two, one for CalDAVPrincipal, the other for SubscriptionInfo
com.apple.icloud.fmfd.heartbeat
com.apple.ids three
com.apple.IMAutomaticHistoryDeletionAgent
com.apple.knowledgestore.sync
com.apple.kvs.periodic-analytics
com.apple.Maps.mapspushd.launchForAnnouncements
com.apple.mediaanalysisd.fullanalysis
com.apple.mediaanalysisd.photosanalysis
com.apple.messages.chatSyncing
com.apple.messages.ckMetricsLogging
com.apple.messages.messageSyncing
com.apple.networkserviceproxy.metadata-refresh
com.apple.noticeboard.update
com.apple.parsec-fbf.flush
com.apple.photoanalysisd.backgroundanalysis
com.apple.photolibraryd two
com.apple.proactiveeventtrackerd two
com.apple.ProtectedCloudStorage.fortnightly
com.apple.quicklook.cloudThumbnailDatabaseCleanup
com.apple.routined four
com.apple.SafariBookmarksSyncAgent.XPC.ZoneSubscriptionRegistration
com.apple.searchd.expirations
com.apple.securityd.daily
com.apple.securityuploadd.triggerupload
com.apple.silhouette.compute
com.apple.siri.xpc_activity two
com.apple.spotlight two
com.apple.suggestd nine
com.apple.suggestions three
com.apple.syncdefaultsd
com.apple.tourist.notify
com.apple.transparencyd.dutycycle
com.apple.UsageTrackingAgent.activity.uncategorized-web-usage