This topic is 4824 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

64bit CPUs have come into the market for months. And 64bit OSs are coming soon. What does the "64bit" means ? Does it have the same meaning of CPU and OS ? And what 64bit will bring for programmers ? I heared someone said that "from DOS to Win32" was a great calamity for programmers. I am wondering if there will be another calamity for programmers when 64bit really comes.

Share on other sites
64bit OSes have been out since '96. Linux has had 64 bit support since before 2000, which is probably why Linux supported x86_64 much sooner than windows. And I have Windows XP x64 (purchased from newegg, but it's sold only as oem) and Gentoo amd64 running on my 64 bit system, so the OSes are already available. The main advantage of 64bit is access to much, much more memory. 32bit only goes to 4GB (with only 2GB/3GB per process on some OSes). With some inefficient tricks I think you can raise the limit to 64GB. 4GB may sound like a lot but 1GB is basically standard on the higher end desktops, which some 2GB machines, and a full DVD movie you might be editing will have to use your MUCH slower hard drive to store some data. While 64bit can go up to 17179869184GB of ram without inefficient workarounds (assuming I did my math right), but I think in the current x86_64 chips, you can only access something like 256 terabytes of ram.

I'm going to assume your talking about x86_64 (also called AMD64 or EM64T) which was designed by AMD, and can run regular x86 just as well as 64 bit code (with no emulation even in a 64bit os). Compared to regular x86, the integers can be twice as big (and hold numbers about 4 billion times bigger.) Which can be very useful in some cases,GMP can run 4 times faster thanks to bigger primitives. But in most cases the biggest improvement is the doubling of the general registers, which can give about a 5-20% increase in speed depending on the application (on AMD processors at least). Unfortunately from the numbers I've since Intel has a poor implementation of x86_64 (probably because x86_64 has been "tacked on" to the p4) which causes 64 bit code to generally be slower than 32. Also all x86_64 cpus include at least SSE2. I think there's some other more minor stuff too. There is a potential decrease in speed due the increased sized of pointers, instructions and data alignment, but this seems to be more than countered (on the AMD processors at least) by the improvements made to the architecture.

The 64bit transition is going a lot smoother than I thought it would (probably thanks to the lessons learned in the dos days, and better designed OSes). Mostly I just have to worry about 64bit drivers (not a problem with a new system if you check out the parts first), and the few programs that interface heavily with the OS (virtual drives, firewalls, viruses scanners and the like).

The tricky part would be making sure your code can compile on 64bit and 32bit systems. (only really important when you make assumptions about the size of the integer variables, or there size relative to pointers.

One really annoying thing I learned is that on gcc in 64 bit linux (I don't know of a 64 bit windows version to test on)
sizeof(int)<sizeof(long)=sizeof(long long)=sizeof(pointer)
which seems really annoying to me since from my understanding of the c standard int should be the same as the native size on the processor. And long having the same size as long long seems rather silly. they did this to help with compatibility with older apps but I would think that a compiler flag to enable this behavior would have been nicer since the apps have to be recompiled anyway.

[Edited by - Cocalus on July 9, 2005 11:30:49 AM]

Share on other sites
Well done, Cocalus! :-)

All I can do, is paste this link about 64 bits in game programming: clicky (but you need to have Gamasutra account, btw, which is free).

Share on other sites
Quote:
 Original post by neverland64bit CPUs have come into the market for months.And 64bit OSs are coming soon.What does the "64bit" means ?Does it have the same meaning of CPU and OS ?And what 64bit will bring for programmers ?I heared someone said that "from DOS to Win32" was a great calamity for programmers.I am wondering if there will be another calamity for programmers when 64bit really comes.

For the most part the only serious problem will be with code that does typecasing between pointers and integral types and pointer arithmetic where the result is stored in and assumed to be 32 bit integers. In C++ the size of an integer type is only guaranteed to be a minimum size. For instance the 'int' type will always be at LEAST 16 bits in size while the 'long' type will always be at least 32 bits in size. Unfortunately many developers simply assume that both 'int' and 'long' are 32 bits. While it might seem trivial this can be problematic when the use of 'int' requires that it be 32bit (i.e. in data structures where memory layout is important) AND that pointers are also 32bits in size.

Consider the following:

char *ptr = new char[256];int handle = (int)ptr;ptr = (char*)handle;

The above assumes that pointers and int are the same size. If however you compile for 64bit systems where 'int' is 32bits and pointer are 64bits the above code no longer works. While this may seem unlikely there is a considerable amount of code that uses operations similar to the example.

The other issue is pointer arithmetic. Consider the following:

int get_delta(const char *str1, const char *str2) {	return (str2 - str1);}

The same issues apply here. If the difference in memory locations pointed to by str1 and str2 is greater than 32bits the result will be incorrect.

See the definitions in <limits>, <limits.h>, and <stddef.h> for type definitions intended for use in those situations.

Share on other sites
I wrote a little article on my blog a ways back about some of the major differences between x86-32 and x86-64

Share on other sites
64 bit CPUs also read and write to memory 8 bytes at a time, whereas 32 bit cpus are 4 bytes at a time, iirc.

Share on other sites
Some useful info on the MSDN site. (windows) ...

Share on other sites
What it gives to programmers IMO is more to work with.

As an example look at the 64bit version of FarCry. It works at about the same fps as the 32bit version but with alot more effects and techniques applied to the scene.

Share on other sites
Quote:
 Original post by Gink64 bit CPUs also read and write to memory 8 bytes at a time, whereas 32 bit cpus are 4 bytes at a time, iirc.

Actually that should be "CAN read and write to memory 8 bytes at a time". Just as 32 bit cpu's can read/write 1, 2, and 4 bytes at a time so can their 64bit sisters.

Share on other sites
Quote:
Original post by Helter Skelter
Quote:
 Original post by Gink64 bit CPUs also read and write to memory 8 bytes at a time, whereas 32 bit cpus are 4 bytes at a time, iirc.

Actually that should be "CAN read and write to memory 8 bytes at a time". Just as 32 bit cpu's can read/write 1, 2, and 4 bytes at a time so can their 64bit sisters.

Im pretty sure that they can only read/write 4 bytes at a time, and 64 bit cpus can only read/write 8 bytes at a time. If it doesnt need the bits they are ignored.

1. 1
2. 2
3. 3
Rutin
18
4. 4
JoeJ
14
5. 5

• 14
• 9
• 23
• 9
• 32
• Forum Statistics

• Total Topics
632623
• Total Posts
3007503
• Who's Online (See full list)

There are no registered users currently online

×

Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!