InterpreterPoolExecutor

인터프리터 풀 실행기

Run each worker in an isolated Python interpreter.

···
html
<div class="v"><header><b>INTERPRETER POOL</b><span id="state"></span></header><main><div class="pool" id="pool"></div><div class="transfer" id="transfer"></div></main><footer>parallel workers, isolated state</footer></div>
css
.v{width:min(92vw,660px);height:min(86vh,310px);box-sizing:border-box;padding:clamp(9px,2.5vmin,18px);border:1px solid var(--line);border-radius:14px;background:var(--surface);display:flex;flex-direction:column;gap:7px;color:var(--fg);font:500 clamp(15px,3.2vmin,17px)/1.25 var(--font-sans, sans-serif)}.v header,.v footer{display:flex;justify-content:space-between;align-items:center;gap:8px;white-space:nowrap}.v header b{color:var(--accent);font-size:.9em}.v header span,.v footer{color:var(--muted);font-size:.82em}.v main{flex:1;min-height:0;position:relative;overflow:hidden}.v .mono{font-family:ui-monospace,SFMono-Regular,Consolas,monospace}.v .active{background:var(--accent)!important;color:var(--bg)!important;border-color:var(--accent)!important}.v .muted{opacity:.28} .pool{height:68%;display:flex;align-items:center;justify-content:space-around;gap:7px}.box{width:43%;height:65%;border:1px solid var(--line);border-radius:7px;display:grid;place-items:center;text-align:center;font:600 .82em ui-monospace,monospace}.box em{font-style:normal;color:var(--accent)}.transfer{text-align:center;color:var(--accent);font:600 .8em ui-monospace,monospace}
js
let n=0;function draw(){document.getElementById("pool").innerHTML=[0,1].map(i=>"<div class=\"box "+(i===n?"active":"")+"\">INTERP "+(i+1)+"<br>state "+(i?"B":"A")+"<br>job "+(n+i+1)+"</div>").join("");document.getElementById("transfer").textContent="separate state · explicit message";document.getElementById("state").textContent="worker "+(n+1);n=1-n}draw();setInterval(draw,1150)

Python 3.14 adds InterpreterPoolExecutor, with a separate interpreter for each worker. Each has its own GIL and runtime state, allowing CPU work to run on multiple cores.

Mutable objects cannot simply be shared across interpreters. Data transfer and synchronization must be explicit. The demo shows two isolated worker state spaces.

When to use

Use it for multicore CPU work when explicit state isolation is acceptable.

Open as page ↗