Archived

This topic is now archived and is closed to further replies.

spetnaz_

useing the new P4 HT

Recommended Posts

spetnaz_    100
i have a new PC, bought it 2 weeks ago. 128mb RADEON PRO, 512 DDR2 RAM, Creative soundblaster live sound card, but most importantly i also have that new hyper threaded P4. This means if u look under the hardware manager thingy in the control panel it says that i have 2x3GHz proccessors. Basicly i was woundering if it would possible to make use of these "2" proccessors by making one handle the windows messages and the other one handle game functions in the message handler. My knowledge of OpenGL and DX APIs are currently limited to making tringles spin so i must appologize if this is an obviuos question. and another thing. i downloaded "Tricks of the Windows Game Programming Gurus" by andrei lemoth (might be spelt wrong) from www.programmers-unlimited.com/books and in that book he talkes about some weird optimazation tricks in the first chapter. for example he written that if u want to make struct u should make them allocate a multiples of 4 amounts of bits or just adding variables which will not be used to make it 32 bits worth of memory. Surely its better to allocate 5 bits then 32 as this saves on memory!? he also sayed that its better to make lots of simple functions that do little on there own then one big one. but doesnt that mean that there is simply more code and the proccesor will take longer to do its stuff as it has to switch between different functions instead of doing one big one!? and also he sayed that global variables should be used as often as possible but every other book i read on C++, Teach Your Self C++ in 21 Days, Idiots Guide to C++, and Game Programming All in One, all said that global variables should be avoided at all costs for security so that unwanted changes of the variables are not made. Is he right or is he just CRAZY

Share this post


Link to post
Share on other sites
jamessharpe    497
quote:
Original post by spetnaz_

he also sayed that its better to make lots of simple functions that do little on there own then one big one. but doesnt that mean that there is simply more code and the proccesor will take longer to do its stuff as it has to switch between different functions instead of doing one big one!?



This makes the code more readable and allows you to reuse the code. The compiler will automatically make it into one big function in release mode if it thinks performance will be better

quote:

and also he sayed that global variables should be used as often as possible but every other book i read on C++, Teach Your Self C++ in 21 Days, Idiots Guide to C++, and Game Programming All in One, all said that global variables should be avoided at all costs for security so that unwanted changes of the variables are not made.

Is he right or is he just CRAZY

Global variables have their uses, but generally you should try to avoid them. Why? Consider global variable ''ImportantVariable''. function X() is called - there is nothing to stop the programmer from making changes to ImportantVariable.

Share this post


Link to post
Share on other sites
Sneftel    1788
LaMothe has a lot of ideas about micro-optimization, most of which are wrong. As soon as I started reading that sentence, I thought, "oh gods, what ''trick'' has LaMothe thought up this time?" Here''s a few corrections:

1. Most compilers will pad structures for you.
2. You''re right, each non-inline function call has overhead. For purposes of organization, however, small functions tend to be better (as long as they represent logically encapsulated functionality).
3. Global variables are okay, as long as you realize why they can be a bad idea at times. (Every Other Book You Read On C++ will have a good discussion of this.)



How appropriate. You fight like a cow.

Share this post


Link to post
Share on other sites
spetnaz_    100
thanx on that. Bytheway what is EXACTLY optimization is it just making the code smaller and making the .exe use up as little memory as possible





and what about the P4 HT question.

Share this post


Link to post
Share on other sites
Thor82    114
[OT!!] Off topic: Sneftel, is your sign from monkey island?? [/OT]



There aren''''t problems that can''''t be solved with a gun...

Share this post


Link to post
Share on other sites
boontje    100
By a weird co-incidence I just picked up my new computer with a P4 with HT, and then I see this topic

Anyway, about HT as far as I understand it: HT does NOT mean you actually have 2 processors in you''re computer. It also does not mean you have 2 processors in 1 chip. HT is a technology which makes it possible for the computer to do tiny little tasks seperatly. More important: it makes the processor wait less. Also it is possible to take advantage from HT with code. I dont know how that actually works, but I''ve read that C++ compilers take or will take in the future advantage of HT.

I also have read that programs not optimized for HT have a performance gain between 0% and 20%.

