Ho hum (Sockets)
Ling
K.L.Lo-94 at student.lut.ac.uk
Fri Apr 18 02:55:31 CEST 1997
Hidi!
I thought I'd tell you all what I found in my mailbox earlier in the year
It seems to answer my dilemma. I think it's from ChrisL:
One thread watches the master socket. Spawn new connections.
When IO is found, it is passed to an available thread (note, threads
are not assigned to clients, threads sit in a pool/bag/heap/mess/cess
pit).
If there is no available thread, a new thread is spawned.
Every now and then, the socket threads are killed down to a base
minimum should they exceed the users ratio significantly.
Oki... now, I think I'm going to use the above model for input so I'll end
up with something like:
Master socket thread:
Watches master socket, spawns new connections, checks for input. Passes
input to an available socket thread if it is a whole line and spawns a new
socket thread if there is not one available.
Socket threads:
Receives input and interprets it immediately.
Master output socket thread:
Same model for input. No need to spawn new connection though. :)
Output socket threads:
Receives buffer and flushes it with the appropriate encoding (expansion
for support of any protocols handled here).
Don't know where to place the code to check if there's too many socket
threads. My feeling is that if there's too many, surely it shouldn't
matter as the extra threads sleep anyway.
| "With my naked eyes I saw the falling"
_O_O_ Ling - Freshwater fish rain coming down on."
More information about the mud-dev-archive
mailing list