[INFO\CONFIRM] POL100 X64 - multithread

Here you can post threads on the development of the current release of the core (100)

Moderator: POL Developer

Post Reply
DebugZHI
New User
Posts: 13
Joined: Thu Nov 24, 2016 7:31 am

[INFO\CONFIRM] POL100 X64 - multithread

Post 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.

Question:
POL100 is multithreading?
escript vm is multihtreading?

thank's for you cooperation

Best Regard

Scripter Debug

Zhi 7^ age
kevin
POL Developer
Posts: 53
Joined: Wed Sep 29, 2010 3:47 pm
Contact:

Re: [INFO\CONFIRM] POL100 X64 - multithread

Post 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?
DebugZHI
New User
Posts: 13
Joined: Thu Nov 24, 2016 7:31 am

Re: [INFO\CONFIRM] POL100 X64 - multithread

Post 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...)

Question:
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
Nando
POL Developer
Posts: 282
Joined: Wed Sep 17, 2008 6:53 pm
Contact:

Re: [INFO\CONFIRM] POL100 X64 - multithread

Post 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.
DebugZHI
New User
Posts: 13
Joined: Thu Nov 24, 2016 7:31 am

Re: [INFO\CONFIRM] POL100 X64 - multithread

Post by DebugZHI »

hi all,

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

Best Regards,

Scripter Debug
Post Reply