Please note that I dont know much about HT yet, this is just what I have read here and there

Share this post


Link to post
Share on other sites
spetnaz_    100
but in the hardware manager thingy it clearly says i have 2 proccesors, so windows thinks that there are 2 proccesors. (boontje make sure you enabled HT at BIOS as by default it is not enabled)

So does anyone knowhow i could make my code take advantage of this technology, or is this forum too API oreintated, in which case does any one know where i could get some advise on this)


Just saw something on TV about the new G5, who in hell wants a MAC, they sack, they are expesive becuase they are all pritty inside (why? => so the technicians would be happy at the factory) and about 2 years behind x86 PCs. i mean all MAC lovers need a good wiping

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
but in the hardware manager thingy it clearly says i have 2 proccesors, so windows thinks that there are 2 proccesors.

(boontje make sure you enabled HT at BIOS as by default it is not enabled)

So does anyone know how i could make my code take advantage of this technology, (or is this forum too API oreintated, in which case does any one know where i could get some advise on this. no oofence but this is more of a harware thing thing then OpenGL or DX or MFC)


Just saw something on TV about the new G5, who in hell wants a MAC, they sack, they are expesive becuase they are all pritty inside (why? => so the technicians would be happy at the factory) and about 2 years behind x86 PCs. i mean all MAC lovers need a good wiping

Share this post


Link to post
Share on other sites
boontje    100
I think HT is enabled by default or the computer shop did it for me. I see indeed 2 processors in my device list and in the task manager.

Also, a bit more about HT:

If you want to use HT, use threads. A bit of reading on intel.com:

"This technology is largely invisible to the platform. In fact, many applications are already multi-threaded and will automatically benefit from this technology. However, multi-threaded applications take full advantage of the increased performance that Hyper-Threading Technology has to offer, allowing users will see immediate performance gains when multitasking"

source: http://www.intel.com/technology/hyperthread/index.htm

So, the heavy stuff should be done in threads. This makes programming a bit more difficult, games will even be more complex I think.

Share this post


Link to post
Share on other sites
Sneftel    1788
quote:
Original post by Thor82
[OT!!] Off topic: Sneftel, is your sign from monkey island?? [/OT]

But of course!

Look behind you! A three-headed monkey!


How appropriate. You fight like a cow.

Share this post


Link to post
Share on other sites
eSCHEn    394
I happen to have a few old DOS titles lurking on my hdd, including Elite Plus, let me know if you want it.

Cheers

[edited by - eSCHEn on July 7, 2003 6:41:05 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Im pretty sure that multiple processing is done by the OS and not by your program. There may be a way to do it threw asm but it would be very hard and even if you did you couldnt run it on another computer unlike yours.

Share this post


Link to post
Share on other sites
spetnaz_    100
eSCHEn, iam intrested, how about i give u my e-mail and u send it to me, or give me ur site adresses (if u have one, and if u can be bothered to up load it) if ELITE PLUS is under a meg send it to hitachi52@hotmail.com,

Thank u very much for ur generosaty eSCHEn, i hope it will run on WinXP,

guys come one stop saying "ooohhh, oooff-cooouurrsse it is possible, but its very difficult," i know that thats why iam asking the great nehe.

and Anonymous Poster, it wont be to difficult to simple have some where in the code
"if (the pc has HP P4)
{
do this;
}

else
{
do that;
}

Share this post


Link to post
Share on other sites
pplante    122
The thing that was posted about the new Apple G5 processor above I believe is incorrect. Apple processors are RISC, which is "Reduced Instruction Set Computer" An x86 processor in comparison with a RISC is actually slower, which is why Apple claimed that a 867mhz Apple G4 was faster than an Intel/Amd 1.4 ghz processor because the Intel/Amd chips are x86. There has been revisions to the x86 processor type but still in comparison to a RISC they are slower at preforming tasks.

Hope this clears things up for you and I hope I had all my infos right...

RISC Processor information:
http://www.infoplease.com/ce6/sci/A0841981.html
http://www.embeddedinsight.com/file/rdmpback.html
http://www.lostcircuits.com/cpu/hp_pa8800/

Share this post


Link to post
Share on other sites