-1

now i know this question has been asked quite a few times now but i'm not really wondering how much memory a 32bit processor can address neither theoretically nor practically. just a quick heads up, i come from a civil engineering background so i'm still learning in terms of computer science; and also units of measure are a big deal for me which is actually my question:

now i know you can calculate how much memory a cpu can use by doing 2^32 (or 64) and in this case you get 4.294.967.296 bits. now i know (or i think i know) memory is measured in bytes, so in order to find out how many bytes of memory a cpu can use i divide 4.294.967.296/8 and you get 536.870.912 bytes. then you divide 536.870.912/1024 and you get 524.288 kilobytes. then you divide 524.288/1024 and you get 512 megabytes. then you divide 512/1024 and you get 0,5 gigabytes which is... not great.

now i noticed that if you don't divide by 8 at the beginning you get 4 gigabits; so my question is: is ram measured in bits or bytes. and if it's byes then what is the relationship between cpu address bits and ram capacity?

EDIT: hey, i managed to understand how the units of measure work. basically you have 4.294.967.296 addresses from 0x00000000 to 0xffffffff and each address represents 4 bytes of data. then you divide by 1024 and get 4.194.304 kbytes, 4.096 mbytes and 4 gbytes. sorry it took this long, thanks to all for the feedback.

jumpindonuts
  • 582
  • 1
  • 6
  • 11
  • 3
    Memory is addressed in bytes. – Phylogenesis Dec 19 '16 at 09:21
  • 2
    "*and in this case you get 4.294.967.296 bits*" - no. You get bytes from that calculation. In _theory_ a 32bit CPU could address 4GB - but in practice this is usually just 2GB because of the physical design (don't know the exact details though), and roughly 1.5GB due to limits of the operating system –  Dec 19 '16 at 09:21
  • @a_horse_with_no_name the 2GiB limit is a software design :) Due to MMIO some of the physical address must be used by devices but not as much as 2GiB. Furthermore, a 32-bit machine can access memory of arbitrary size, what counts it not the register size but 1) the size of the bus/physical address 2) the size of a word of memory. Though the OP is probably asking about x86 in which case 2) reduces, as you correctly said, to bytes [yet 1) can still be 32 or 36 bits]. – Margaret Bloom Dec 19 '16 at 12:46
  • @Phylogenesis Nope, see the [PIC16F flash program memory](http://ww1.microchip.com/downloads/en/DeviceDoc/39582b.pdf) for example. :) – Margaret Bloom Dec 19 '16 at 12:47
  • Aside : Since this is a legit question, I don't think it should be down voted. Please explain why you've done it or remove your vote. Thanks. – MadJlzz Dec 19 '16 at 12:56
  • @MadJlzz At least because of this: "... so in order to find out how many bytes of memory a cpu can use i divide 4.294.967.296/8 and you get...". – i486 Dec 19 '16 at 13:17
  • 1
    @i486 : I think he/she made a confusion between _bits_ and _bytes_. edithegodfather : could you please update your question since there is a mistake in it ? Thanks. – MadJlzz Dec 19 '16 at 13:29
  • hey, i managed to understand how the units of measure work. basically you have 4.294.967.296 addresses from 0x00000000 to 0xffffffff and each address represents 4 bytes of data. then you divide by 1024 and get 4.194.304 kbytes, 4.096 mbytes and 4 gbytes. sorry it took this long, thanks to all for the feedback. – jumpindonuts Aug 18 '18 at 23:17

3 Answers3

0

32bit CPU has 32bit address registers and can address up to 4GB memory (bytes not bits). But there are also segment registers. Each segment may have up to 4GB memory. 64K segments * 4GB = terabytes. Practically this cannot be done with any OS, e.g. Windows 7 does not use multiple segments and 4GB is the maximum.

i486
  • 6,491
  • 4
  • 24
  • 41
  • The CPU has a [fixed number of address lines](http://stackoverflow.com/a/39416443/5801661). If you are talking about x86 you are confusing *segments* with *selectors* and also neglecting features like *PAE*. – Margaret Bloom Dec 19 '16 at 12:29
  • @MargaretBloom I agree but this is practical limitation (implementation of specific CPU model). Theoretically the number of address lines can be increased to the maximum: max size of segment register * 4GB. I think the question is more theoretical. At least there is no word about specific 32 bit CPU. – i486 Dec 19 '16 at 13:11
  • then why segment registers are 16-bit? :) What count is the physical address size, how logical addresses are made is irrelevant (register pairing could work as well for example). – Margaret Bloom Dec 19 '16 at 13:24
  • @MargaretBloom Because segment selectors (registers) are 16 bit. "CPU supports 16K(16384) number of segments and thus the total virtual memory space is 4Gbytes x 16K =64 terrabytes". Is this more correct or you think it is still too much? BTW, do you know about x86 segment registers CS, DS, ES, FS, GS? – i486 Dec 19 '16 at 13:36
  • Nevermind. I was asking because, your words, "At least there is no word about specific 32 bit CPU", yet now you say "Because segment selectors (registers) are 16 bit" which is true only for x86. So if your answer is a general one, it's not true because only a few archs have segment regs, if it is specific to x86 it is not true because protected mode doesn't work like that. You can check my answers to see that I indeed know how x86 works :) – Margaret Bloom Dec 19 '16 at 13:43
  • I agree that segment registers are x86 specific. But the facts are that at least x86 can address (theoretically) up to 64TB which was my answer. I tried to explain that 32bit size of registers is not the limit of addressable RAM. And the question is not "how much Flat memory can it use" but "how much memory". – i486 Dec 19 '16 at 13:52
