Mac os How do I run folder actions on performance P core

Unfortunately, the search results do not provide any information on how to specifically run folder actions on the performance (P) cores of Apple Silicon Macs. Folder actions are designed to run automatically when certain events occur on monitored folders, but the operating system determines which CPU cores are utilized. Folder actions are triggered by events like adding, removing, or modifying files in the monitored folder. They execute scripts or automations you have set up, but there is no built-in way to control which CPU cores are used for these actions. The search results explain what folder actions are, how to set them up, and some common use cases, but do not mention any methods for explicitly running them on the performance cores. This is likely because folder actions are relatively lightweight tasks that do not require the full performance of the P cores. Unless Apple provides a specific method to force folder actions to run on the P cores (which is unlikely given their intended purpose), they will likely execute on the efficiency (E) cores by default to conserve power. The operating system's process scheduler determines the optimal core usage based on the workload and available resources.
what about running terminal commands on P cores
Based on the provided search results, there is no direct way to force terminal commands or scripts to run specifically on the performance (P) cores of Apple Silicon Macs. However, there are a few potential methods mentioned:
  1. Using Quality of Service (QoS) settings:
  • When running commands from Swift, Objective-C or equivalent languages, you can set the QualityOfService to "background" (integer value 9) to run the command entirely on the Efficiency cores.
  • This means setting QoS to a higher value like "userInteractive" (33) would allow the command to potentially utilize the P cores as well.
  • An example utility called DispatchRider is provided that allows running commands at different QoS levels to explore core usage.
  1. Using process affinity settings (for Intel/AMD CPUs):
  • On Windows, you can use the Task Manager to right-click a process and select "Set affinity" to uncheck the Efficiency core logical processors.
  • This forces the process to run only on the P cores, but is an Intel/AMD CPU specific technique.
  1. BIOS settings (for Intel/AMD CPUs):
  • Some BIOS versions may have a "game mode" option to disable Efficiency cores, forcing all processes to run on P cores when enabled.
Unfortunately, none of the search results directly describe a method to force terminal commands or scripts to explicitly run on the P cores of Apple Silicon Macs from the command line or Terminal itself. The QoS method seems to be the closest option, but does not guarantee P core usage.
but if the shell is launched from a folder action you can't promote a QoS higher than its parent process
You make a valid point. If a shell or terminal command is launched from a folder action, it cannot be assigned a higher Quality of Service (QoS) priority than the parent folder action process itself. Folder actions are triggered by file system events and run at the default QoS level set by the operating system. Any child processes spawned by the folder action, such as a shell script or terminal command, will inherit the same or lower QoS priority as the parent folder action process. The search results confirm that while you can set the QoS level for command-line tools and processes manually, this is limited by the QoS of the parent process that launched them. A child process cannot be promoted to a higher QoS than its parent. So in the case of a folder action launching a terminal command or script, that command would run at the default QoS level determined by macOS for folder actions. It would not be possible to explicitly run that command on the higher priority performance (P) cores, as the QoS would be capped by the folder action's QoS. Unless Apple provides a way to configure folder actions to run at an elevated QoS level from the start, any commands or scripts executed from within a folder action will be limited to the efficiency (E) cores and default QoS priority assigned by the operating system.
how can I ensure a process launched from a folder action uses the highest possible QoS
what are the limitations of setting QoS for processes launched from folder actions
are there any workarounds to promote QoS for processes launched from folder actions