<div>I'm not sure that having a separate stack for each lightweight thread is the right solution since it sounds kinda wasteful.<br></div><div><br></div><div>On the other hand, you don't need to CPS-transform all the code, but only portions of it which do I/O or yield.</div>
<div>So, basically, only top level control and I/O code will be transformed and the "meat" will stay undisturbed, as fast as usual.</div><div><br></div>