Threading the server

Plans/Ideas

  • Per-map threads and per-player threads
  • Mutex locks in players, and in ‘map queues’.
    • ‘map queues’ are queues of things for a map thread to do, that it is told to do by other maps.
  • One map thread when wanting to do something such as teleport an object to another map, get a lock on the map’s queue and put it in a queue of things for the other map thread to do in it’s next tick.
  • In order to avoid all chance of deadlock, do this when processing the queue of things other threads told the thread to do:
    1. Lock it’s queue
    2. Copy it’s queue and clear the original
    3. Unlock it’s queue
    4. Process the copy of the queue.
    • Otherwise, there is a small chance that two processing queues at the same time might want to lock eachother to add to the list.
    • Alternatively one could do per-query-entry locking, however that wouldn’t work with a linked list, plus that much locking and unlocking may become expensive on cpu
  • Perhaps use the proposed unified event system to implement the per-map queues.

Issues to watch out for

  • Have to be careful to avoid deadlock circumstances.

Comments

  • I consider this to be a very low priority thing, however made the wiki page here to make sure some ideas about implementing it are not lost — Alex Schultz 2006/10/09 11:15

More information

FIXME put information from the logs of IRC discussion here

 
dev_todo/thread_the_server.txt · Last modified: 2006/10/09 11:17 by rednaxela
 
Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Debian Driven by DokuWiki