LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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


Reply
  Search this Thread
Old 11-04-2008, 11:10 AM   #1
ron7000
Member
 
Registered: Nov 2007
Location: CT
Posts: 248

Rep: Reputation: 26
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.
 
Old 11-04-2008, 11:36 AM   #2
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,249
Blog Entries: 5

Rep: Reputation: 191Reputation: 191
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.
 
Old 11-04-2008, 11:49 AM   #3
claudius753
Member
 
Registered: Jan 2004
Distribution: Mac OS X 10.6.4 "Snow Leopard", Win 7, Ubuntu 10.04
Posts: 322

Rep: Reputation: 31
I believe the IA64 architecture uses 64 bit words.
 
Old 11-04-2008, 12:00 PM   #4
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
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.
 
Old 11-04-2008, 12:09 PM   #5
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
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.
 
Old 11-04-2008, 12:43 PM   #6
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
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.
 
Old 11-04-2008, 01:13 PM   #7
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Ops, you are right. If by ia64 he means Itanium, then the word size is always 64, unlike in amd64/x86_64.
 
Old 11-04-2008, 01:44 PM   #8
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
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?
 
Old 11-04-2008, 11:17 PM   #9
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by Quakeboy02 View Post
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...).
 
Old 11-04-2008, 11:42 PM   #10
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
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.
 
Old 11-05-2008, 02:10 AM   #11
telemeister
Member
 
Registered: Dec 2007
Location: Brisbane Australia
Distribution: Slackware
Posts: 63

Rep: Reputation: 16
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
 
Old 11-05-2008, 03:42 AM   #12
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
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.
 
Old 11-05-2008, 11:16 AM   #13
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
Quote:
Originally Posted by H_TeXMeX_H View Post
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.
 
Old 11-05-2008, 12:26 PM   #14
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
I wasn't completely off, take a look at the Operating modes table in your link.
 
Old 11-05-2008, 12:36 PM   #15
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
Quote:
Originally Posted by H_TeXMeX_H View Post
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Ram Memory Dimon-z Slackware 2 06-17-2008 11:06 AM
Ram Memory Question PipeDreams Linux - Hardware 5 01-06-2006 11:25 PM
Insufficient memory to print from MS word to a printer on a CUPS server amon Linux - Networking 7 11-14-2005 05:14 AM
RAM Memory Installation kermit Linux - Newbie 1 12-07-2004 08:57 AM
RAM Memory use dtsfanatic Linux - General 1 01-11-2002 09:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration