Generators in D

Sean Kelly sean at invisibleduck.org
Tue May 17 12:32:10 PDT 2011


On May 17, 2011, at 7:37 AM, Piotr Szturmaj wrote:
> 
> In regards to serializable fibers, I've found some interesting potential usage - session handling in HTTP server. Fiber code could represent session and could be saved to disk in the middle of execution, just like sessions are saved in PHP. This is used to offload memory when handling great number of sessions.
> 
> If serialization will be clever enough, these fibers could even be shared across different servers! This is really a requirement in load balanced environments.

The trick is serializing the map of dynamic objects referenced by the Fiber's stack.  And more generally, dealing with any pointers on the stack at all.  It's the same problem as pointers in a memory-mapped file.  That said, you really shouldn't have to serialize Fibers just to offload memory.  That's what the virtual memory manager is for.


More information about the Digitalmars-d mailing list