What's Virtual Memory? - Computerphile

  Рет қаралды 174,290

Computerphile

Computerphile

Күн бұрын

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.
Extra Bits: • EXTRA BITS: More on Pa...
/ computerphile
/ computer_phile
This video was filmed and edited by Sean Riley.
Computer Science at the University of Nottingham: bit.ly/nottscomputer
Computerphile is a sister project to Brady Haran's Numberphile. More at www.bradyharan.com

Пікірлер: 318
@Richardincancale
@Richardincancale 2 жыл бұрын
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.
@32768hertz
@32768hertz 2 жыл бұрын
this is a content channel, just something for clicks
@guywiththebottle
@guywiththebottle 2 жыл бұрын
I wish I understand more of the differences between the different types of memory management.
@maxpower7086
@maxpower7086 2 жыл бұрын
Nice explanation dude. I'll add that to my ever expanding block of computer knowledge.
@dannystoll84
@dannystoll84 Жыл бұрын
I've been bothered by a simple question regarding virtual memory. Suppose I have some extremely time-critical program that needs to run as quickly as possible. With virtual memory, it seems to me that every time my program reads or writes to an address (presumably this happens constantly), the operating system needs to translate this address into a physical address and look there instead. Wouldn't this introduce a significant amount of runtime overhead to the program? I recognize the countless benefits of virtual memory -- from sharing memory between processes to general system security -- but are there not situations where it would be preferable to avoid this overhead and use direct physical memory access?
@Richardincancale
@Richardincancale Жыл бұрын
@@dannystoll84 Hi - doing the lookup to translate from virtual to real address is done using associative memory - one register per virtual page and this is effectively done in parallel for all pages, so it’s extremely fast - much faster than memory access. If the page is marked as not in memory then an interrupt is raised and the OS has to get the page from disk/SSD which is orders of magnitude slower. For information that is time critical or for other reasons must always be available, eg for DMA transfers, pages can be marked as being permanently resident in memory, so they are never swapped out. Hope this helps?
@I.____.....__...__
@I.____.....__...__ 2 жыл бұрын
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).
@nullptr.
@nullptr. 2 жыл бұрын
Isn't that done regardless of virtualization? the OS won't let your program touch memory outside of the bounds allocated to it, being referenced directly or through translated addresses, and the shared memory for libraries will be read-only for your process regardless
@KohuGaly
@KohuGaly 2 жыл бұрын
@@nullptr. When your program is running your OS (likely) doesn't. The OS needs to be notified when invalid address is being accessed. For that to happen, the hardware needs to know which addresses are valid. Presumably, without asking the OS every single time a memory access happens (because that'd be colossal waste of time). It is possible to do this without virtualization, with more primitive mechanisms. But there needs to be _some_ mechanism to facilitate this.
@AndrewTSq
@AndrewTSq Жыл бұрын
I've wondered about this.. does this mean a buffer overflow is impossible then?
@TheBrainn
@TheBrainn Жыл бұрын
Back when there were operating systems like ms dos and windows 3.1 and 95 and all that jazz before program memory was virtualized the OS memory on non Unix systems would often crash whenever a program crashed, which would sometimes be every two or so hours if you were lucky
@TheBrainn
@TheBrainn Жыл бұрын
@@AndrewTSq a technical failure such as a buffer overflow or any memory leak would still just result in crashing other programs running even on virtualized OS memory, that is until software arbitration improved with the introduction of IPCs and processes/services.
@JustFamilyPlaytime
@JustFamilyPlaytime 2 жыл бұрын
Someone take away his pastel coloured markers and give him a black pen - then we'd be able to see his diagrams!
@GrumpyDerg
@GrumpyDerg 2 жыл бұрын
YES!
@bentoth9555
@bentoth9555 2 жыл бұрын
Orange highlighter on white paper was an awful decision.
@zaphodbeeblebrox1695
@zaphodbeeblebrox1695 2 жыл бұрын
It's of course a highlighter pen, used normally to *highlight* EXISTING black text/writing.... the clue is in its title - to use as just a pen is just plain ridiculous
@franziscoschmidt
@franziscoschmidt 2 жыл бұрын
Hard words but justified
@bentoth9555
@bentoth9555 2 жыл бұрын
@David Jameson He had, and uses later in the video, other more visible colors on hand. He could've gone with the darker ones to start.
@stensoft
@stensoft 2 жыл бұрын
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.
@framegrace1
@framegrace1 2 жыл бұрын
Not really, each VM is just an "application". It will make no difference, the most recent used page will always be the most recent used page on all VM's anyway. Also, that would be impossible (you would need a physical MMU per each VM).
@stensoft
@stensoft 2 жыл бұрын
@@framegrace1 You don't need a separate MMU per VM, just a MMU which supports two levels of mapping such as Intel VT-x and AMD-V.
@dipi71
@dipi71 2 жыл бұрын
@@framegrace1 If you think of running an OS just like an »application«, you might think of software-emulating the whole machine including MMU, CPU, graphics etc. Actual virtualization does much more than that, so Jan Sten Adámek's original point is an apt ovservation.
@MasterGeekMX
@MasterGeekMX 2 жыл бұрын
And this is the comment Steve wanted.
@Danny-hj2qg
@Danny-hj2qg 2 жыл бұрын
I've had the question in the title of this video for numerous years. Thank you Computerphile.
@davidmurphy563
@davidmurphy563 2 жыл бұрын
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.
@lordplenty
@lordplenty 2 жыл бұрын
42.
@adamsbja
@adamsbja 2 жыл бұрын
Brady was described by Matt Parker as the audience in the room. He has a knack for asking the right questions at the right time for what the viewer is thinking.
@ShainAndrews
@ShainAndrews 2 жыл бұрын
@@lordplenty Thanks for all the fish.
@ZacharyVogt
@ZacharyVogt 2 жыл бұрын
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.)
@jkobain
@jkobain 2 жыл бұрын
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.
@HazyJ28
@HazyJ28 2 жыл бұрын
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.
@hardlyb
@hardlyb 2 жыл бұрын
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.
@TheOriginalJohnDoe
@TheOriginalJohnDoe 2 жыл бұрын
Starting the weekend well!
@fllthdcrb
@fllthdcrb 2 жыл бұрын
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...
@toby9999
@toby9999 2 жыл бұрын
I can still remember writing 6502 code all in hex for the C64. No assembler.
@ralfbaechle
@ralfbaechle 2 жыл бұрын
@@toby9999 Which after a while burns the hex numbers of the opcodes so badly into the brain that now about 40 years later I still do recall all the commonly used opcodes of the 6502.
@fllthdcrb
@fllthdcrb 2 жыл бұрын
@@toby9999 ISTR I did that a few times myself. In retrospect, it's rather hardcore. 😆 And since you said, "6502", I should mention something else. The C64 had the 6510, which was pretty much a 6502 with an added I/O port, mapped to the bottom 2 bytes of the address space (alas, sacrificing some of that precious zero page), which the C64 used for controlling bank switching (it was equipped with a full 64 KiB of RAM _and_ 20 KiB ROMs _and_ several chips with memory-mapped registers, and it wasn't possible to have all of it available at once in a single 64 KiB space) and the tape drive.
@williamdrum9899
@williamdrum9899 2 жыл бұрын
@Ralf Baechle ORG 0C00 EE 20 D0 4C 00 0C
@williamdrum9899
@williamdrum9899 2 жыл бұрын
@Daniel Dawson Had I known that from the beginning I would have never used $00 to store joystick reads... my game kept crashing and I had no idea why!
@marksterling8286
@marksterling8286 2 жыл бұрын
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
@b1lleman
@b1lleman 2 жыл бұрын
If it was Solaris then it's absolutely normal (standard) that it does non-logical things :-)
@RonJohn63
@RonJohn63 2 жыл бұрын
You could have partitioned an existing HDD. The _real_ problems were that the swapping algorithms were still primitive (Linux swap partitions also needed to be 1.5x RAM size) and that Sun assumed that you wanted swap (which at the time, given RAM sizes, was reasonable).
@ralfbaechle
@ralfbaechle 2 жыл бұрын
Oddly I was just thinking about this a few minutes before finding your comment. That said, I thought it the minimum size of swap was twice that of physical memory? This requirement did also affect other BSD derivates and there was a technical reason for it but I long forgot it. Maybe somebody else can explain?
@ralfbaechle
@ralfbaechle 2 жыл бұрын
@@RonJohn63 Linux - the kernel that is - never had a requirement for swap. It's just the installers of some Linux distributions stubornly insisted on a swap partition. Sometimes one could wiggle around that, sometimes one had to just accept that and remove the swap partition after the installation was complete.
@framegrace1
@framegrace1 2 жыл бұрын
That was not a caprice, or a way to sell more disk. It was recommended so the OS could store the memory and the symbols on kernel panics. So they could investigate later if needed. Almost all early Unixes did the same, Linux included. Curiously enough, nowadays Laptops use this same feature to be able to hibernate; they dump all memory to swap like when a panic, so they can restore the laptop to exactly the same state on restart.
@sharpfang
@sharpfang 2 жыл бұрын
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.
@jonasdaverio9369
@jonasdaverio9369 2 жыл бұрын
I guess you would call them registers at this point, or is there any reason not to?
@sharpfang
@sharpfang 2 жыл бұрын
@@jonasdaverio9369 Not really. It had registers - accumulator, 12-bit pointer register, PC, status, SP (imagine using stack on that 😂). It was a specific set of chips of a family that had all the same core but with different peripherals and different RAM sizes: 4, 16, 64 and 128 bytes of RAM variants, and 1-4k program memory. This one was just the most stripped down one, cheapest of them. I got myself a 64b/1k variant with built-in ADC, never got to use it.
@jonasdaverio9369
@jonasdaverio9369 2 жыл бұрын
@@sharpfang Why would you want 4 bytes of RAM if you already have so much registers? (Wow, 8 bytes of memory just with registers, that must seem a lot compared to the RAM). I can't seem to understand why it would be economical to be that restrictive on RAM when you already have a comparable amount of registers.
@sharpfang
@sharpfang 2 жыл бұрын
@@jonasdaverio9369 accumulator receives result of every command, so it's not suitable for storing data. 12-bit pointer register is necessary to access the program/data memory, so if you use it for storing own stuff, you can't access any static data, just your 4 bytes of RAM. Can't really mess with PC because that's what makes the program run at all. Status is essentially read-only, and changes after every command, so no storing stuff there. Only the 1 byte of SP could be usable for storing variable data.
@jonasdaverio9369
@jonasdaverio9369 2 жыл бұрын
@@sharpfang Ok, my point was just that you could consider your RAM as general use registers, even though it's an external device. It would be used in a very similar way (the only difference would be adressing)
@pistonsjem
@pistonsjem 2 жыл бұрын
finally i can leave hundreds of tabs open on my ipad exactly like my pc
@Roxor128
@Roxor128 2 жыл бұрын
I wish I only had hundreds open!
@simplyacatenjoyinglife3260
@simplyacatenjoyinglife3260 2 жыл бұрын
Who makes these thumbnails? That person needs a raise.
@mattthe2nd865
@mattthe2nd865 2 жыл бұрын
Virtual memory makes me think of "downloading more ram".
@ohwow2074
@ohwow2074 2 жыл бұрын
It kinda is like having more RAM. A process can request a block of memory from the kernel and the kernel can just give it a virtual address and still not map it to a physical location until that process really wants to write to that location. In other words the OS can lie and claim that the computer has got e.g. 16 GB of memory while it only has 8.
@AmitYadav-rp3ot
@AmitYadav-rp3ot 5 ай бұрын
Great video!!!
@tracygilmore7983
@tracygilmore7983 2 жыл бұрын
Guuyyyys, give the man a high contrast marker so we can see what he draws.
@Dayanto
@Dayanto 2 жыл бұрын
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.
@InquisitiveUniverse
@InquisitiveUniverse Жыл бұрын
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.
@williamdrum9899
@williamdrum9899 2 жыл бұрын
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 0x03FFFFFC 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.
@c1ph3rpunk
@c1ph3rpunk 2 жыл бұрын
Ben Eater’s 8-bit computer, 16 bytes, hello world works.
@samuel7998
@samuel7998 2 жыл бұрын
Doesn't Ben Eater's 8-bit computer means it has 8 bits for memory addressing? Meaning it can address 2^8=256 bytes? This one has 16 bytes of addressable memory, making it a 4-bit if I understand correctly.
@jope4009
@jope4009 2 жыл бұрын
@@samuel7998 No. When people talk about 8-bit, 16-bit, etc. computers , they mean the width of the data bus, not the address bus.
@martinbakker7615
@martinbakker7615 2 жыл бұрын
@@jope4009 actually they talk about the accumulator size. Lookup 8086 vs 8088. Same 16bit cpu except for databus.
@augustovasconcellos7173
@augustovasconcellos7173 2 жыл бұрын
This video would have been *really* useful to me a week ago when I was having my OS finals
@MyzaZoo555
@MyzaZoo555 2 жыл бұрын
So it's kinda like a hashtable but for hardware?
@sharkie115
@sharkie115 2 жыл бұрын
17:24 Linux also supports swap files. In fact you can have many swap partitions and files at the same time and even add and remove them on the fly.
@WilliamAndrea
@WilliamAndrea Жыл бұрын
You can also have virtual swap via zram!
@ysakhno
@ysakhno 2 жыл бұрын
"of course 16 byte CPU wouldn't be much use for anything" -- the guy obviously hasn't heard of Ben Eater
@andreasklindt7144
@andreasklindt7144 2 жыл бұрын
The good thing about swap files on linux is that you can add them on the fly if you need them and if your computer is still responsive. Swap files and partitions can also exist simultaniously for whatever reason there might be for such a setup. But I have a question about swap files, is there a way to read what data is stored in it? I mean, could a swap file be a potential security risk?
@harold2718
@harold2718 2 жыл бұрын
The risk can be mitigated, but yes, see the swap-digger tool for example.
@d5uncr
@d5uncr 2 жыл бұрын
Yup, if your super-secret password for some reason gets swapped out anyone with read rights on the swap file/partition can potentially read it. That's why Linux whines if your swap file has public read and suggests you chmod it 0600. You can also set up cryptswap, so your file gets encrypted and you can have your swap partition on a Luks encrypted area.
@ELYESSS
@ELYESSS 2 жыл бұрын
If you can read the swap file, you can also read the swap partition, but also read the memory directly.
@majorgnu
@majorgnu 2 жыл бұрын
@@d5uncr That's why applications should keep their secrets in mlock'd memory. See: man 2 mlock
@Mythilt
@Mythilt 2 жыл бұрын
In a way, memory chips do this all the time, since there is the address map, the logical map, and the physical map in the chip. The address map is what the CPU see as the memory locations, e.g. 0x0023-0x0025. The logical map is how the addresses are in the chip the address sequence might be 0x0023, 0x0025, 0x0024 for instance. and the physical map is how the actual memory cells are laid out on the chip, usually bit grouped instead of byte grouped, all the first bits are grouped, then the second bits are grouped, etc. Again, the order of the bits might be different on the chip as well, with the physical locations of the third bits of the byte are next to the first bits instead of the second. I'll admit I'm a bit out of date w/regards to memory layout since its been 21 years since I worked on testing the chips, so it might not be the same anymore.
@phasm42
@phasm42 2 жыл бұрын
When I first learned about virtual memory (in the context of 386 protected mode) all the pagetable stuff seemed like a bunch of convoluted nonsense. Now, I see how elegant it is, page faults transferring control to the OS to load pages of memory from disk into RAM, and the program continues on its way none the wiser.
@raindropssonroses
@raindropssonroses Жыл бұрын
I got the same sense when I initially started with this concept too. Especially multilevel paging... but the more I think about it now, all these core designs are really so beautiful and elegant. Blows my mind how the cpu literally does not know the difference between an app, a driver, our os, or anything else. All these are artificial boundaries created by us humans :) My teacher once gave the analogy of cpu being just a buzzsaw lol
@ratdude747
@ratdude747 2 жыл бұрын
I thought paging files/partitions were mostly phased out due to SSD wear leveling concerns? I know this was a big issue with running windows XP/Vista on SSDs (and whether or not to have a swap partition on linux systems).
@RonJohn63
@RonJohn63 2 жыл бұрын
The algorithms used by SSD controller chips got better. Of course, _the_ solution is to have lots and lots of RAM. (Thus, while my CPU is still an archaic FX-6100, the mobo is filled to it's 32GB max, and I use a SATA SSD drive.)
@framegrace1
@framegrace1 2 жыл бұрын
IIRC, SSD's have a similar "Memory Mapping" technology inside which makes the wear leveling for you. So you write lineal, but the SSD scatters the data all over the place. Anyway, remember that pages on memory Pages on disk. You can use a different storage algorithm to store the page depending on the underlying storage, if you want.
@trelligan42
@trelligan42 2 жыл бұрын
01:50 I think you just named a semiconductor company. I can see it now; *_Luminous Computers_* in some warehouse district, with a giant sign in Neon (real or simulated).
@andljoy
@andljoy 2 жыл бұрын
I am more shocked iOS did not support swap/virtual memory/page before now.
@funposting8912
@funposting8912 2 жыл бұрын
Internal builds have had it available for a long time, it’s not that it wasn’t possible, it’s that generally, it’s just not a good idea. As a rule, you should not need to swap on a mobile platform. Still, systems built for two applications are going to start supporting eight concurrent applications overnight, so fair enough
@Arikayx13
@Arikayx13 2 жыл бұрын
RIght! What is this Apple System 7.5?
@Acorn_Anomaly
@Acorn_Anomaly 2 жыл бұрын
I think they did, but at an OS/program level, not app level. Same as Android.
@sub-harmonik
@sub-harmonik 2 жыл бұрын
.. did you watch the whole video?
@briancoverstone4042
@briancoverstone4042 Жыл бұрын
I'd like to know more about a hypervisor running multiple operating systems with identical read only blocks. Does it dedupe and combine blocks across VM guests during idle time? And does VTd speed up hypervisor memory lookups?
@yaiirable
@yaiirable 2 жыл бұрын
Can I finally download more RAM?
@cidercreekranch
@cidercreekranch 2 жыл бұрын
Segmented addressing. Never mention that again! :)
@nHans
@nHans 2 жыл бұрын
Goodness! Using two 16-bit registers on the 8086 to create a 20-bit address of the form Segment:Offset ... nightmares! Even today, when buying clothes, I get a shiver when I see _Small, Medium, Compact, Large,_ and _Huge._ 👻
@MountainKing123
@MountainKing123 2 жыл бұрын
Have you ever considered a series for GPUs? I think it would be great, since there are barely any reliable and modern information about how GPUs actually work nowadays.
@electric_sand
@electric_sand Жыл бұрын
Have you found any? I'm in the same boat, can't seem to find some solid information on GPUs
@user-yv1qs7sy9d
@user-yv1qs7sy9d 2 жыл бұрын
I don't know if I got correctly what the professor said about the multilevel translation but modern systems do use it. Each process commonly uses only a little of the available memory and its "pages" are adjacent which means that its translation table is mostly empty. This would waste memory to store the empty cells of the table. To counteract this, translation can be made multilevel, so that each table points to another, which exists only if the memory it points to is actually used.
@framegrace1
@framegrace1 2 жыл бұрын
That is done by the kernel. (and much more). MMU Optimization is maybe the main source of speed differences between OS's. THe only thing that needs to be done fast is the memory translation. How do you configure that MMU doesn't require realtime accuracy.
@user-yv1qs7sy9d
@user-yv1qs7sy9d 2 жыл бұрын
@@framegrace1 Still, that doesn't change the fact that multilevel translation does happen.
@christopherg2347
@christopherg2347 Жыл бұрын
1:35 You would likely need to salvage part of the initial program space, overwriting it with the output. Donald Knuts book had a challenge, writing the shortest program that fills the entire memory (including the program itself) with a single value. This would be similar, except no perfect overwriting of every memory cell is necessary.
@romanboman3847
@romanboman3847 2 жыл бұрын
what if there was some important data like passwords, keys can u force it to allocate on disk and then pull the plug and search on disk for this important data?
@johnsenchak1428
@johnsenchak1428 2 жыл бұрын
Can you do a video on Microsoft patches and how they protect the computers from vulnerabilities
@Faladrin
@Faladrin 2 жыл бұрын
A patch is just an update to code on the system. What the specific patch does to make things better (performance, security, new features, etc) will be different for each patch. I'm not sure what angle a video on Windows Update technology could have that would be useful for a general purpose audience.
@johnsenchak1428
@johnsenchak1428 2 жыл бұрын
@@Faladrin More specially what it means by remote code execution, elevation of privileged , security bypass
@itscarl0zyall1
@itscarl0zyall1 2 жыл бұрын
Why is this being drawn out on this kind of paper and highlighter? Was there no pen available? This is so hard to read
@webjoeking
@webjoeking 2 жыл бұрын
Virtual Pen needed to be swapped out for a real pen.
@landsgevaer
@landsgevaer 2 жыл бұрын
Chain paper: "what did I do wrong?"
@McDuffington
@McDuffington 2 жыл бұрын
This seems close to how cartridge game console like the NES and SNES worked. The cartridge basically is part of the memory and can be addressed immediately. So nothing needed to be loaded into memory; the game cartridge is the memory.
@j7ndominica051
@j7ndominica051 2 жыл бұрын
They've boosted the saturation of orange to make the pen look radioactive, but the paper is still unreadable with insufficient contrast in brightness. Isn't this what was used to be called a memory mapped file? Programs dealing media streams wouldn't attempt to load the whole file into memory, unless the program is a dumb as Windows Sound Recorder. They'd read it from disk and use a structure like Photoshop's scratch disk for edits.
@klaxoncow
@klaxoncow 2 жыл бұрын
Memory-mapped files are an application of virtual memory. Like, on Linux, you use the "mmap" function to map a file into memory (it takes a file descriptor and an offset into the file as arguments). But, if you want to just allocate RAM, then you call the same function but ask for "anonymous memory" and don't supply a file descriptor. The two things are handled through the exact same system call. On Windows, the equivalent system call is called "VirtualAlloc" and it functions more or less the same way. Memory mapped files and virtual memory are the same thing, at this level, using the same system call. The difference being whether the pages you're allocating are backed up by a physical file or not (and, as mentioned, they're called "anonymous" when they're not). It's the same thing, really. "Virtual memory" is the overall mechanism, "memory mapped files" is a particular application of it to map a file into RAM pages.
@JATmatic
@JATmatic 2 жыл бұрын
If you ever have run a program with AddressSanitizer enabled, then you get funny amounts of virtual memory used in htop. But physical memory usage is still normal.
@nonsuch
@nonsuch 2 жыл бұрын
That's a pretty trippy marker! I want one! 😛😉
@DanielJStahl
@DanielJStahl 2 жыл бұрын
Orange highlighter might not have been the best choice
@hedgehog125
@hedgehog125 2 жыл бұрын
Is there also wear levelling for RAM? And does that use a second virtual memory lookup?
@Acorn_Anomaly
@Acorn_Anomaly 2 жыл бұрын
That would likely be something implemented by the memory chips/modules themselves. While that would add another level of lookup/translation, it's probably not something the CPU would be made aware of.
@CookiePepper
@CookiePepper 2 жыл бұрын
No wear leveling for RAM.
@StephenHoldaway
@StephenHoldaway 2 жыл бұрын
Wear-leveling isn't needed for DRAM, but yes it might work like that if it was required. DRAM doesn't have write endurance limitations as it's only holding a charge temporarily for each bit, unlike flash memory which needs to force a charge through a barrier to store it when unpowered, which causes a small amount of damage each time
@charlieangkor8649
@charlieangkor8649 2 жыл бұрын
There is no wear levelling for RAM.
@congenio
@congenio 2 жыл бұрын
To answer this question, I paraphrase Seymour Cray: "Virtual memory is memory that you don't have." - what he actually said was: "Memory is like an orgasm. It's a lot better if you don't have to fake it."
@Amonimus
@Amonimus 2 жыл бұрын
Wouldn't a similar thing happen when you attach a second RAM, so its starter address has to be appended to machine's total available?
@framegrace1
@framegrace1 2 жыл бұрын
This is a benefit the video doesn't explain: Virtual memory allows the applications to use all the addressing space, no matter the physical amount of ram available. So in a 64 bits machine, the application can use any of the 16 billion gigabytes of addresses if it wants. The Memory Mapping unit will match it to somewhere on the memory you have. That means that appart of being 32 or 64 bits, the application doesn't care of the amount of memory. (The OS will send an error if there's not more RAM and the app will stop)
@H4x4t3hN00bz
@H4x4t3hN00bz 2 жыл бұрын
How much delay does virtual memory introduce versus accessing memory directly?
@compuholic82
@compuholic82 2 жыл бұрын
Depends on whether the requested data is located in RAM and whether the memory page has been accessed recently. The translation is built into the memory management unit (MMU). On all modern CPUs the MMU is directly integrated into the CPU which performs the translation on the fly. So for that part of the translation process: No delays. But of course there is a catch. In order for the MMU to do the translation, it needs access to the page table which is stored in memory. And memory accesses are slow compared to the CPU. So the MMU has a special cache, called the translation lookaside buffer (TLB). So for most requests, it can avoid to access the page table. And of course if the data is not stored in RAM but swapped out, it takes forever (well, compared to the speed the CPU runs) to swap the data back in. So long story short: Most of the time: No delay. A slight delay if the MMU needs to access the page table. And a huge delay of the page has been swapped out.
@crcrewso
@crcrewso 2 жыл бұрын
Isn't dual abstraction of address space a big thing in security. I could have sworn the second layer was undersubscribed with blocks acting basically as honey pots. When the first layer tried to manually request the location in a rude way, think off by 1 C index requests, a security exception would be raised and the OS would know that there was a bad actor thread running. Please see buffer overflow vulnerability mitigation.
@ShinyQuagsire
@ShinyQuagsire 2 жыл бұрын
Yeah it's common to put holes in virtual memory at the start+end of the stack/heap allocations. A strcpy to a heap address then couldn't corrupt other allocations, recursion won't clobber other thread stacks, etc. It doesn't help much for array index OOBs though.
@framegrace1
@framegrace1 2 жыл бұрын
AFAIK, this all comes from how kernels handle the MMU, not MMU itself or having multiple MMU's.
@primordial_platypus
@primordial_platypus 2 жыл бұрын
Didn’t IBM do an early version of this in the 1960’s.
@quintrankid8045
@quintrankid8045 2 жыл бұрын
Yes and some earlier systems had virtual memory as well.
@patheally
@patheally 2 жыл бұрын
Is this available on the M1 chip?
@astrix_mvp
@astrix_mvp Жыл бұрын
The implementation on iPad must be something more than a decades old computer technology? I can't get my head around this.
@misterhat5823
@misterhat5823 2 жыл бұрын
I've done plenty of things in assembly in embedded applications using 16 bytes or less. So it certainly isn't useless.
@bolagadalla
@bolagadalla 2 жыл бұрын
Would this somehow protect against attacks in memory tho? Meaning if someone is attacking the memory to try and get some data from there, and there is a virtual memory in place, would that somehow slow them down or prevent them from getting data out? Since they would be seeing one address but in fact its in another address. Or would it not matter?
@trelligan42
@trelligan42 2 жыл бұрын
It makes no real difference. The computer has to know how to access the information, the manufacturer has to publish details of how it's done, the attacker will have the know-how-or it's not a successful attacker. Bad attackers get no money.😁
@bolagadalla
@bolagadalla 2 жыл бұрын
@@trelligan42 thank you for the clarification. I Appreciate it.
@Gooberpatrol66
@Gooberpatrol66 2 жыл бұрын
Advertising your computer having virtual memory as a selling point in 2022 is like treating a car having wheels as a selling point.
@tanmaypanadi1414
@tanmaypanadi1414 2 жыл бұрын
if it works for the normies then that's all it needs.
@Freshbott2
@Freshbott2 2 жыл бұрын
That’s a bad characterisation. Not using it is reflective of a modern, resource efficient OS. I’m not aware if Android uses swap but if it does then it’s a recent addition. Notice that they didn’t add it to iOS. A mobile OS should be stingey with resources. They didn’t forget to add it. The point in bringing it to iPad is that it’s moving from a just a fork of a mobile OS to one focused around desktop style multitasking needing desktop amounts of RAM that just weren’t realistic before. If I had an older gen iPad I’d be more disappointed that it arrived at all rather than acting like Apple was late to add it.
@MattExzy
@MattExzy Жыл бұрын
@@Freshbott2 I just feel silly for assuming that iOS already used some type of swap for the past decade. But then again, I haven't purchased an iOS device in over a decade, either. I do know however that Android has had ZRAM (compressed virtual memory) since about version 4-something.
@TragicGFuel
@TragicGFuel Ай бұрын
@@Freshbott2 another Apple fanboy
@kikodekliko1209
@kikodekliko1209 2 жыл бұрын
How many layers of abstraction are possible before nobody in the world actually understands how a computer or application works?
@soraaoixxthebluesky
@soraaoixxthebluesky Жыл бұрын
Now I know why old computers gain so much performance from SSD upgrade due to the bit of memory being copied in a storage as a form of a translated pages (swap/ swap compressed). Accessing the HDD going to be insanely slow if you're RAM limited thus replacing it with SSD going to make a significant improvement on getting the CPU fully loaded with process. Especially on 32-bit machine with 4GB of memory. Of course we are still limited by the maximum bus speed at the end of the day even with, say, SATA3 ssd.
@ericsimaginaryfriend
@ericsimaginaryfriend 2 жыл бұрын
Nice
@chikinnunget5231
@chikinnunget5231 2 жыл бұрын
Yep
@vootkidss2704
@vootkidss2704 2 жыл бұрын
I think that safety is important and one should use double-protection technologies, such as Oreol Staking!
@joikaboela8849
@joikaboela8849 2 жыл бұрын
wow cool vid
@SergeMatveenko
@SergeMatveenko 2 жыл бұрын
Oh my! That pen...
@wisemandenny8
@wisemandenny8 2 жыл бұрын
Steve has the coolest shirt on
@dericn
@dericn 2 жыл бұрын
and it has very strong buttons!
@bryannguyen1260
@bryannguyen1260 Жыл бұрын
Virtual memory is backup RAM for when you play modern videogames like Warzone on an 8GB PC at the cost of fps.
@LanceMcCarthy
@LanceMcCarthy 2 жыл бұрын
You could probably do Hello World with 16 bytes because there are only 7 different characters. The rest of the bytes would be for mapping the duplicates
@majorgnu
@majorgnu 2 жыл бұрын
You could do Hello World with 1 byte or even less. You just need an ISA with a dedicated Hello World instruction :P
@MacHooolahan
@MacHooolahan 2 жыл бұрын
A perfectly excellent description of paging - which has been around for zonks. Sorry is there something "new", couldn't see that bit :S
@ChrisLee-yr7tz
@ChrisLee-yr7tz 2 жыл бұрын
They didn't say paging was new.
@MacHooolahan
@MacHooolahan 2 жыл бұрын
@@ChrisLee-yr7tz Indeed they didn't.
@mausmalone
@mausmalone Жыл бұрын
Every once in a while Apple or Google announces a feature in one of their devices and my only reaction is "HOW did you NOT already have that?!"
@AboveEmAllProduction
@AboveEmAllProduction 2 жыл бұрын
Highlighter not the best pen 😀
@xion1305
@xion1305 2 жыл бұрын
VERY 🤔 about Samsung's "RAM Plus" feature. Feel like their offering less RAM then normal then replacing it with this potential hoodwink. My thought is wether it's innovative or a just a gimmicky thing.
@pilotandy_com
@pilotandy_com 2 жыл бұрын
Isn’t that essentially what mmap in c is doing?
@abeachristine5446
@abeachristine5446 Жыл бұрын
Do this damage ssd
@lammatt
@lammatt 2 жыл бұрын
Download more ram?
@davidhutchinson88
@davidhutchinson88 2 жыл бұрын
Couldn't follow along with the yellow marker on white paper, very hard to read
@rynoopperman5010
@rynoopperman5010 Жыл бұрын
VMware virtualisation / MS hypervisor Mapping changes all the time cause DRS moves workloads around and re-registeres virtual memory continuously
@RobinHagg
@RobinHagg 2 жыл бұрын
Sharpie please
@wraiths_
@wraiths_ 2 жыл бұрын
Black marker pls
@tyrport
@tyrport 2 жыл бұрын
4K is the largest amount you can do 16 bit CRC with.
@MePeterNicholls
@MePeterNicholls 2 жыл бұрын
Hello world in ascii might work but ut8 🤷🏽‍♂️
@ConnorKennedy16
@ConnorKennedy16 Жыл бұрын
This video screams "computerphile: late night". I love it, but it looks like you pulled Stave from a party after a few drinks and decided to make the video right then
@brandonlink6568
@brandonlink6568 2 жыл бұрын
The opposite of this is a RAM drive but with 12 terabyte hard drives being economical they don't get much use anymore
@SirHackaL0t.
@SirHackaL0t. 2 жыл бұрын
Fyi, orange highlighter is not the best choice for showing info on paper.
@justwanderin847
@justwanderin847 2 жыл бұрын
Memory Mapping ? is that the same?
@Acorn_Anomaly
@Acorn_Anomaly 2 жыл бұрын
In many cases, pretty much. Memory mapping the file is asking the OS to make the contents of a specific file available to your program at a specified memory window. (And in fact, the process of translating between logical/virtual memory and physical memory is often referred to as "memory mapping".)
@decanmusic2997
@decanmusic2997 2 жыл бұрын
do a video about the google AI being self-aware, please!
@Computerphile
@Computerphile 2 жыл бұрын
coming right up :) -Sean
@decanmusic2997
@decanmusic2997 2 жыл бұрын
@@Computerphile 🤩
@sushanshakya
@sushanshakya 2 жыл бұрын
It's very confusing that the OS will somehow manage the logic of Virtual memory as OS is also running in the CPU and possibly using the data from RAM itself.
@briancoverstone4042
@briancoverstone4042 Жыл бұрын
Some RAM is marked as Do Not Swap. Such as the code that does the actual memory swapping. Otherwise it could swap itself out, similar to one eating their own head.
@johhue
@johhue Жыл бұрын
I am colorblind. Cannot see any of these diagrams.
@alexrossouw7702
@alexrossouw7702 2 жыл бұрын
Highlighters are supposed to be the most visible pen
@subliminalvibes
@subliminalvibes 2 жыл бұрын
Reminds me of the old 'Download extra RAM' popups. 😆
@Roxor128
@Roxor128 2 жыл бұрын
Those would have been advertising memory-compression software if legitimate. You heard about it a lot back in the 1990s, but it was also quite unreliable. Get an error in the underlying compressed block of memory, and you'd be looking at the Blue Screen Of Death. Since then it's been implemented as part of the OS with improved reliability (presumably through use of error-correction codes to guard against memory errors). Windows, Linux and MacOS all support it, and one of the Linux implementations found its way into Android 4.4. The _illegitimate_ examples would range from at best just increasing the size of your swap file (something you can do yourself in about a minute and a reboot if you know where to look in Windows' copious amount of settings), often doing nothing at all, and at worst being outright malware.
@steamrangercomputing
@steamrangercomputing Жыл бұрын
Is it just me or does apple sound really outdated? Like in this video virtual memory is mentioned as a new thing on iPads, and in another video a modern looking Mac was mentioned as having a 2 core cpu. Both of these things have been popular since the early 2000s.
@47Mortuus
@47Mortuus Жыл бұрын
2:29 Am I high? (The marker)
@AndersonTheAgent
@AndersonTheAgent 2 жыл бұрын
Who diagrams with a highlighter???
@timng9104
@timng9104 2 жыл бұрын
can we take a look at PassKey announced by Apple and maybe Google, Windows soon. hardware security primitives what are they?
@Lion_McLionhead
@Lion_McLionhead 2 жыл бұрын
The lion kingdom has always turned off swap space for solid state storage, out of fear of using up the write cycles. Not sure if they're doing it for planned obsolescence or because people have enough money to just not care about write cycles.
@bradyblough
@bradyblough 2 жыл бұрын
Drawing in orange highlighter was a bad move. You’d think they’d realize that the camera wasn’t going to pick it up well.
@aw34565
@aw34565 2 жыл бұрын
10PRINT"HELLO WORLD" on my BBC Micro takes 20 bytes (The difference between TOP and PAGE).
@TheSudsy
@TheSudsy 2 жыл бұрын
The opposite of RAM disc.
@luv2stack
@luv2stack 2 жыл бұрын
Genius
@tristanrogers1780
@tristanrogers1780 2 жыл бұрын
Virtual memory is the best
@murtadhaaldulaimi4825
@murtadhaaldulaimi4825 2 жыл бұрын
LFG if you don’t work with Oreol Staking provider yet
But, what is Virtual Memory?
20:11
Tech With Nikola
Рет қаралды 213 М.
Apple M1 Ultra & NUMA - Computerphile
15:24
Computerphile
Рет қаралды 254 М.
Василиса наняла личного массажиста 😂 #shorts
00:22
Денис Кукояка
Рет қаралды 8 МЛН
PINK STEERING STEERING CAR
00:31
Levsob
Рет қаралды 22 МЛН
Is 8 GB of RAM enough? macOS RAM management explained
15:37
Definitive Mac Upgrade Guide
Рет қаралды 22 М.
How WiFi Works - Computerphile
17:19
Computerphile
Рет қаралды 197 М.
LogJam Attack - Computerphile
18:47
Computerphile
Рет қаралды 179 М.
Analog Chip Design is an Art. Can AI Help?
15:48
Asianometry
Рет қаралды 185 М.
Your Computer is Lying To You (Virtual Memory)
6:51
Jacob Sorber
Рет қаралды 16 М.
Why the Soviet Computer Failed
18:57
Asianometry
Рет қаралды 2,9 МЛН
Just In Time (JIT) Compilers - Computerphile
10:41
Computerphile
Рет қаралды 261 М.
How does Computer Memory Work? 💻🛠
35:33
Branch Education
Рет қаралды 3,7 МЛН
Stack vs Heap Memory - Simple Explanation
5:28
Alex Hyett
Рет қаралды 196 М.