Repository navigation
Conversation
This was referenced Oct 17, 2026
Merged
demrom
force-pushed
the
feature/extension-shell-workers
branch
from
October 18, 2026 16:54
e3c05e2 to
71c4e4c
Compare
demrom
marked this pull request as ready for review
October 18, 2026 16:54
…Settings The host runs min(worker_limit setting, hw.physicalcpu, bundled ShellWorkerCount) workers at once and returns ENOSPC beyond that. ShellWorkers/generate-targets.sh (POSIX sh and awk, like the other scripts of the repo) keeps the extension targets and the Settings list in line with ShellWorkerCount. The new Settings strings are localized in the existing Root.strings files. tests/worker-pool.m gains a limit check.
…-app # Conflicts: # README.md
This was referenced Oct 23, 2026
# Conflicts: # a-Shell.xcodeproj/project.pbxproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Native commands share a-Shell's process. This adds a public pane API (
ShellWorkers/NativePane.h) that runs each command in its own Generic Non-UI extension, with separate cwd, environment and socket streams. Cancel and release terminate the worker before freeing its slot, and a lost worker reports 137.Pool size
The mini target bundles ten workers. By default the host runs one per physical core (six on an iPhone 16 Pro). The new "Shell workers" setting changes that up to the bundled count; a request beyond the cap gets ENOSPC.
ShellWorkers/generate-targets.sh [N]regenerates the targets and the setting for a different bundled count.Testing
worker-pool-checkcases plus four ios_system spawn/nested-environment cases and the next ordinary command after each case, plus both redirected-input and piped-input gzip/wc gates; each pipeline counted 2,000,633 bytes, matching the thread path. The same suite passed in the Simulator with released Dash code and a login profile containingalias exit=clear.ios_waitpidwith ios_system#188.Why one worker per core
A fixed CPU job on the phone, each run starting cold (nominal thermal state, on the charger):
The A18 Pro has 2 performance and 4 efficiency cores, and the results fit speedup ≈ P + 0.57 × E, where P and E are the busy performance and efficiency cores. That tops out at 4.26 once all six cores are busy. More workers add nothing for CPU-bound work. Under ten minutes of continuous load the phone reached serious thermal state within 22 seconds and ran 8% below the cold rate.
Other loads peak elsewhere. Above ten, the phone rows run several threads inside each of the ten workers:
Mostly idle jobs keep gaining, but each job slows down: 5% at 40 streams, 66% at 80 and 2.9x at 160, where the phone reached serious thermal state. That is why the setting goes above the core count.
In the Simulator on a 14-core Mac, 1,024 workers launched and finished the mostly idle job; throughput levelled off at 512 (6.07 jobs/s), and file I/O peaked at 16 workers. A 2,048-worker run stopped at 1,260 with EBADF. These numbers show the pool mechanics scale, not what an iPhone can sustain.
Dependencies
Needs ios_system#180 through #184 and dash_iOS#1 and #2, including libedit. Merge before #1091.
Limits
Workers hit the per-process memory limit early. A worker allocating 64 MiB was killed after about 27 MiB of footprint, and two idle workers that had reached about 28 MiB during a CPU run were killed later; the device log reports
killed by jetsam reason per-process-limitfor all three. Memory-heavy commands should stay in the app process. Background lifetime and App Store review are untested.A worker self-probe using
task_info(TASK_VM_INFO)forphys_footprintplusos_proc_available_memory()measured a 35 MiB budget. I ran the same barecodexbinary (0.160.0) in the main a-Shell process and a fresh extension worker in a separate a-Shell test build on an iPhone 16 Pro; retained device receipts report iOS 27.0.1 (24A446). Xcode Activity Monitor measured a main-app startup maximum of 78.2 MiB over eight physical-footprint samples at a median interval of 1.036 seconds, with no lifetime peak available. The worker produced zero startup samples and lost its pane with synthetic status 137, without a matching jetsam record to establish the cause. Please enable Increased Memory Limit (com.apple.developer.kernel.increased-memory-limit) for each worker extension App ID and regenerate its provisioning profile; I will add the worker entitlement after those profiles support it and remeasure the resulting limit.