-1

I once had a core2 duo Intel processor, and 2 Gigabyte RAM installed in my machine, I had installed another RAM with 4 Gigabyte but Windows couldn't used the full added space, and all usable RAM is 2.9 Gigabyte. usable RAM with 32 bit processor

Wolverine219
  • 151
  • 1
  • 1
  • 8
  • This limit comes from the OS and the question is for theoretical address space of 32 bit CPU, not for specific OS implementations. Windows (non server editions) do not use all possible features of the CPU. – i486 Dec 19 '16 at 10:27
  • I don't really get this, because Windows 7 with other machines that have core I3 for example can use RAM space more than 6 Gigabytes. – Wolverine219 Dec 20 '16 at 17:09
-1

A memory is made by a number of read-writable items, called words.
Each items is given an unique number, called address.

The CPU has a fixed number of bits/pins to represent an address.
One bit can present the addresses 0 and 1.
Two bits represents at most 00, 01, 10, 11.
Three bits represents... well you got it.

Each bit has two values, each bit is independent of the others, so each time you add a bit you double the number of values (just take all the old values and put a 0 in front of them, do it again with a 1 and you get as twice as the old values).
So n bits are 2n possible values, 2n possible words.

If the CPU has at most these number of bits to present an address (culprit: the size of a register doesn't have to match the number of bits of an address. 32-bit CPU can have 36-bit addresses for example) it can access at most that much words of memory.

A word of memory can be any non zero size. Literally, any size. Including 1-bit or 14-bit or 8-bit.
The most diffused architecture on the marked, the x86, use words of 1 byte (so with 32-bit addresses it can access 232 = 4GiB) but this is in no way a general rule.

Margaret Bloom
  • 41,768
  • 5
  • 78
  • 124
  • thanks for the reply; i guess the answer is don't take the formula as "do all be all" :) – jumpindonuts Dec 21 '16 at 13:53
  • @edithegodfather As you can see from the comments and other answers, a lot of people get this wrong :) The formula is simply: *total bits* = *max number of words* times *bits per word*. It's not easy to be generic, though, for example, "byte" doesn't mean 8-bit everywhere, that's why a lot of protocol use the term *octet*. – Margaret Bloom Dec 21 '16 at 14:08