Jump to content

Best way to implement Multi Threaded Support


Recommended Posts

Posted

Hello,

I was wondering wats the best framework to use to implement multi threaded pools into the mangos code.

I saw ace has multi threaded support.

Wat would be the best way to intergrate it into the code.

Posted
there is not any other word,

Multi threaded pools = Multi threaded core.

That's not quite true...

Multithreaded is anything that has more than one thread. Mangos already has multiple threads, but the "heavy" workload is not distributed among several threads.

Thread pool is a more specific concept. If you have 4 hyperthreaded cores, so you can handle 8 threads concurrently, you can create a pool of 8 threads and try to distribute the workload among these threads.

Posted

And as far as I know the plans the mangos team has with the maps is a threadpool that handles "jobs" so every action that the maps perform is added to a queue which is handled by the threads in a threadpool. This is what I've heard might not be 100% accurate.

Posted

Thread pool is a more specific concept. If you have 4 hyperthreaded cores, so you can handle 8 threads concurrently, you can create a pool of 8 threads and try to distribute the workload among these threads.

You can also have a thread pool of 20 threads, or 10 or 50. Even with only 1 core.

Imho if you have one thread per map, that is not a threadpool because a request for a specific map will always be handled by the same thread. And the threads will live for the whole duration of server runtime.

from top of my head there are multiple ways to implement more "multithreadedness" into mangos:

1) Global Threadpool that handles everything: Packets, AI, Timers

2) Threads for specific tasks for example run chat on own thread or things like that

3) Threads per specific area (map, zone, grid)

4) mix of above

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use