[squeak-dev] Distributing network load using HydraVM
siguctua at gmail.com
Tue Feb 26 03:51:56 UTC 2008
My head just visited another idea, and i'd like to share it :)
There was a discussion on how to pass sockets between images safely.
And due to reasons that it's not safe, not easy, and require a lot
changes which may break compatibility, solution was postponed for a
Now, i think i found the way how to pass the newly created socket to
another image by using a special accept primitive.
What this primitive should do:
by taking parameters: interpreter handle, socket handle and channel
name, it should
1. do validity checks (all handles should be valid e.t.c)
2. accept new incoming socket connection (socket handle passed to
primitive should be in listen mode)
3. if system fails with accept(), primitive fails
4. create an event and put new socket handle , and channel name to it.
5. enqueue given event to target interpreter event queue.
- register socket handle in SocketPlugin internal structures.
- then find channel with given name, and put SocketHandle bytearray as packet.
Now at language side, you simply need a channel, which listening for
packets, containing socket handles.
Once packet received, you know, that it's newly accepted socket
connection and can do anything you want with it.
by finishing writing this, i just thought that passing ownership of
already open socket can be done in similar way:
a primitive can remove given socket from SocketPlugin internal
structures and pass it with event to another interpreter.
Igor Stasenko AKA sig.
More information about the Squeak-dev