apache & php on a 64bit ubuntu

Asked by Joy Wow on 2009-10-15

if I install the LAMP server on a 64bit Ubuntu, will the apache/php/mysql all be working in 64bit mode?
meaning if I e.g. do

$i = $i<<1 & 0x1;

64 times, will I get 0xFFFFFFFFFFFFFFFF or still 0xFFFFFFFF?


Question information

English Edit question
Ubuntu Edit question
No assignee Edit question
Solved by:
Thomas Krüger
Last query:
Last reply:
midnightflash (midnightflash) said : #1

It *should* all work as 64bit. Every-way else it would deserve a bugreport.


Cristi Nistor (cristi-nistor) said : #2

64 bit OS means working with double words pointers and registers. Also your addressable memory will be 16 EB in theory, in practice is limited to physical hardware capabilities, but in many cases is more than 16GB.

http://en.wikipedia.org/wiki/64-bit an explanation of 64 bit OS architecture.

Thomas Krüger (thkrueger) said : #3

Looking at his question for a while I think he may have meant:
If I am writing architecture depended code will it work differently on different architectures?
The answer is simple: Yes it will.

The example you gave has two problems:
1. I you are using shifts you really should know what you are doing and what happens on different systems. If not is not an architecture issue but a common programing mistake.
2. Both 0xFFFFFFFFFFFFFFFF and 0xFFFFFFFF are representing -1. So, no big difference! ;)

Joy Wow (joy-wow) said : #4

Hey thanks guys!

Actually, I'm thinking about Parallel computing to havest the most out of the system. For a 64bit system, I should be able to do twice as fast as that I can on a 32bit system.

But the question, like I mentioned, is that if I can count on the php/apache etc. on a 64bit system, if they will be indeed working 64bit rather than just a "transplantted" 32bit version.

Thomas, to me, they make much difference. With 16 F, I don't need to worry about lossing data while it runs at full speed. Otherwise, I'll have to cut the bandwidth to half.

I know this is not a problem with C/C++ running on a 64bit system, but when it comes to php/apache on a ubuntu system?

Joy Wow (joy-wow) said : #5

To be more specific, an int to me is more than just 1 int, it's 32 (on a 32bit system & 64 on a 64bits system) bits. Now I don't need that much bits to represent a small number, say 1~7, only the lower 3 bits are useful. So if I pack 10 such numbers together to forge an int, i can run 10 times as fast as doing 1-by-1 on a 32bit system, and about 20 times if the int is 64bit.

Best Thomas Krüger (thkrueger) said : #6

This would be a hack the system architecture is not designed for. IMHO to get reliable value out of this you would have to so many special case checks (over / underflows, negative values...) that it will consume all the performance you won by the hack itself. I mean problems as the one your question points to.

Also you are typing to do some very low level performance tuning while using PHP. That just doesn't fit. PHP is the very last language I'd consider to do work where performance is desired. Even if you need a web interface there are much, much better performing language like Python or Perl.

Joy Wow (joy-wow) said : #7

Thanks Thomas Krüger, that solved my question.