🔒 Locked
Hyper-Threading
Advertisement
Original Post
My exp. is that your code just needs to impliment threads in general.
If you have multiple threads they will get executed SMP(2cpu) style just fine on Hyper-Threaded systems(1cpu).
As far as code examples, What programming languages are you going to use? And I'm taking that your doing this for a game, but would you clarify what you want to gain through multithreading.
Also realize that good threading makes coding a program much more complex.
[edited by - Abbacabba on January 9, 2004 9:19:59 AM]
If you have multiple threads they will get executed SMP(2cpu) style just fine on Hyper-Threaded systems(1cpu).
As far as code examples, What programming languages are you going to use? And I'm taking that your doing this for a game, but would you clarify what you want to gain through multithreading.
Also realize that good threading makes coding a program much more complex.
[edited by - Abbacabba on January 9, 2004 9:19:59 AM]
Direct3D suffers a substantial performance hit when it becomes multi-threaded.
quote:
Original post by circlesoft
Direct3D suffers a substantial performance hit when it becomes multi-threaded.
Only if you specify the MULTITHREADED flag on CreateDevice. You don''t need to specify the flag if you can *guarantee* that the device won''t be accessed concurrently by 2 threads (e.g. if you use some semaphore or whatever) or if you''re just using the other thread for input/sound/AI...etc.
The debug runtime will complain about this like crazy, but it''s alright as long as you know what you''re doing.
Muhammad Haggag
I agree, you would have to guarentee that only one thread ever accesses memory and draws to the surface. The other thread might be able to help prepare batching or something, but the thing slowing games down these days is the GPU, not the CPU necessarily. I don''t see that multiple CPU support is going to gain you much, unless you have some complex AI or something. Did you have a specific reason for wanting it?
Chris
*Life is like the rock in a sling-shot. Pick a good target, take good aim, and get there as soon as possible!*
Chris
*Life is like the rock in a sling-shot. Pick a good target, take good aim, and get there as soon as possible!*
abbacabba, i''m using Visual C++ with Direct X 9...
i''m trying to make a bomberman game and i''m thinking of using threading to run all the bombs (drawing the bomb and counting down the timer till it blows) the bomberman has planted on the map.
is it a wise way ?? since i think it''s better than multi tasking...
i''m trying to make a bomberman game and i''m thinking of using threading to run all the bombs (drawing the bomb and counting down the timer till it blows) the bomberman has planted on the map.
is it a wise way ?? since i think it''s better than multi tasking...
Well, honestly, I think it would be better to just make each bomb a class, create the class when he places the bomb with the current time, then add the class to a linked list. Every frame, go through the list and check to see if the right amount of time has passed since it was created. If so, initiate it''s explosion, then destroy it after the explosion is complete several frames later and remove it from the list.
Chris
Chris
quote:
Original post by Supernat02
but the thing slowing games down these days is the GPU, not the CPU necessarily.
Actually, many games are still CPU-bound.
I like pie.
chris....luckly i used the same logic u''ve told
so when i have created the new bomb class and entered them in link list, i just call a threading function to run the bomb in calculating the time and re-drawing it on the screen till the time run out. then it create a fire object and remove the bomb from the linked list.
do u have any suggestion ?
so when i have created the new bomb class and entered them in link list, i just call a threading function to run the bomb in calculating the time and re-drawing it on the screen till the time run out. then it create a fire object and remove the bomb from the linked list.
do u have any suggestion ?
May i first point out that every commercial game in use today(rather ones that are considered new) have multithreading, Return to Castle Wolfinstien uses 4 threads. Any game that has network code will use threads, most games that use input from a keyboard, mouse, or other input device will use a thread or two. But keep in mind that every thread is a performance hit, every thread started has a minumum sized Stack all to its self, and it takes a moment for windows to switch between different threads. So in conclusion Threading is Crucial but dont use more than a few threads, oh yeah and HyperThreading just allows for better Multithread processing specificly in the department of Mutex''s. im not totaly sure on the specifics but that was what was shown by a graph in a popular science or web site or something that i saw when HT first came out.
HippieHunter,
You make a good point I hadn''t thought about. I guess my main point was that you shouldn''t use multiple threads to actually do the drawing. It does make sense to use them for other processes involved, such as networking, keyboard input, etc. Good call.
Delacroix, I don''t really see an added value by having the bomb''s calculations done in a separate thread, albeit I might be missing something. It seems like the overhead might negate running simple time comparisons.
I would just make a single public Render function in the class, and in that render function check the time, set another public flag whether the bomb is dead or not, then create a container class to house the bomb classes, with a single public Render function that goes through the list and renders all of the bomb classes, first checking to see if the bomb is still alive, and if not, destroy it. That''s how I would approach it, but there are many ways!
Chris
You make a good point I hadn''t thought about. I guess my main point was that you shouldn''t use multiple threads to actually do the drawing. It does make sense to use them for other processes involved, such as networking, keyboard input, etc. Good call.
Delacroix, I don''t really see an added value by having the bomb''s calculations done in a separate thread, albeit I might be missing something. It seems like the overhead might negate running simple time comparisons.
I would just make a single public Render function in the class, and in that render function check the time, set another public flag whether the bomb is dead or not, then create a container class to house the bomb classes, with a single public Render function that goes through the list and renders all of the bomb classes, first checking to see if the bomb is still alive, and if not, destroy it. That''s how I would approach it, but there are many ways!
Chris
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement