 Virtual memory works pretty much the same as the rest of memory, but it's got a few differences that make it a little more interesting. While the caches in main memory are managed by the hardware itself, virtual memory is generally managed by the operating system. Any request for data from a hard drive is going to take extremely long relative to the processor running at 3-4 GHz. It may take tenths of a second to actually get that off of a hard drive. So this is a huge amount of time. In that case, we can ask the operating system to do some more complex management for us as well. We don't have to settle for the simple schemes that we do with hardware. We know we're going to spend a lot of time waiting for this. We might as well try to do it as efficiently as possible. So virtual memory has to contain all of the data that all of our programs are using at the moment. But it's going to effectively consist of our main memory as well as an additional chunk for the hard drive. From our operating system's perspective, this is a fully associative memory. We can stick pieces of data wherever we'd like to. Some programs will use more data. Some programs will use less. And programs request data at different points. A program may start off asking for a small piece of data. Then another one comes in and asks for a piece of data. Then our first one comes back and asks for a huge piece of data. We have to find a way to fit all of those into memory. So using a fully associative memory allows us to fit data in wherever we need it, regardless of how large it is. And we already know we're spending a whole lot of time to access this memory anyway. So it's not too big of a deal to have to search for that data. Our operating system will usually help us out by keeping track of where it's put various things for us so that we don't have to search every byte of memory. But that's pretty much all of the difference. I already mentioned how you'll need to swap pages between main memory and the hard drive when you run out of space for data in memory. That's because we're not going to keep an entire copy of everything over on our hard drive. We'll just use the hard drive or a solid state drive as an extension to our main memory. Not as a higher level the way we did between the caches and the main memory.