Dual threads? Or Parallel threads?
3 posters
Blokworld :: Development :: Information
Page 1 of 1
Dual threads? Or Parallel threads?
One of your tech posts stated single or dual threads, would these be parallel threads? I would rather take full use of multicore
Thraka- Posts : 2
Join date : 2011-04-15
Re: Dual threads? Or Parallel threads?
The way my engine works at the moment is it tries to split the 'work' (recreating chunks) into units (creating blocks, generating light, making meshes) and then these work units can be processed within the main loop or on a a single thread parallel to the gameloop.
I went down this path because on testing with a dual core machine i noticed some slowdowns occurring when the work thread basically consumed 100% of a core.
I would have liked to adopt a more multi core friendly approach but didn't want to end up with loads of locking issues which would increase the complexity of the whole thing.
There is just one interface between the gameloop and the building code and that is the meshes. The bulding code creates them and queues them up then the gameloop gets them from the queue and draws them. This is the only real area where locking or synching is done atm.
I went down this path because on testing with a dual core machine i noticed some slowdowns occurring when the work thread basically consumed 100% of a core.
I would have liked to adopt a more multi core friendly approach but didn't want to end up with loads of locking issues which would increase the complexity of the whole thing.
There is just one interface between the gameloop and the building code and that is the meshes. The bulding code creates them and queues them up then the gameloop gets them from the queue and draws them. This is the only real area where locking or synching is done atm.
Slaihne- Posts : 264
Join date : 2011-03-17
Age : 56
Re: Dual threads? Or Parallel threads?
I'm using multi threading in my voxel engine.
It's quite tricky to put in place, but when it's done, it works very well.
What I do mainly in parallel :
- Creating chunk landscape from 3D & 2D simplex Noises
- Creating Vertex/Index Buffers
From my experience, I need to limit the number of "background worker" threads that can run in parallel to the number of real CPU core minus 1 (1 left for the main render Loop).
Going above this, and you begin to have an impact on the main render loop.
On my 8 cpu (4 virtual one) cores, I use "only" 3 background worker. And it works very well.
It is generating the landscape (3d and 2d simplex noises mixed up), vertex buffer and index buffer of 1156 chunks (16*16*128 blocks) in 5 secondes.
One thing : I stopped using the "default" .net threadpool mechanism for this very nice thread pool manager : http://www.codeproject.com/KB/threads/smartthreadpool.aspx
Mainly because, it can handle things that the default threadpool cannot :
- Giving priority to submitted tasks <== Most important one !!!
- Cancel queued tasks
- Can create group of tasks for synch cases
- ...
It's quite tricky to put in place, but when it's done, it works very well.
What I do mainly in parallel :
- Creating chunk landscape from 3D & 2D simplex Noises
- Creating Vertex/Index Buffers
From my experience, I need to limit the number of "background worker" threads that can run in parallel to the number of real CPU core minus 1 (1 left for the main render Loop).
Going above this, and you begin to have an impact on the main render loop.
On my 8 cpu (4 virtual one) cores, I use "only" 3 background worker. And it works very well.
It is generating the landscape (3d and 2d simplex noises mixed up), vertex buffer and index buffer of 1156 chunks (16*16*128 blocks) in 5 secondes.
One thing : I stopped using the "default" .net threadpool mechanism for this very nice thread pool manager : http://www.codeproject.com/KB/threads/smartthreadpool.aspx
Mainly because, it can handle things that the default threadpool cannot :
- Giving priority to submitted tasks <== Most important one !!!
- Cancel queued tasks
- Can create group of tasks for synch cases
- ...
S33m3- Posts : 54
Join date : 2011-03-23
Blokworld :: Development :: Information
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|
Fri Jul 01, 2016 7:25 am by croxxx
» Source?
Thu Jul 12, 2012 9:55 am by raistlinthewiz
» Version Available (Take 2)
Sat Jun 09, 2012 3:23 am by kamild1996
» Terrain Rendering Bug
Thu May 17, 2012 8:07 am by sackboy789
» Mystery Block!
Thu Mar 29, 2012 4:42 am by Corvin73
» Your procedural tree/plant seeding technique?
Sat Mar 24, 2012 3:10 am by Slaihne
» Voxeliq project
Wed Mar 07, 2012 4:25 am by raistlinthewiz
» What is a Tech-Test?
Wed Jan 18, 2012 12:32 pm by joeydmars
» Images
Fri Jan 06, 2012 6:02 am by croxxx