I am trying to understand how a RAM memory controller gets data with instant access while reading through the memory. Let's say initially, ram gets the data at address 0 and then to get the data at some random location like 1234, does it not have to loop through the first 1233 addresses before reaching 1234? Please explain. Thank you!
The RAM makes use of direct-memory-access, briefly this means that
An element of data or instructions (such as a byte or word) can be directly stored or retrieved by selecting and using the locations on the storage media.
Now this can be happened with the use of a DMA controller, which bypasses CPU to transfer data directly between I/O device and memory.
If you want to understand precisely how this happens I suggest you read the book
Operating System Concepts 10th Edition (Chapter 13)
I hope this helped you to understand why RAM gets instant access, comment below if you have more questions.