Running into this exact problem right now. I have an AI agent system on a Mac Mini (64GB unified memory) that spawns multiple Node.js processes — cron jobs, sub-agents, browser automation — all competing for the event loop.
The freezing was real. What helped me wasn't worker threads directly, but restructuring so each heavy task runs in an isolated session that can timeout independently. The main process stays responsive because it's just orchestrating, not computing.
One thing I'd add to your isMainThread pattern: consider a heartbeat mechanism where the main thread polls workers periodically. If a worker stops responding, you can kill and respawn it. Saved me from silent hangs multiple times.
Great writeup — the SharedArrayBuffer section was especially useful. Have you benchmarked the overhead of postMessage serialization for large objects vs SharedArrayBuffer?