Clean

How Flash Drives Work

Published Jun 29, 2022, 7:04 PM

By listener request, here's an episode about flash drives and flash memory. What makes it different from RAM and hard drives? How does it store information?

Welcome to tech Stuff, a production from I Heart Radio. Hey there, and welcome to tech Stuff. I'm your host, Jonathan Strickland. I'm an executive producer with I Heart Radio and how the tech are you? I received a request to talk about flash memory from a hardware engineer, musician, and self described total nerd via the I heart Radio app talk back feature. Uh. That's that little microphone icon you would see if you were to navigate to the tech Stuff podcast page on the I heart Radio app. If you click on that, you can leave a voice message up to thirty seconds long there, and if you want me to include the audio in an episode, you can let me know. I always prefer opt in rather than opt out. This particular voice message did not ask for it to be used in an episode, so I'm just leaving it out to be on the safe side. But let's talk about flash memory now. One thing that we need to clear up is when we talk about flash memory, we're typically talking about data storage, you know, like like a hard drive, rather than talking about something like traditional computer memory like RAM. RAM stands for random access memory. Computer memory, as we typically define it means a temporary storage system that holds data and instructions that a CPU or central processing unit needs when it's running a particular process. Computer memory is what saves a processor from having to retrieve specific information from long term storage over and over and Without RAM, computers would be much much slower than they are. And it's why some folks will say that one way to speed up your computer is to add more memory. It actually gets way more complicated than that, though, and I'm sure I'll talk about that in another episode. Maybe I'll do an episode about the the components in your machine that determine how quickly it runs, because there's a lot of There are a lot of factors, it's not just one thing. Also, one way that folks will describe RAM versus storage is the kind of think of it like human short term memory versus long term memory. We use short term memory to handle something that's going on in the moment, such as let's say you meet someone for the first time, and they introduce themselves and they give you their name, so you use their name as you talk to them. We then commit important stuff to long term memory so that we can pull from that should we ever need to, like remembering that person's name when you see them at a function three years later. Then you don't want to look like a total jerk. By the way, I am really bad at long term memory. I'm not great at short term either. As it turns out, I kind of live in the moment. It's like the world is just constantly new and amazing to me. That's the way I prefer to think of it, rather than I him really bad at remembering people's names. But flash memory typically behaves more like a hard drive than RAM does. It's a way to store information for more of a long term solution. Flash drives are also known as solid state storage devices UH. They use an all electronic method to store data, as opposed to traditional hard drives, which have moving parts like platters and read right heads. Also, flash drives are non volatile forms of storage. That means that the data stored on a flash drive is going to stay there even if the computer that the drive is is connected to has been switched off. Stuff in RAM is volatile, so information stored in RAM is volatile. Memory that are volatile data. That means that information will go by by when you power your computer down. RAM requires power to continue to store information. That's not the case with flash storage. Or flash memory. Like a traditional hard drive, a flash drive will jealously cling onto that precious data. It just does so in a different way from traditional hard drives. All right, So let's do a quick rundown of how traditional hard drives work so that we can make this distinction. Now, I mentioned that a traditional hard drive has a platter and a read right head, so you can kind of think of it similar to a turntable or record player and vinyl records. Only imagine that your turntable is able to not just play music on a record, it can also record music to a blank record. Now, with vinyl records, we record information in grooves, and a stylist or needle travels through that groove, and the physical vibrations the grooves transferred to that stylus get transformed into an electric signal thanks to a tiny electro magnet that then can be amplified and sent to speakers, and then we get playback. With traditional hard drive, we're not talking about physical grooves. Instead, we're using the read right head, which is able to generate and detect magnetic fields, so it can align magnetic particles that are on the hard disk platter, and those particles based on their alignment, can represent zeros and ones, you know, bits, the basic language of computers. This, by the way, is why you may have heard that you should keep powerful magnets away from computers. If that computer relies on any type of magnetic storage, a powerful magnet could change the alignment of the particles on that platter, and that would destroy the data stored on it. You could do that on purpose too, in an effort to make an old hard drive unreadable, you know, to conceal whatever had been stored on the drive. We call this degassing, and uh, it's an important step. If you were to ever like retire a computer and you want to maybe donate it, or sell it or or give it away, chances are you want to make sure that anything that you had stored on that computer is well and truly gone. You don't want it to resurface at some point. It might have some sensitive information on there, So that's one reason you might want to decoss an old computer. But flash drives don't use magnetism to store data, So you could bring a powerful magnet near a solid state drive and you would not change a single bit of data that's stored on that device. So a flash or solid state drive isn't susceptible to the gossing. That's good and bad. It's bad only if you're trying to come up with a way to prevent someone from retrieving data that was once stored on that flash drive. You would have to take a different approach in order to do that. Now, the listener who left this request and my apologies but I don't actually have your name, mentioned that he was familiar with flash from ages back and referred to I PROM Now I'm assuming he means e E p R O M, but he could have meant E E p R O M will cover both. So E E p r O M stands for electronically eraseable programmable read only memory, and it is kind of a forerunner to flash. It's sort of the foundation that flash would be built upon, although the two are distinct. So let's talk about read only memory for a second because it's that's also important. Now, I already mentioned RAM, that's random access memory. RAM is volatile and it is rewriteable, meaning you can read or overwrite data stored in RAM as much as you like. Read Only memory or ROM is different, as the name indicates, you usually can only read data from a ROM storage source like a WRAM micro chip, but you aren't typically able to write new data to a ROM. With computers, we usually find very important basic level process is stored in ROMs, such as the boot sequence for a computer, so that your machine goes through all the necessary steps to swing into working order. You wouldn't want to overwrite that stuff. These are the most basic instructions needed to make the machine work. If you're in the main or multi arcade machine emulator scene, you might think of ROMs as the code for a specific arcade game. In the old days of arcades, manufacturers would program games on actual microchips. The game was never meant to change, and so programming them on rom's made perfect sense. So if you were to open up one of those classic arcade machines, you would find circuit boards holding various chips, and that, in fact would be the game. It's not from a disk or anything like that, unless you're talking about a game like Dragons Layer, which in fact used laser desk technology. But that's beside the point, and those games were stored on read only memory. However, e E PROM E PROM also includes the allotronically erasable programmable part. Right, So clearly I PROM is not exactly like traditional ROM. It is user modifiable. Users can erase and reprogram individual bytes of data stored on I PROM. This in itself was an evolution of single E E PROM E P R O M that was just eraseable programmable read only memory and listener. If this is what you were referring to, my apologies, Uh, it means that you go further back than I anticipated. So uh, E PROM actually was another form of PROM that's programmable read only memory. You might wonder what's the difference between E PROM with a single E and e PROM with a double E, and it really is that electronically eraseable part. So with the old e PROM chips one E, you could technically erase data that was stored on that chip. However, to do so, you first had to expose the chip to ultra violet light for a good long while, like an hour. So imagine having to wait an hour in order to erase data that was stored on a chip so that you could write over it again. Obviously, that would not be viable for your average user. Data on a double E e PROM, on the other hand, could be erased by applying a slightly higher than normal electrical voltage to the chip. Now, as you might imagine, that's way less work than exposing a chip to ultra violet light, and it made e PROM storage viable for specific applications, not yet to the point of a solid state drive. Now, before I jump into what makes flash work, remember flash is kind of an evolution of e PROM. But let's let's talk about the history of flash. So i PROM dates back a few decades, and flash we can actually trace back to the mid nineteen eighties. Dr Fugio Massuoka, who was working for Tashiba, developed flash memory. Masuoka said that the name flash was actually suggested by a colleague, Mr. Shoji are Zumi, because Razumi felt that the process of a racing store data off the the flash method was very similar to an old school cameras flash. Now, I suspect that some of you all out there might not have had that much experience with flash cameras because everyone's using their phones, and I mean some people have like the little led flash on their phones. But it's totally different from the old flash cameras, which used capacitors to generate a very quick, very bright flash of light when you were taking a picture in low light situations. And flash cameras used to be huge, and of course they still are being used in some settings, like professionals of course still use them, but a lot of I think a lot of the average people out there probably have had limited access to them if they are below a certain age. I'm of an age where I remember flash being like just standard on cameras, like you really needed it or else. Any picture you took indoors was not going to come out properly. Anyway, the actual methodology for storing data on a flash drive was really clever. I'll talk about that more after we come back from this break. Okay, let's talk about how flash data is stored in the first place. Imagine you have a grid, so you've got columns and you've got rows. Each box in this grid, each cell within that grid has two transistors located at each of the intersections around it. One of those transistors is what we would call a floating gate transistor, which holds a charge inside it. The other is a metal oxide silicon or moss transistor and serves as the control gate. Uh now, I guess I'm gonna need to talk about gates. As we're using floating gate and control gate. That doesn't really mean anything unless you dive a little further in. So gates are really that's shorthand for logic gates, and this serves as the foundation for any circuitry system uh, specifically digital systems. So with a logic gate, you've got a circuit that at least has at least one input, and it can have more than one, but has at least one, and it has only a single output. And what is being input and output in this case, well, we're talking electric charges. Uh. These circuits provide specific functions which we designate with names like and or not nor nand and so on. Those names tell us how the gates behave and the output that they will produce based upon the type of input coming into the gate. For example, a simple and gate might have two inputs and will refer to these inputs as input A and input B, and it has a single output. Remember all gates have a single output we'll call the output X. There are four possible scenarios with this gate, which we will represent using binary data or bits. That's that is, zeros and ones. So instead of talking about electric charges. We're gonna talk about feeding zeros and ones to a logic gate through its inputs and what is generated as an output. Now you've got your and logic gate, and let's say that you feed zeros to both input A and input B. Well, and AND gate will then produce a zero as the output. So output X will generate a zero. Now let's say that you feed a zero to input A and a one to input B to your hand gate. Well, the X output will still be zero. In fact, the only way that the X will equal one is if both A and B inputs are ones. That's why it's called an and gate. The gate produces a one if all inputs going into the gate are also ones. And remember like we're talking about a simple example here where we have two inputs, but you could have more than two inputs going into a single gate, but it would have to be all ones going into that gate for the gate to produce a one. On the other side, with flash drives, we're talking about NOR or nand architectures, So a NOR gate will only produce a one if all inputs going into the gate are at zero. So if input A zero input via zero, then x will equal one. But with any other combination, like if you have all ones or a combination of zeros and ones going in as input, the output is going to be a zero. A nand gate is a not and gate. This will produce a one out put in every single case, except when all inputs are ones. So if you've got two or more zeros going into a nand gate, you're gonna get a one coming out. If you get a combination of ones and zeros, you're gonna get a one coming out. If all the inputs are ones, you get a zero coming out. Now, these are the functions gates can serve, and you can actually program stuff by creating all these different logic gates in a various series in order to produce particular you know, outcomes. But let's talk about the gates themselves. So we're talking about transistors here. The transistors and electric circuits can serve as a type of switch, either allowing data to pass through or not. On one side of the transistor, you have the source that is the place where input is coming from, and on the other side of the gate, you have the drain that's the place where the output is going to. With a standard moss fat transistor. A moss FET stands for metal oxide semiconductor field effect transistor. You would open the gate or you know, turn the switch on by placing a charge on the gates electrode. That would turn the semiconductor transistor into a conductor and allow electricity to flow through. Removing the charge from that electrode makes the semiconductor transistor behave like an insulator. That's the big deal with transistors. They can, depending on the situation, act either as a conductor or insulator. They can either allow a charge to move through or prevent it. All right, Now, let's talk about a floating gate transistor that has an extra piece to it. The floating gate is electrically isolated from the rest of the transistor. That isolation is key because it means once you store a charge in a floating gate, that charge will stay there. And that's because the floating gate isn't connected to a drain where the charge could otherwise go. This gets a bit tricky to explain without visual aids, but I'll give it a go. All right, So with a flash drive, we've got your control gate, and we've got your floating gate, and an intersection in this grid of rows and columns. The rows of the grid are the word line, and the word line goes through the control gate. With that link, the cell and flash memory holds the value of one, so by default, all the cells in flash memory are set to one, not to zero. To change any cell to the value of zero, you actually have to put in some work. So the rows are the word line. What then are the columns, Well, that's called the bitline. The bitline can carry a charge to the floating gate by pushing the charge through at a slightly higher voltage than what is used for the control gate. That's enough for electrons to bridge the gap of the otherwise isolated floating gate, and the floating gate will then hold a negative of charge. Because electrons are negatively charged sub atomic particles, and this process is called the Fouler nord Heim tunneling process. The collection of electrons in the floating gate then becomes kind of a negatively charged force field between the floating gate and the control gate. A cell sensor monitors how much charge passes through the floating gate, and if the flow is above a certain threshold, the value of the cell is interpreted as a one. If the value is below this threshold, the value within the cell is considered to be zero. So another way to think about it is that if the cell conducts a current, it's representing one. If it is acting more like an insulator, it's representing a zero. To return the cell value to one, you have to apply a higher voltage electric field to the cell. And really this process typically targets sections of the flash memory called blocks, particularly for the type of flash memory that we who's frequently um and sometimes you might even have to target the entire flash chip itself and boiled down. By controlling the voltage to the control and floating gates of the transistors on the solid state drive, you can create the zeros that represent the data. Remember it's by default it's set at one, So really creating zeros is what is writing data to that. Otherwise you just have, you know, a block of ones. So erasing flash memory really just means turning all the cells within the memory to one, and writing to flash memory really just turning means turning selective cells to zero. So let's say you're starting off with a bite of blank flash memory. Uh, that would be eight ones. So a bite is eight bits, right, and we've established that a blank cell is a cell that's holding a one within it. Let's say you want to write a bite that is actually zero followed by seven ones. You could theoretically keep writing to that same bite. You could change you could reprogram that byte by changing other ones in that series to zeros over time. You could not, however, change in these zeros back to ones without erasing the entire byte, really, without erasing the entire block that the bite is on. So you could write data in the form of zero one zero one, zero one zero one, but you could not then go back to zero followed by seven ones without first erasing everything and starting over. It gets a little confusing. Don't worry, it will get more confusing. I should also mention there's also flash RAM. But that's the type of volatile memory, meaning if it does lose power, then any information stored within that memory is lost. This is the type of memory found in things like car radio systems, where you've maybe stored preset radio stations and such. So you might think, but my radio stations stay on even after I'm you know, turn off the car and I get out and do whatever. But when your car is off, that system is still drawing a very tiny amount of power from your car's battery in order to maintain those settings. However, if your vehicle were to totally lose power, like let's say you had the battery completely removed, then you would lose that data and you would have to reset all your favorite stations. Okay, when we come back, we'll get into a little bit more detail about NAND versus NOR architectures, because flash comes in both, and we'll talk a bit more about how flash is organized by architecture. Uh trust me, it actually is really interesting. It does get a bit complicated, don't worry. I'm here with you every step of the way. But first let's take a quick break. Okay. I mentioned earlier that flash typically comes in NAND and NOR architect ictures, and the NAND architecture is the one most of us have experience with. It's the type of memory used for SD cards, USB flash drives, and computer solid state drives. NOR is usually used for storing digital configuration information. Uh nand flash has transistors in grid wired in series. NOR flash has its transistors or cells wired in parallel. That architecture does matter because with NOR you can actually program at the bite level. You can write and rewrite at the bite level. When nand you have to do it at a much larger level, which we'll get to in a second. And we're gonna stick with nand because again that's the type most of us interact with regularly. The organization of a nand flash drive goes with cell, which is your individual unit in which you know you're storing either a zero or a one one by default. Next, you have strings, and as that name suggests, a string is a series of cells that are connected to one another, where the source of one cell connects to the drain of the next cell. One level up from strings, and you have pages. So a page is a collection of strings. A collection of pages makes up a block, and a collection of blocks connected through the same bitline makes a plane. Finally, you've got the flash dye, which consists of one of or more planes, plus all the components that allow the drive to write, erase, and read data in those cells. Now, this arrangement allows the drive to read and write on a page level. So that's as far down as the read right functions go as to the level of page. Remember, you have cells, strings, then pages, so read write is at the page level, and if you want to do a race, you actually have to go up to the level of a block. So to erase data from a flash drive, you work in blocks. So let's say you've got some data that's stored within a block, and there's technically room for more data to be stored there, right, So let's say that half of that block is filled but the other half is available. Well, you want to add more information to that block, but in order to do that, you can't just write the information to the end of the block. You would first need to erase the block. So the way this actually works is that first you would have a different block in the memory which has been untouched. All the cells are set to one, so that block is effectively blank. You would actually copy over the information in the partially filled block and you would store it in the new block, and then you would add in the new data that you wanted to say at the end of that. So it's like you're writing. You're rewriting stuff that was already there and then writing the new information at end of it. The old block, the one you pulled from the one you copied, can then be erased. All the cells can be reset to one. Now this sounds messy, but I should add that when I say you have to do this, it's not actually you doing it, it's the computer. One drawback of flash memory is that it can wear out over time. It's not as big a deal now as it used to be, and it never was a huge deal, but it was something that you had to keep in mind. So you have a finite number of a race and right cycles or program a race cycles, also known as PE cycles. See when I think of PE cycles, I think of grade school and having to exercise. But no, over over time, the cells will wear out and they won't hold a written block of data properly. You can kind of think of it in the way that um that batteries have recharge cycles, and I have a limited number of those, right, Like a battery capacity to hold a charge decreases over time, and the more times you discharge and recharge a battery, the closer you get to that that level where the amount of energy it can store is no longer sufficient. Same sort of thing with flash drives. But again, these days, flash has advanced to a point where it's likely that other components in your system are gonna wear out or break before you ever have to worry about running up against the limitations of flash memory. Um. And that's for two reasons. One, the design of flash memory has improved over time so that they can withstand more program erase cycles. And two we've also been able to cram way more memory into a flash drive over time, and so you don't have to erase as often because you've cut so much space to use. Now we all know, I mean we should all know that when you create more space, that doesn't mean that you suddenly have all the freedom in the world. Because if you have space, at some point, you're gonna find ways to fill it, right, Like I remember Bay back in the day when I was very young, you know, hearing something about like a computer that would come like with a two D fifty six megabyte hard drive, and I was, I was, I was boggled. I was like, who would ever be able to fill up a hard drive that was as massive as two D and fifty six megabytes? That's just crazy? And of course that's nothing now, right, Like, we don't even think about that being a significant amount of storage these days, you know, you probably have programs that are far larger than that at the time, I thought, well, there's no way, which at this point, it doesn't matter how big the drive is. I know that someone's going to find a way to fill it up, and probably way faster than I would anticipate. But these days, if you look at solid state drives, you can find them in the terabyte range. Right, They're holding terabytes of data and these things can be really small. It's fascinating to me how we've developed this technology. Uh. And it's due to things like the manturization of transistors that it's even possible, along with the improvement in architecture, so that you could have this very dense storage system and a very small form factor. Uh. Phenomenal to me that you can, you know, pop onto a store and buy a two terabyte solid state drive. Now, there are other benefits to solid state drives too. Hard drives. You know, I mentioned before that they are not prone to being a race if you happen to be, you know, close to a large magnet. But there are other big benefits as well. A solid state drive has no moving parts in it, so it's not as delicate as a hard drive is. A hard drive like a mechanical shock, as in dropping it and having it land on the floor. That could be enough to break it. Right. It could unaligned the platter so the platter is no longer in the proper plane, which means it won't turn properly. It could damage the red right head. You could do physical damage to a hard drive relatively easily. I say relatively because I used to have an MP three player that had a physical hard drive in it, and goodness knows, I dropped it a couple of times and I was just fortunate that it was made exceedingly well and UM didn't immediately break the hard drive. But yes, solid state drives are much more resistant to physical damage than hard drives are. They're also way faster because again, you don't have moving parts. You don't have to spin a platter up to beat and move the read right head to the proper physical location on the platter to read the information. UM. For that reason, you know, gamers really like solid state drives because games will load much more quickly. You'll be able to load information from the drive to memory to be processed faster than you would with a physical hard drive. Again, when we start talking about what is it in your computer that makes it faster or slower drive. Drive type is one of those factors, not necessarily the most important one, but it is one of the factors. So I guess I will do an episode. Maybe next week, I'll try and do an episode about what are the things that determine how fast or slow your computer is? Uh, because I think that would be a fun discussion to have. Anyway, that's kind of a low down on what flash memory is and how it works. Like I said, it gets a little complicated to understand without the use of visual aids. Fortunately, there are tons of resources out there where you can learn more about this, including videos and papers and diagrams and such. Um there's an article and how stuff Works my old Stomping Grounds that explains how flash memory works. All of that can be really useful if you want to learn more. I highly recommend you look into it. Thank you so much for the suggestion. Remember, if you want to leave me a suggestion, you can do like this listener did and leave a message on the voice talkback feature on I Heart radio app. Go to the tech Stuff portion of I Heart Radio's app. Use that little microphone icon. You can leave a message up to thirty seconds and length, or you can reach out to me on Twitter, the handle that we use as Text Stuff HSW, and I'll talk to you again really soon. Text Stuff is an I Heart Radio production. For more podcasts from My Heart Radio, visit the heart Radio app, Apple Podcasts, or wherever you listen to your favorite shows. H

In 1 playlist(s)

  1. TechStuff

    2,450 clip(s)

TechStuff

TechStuff is getting a system update. Everything you love about TechStuff now twice the bandwidth wi 
Social links
Follow podcast
Recent clips
Browse 2,447 clip(s)