Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
11-04-2008, 11:10 AM
|
#1
|
Member
Registered: Nov 2007
Location: CT
Posts: 248
Rep:
|
how much RAM memory is a word?
hi, have a user running some fortran software and the program asks to input the amount of memory that is available in the system that the program can use.
But the way it asks is: specify the amount of memory in words.
so my question is, how much is a word of memory?
I haven't done any of the math but I trust the user and she has worked the numbers every which way and nothing seems to add up.
The system is running SLES 10, ia64, has 64 GB of RAM, upon a reboot doing a top we see 1 GB of ram used and 63 GB free.
|
|
|
11-04-2008, 11:36 AM
|
#2
|
LQ Guru
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,249
Rep: 
|
appears to be 16 bits or two bytes for X86 Architecture..
http://en.wikipedia.org/wiki/Word_(computing)
Quote:
Originally Posted by wikipedia Word_(Computing)
In computer science, a dword (double word) is a unit of data that is twice the size of a word. On the x86 platforms, which have a word size of 16 bits, a dword unit of data is 32 bits long.
A qword (or quadword, or quadruple word) is a unit of data that is four times the size of a word. On the common x86 platforms, this unit of data is 64 bits because the size of a word on an x86 system is defined to be 16 bits (whether the particular machine works primarily with 16, 32, or 64 bit items).
Finally, Intel uses the term double quadruple word, or DQWord, to denote a 128-bit datum, found in the implementation of Streaming SIMD Extensions and its ancestors. Microsoft Macro Assembler uses oword (octuple word) for the same data size.
|
|
|
|
11-04-2008, 11:49 AM
|
#3
|
Member
Registered: Jan 2004
Distribution: Mac OS X 10.6.4 "Snow Leopard", Win 7, Ubuntu 10.04
Posts: 322
Rep:
|
I believe the IA64 architecture uses 64 bit words.
|
|
|
11-04-2008, 12:00 PM
|
#4
|
Senior Member
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,410
Rep: 
|
From: http://en.wikipedia.org/wiki/Word_(computer_science)
Quote:
The amount of data transferred between the processing part of the computer and the memory system is most often a word. An address used to designate a location in memory often fits in a word.
Modern computers usually have a word size of 16, 32, or 64 bits.
|
For what we call X86, that would be 32 bits. For AMD64/X86_64 that would be 64 bits.
|
|
|
11-04-2008, 12:09 PM
|
#5
|
Gentoo support team
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083
|
The concept of "word" is defined as a group of bytes with some internal significance and that can be handle as a sole entity by the machine. So, when you send or read something to/from a cpu registry or the ram of your machine, you read a or write a word usually. This depends on the architecture of the system though.
All the x86-compatible cpu's support a 16 bits word size, but they can work with greater word sizes.
For me, the word size is defined by the assembly code of a given application. The max size of the registers you use define the word size. On 80386 and avove this can be 32 bits. On x86_64 capable cpu's this can be 64. Note that I say "can be", and not "is".
It depends on the mode you use your cpu. If you use a 64 bits OS, then your word size will be 64 bits because the object code of your programs will use 64 bits registers. If you use an OS compiled for x86, then the word size will be 32 bits, since that's what your object code will look like.
|
|
|
11-04-2008, 12:43 PM
|
#6
|
LQ Guru
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
|
AFAIK, ia64 is Itanium and all Itaniums are 64-bit processors so the word size is 64 bits. On x86_64 it can vary depending on whether the kernel is 32-bit or 64-bit, therefore whether the processor is running in 32-bit or 64-bit mode.
|
|
|
11-04-2008, 01:13 PM
|
#7
|
Gentoo support team
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083
|
Ops, you are right. If by ia64 he means Itanium, then the word size is always 64, unlike in amd64/x86_64.
|
|
|
11-04-2008, 01:44 PM
|
#8
|
Senior Member
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,410
Rep: 
|
It seems to me that the hairs are being split a bit too fine when a compatibility mode is equated to the kernel's native mode. Can the x86 (i.e. 32-bit native) kernel run 16-bit or 8-bit programs in any compatibility mode, such as for wine?
|
|
|
11-04-2008, 11:17 PM
|
#9
|
Gentoo support team
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083
|
Quote:
Originally Posted by Quakeboy02
It seems to me that the hairs are being split a bit too fine when a compatibility mode is equated to the kernel's native mode. Can the x86 (i.e. 32-bit native) kernel run 16-bit or 8-bit programs in any compatibility mode, such as for wine?
|
I am not familiar enough with the wine internals to answer that question. What linux runs is wine, how wine hooks up the whole thing is another question that I cannot answer.
There's no need either. Putting a similar example, and x86_64 kernel can run wine (a 32 bits binary itself, since wine doesn't compile in x86_64 natively), so yes, the kernel can use smaller word sizes when necessary I guess. In any case note that the x86/amd64 case is very special, since the cpu can run natively that code even when working on 64 bits mode. The IA32 emulation option must be on for that to work when you compile your kernel, but there's little "emulation" involded since it's really the cpu which supports the whole thing.
Yes. The OS can be able to run programs with a smaller word size. But if someone ask me "which is the word size for a given architecture?" then I would answer that it is the word size that's native to that architecture, regardless on how much backwards compatibility has been preserved, in amd64, I say it's 64 bits.
However, I am not the kind of user who reads all the technical papers for each released cpu, and it's long since I used assembler for anything (as long as on a 486 cpu, so...).
|
|
|
11-04-2008, 11:42 PM
|
#10
|
Senior Member
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,410
Rep: 
|
To add even more complication to this question, doesn't 32 bit mode support 64 bit data addressing with the PAE extensions option turned on for those processors that support PAE?
And to make it even more complicated: http://en.wikipedia.org/wiki/X86-64
Quote:
x86-64 is a superset of the x86 instruction set architecture. x86-64 processors can run existing 32-bit or 16-bit x86 programs at full speed, but also support new programs written with a 64-bit address space and other additional capabilities.
|
So, perhaps the answer is: It depends on which processor your using, what mode it's running in, AND what compiler options you chose when you compiled your program.
|
|
|
11-05-2008, 02:10 AM
|
#11
|
Member
Registered: Dec 2007
Location: Brisbane Australia
Distribution: Slackware
Posts: 65
Rep:
|
From the point of view of the query in the fortran program:
"Specify the amount of memory in words".
Most likely to the fortran programmer, the 'word' means the space occupied by a standard integer (or real) element - perhaps needed for array sizing etc.
As stated by several others this will vary with hardware, compiler, compiler options etc.
One pragmatic way to check your assumptions on these variables might be compile a simple program as below using exactly same compiler options as your application program.
Code:
program sizer
integer array(1000000)
do while(.true.)
array(1)=1.0
enddo
end
Compile and run first like this and then with lines 2,4 commented out (removing the array stuff)
On my standard 32 bit linux box, I see a change in virtual memory usage of 3912 kb (using top) between the 2 cases. This tells me that each integer is definitely occupying:
3912kb*1024/1000000 = 4 bytes.
(PS To see the memory used by the data array, you actually have to be using the array - hence the while statement -
Hence this will hog the CPU so dont try while others are using the machine!)
Steve
|
|
|
11-05-2008, 03:42 AM
|
#12
|
LQ Guru
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
|
In x86_64 I think it all depends on the kernel which sets the processor to 32-bit or 64-bit mode. With emulation all it does is expand 32-bit to 64-bit and send that to the processor. The same thing would be done with wine, convert 8-bit or 16-bit to 32-bit send that to the kernel, kernel coverts it to 64-bit sends to processor ... lots of converting going on, probably will produce some performance overhead, not that it matters for 8-bit or 16-bit programs.
Last edited by H_TeXMeX_H; 11-05-2008 at 03:43 AM.
|
|
|
11-05-2008, 11:16 AM
|
#13
|
Senior Member
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,410
Rep: 
|
Quote:
Originally Posted by H_TeXMeX_H
In x86_64 I think it all depends on the kernel which sets the processor to 32-bit or 64-bit mode. With emulation all it does is expand 32-bit to 64-bit and send that to the processor. The same thing would be done with wine, convert 8-bit or 16-bit to 32-bit send that to the kernel, kernel coverts it to 64-bit sends to processor ... lots of converting going on, probably will produce some performance overhead, not that it matters for 8-bit or 16-bit programs.
|
You didn't read my link, did you? Exactly what emulation do you imagine is going on in the kernel? The kernel doesn't perform math functions or memory reads and writes. There is no such converting going on, but this is not the place to argue over it, I suppose.
|
|
|
11-05-2008, 12:26 PM
|
#14
|
LQ Guru
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
|
I wasn't completely off, take a look at the Operating modes table in your link.
|
|
|
11-05-2008, 12:36 PM
|
#15
|
Senior Member
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,410
Rep: 
|
Quote:
Originally Posted by H_TeXMeX_H
I wasn't completely off, take a look at the Operating modes table in your link.
|
I understand that, but what you were describing was an interpreted environment. Linux is not one. The kernel gets control with either a call to a kernel function or from an interrupt such as timer or execution exception. If the opcode is illegal in the running mode, then of course the kernel will get an interrupt. Other than that, no, the code just runs to whatever conclusion. I can see that jumps and calls would be an issue, they always are, so that's why there is the compatibility package. But accessing data and performing an action on it, I don't see it, and I believe that's what the question of the size of a word pertains to. Consider that your program can still access data on the byte level in a 64 bit environment. Hmm, the code for doing 64 bit math has been around for a long time, even in the 16 bit environment, though it wasn't native access, and IIRC used memory accumulators and multiple registers.
|
|
|
All times are GMT -5. The time now is 11:22 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|