concurrency program design stackless python tasklet or python thread?

davy zhang davyzhang at gmail.com
Tue Nov 11 02:45:04 EST 2008


thanks very much for the hint,  circuits is a very good event-driven
frame work just like twisted

but currently my project is in a pretty much complex way

see, I'm designing a so called "Game Server", every client has their
own task execution order, see like below:

1.clientA wants to sale his armor
2.clientA wants to buy the knife
3.clientA wants to talk to npc

I think for one client this sequence should be lined-up, the task
should follow the 1,2,3step

but there's multiple clients on this server so for multiple clients
they can not wait until clientA finishing his job. if there's clientB
like below:

1.clientB wants to say something to npc
2.clientB wants to attack clientC
3.clientB wants to draw his sword

the whole process for the server should be like this sequence:


1.clientA wants to sale his armor
2.clientB wants to say something to npc
3.clientB wants to attack clientC
4.clientA wants to buy the knife
5.clientA wants to talk to npc
6.clientB wants to draw his sword

for clientA and clientB separately their tasks are lined-up, for whole
system they are concurrent

and plus I don't want to block the whole task system when a single
client dealing with big chunk task.

I don't know if I get picture right:)

any idea about my design? thanks a lot



More information about the Python-list mailing list