Computer Science - Computer Architecture
On a 64 bit system (where the bus length and word size are 64 bits) how would we determine the ammount of addressable locations in say 4gb of memory?
is is the case of
size of memory / word length = ammount of memory locations?
so on a 64 bit system where we have 4 gb of ram, there are 536,870,912 locations
each holding 64 bits?
74 Replies
No, modern computers are always byte addressable. The native word size has nothing to do with how much memory is addressable. A single memory address points to exactly one byte in memory.
@mtreit think he already addressed his question on chat https://discord.com/channels/143867839282020352/143867839282020352/1214661436081705020
viceroypenguin
yes, 32b - 3b = 29b = 512mm = 536...
Quoted by
<@1102729783969861782> from #chat (click here)
React with ❌ to remove this embed.
That's an odd way of stating it if the question is about how many addressable locations there are.
A memory address doesn't point to a 64-bit or 32-bit value, it points to a single byte. That byte might be the start of a 32-bit or 64-bit number as far as the software using the memory is concerned, but it certainly doesn't have to be.
I think Java actually has their addresses multiplied by 4 to handle more than 4GB on 32bit
Its actually not for 32 bit purposes. Its for 64 bit processes to be able to use the same amount of memory as 32 bit processes.
While having a lot more memory actually available.
https://wiki.openjdk.org/display/HotSpot/CompressedOops
this is purely for the sake of computer architecture so not involving any languages like java.
Let me just clarify what i meant ane maybe someone can correct me if im wrong.
on a 64 bit (8 byte) system, with main memory the size of 4GB (2^32), the amount of addressable locations (or containers for data) is determined by: address locations = main memory size (4gb) / word size (8 byte). this gives us 536 870 912 memory locations, each capable of holding 8 byte words (or 64 bits). address location can represent 2 ^ 64 bits of data.
that what i thought and i think that viceroypenguin basically confirmed my theory, although in a true sccientific fashion, i can never be 100% certain that i mcorrect
Addressable locations are not related to word size because each address is to a single byte, not a single word
are you sure that this is correct. youre not very clear with your answers.
perhaps you could elaborate
again, in memory size of 4 gb (2^32) each address location holds 8 bytes of data therefore (4gb) 2^32 / (8bytes) 2^3 = 2^29 or 536 870 912 addressable locations
each location can represent 64 bits of data, but in most cases it doesnt need to use all of it.
Each address points to one byte of data
I think that's the disconnect
Every byte in memory has an address
Imagine a byte array (like an ascii string) and imagine how you can walk that string character by character. How would that work with the scheme you are describing?
so if a single address points to a single byte of data, then in 4 gb of ram there should be 4 gb / 1 byte of addressable locations?
Yes
4gb( 2^32) / 1 byte (2^0) = 2^32 or approximately 4 billion addressable locations?
so the ammount of addressable locations is basically the ammount of the ram itself
so, if there is a 64 bit system, with a 64 bit word, then that word has to be split up into 8 different address locations?
Yes, each byte of the 8 byte word has its own address. In practice, you just take the address of the first byte and the language you are programming in handles the rest based on the size of the data type
just to clarify this isnt related to any programming language.
im a little confused now as
Pointer arithmetic in C is a good illustration. If you have a pointer to an array of int, incrementing the pointer advances it by four bytes. If you have a pointer to an array of char (byte in C# terms) incrementing the pointer advances by one byte. The language knows the size of the data types.
this basically confirms what penguin said
This is saying the size of the address
this sould confirm that a single address location is 8 bytes
Not the size of what the address points to
Again modern computers are always "byte addressable" meaning each address is to a single byte
the size of the address itself is a byte
so if an address location can hold 8 bytes, 1 byte can be for the address itself, 4 bytes can be for the data and the other 3 can be used for whatever
This is completely wrong
yea, chat gpt can be very wrong. but this is also what penguin confirmed in main chat, thats why im still sitting here struggling to grasp this.
@viceroypenguin | 🦋🐧🌟 can you clarify
Driving to work, will be offline for a bit
no worries. thanks for the help dude 🙏🏼
Also watch this video
https://youtu.be/ixJCo0cyAuA?si=cscm8VhNXu-30P81
Computerphile
YouTube
Where did Bytes Come From? - Computerphile
Why do we have 8 bits in a byte? Professor Brailsford on the origins of the humble byte.
Why Use Binary?: https://youtu.be/thrx3SBEpL8
Babbage's Puzzle: https://youtu.be/2qzjBmK0_20
Initial Orders II: https://youtu.be/nc2q4OOK6K8
The Font Magicians: https://www.youtube.com/watch?v=jAdspOtgciQ
Colossus and Bletchley Park: https://www.youtube...
gotcha
oh, this is a completely different question than what you originally asked.
the question you originally asked, rephrased, is: if i have a 4GB-long array of pointers, how many pointers are in the array (aka how long is the array in terms of units). and the answer to that is 2^29 (or 512Mi or 536,xxx,xxx).
no
the question I htink you're trying to ask is: if i have 4GiB of RAM, with a
word size
of 64 bits (8 bytes), then how many addressable locations are in memory.
which the answer is the same, but it means something completely different.
but pointer size and word size are not the same thing^ Literally the same question with a little less details
it is not. you may not understand it, but https://discord.com/channels/143867839282020352/1214660473526427748/1215009090930090054 abd https://discord.com/channels/143867839282020352/1214660473526427748/1215009367162880102 are two completely different questions.
its literally the exact same question...
it is not
...
you may not understand it. but they are different questions.
now....
if you have 4GiB of RAM, then you don't need 8 byte pointers; 32b (4 byte) pointers will work, regardless of the
word size
the size of the pointer has nothing to do with the size of the addressable location.what pointers
the size of the pointer has to do with how many addressable locations you want to address. if you ahve 4GiB RAM, you cannot have more than 2^32 addressable locations, so you don't need 8 byte pointers
whats a pointer xd
ok, so now we're getting into why you don't understand.
haha
would you like me to ask the question one last time so that we can start from scratch?
ok, let's go back to the beginning
here's the thing
whether system is 64 bit or 32 bit has nothing to do with how many addressable locations ar ein memory
ok were getting somewhere 😄
the ISA determines what the addressable locations are. not the word size
i see
in x86 and x64 ISAs, the addressable location is the byte.
so a memory location is 1 byte in size?
in x86/x64
yes : )
gotcha
in others, it may be 4B or 8B
which are the most popular architectures today correct?
or standard atleast
x64 and ARM are the two most popular today, correct
soo, in that case
ARM uses a 4B or 8B addressable location.
so if we have 4gb of ram in order to find the ammount of locations we use 4gb / 1 byte
which is approx 4 billion addressable locations
basically the ram size itself
?
now question: why is the number of addressable locaitons important to you?
correct
ahh. damn!
gotcha
because keep in mind that the representation of that addressable location is not necessarily the same as the the number of addressable locations
um, not really important. i just wanted to build a more borad understanding.
because even though you can't address every byte of RAM in ARM, the representation of that location is still at the byte level
aka location 0x4 is still represented by 0x4 instead of 0x1
so if there is a 64 bit word, lets say hypothetically that we use the entire 64 bits for endocing data, then it has to spread over 8 different address locations (8 bytes)
i think mtreit already confimed that
Ok I don't know anything about ARM, you're saying you can't address individual bytes on ARM?
How do strings work?
IIRC… you have to load up the 32b word at a time and process it that way with shifts and such.
actually, im just going ovber computer architecture for my cs degree, im a 1st year. were going over caching, paging and etc. still kinda uncertain about the whole concept of blocks, frames stots and flags etc
shits really interesteing
but hard
Yeah, chip caching is gonna be really interesting.
L1, L2, L3 etc
Stack Overflow has some comments like this:
ARM (like most modern ISAs) uses byte addressing. (ARM does have a feature to allow bit-level addressing, mapping a section of the address space (bit band) for this. Such is primarily intended for memory-mapped I/O where atomic bit-level addressing can be useful since accesses to I/O devices can have side effects (so a byte read to get a single bit could generate unintended side effects for the seven other bits read and a read-modify-write sequence to change one bit could have unintended effects).Is that just completely wrong?
can anyone just confirm that this is correct: cache and ram is split into blocks holding 2^n data words. (cache blocks are called slots). pages are blocks of data transferred from seccondary memory to main memory.
but what are frames and flags?
more likely to be right than me. maybe i'm mixing it with another ISA
"Secondary memory" meaning disk storage or the like, presumably. Also not sure about ram being "split into blocks", but maybe that's talking about hardware details that are beyond my knowledge (I'm not a hardware guy at all.)
Frames and flags...need more context.
ahh, cheers for the help anyways. I think thats plenty you guys explained to me in terms of the address locations etc. i really appreciate that!
🙏🏼
No problem, glad you're learning 🙂