Page 1 of 1

[INFO\CONFIRM] POL100 X64 - multithread

Posted: Thu Apr 30, 2020 12:52 am
by DebugZHI
Goodmorning to all,

i've lurked on all forum about some information about multhithread for pol, but i don't have found a complete answer.

POL100 is multithreading?
escript vm is multihtreading?

thank's for you cooperation

Best Regard

Scripter Debug

Zhi 7^ age

Re: [INFO\CONFIRM] POL100 X64 - multithread

Posted: Thu Apr 30, 2020 2:40 am
by kevin
Hi DebugZHI,

POL has been default multi-threaded since 2016, and has supported _only_ multi-threaded since 2019. However, the underlying C++ objects in the game themselves do not support multi-threads (eg. changing a Character's name is not thread-safe and cannot be done in two threads). We have thread synchronization to take care of that via a `PolLock` mutex). For example:
  • The single "Scripts Thread" is responsible for stepping through all pending scripts to run. Since scripts modify game objects, their execution is done in a PolLock.
  • Each client connection gets its own thread. On receiving a data packet, since this can modify the game world (eg. a 'move item' packet), the packet handler execution is done in a PolLock.
Does this answer your question?

Re: [INFO\CONFIRM] POL100 X64 - multithread

Posted: Fri May 01, 2020 2:18 am
by DebugZHI
Hi Kevin,

thank's for the answer.
Taking about you information i can deduce that an optimal processor to maximize pol performance, would be:

1- high cpu clock for single thread escript performace (such as npc AI and complex world script)
2- medium core numbers (8/16) for core threading support (ecompile, core, client connection, etc...)

it can be any correlation between high number of npc spawn (such as 100/120 npc within an area of 10*10 tiles) and high burst of cpu usage that will persist for 1 or more minutes?

that's right?

Best Regards

Scripter Debug

Re: [INFO\CONFIRM] POL100 X64 - multithread

Posted: Fri May 01, 2020 3:44 am
by Nando
Yes, optimize for single-threaded performance and a few cores. At the moment POL can't effectively use that many cores because the architecture requires a global lock in many common operations. So it doesn't hurt to have more cores, but POL won't use all of them.

Re: [INFO\CONFIRM] POL100 X64 - multithread

Posted: Sat May 02, 2020 12:55 am
by DebugZHI
hi all,

thanks a lot for your answers, now i've a more clean situation.

Best Regards,

Scripter Debug