ELI5: How does RAM point us to data?

r/

So I was doing some research, and I came across this line “RAM allows you to access any memory location directly, meaning you don’t need to read through all the preceding locations to get to the one you need.” I couldn’t find any websites that didn’t elaborate this without a load of technical mumbo jumbo, and I was wondering how you can access memory locations without reading through all the existing locations to find the correct one?

Comments

  1. eposseeker Avatar

    Hard disk drives have a disk inside, kind of similar to a CD, except different, but that’s not important right now. 

    On that disk, physical locations represent memory locations. To get to a specific location, the disk had to spin until the location was under the scanner, like in a gramophone.

    RAM doesn’t have a disk inside and doesn’t have to do that.

  2. hampshirebrony Avatar

    Get me the tenth word from page 143 of that book.

    There is a bit of a seek needed to do that, but less than you starting at page 1 and reading all the way through.

  3. jbtronics Avatar

    RAM stands for random access memory. The random access means, that you can access any of your data at any given time (with the same time required).

    It’s like a shelf, where you can take things in and out at any position you want, without needing to wait.

    There are also memory technologies (especially in the past) which didn’t allow for random access, but you have to wait until the point came, where your data was located. You can imagine that like the little conveyor belt in restaurants. You cannot get your desired food at any time, but you have to wait until the spot with your desired food comes by at you.

  4. lewster32 Avatar

    Each item in RAM has an address like a house in a street. You just use the address to directly get the contents.

  5. AtlanticPortal Avatar

    Have you ever played the naval battle? When you hear “D5” you are able to look at the board and check if your ship is there or not without checking line A, B, and C through 1 to 8 and line D through 1 to 4 before. You directly look at D5.

    The same way works with RAM. Forget the word random thinking that it means one random cell. It means that if you pick one random cell you get always the same probability of reading the data after X time. That’s because you have 8 “wires” to the board for the columns and 8 “wires” to the lines in your mind for the game and you have actually 32 or 64 physical wires from the CPU to the memory.

  6. Mediocre_River_780 Avatar

    RAM is like a bunch of numbered boxes. Your computer knows exactly which box it needs, so it goes straight to it and grabs what’s inside. No need to check all the others first. That’s what “random access” means.

    Old memory wasn’t like this. It was more like a spinning drum with info written around it. The computer had to wait for the drum to spin until the info it needed came around.

    With RAM, the computer doesn’t wait. It just jumps straight to what it needs.

  7. Tomi97_origin Avatar

    Well RAM is split into cells which exist in a grid and you can just ask for specific row and column.

    Like an apartment building where each cell represents a flat. You can go to room 5 on floor 20 directly without checking all the previous floors.

  8. KingGorillaKong Avatar

    Say for example you’re looking for a blue house, two story, attached front single garage, front bay window, two bedroom windows on second story.

    Without the address you have to go through and search every neighborhood and house until you find this house.

    But with the address and a map, you can see where the house is and know how to get there the fastest.

    So when RAM is being used for the purpose you are asking about, there’s an entry stored on the RAM to say “access this process/file/asset/etc at this directory address on the storage drive”.

    Otherwise RAM just has these things copied to the RAM memory itself for faster access to bypass needing to use the storage. But if these things aren’t needed constantly but need to be accessed frequently, storing the directory address would be more useful so the process isn’t waiting for storage to search for a random file, it can just go to that location.

    Similarly, it’s like having a website URL to access a website. You can search for it using a search engine, but with the URL you can go directly to it, saving yourself time.

  9. boring_pants Avatar

    Essentially by being organized as a big grid. So you can say “select the 14th row, and then grab the 34th column from there” All of these rows and columns are connected to the memory controller so it can access them directly, unlike a hard drive which has to move a physical device into position to access that part of the disk.

  10. Rivereye Avatar

    Addressing. Each piece of memory has an address space associated with it, much like your home has an address associated with it. If you gave me your physical address, I wouldn’t need to search every building in the world to find it, I could just head straight there.

  11. huuaaang Avatar

    I had to make a simple ROM circuit in university to store 9 digits but the same priniciple applies to reading from RAM.

    You have a data bus and an address bus. A bus is a set of wires, each one corresponding to a “bit” of a “byte.”

    THink of it like a river with tributaries gated by sleuces that you can control individually by entering a number into a control panel. That’s your address bus. When you “address” a sleuce it opens and dumps into the main river. The river is your data bus. Only one sleuce can be addressed and open at a time. SO what’s in the river at any given point corresponds to what was in the tributary that was last addressed/opened. Say, for example, you dye the water in each tributary. So the color of the river depends on the sleuce you have open. If no sleuce is open then you just have clear water running down the river.

  12. Trollygag Avatar

    I think they’re trying to contrast spinning platter or drum memory with directly addressable memory.

    For directly addressable memory (like RAM, but also some non-volatile memory) the machine instruction is something like ‘get me the data at this <address>’ and that address points to a spot in a big grid that can be read from.

    How that happens is some technical mumbo jumbo that you are taught in a 300 series class in college for computer engineers or electrical engineers where you may be taught how to make an addressing system and addressable memory.

    With spinning platters or drums, memory is in a spot and the platter/drum has to spin around until the reader can see that spot. This is like a hard-disk drive.

  13. toastybred Avatar

    Look into how Assembly (machine code) works. Basically everything is referenced by memory addresses. Each location in memory is directly addressable by a number and it is up to the programmer to keep track of what is stored in each location. The ability to randomly access is because each memory location is its own unit and wired element on a chip rather than a physical location on a piece of material in serial memory formats like disk or tape that need to be physically moved to access.

  14. Windamyre Avatar

    RAM basically works by having a look up table and the ability to access any spot. This is compared to sequential or one way memory.

    A (bad) analogy might be the difference between a book store and a library.

    If you want a particular book in a bookstore, you basically have to scan the shelves for that book. You can take some shortcuts if you know the genre or something, but even then you have to scan those shelves. The books might be in order by Author, or maybe another customer moved it.

    In a library you can lookup the book and head right to the shelf (ideally) and get what you want.

    Non-RAM memory isn’t used much in consumer-facing products today. Tape drives were a good example. You started from th beginning and went through the whole tape until you found what you were looking for. (yes, this was improved on later but this is ELI5).

    To add to the confusion, other labels like ROM aren’t the opposite of RAM.

  15. Drone30389 Avatar

    There are three types of memory addressing:

    • Sequential Access: a tape drive, where to get to any particular memory location you have to physically move the tape and pass over every memory location on the way.

    • Direct Access: a floppy disk drive or hard disk drive, the disk is spinning and the read head can move directly to the sector of the desired memory location, so you have to pass over some of the memory locations to get to the one you want but not all of it.

    • Random Access: memory chips. These have an address for each and every memory location, so you tell it the exact address that you want to access and it tells you what’s there without having to pass over anything else. It’s like a spreadsheet of memory locations.

    In addition to addressing types, there are also the access modes:

    • Read Only Memory: you can read from it but you can’t write to it (it’s programmed during manufacturing, or it can be written to once but then it can’t be changed).

    • Write Only: in practice usually some kind of output, like a printer or display that the computer to send data to but can’t read that same data back.

    • Read/Write (R/W) Memory: you can read data from it and you can overwrite it with new data.

    The reason I bring those up is because in the old days people often referred to memory as either “RAM” or “ROM”, even those are referring to two different categories.

  16. daniu Avatar

    Imagine 1,000,000 spaces of memory arranged in a 1,000 x 1,000 grid with a electrical connection for each row and each column. When you connect one of the row connectors and one of the column connectors to electricity, one of the cells lights up and you can read its content. 

  17. Whatwasthatnameagain Avatar

    The mail man has a letter for you. He knows your address so he comes to your house and drops it off.

    He does not have to go to every house between the post office and your house to get there.

  18. theronin7 Avatar

    To make a long – very complex story – short, every memory location in RAM is essentially addressed, Think of a long long long corridor of rooms , like a hotel. Data is stored in these locations (which are blocks of bits)

    Your ram an access those locations direction, as opposed to something like a tape that has to fast forward or rewind to the right location. Back in the early days this was a very important difference.

    These days the lines are much much more blurred and when people refer to RAM they are almost always referring to the ultra-highspeed volatile memory the computer uses as a scratch board and to maintain software, data and other things its pulled off the hard drive – allowing it to work much much faster than if it had to access the hard drive each time (which generally uses different technologies… though again these days the lines are much more blurred) .

  19. Murgos- Avatar

    It think the thing you are missing is that when the program is compiled variables get assigned addresses which are embedded in the program code so that the processor knows where to get it. 

    Edit: I’m assuming you understand addresses themselves and also aren’t asking about how the memory circuit is designed. 

  20. FishFollower74 Avatar

    Think of RAM as empty bookshelves. You can add as many books to the shelves as they’ll hold. Within the operating system, there’s a card catalog of sorts that tells it where all the books in the library are. Add a book (a program puts something into RAM), and voila – a card catalog entry gets created (the index to where those “somethings” are).

    There are also some programs that put things into specific locations in RAM, so the program always knows where that “book” is on the set of “shelves.”

    Side note: yes, I’m well aware that this analogy breaks down at some point (I work in the tech/OS/networking field, so I’m a geek). This is how I’d explain it to a 5 year old.

  21. bradland Avatar

    Those kinds of statements don’t make a lot of sense in a modern context, so it’s important to understand a bit of history.

    Back in the early days of computing, computers did not have RAM. They read directly from some storage media into the processor. The only “memory” available were the slots that hold numbers in the processor.

    A lot of that storage media was linear in nature. For example, computers used to read data from magnetic tapes. If you wanted data, you had to read through literal linear feet of tape to get to what you need.

    Memory is enumerated with addresses, kind of like rooms in a hotel. With old linear storage media, you had to start at room 1 and go through each room to get to the next. With RAM, if someone tells you to go to room 15, you can just go directly to that room and enter it to see what’s inside.

  22. BootyMcStuffins Avatar

    Imagine you were doing an open book math test. Not only is it open book, but your instructor is allowing you to use an index card full of notes!

    You can reference the formulas on the notecard directly. It’s really fast to look those formulas up, but you have a limited space to store formulas (one notecard).

    All the other formulas you need will have to be looked up. To find them you’ll need to look at the textbook’s appendix or table of contents, flip to that section of the book, find what you need.

    You can access all the formulas in the book, it just takes a bit longer than accessing the formulas on the notecard

  23. Blueroflmao Avatar

    I find everyone seems to overcomplicate this a bit, so heres my attempt:

    Your storage (disk) is somewhat like a library. Lots of information stored according to a system, but to find something specific you need to look it up in a registry, find the right shelf, the right section, pull out a book, look up the chapter, and then find the right page with the information you were looking for. This takes time.

    A process is given some amount of RAM when you run it;
    RAM is more like a shelf in a workshop next to the work-area. There are fewer shelves with less things on them, meaning you can display things and leave them easily accessible – tools and the exact pages you need are all in the open, and you’ll find them at only a short glance.

    If i had to compare the two directly:
    Disk storage is asking a librarian to find what you need. RAM is your private Chef’s fridge – he only buts what he needs to make food, and knows exactly where to find what you want.

    To summarize: your table has less space than your basement, but because its limited you’ll only put what you need for today on it. You know whats on it, you can see all of it, and its likely you’ll need most of what is there – unlike the random stuff stowed away in the basement.

  24. purple_hamster66 Avatar

    Most of these answers simply assume you understand how an address is used to find a piece of data, but to understand this, you need to grok the MUX, or Multiplex, a circuit that connects two things (the data address and the RAM data storage cell) like a Dewey decimal system works to help you find (“connect to”) a specific book in a library:

    • The highest digit of the Dewey number tells you which side of the library to search.
    • The next digit might tell you which bookcase within that side.
    • And the lowest digit tells you which shelf within that bookcase.
    • There are digits and letters beyond the decimal point that refine this more, but that lowest level is always a search in a library.

    In a MUX circuit, the software provides the data address and it connects wires from the data “latch” (the CPU’s memory receiving circuit) to the single RAM cell that contains the data. Then the data is “read” (copied) from the RAM cell to the latch, and then on to wherever the CPU needs that data to go (which is complicated, so I won’t describe it).

    The big difference between a MUX circuit and a library is that in a MUX, each address is one-to-one associated with a single data storage cell, not one-to-many or many-to-one like in a library, ex, a particular digit might be associated with multiple consecutive shelves in a library. We architect RAM memory so that never happens.

    The other clever thing is that the MUX logic can be split across multiple chips — it does not have to be done all in the same circuit. For example, some of the MUX is inside the RAM chips themselves, whereas higher levels are contained in a huge chip whose sole purpose is to do MUXing. There are also levels above the top-level that tell the computer where the data is located, that is, it might be in a really fast RAM (for speed of commonly used data) or on a really slow but huge device (because RAM is expensive, and fills up). These are done in the same manner, but can involve serial searches through tables that tell where the data is right now… lots of research has gone into making that fast.

  25. SeriousPlankton2000 Avatar

    Imagine a cassette tape and a CD. With a cassette tape you’ll press “play” and “fast forward” to skip all the songs you don’t want to hear. With a CDROM, you’ll press the track number and you’re there.

    CDROM are like RAM.

    But also: With RAM you can chose at any time to play or record. with ROM in contrast you can only read.

    There are special chips that can’t be read but written to. (the value will be used by hardware; you’re expected to not need to read the value after you set it)

  26. defectivetoaster1 Avatar

    effectively every memory cell in RAM has an address that specifies the cell and the data held in that cell at that time, to read or write the data you just need to set the address of the cell you care about and then you can read whatever’s there or write to that cell, other older kinds of memory like the now ancient delay line memory used in the very first digital computers effectively had a medium (early ones were literally just a chamber of mercury) that a wave could propagate through and you wrote to memory by adding pulses to the wave going through the medium, and you would have circuitry to keep recirculating that wave through the medium, if you wanted to read or write a particular piece of data you had to wait for its location in the wave to circulate round to the read/write circuits, whereas with RAM you can just specify a location and immediately have access to it

  27. SvenTropics Avatar

    To be fair, that’s all storage nowadays.

    In the past, tape storage was heavily used for personal and corporate computing. You had to physically rewind the media before the content and play past the content to acquire it. Platter drives, you had physically move the head to where the content was located and wait until the spinning platter had the data pass under the head. While this took a fraction of a second in practice, it was still a factor. Modern solid state memory and storage work very similarly when it comes to access. You can pull up a sector of memory and access the contents of it directly instantly. Where they strongly differ is in how they remove data. SSD’s require that a whole sector is reset while RAM can change a single bit at any point independently.

  28. Rabidowski Avatar

    You’re thinking in terms of software where you’d have to parse through data to find what you are querying for. RAM is hardware, engineered to have a “pointer” that can fetch a specific data address. It doesn’t care what’s in that address location.

  29. Windays Avatar

    Think of it like the Dewey decimal system for libraries.

  30. Not-User-Serviceable Avatar

    This is a comparison to old tape systems, where to find a particular piece of data you’d have to (essentially) rewind the tape and read it through until you reach the data you wanted (identified by some header information).

    With RAM, each record is directly accessible via its address. If you want to read bytes 1002…1006, you just do. Directly. And that ability to access any piece of memory in any order, i.e. random access, is what made RAM special.

    Think of tape based storage like an old cassette tape, where if you wanted to find a particular song you’d have to listen to (or fast-forward) through the whole tape, whereas RAM was more like a CD where you could go directly to your song. That’s a very weak analogy, but I think it gets the difference across without going into the weeds.

  31. ledow Avatar

    It’s “random access” because you can access any part of RAM you like at random and it will fetch it for you. It just literally activates certain lines in rows and columns and that allows it to send/receive data to a very specific part of the chip immediately. That activation is done by the “address” of the data, which is just a binary number that corresponds – somewhere – to the right rows/columns necessary to access each piece of data. e.g. 10001111 might correspond to row 8 (1000) and column 15 (1111) in the chip, and that having power on those rows/columns literally just activates only that part of the memory so you can read/write from JUST THAT PART.

    Other types of memory have historically included serial memory, where you would have to go through the memory one item at a time to get to the one you want each time. Some very old / cheap types of memory are like that, and some even required you to read every byte and then WRITE IT STRAIGHT BACK to memory in order for it to stay there.

    Hence when “RAM” was invented it was quite a revolution to say “Hey, give me the data at address 1,000,000” and it was able to just do that immediately.

    But it’s so long established that you can just access any part of RAM you like, with the right permission, that pretty much that’s what we expect of every computer on the planet nowadays, whether tiny embedded microprocessor, or cloud-scale supercomputer with NUMA, etc.

  32. mikej091 Avatar

    Think of a sequence of numbers, for example 1,2,3,4 all the way up to 12. Now think about an egg carton for a dozen eggs. Each of the slots that hold an egg could be numbered using that same 1 through 12 sequence. But they don’t have to hold an egg, they can hold anything that’s small enough to fit in the slot. And you can put things into the slots, or pull them out in any order you want by identifying the slot by number. This is kind of how RAM works. It’s a really big egg carton with lots of slots that can hold a small amount of data.

  33. Adezar Avatar

    Sequential access storage is like a train. If you want to look at specific data you need to wait for the train to go by that location and then you can look out the window and see that data. The most sequential access storage is tape. There is no magic way to read the middle of tape media, you have to roll through the tape until you get to where your information is. Like listening to a cassette tape for audio, you have to FF until you get to the song you want.

    Random Access Memory allows for you to go to a specific location of media, but the media must be designed for it. A CDROM is still spinning but the laser can quickly move to the right lane of data very quickly so can get to a given location within one rotation. Still not completely random but much faster.

    RAM is like having a massive bookshelf system where if you have the address for a specific bookshelf, specific shelf and a specific slot and you had the ability to reach every one of those slots without moving you could just reach out and grab the item/data/book you want without having to go past anything you don’t want.

    Just reach out, grab the book and have access to it. The trick is you have to have that address information, so you still need a card system that can translate something you know to that address. In RAM when you save information it returns “hey, if you want this back again later just go to this location and it will be waiting for you”. So the program stores that address in some format that makes sense to the program “location where I put Moby Dick” and next time the program wants to grab Moby Dick from the shelf it doesn’t have to figure out where it is, it already knows and goes straight to that location and grabs it.

  34. fishbiscuit13 Avatar

    To clarify where your misunderstanding is coming from, the data itself isn’t randomly placed, a more descriptive term would be “arbitrarily accessed memory”. When the system puts data somewhere, it logs the location so it knows where it is when it has to find it again. Then it can go directly to that address, instead of having to spool through all the data like if it was reading a tape or disk.

  35. OutsidePerson5 Avatar

    Basically your computer keeps an address book of all the data it has in RAM so it can quickly find the address of a given thing then go to that address and retrieve it.

  36. EmergencyCucumber905 Avatar

    Every byte in RAM has a unique address. To access that byte the CPU provides the address to the memory controller.

    The address is just a number, encoded in binary.

    So it might look like 001 1011 1010, where the first 3 bits are the rank (RAM chip) and second and third sets of bits are the 2D location on the chip corresponding to that address. The byte at that address is then sent back to the CPU.

  37. Guvante Avatar

    Contrast it with a tape drive. If you want to read the 5,000th block and you are at block 17 you need to “read” the ones in between in so far as you need to physically move past them.

  38. DBDude Avatar

    Think of very old core memory. It was just two crossing strings of wires with magnetic loops at the intersections. You set a bit of memory by running current through the two wires that crossed at one loop, which was then magnetized. Then they had other wires running that could tell if that loop was magnetized or not, which was reading.

    It’s kind of the same idea now, using electrical signals to set and read bits, just on a vastly larger scale and with some intelligence built in to be able to address chunks of data.

  39. pdg6421 Avatar

    All of the memory contents still have addresses tagged to them. To my understanding, the contents are located in a grid type array which means the addresses don’t need to be sorted through to point a value out.

    Hypothetically, if you have 100 items with 10 rows and 10 columns, and you wanted to get to item number 30, you would just specify to check the 10th element in the 3rd row).

  40. Emu1981 Avatar

    Random Access Memory is like a big warehouse with long corridors and a whole bunch of shelves. To access the data you send the warehouse a corridor address (a column address) which activates a certain corridor and a shelf location (a row address) and then the warehouse worker goes to that particular shelf location and returns whatever data is located on that shelf. Writing data is the same but you give the worker some data to store on the specified shelf. It is called random access because you can access any location within that warehouse with just a column and row address and it distinguishes the memory from the various other types of memory.

    This may sound like an obvious way for memory to work but we have had plenty of other types of memory over the years. We have had:

    • Racetrack memory – imagine a big loop of tape that cycles through past a read/write head. You cannot access any singular part of that memory pool without cycling through the tape until you get to the part that you want. This used to be rather common way back in the day (e.g. for recorded announcement systems where you would have a loop of tape with the audio in a machine and you would hit play to play the announcements and hit stop to stop it but then you could hit play again to replay the announcement) but I cannot think of any sort of usage of this type today – that said, googling it does bring up some modern version of this that uses nanowires that could potentially replace the high speed caches within CPUs.
    • Read Only Memory (ROM) – similar to RAM but you cannot write to any part of the ROM without special tools. There are various subtypes of ROM like Erasable Programmable ROM (EPROM – can be written to with special tools), Electronically Erasable ROM (EEPROM – can be electronically erased and then written to), Masked ROM (MROM – data is programmed in during manufacturing and cannot be changed) and Write Once Read Many (WORM – you can write to the medium once only but you can continue to read the data as much as you want). Technically your BIOS is a EEPROM, pressed CDs, DVDs and Bluray discs are MROMs, and the writable versions of those discs are WORM.
    • First In, First Out (FIFO) – like a long conveyor belt in a box where you put data in at one end and you can only access the oldest piece of data at the other end which removes it from the conveyor belt and makes the new oldest bit of data accessible. Still commonly used for buffering data – e.g. for network communications and reading the raw data from camera chips as it allows for data to that is coming in too fast to be handled in real time to be stored and released at a rate usable by the system.
    • First In, Last Out (FILO) – like a stack of dishes where each chunk of data (dish) you add is placed on top and you can only access the top most dish until you remove it. This is still commonly used within the CPU of your computer with the execution “stack” but 99.9% of people won’t even come close to needing to know that this even exists let alone need to know how to make use of it.
  41. Qiwas Avatar

    I think most replies are missing the point of the question entirely by oversimplifying too much. Basically, you can think about RAM as being an array of cells, each having its own address (which is just an integer from 0 to some number (typically 2^32 or 2^64 )). Now you need a way to read and write to each cell, and let’s say we’re only concerned about reading for now. For this purpose you can imagine them having a “read” signal: when it’s 1, the cell is outputting data (the exact mechanics of this don’t matter, just think of it as of a box being open), and when it’s 0, it isn’t (the box is closed).

    Now picture this: you have an array of cells, each with an ability to be “opened”. How do you convert an address (which is just a binary number, a string of 1’s and 0’s), to a signal that’s directed to precisely one of those cells? And the answer is, this is exactly the job of a circuit called binary decoder. If you open the link, you’ll see a picture with 3 inputs on the left and 8 outputs on the right. It means it accepts a 3-digit binary number and, based on it, activates (sets to 1) one of the 8 output pins. Moreover, it does so instantly, without having to traverse any of the “preceding” pins, whatever that would mean. Its exact inner workings require an understanding of logic gates, but if you decide to learn more about them you’ll quickly see that the way the decoder accomplishes this is not magic, just basic combinational logic

    So to recap: each cell has an “activator signal” that lets you read data from it once set to 1. A binary number (which represents the cell address) is converted to a signal that activates precisely one of the cells using a decoder.

    Obligatory “this is a simplification and not quite a full picture (with RAM usually being 2 dimensional and all)”, but this is one way it could on a homemade computer for example

  42. ScandInBei Avatar

    Let’s say you want to get the 2nd word from the 3rd paragraph from the 186th page in a book. 

    Some technologies may start from page one and “read” until it finds the right location.

    What Random Access means is that the RAM can directly find the correct page. 

    ..

    Now it’s quite likely that you want to get the 3rd word from the same paragraph next, and while RAM is fast, the CPU cache is even faster. So the CPU is getting the complete page from the book, gives you (the program) the right word and saves the page in its cache. If you were to ask it for the best word it would be even faster as it’s in the cache. 

    So how can it access any page of memory directly? Well, it saves the pages in a “grid”. 

    If you want to get page 187 and you have 10 columns in the grid, it will be on row 19, and it will be the 7th item on that row.

  43. idgarad Avatar

    Some folks are over-simplifiyng it. Tape, Disk, and memory can be either Linear or Random access depending on how they are configured.

    ABCDEFGHIJKLMNOPQRSTUVWXYZ

    Okay there is our data. I am given a address say 8 that refers to the 8th letter which is H and I want to read 4 more units of data so it returns HIJKL.

    That is the expectation of our read.

    Linear access means we have to read in order ABCDEFG first to get to H. Then read 4 more and return the results. That is linear access. The number of read operations is fixed to the length of the data traversal. We have to read everything along the way. We don’t have to use it, but we have to read it.

    Random access means we don’t have to read ABCDEFG before we start reading H. We can just jump there and read the 4 additional characters and we are done. More importantly HOW we store where we are in the read factors in.

    We use a register or bit of data that is our CURRENT_POS. In linear read this is always counting up by 1. In Random read we just set it in our example to CURRENT_POS=8. We read 4 and now CURRENT_POS=12. We can then set CURRENT_POS to say 20 and read 2. Then set it back to CURRENT_POS=2 and read 12. That is the Random Read ability. Where as in linear we always have to start from 0 and walk through until we get to our destination. So CURRENT_POS has to increment internally for ‘reasons’. Magnetic media often tended linear because the head alignments are perfect so you need to make sure you are in a landing zone, then data, then an end of record, etc. RAM on the other hand is addressable by it’s design so inherently Random as you don’t need to read any extra stuff first to get to where you want to go.

    Even tapes can be random read because we can build and store an index at the end of a tape that maps where that CURRENT_POS we create is physically on a tape.

    Linear Access is also in a specific way, a single linked list in which when we start reading data the block tells us where the next piece of data is, but we can’t go backwards. Random kinda requires some sort of lookup table to tell us where a particular piece of data actually is.

    tl;dr: Linear = driving to work, Random = Hot dropping space marines at a target.

  44. SkullLeader Avatar

    RAM = Random Access Memory – i.e. you can access (read or write) to any item in memory whenever you want to, by specifying the location you want to read or write. And the amount of time it takes to do this is independent of things like the last location you read or wrote from.

    This aspect of RAM works basically by using digital circuits called multiplexers and demultiplexers. The input is the address (location) in memory that you want to read or write to. If you are reading, the output is whatever is stored at that location. If you are writing, then there is no output as such, but you provide an additional input which is whatever value you want to store at that location.

    Random access, as opposed to, say, some sort of linear memory like a tape where you would have to wind the tape so that the desired item could be read or written to. If you write one item at the start of the tape, and now you want to read an item at the end of the tape, you have to wind the tape all the way to the end to do that. Whereas if you write to the start of the tape and now you want to read something in the middle of the tape, that takes less time because now you only have to wind part of the way through the tape.

    Disc based storage like a hard / floppy disk or a CD/DVD is sort of a hybrid of these.

  45. jmlinden7 Avatar

    Suppose you want to access a specific address. You tell the RAM, fetch me the data that’s in address 0x5B23

    The RAM translates that into a row and a column number, and it sends the row and column number into its address array as a bunch of ones and zeros, while turning on the fetch circuitry.

    The ones and zeroes only turn on the specific row and specific column that the desired address is one, while linking that address to the fetch circuitry. In order for an address to turn on, its row and column must both be on. This makes the data on the fetch circuitry equal to whatever data was in that address, since it’s the only address that matches that row and column number, and therefore the only address that is on.

  46. VanderHoo Avatar

    Lots of good explanations here, but I want to add a practical detail. Another reason you don’t have to “look” for the data you put in memory is because every section of memory has an ‘address’, and you have to log those addresses as you use them so you can retrieve the data again.

    To use the bookshelf example, this would be like making a note that you put a book in section 2, shelf 5, slot 13. That way when you come back, you can go right to the book you’re looking for instead of scanning through the shelves.

    Another important aspect of addresses is ‘cleaning up’ your data, which is clearing out memory sections you are not using anymore so other processes can use those sections. If your software doesn’t do this, you will eventually clog up the memory with junk data, which is known as a ‘memory leak’.

  47. Anony-mouse420 Avatar

    Think of RAM as a numbered list:

    1. Virtual-Rice1844

    2. AnonyMouse420

    3. Spez

    … and ROM as a linked-list:

    Virtual-Rice1844 => AnonyMouse420 => Spez

    The only way to access Spez in the second is to go through AnonyMouse420 and Virtual-Rice1844, whereas in the first, you can ask for the third member of the list directly. HTH