Threading questions

BlitzMax Forums/BlitzMax Beginners Area/Threading questions

JBR(Posted 2010) [#1]
Hi, new to the threading business.

I have 256 entities which takes 9ms

I then divided it into 2 functions. One threaded and one just runs in the main thread. i.e. one does the odds & the other the evens.

It now takes 5ms

I'll be doing particles aswell and I just can't ignore the performance boost.

I'm using the xor3d system with BMax and wonder if there are anythings I should look out for?

Everything seems ok at the moment.

I remember from a while back someone was going to set up an information bit about threading?

Any advice is greatly appreciated
Jm


ima747(Posted 2010) [#2]
I would suggest you direct this more towards xor3d forums or support (if there are any, I'm unfamiliar). Graphics access is limited to main thread (possibly not under newer versions of directx for some things... rumor I read somewhere) however normal memory access is allowed from any thread, so long as you don't modify the same thing from 2 locations at once (such as adding something to a list in one thread while another is reading the list). So what is safe within an engine will be dependent on what the engine actually does. e.g. if creating an entity only creates the memory space for the entity and perhaps an array of points and other data sets there should be no problem. However if creating an entity also creates a texture that may also be loaded to the graphics card when it is built and that may not be safe from a child thread...

So again, it will depend on what's really happening behind the scenes to determine if it is safe or not.


Dreamora(Posted 2010) [#3]
MT access to graphics is a DX11 feature