What's Virtual Memory? - Computerphile

preview_player
Показать описание
With the news Apple are implementing Virtual Memory on the iPad, Dr Steve Bagley takes us through what virtual memory is and how it works.


This video was filmed and edited by Sean Riley.


Рекомендации по теме
Комментарии
Автор

I don’t think this was Steve’s best video. In my opinion he mixed up three important concepts that have different motivations and are easier to understand separately: relocation, virtual memory and segmentation.

Early computers ran a single job at a time so the programmer could decide to start his program at any arbitrary address and place the data in memory as he wanted, there was no interference from other programs.

The next step was multi programming where several programs were in memory at the same time and the processor time-sliced between them. Initially this was achieved by using a ‘relocating loader’ that adjusted any internal (relative) address references to the actual addresses in memory. Then hardware was devised to help - a Base and Limit register set that allowed each program to see its address space starting at zero and continuing up to the limit. This had the dual benefit of performing the relocation using hardware that just added the base address to each memory reference (and checking it didn’t exceed the limit) and protecting other programs (and the operating system) from getting overwritten by accidents or bugs.

The Base/Limit approach continued into the 1970s (think ICL1900, IBM360) but had the disadvantage that memory needed to be allocated in one contiguous block for each program, which leads to inefficient use over time, unused gaps etc. And this at a time when memory prices were the key constraint in building large computers.

To increase efficiency the team at Manchester University designed Atlas to have demand paged virtual memory, so that the need for large contiguous blocks of memory could be overcome.

Finally the next generation of computers using virtual memory, eg Multics figured that you could also Segment virtual memory so as to have read only pages shared by several programs, like library routines, and other uses for shared segments were found, for inter program communications.

Hope this helps.

Richardincancale
Автор

Another benefit of virtual-memory is memory-isolation. It prevents programs from messing with memory of other programs, which increases stability and increases security (it's not 100%, but certainly better than letting all programs access shared physical memory).

I.____.....__...__
Автор

The presenter is getting very good at asking pertinent questions.

If we ever have an AI working on the meaning of life the universe and everything he could come in handy.

davidmurphy
Автор

I've had the question in the title of this video for numerous years. Thank you Computerphile.

Danny-hjqg
Автор

Someone take away his pastel coloured markers and give him a black pen - then we'd be able to see his diagrams!

JustFamilyPlaytime
Автор

6:40 There's a real benefit for multiple mappings and it's when running virtual machines: the virtualised OS does one mapping for its programs and the host OS does another to the physical RAM.

stensoft
Автор

The lighting + fluorescent marker was a bold choice. But I didn't dislike it as much as others seemed to have. I think it was fun and interesting, in small doses. (I certainly wouldn't want it to be the norm though.)

ZacharyVogt
Автор

Windows 10 and 11 use this technique as "fast startup", too. So, when you shut down the PC, it writes the volatile memory to the non-volatile storage. That way, your boot time is quicker. Rather than going through your entire bootloader sequence, it can just throw the written storage DATA back into RAM. Kind of like a hybrid of Hibernate mode and Sleep mode. This is why Hibernate mode is now hidden by default in Win10/Win11.

HazyJ
Автор

About 30 years ago I wrote an incremental linker for Unix (mostly for Sun, but it got ported at least a couple of times -- for all I know, it's still running someplace), and this was around the time that a lot of low-level I/O operations were starting to be written using mmap. Some colleagues suggested at the time I should forsake read() and write() and just use mmap for everything, but my experiments showed it actually made the linker slower to use that for everything, despite it being faster to use it for some things, such as incrementally updating the debugging information in the output file. I've occasionally wondered if making basic I/O depend on mmap ever happened, and if so, how they solved the performance issue I saw. But I don't program at the level anymore, so I don't know how things work these days, and I'm at the mercy of the people writing O/S stuff, instead of being one of the people inflicting my decisions on others.

hardlyb
Автор

I liked that the talk mixes different concepts and approaches on RAM management — all because it has been developed on top of one another and tries to solve one common problem, in steps.

jkobain
Автор

FYI, one of the most popular home computers of the 1980s, the Commodore 64, was equipped with 64 KiB of RAM. Its CPU, the MOS 6510, divided memory into 256-byte pages. That's 8 bits of address space per page. Makes a lot of sense, considering it was an 8-bit CPU (other than addresses, of course). It even had a special "zero-page" addressing mode for some instructions, that reduced the instruction size by a byte, and often saved a cycle too, in exchange for being restricted to the lower 256 bytes. As you might imagine, that zero page was crowded with important system variables.

Well, the C64 also had no virtual memory. But then, it barely had an operating system, either, so...

fllthdcrb
Автор

I think it was a Sun OS implementation where we put a lot of Ram in this particular system and the OS insisted that you had to have a swap partition about 1.5x the real Ram. It meant we had to buy an extra ultra scsi disk just for a swap partition we didn’t even want.

Learning experience

marksterling
Автор

finally i can leave hundreds of tabs open on my ipad exactly like my pc

pistonsjem
Автор

There are actually microcontrollers with 4 bytes of RAM. They use flash as program and static data memory, and have 1 kilobyte of it; RAM is used only for changing data, e.g. in the hello world you'd need 1 byte of RAM to loop over the data. They are useful in smallest of embedded applications: battery monitors, pushbutton inpts, watchdog timers, simple regulators, infrared remotes and so on.

sharpfang
Автор

Virtual memory makes me think of "downloading more ram".

mattthend
Автор

Who makes these thumbnails? That person needs a raise.

simplyacatenjoyinglife
Автор

11:07 Love how he just casually explained the concept of address mirroring. This is actually a trick the Game Boy Advance uses: A pointer to the IRQ handler is supposed to go at 0x03007FFC but an actual interrupt loads the address stored at which is much easier for the ARM to load due to its use of ompressed operands. Thanks to mirroring it works out to be the same value regardless.

williamdrum
Автор

Guuyyyys, give the man a high contrast marker so we can see what he draws.

tracygilmore
Автор

I actually made a video on this lol but without all the jargon. Lot's of stop gap animation as well.

But listening to a master of his craft is awesome.

InquisitiveUniverse
Автор

Virtual memory is also important for making 32 bit programs work seamlessly on 64 bit systems.
Each program can still only target 4GB, but by translating the addresses to 64 bit, they can be spread out in physical memory and avoid overlapping memory spaces.

Dayanto