Virtual Memory: 4 How Does Virtual Memory Work? - バイリンガル字幕

Now, let's talk about how virtual memory works, and we're going to introduce two concepts here, virtual and physical addresses and some acronyms for them.
So how does virtual memory work?
The basic idea is we have these separate memory spaces.
So virtual memory is what a program sees.
Physical memory is the physical RAM in the computer.
When you install memory in your computer or you buy a computer with memory, this is what you're paying for.
What the program sees, the virtual memory, this is what the ISA promises.
So remember in MIPS, this promises the virtual address.
So if we do a load R4,024 R0, this is going to access a virtual address 1,024.
So the MIPS ISA promises a certain virtual memory address space, but the physical memory is what you have in your machine.
So if you have two gigabytes of RAM installed,
you're going to have physical addresses from 0 to 2 to the 31 minus 1, that's 2 billion bytes of memory.
So virtual addresses or VA,
we're going to abbreviate the virtual addresses VA, this is what the program uses, and in MIPS it's a 32-bit address space.
The physical addresses or PA, is what the hardware uses, or And this is determined by how much RAM you have installed.
If you only have a little bit of RAM installed, your physical address space, or your PA, is going to be small.
If you have a lot of RAM, it's going to be big.
But now we have separate address spaces here.
So each program is going to have its own virtual address space, and we have a physical address space for our memory.
So how do we make this work?
How does a program work?
So, the program executes a load, and the load is going to specify a virtual address because that's the way programs work.
So, here's our processor, it's running the program virtual address space, and here's our load.
So, load R3, 1024 R0.
What's the physical address going to be here?
Sorry, virtual address?
Well, it's just going to be a thing.
So the processor is going to access a virtual address 1024.
That's what this instruction is going to do.
Now, the computer is going to translate this virtual address to the physical address in the memory.
So we're going to have a translation here.
This is our map from virtual address to physical address.
And it's going to tell us how to get the data over here.
So here's the data we want for R3.
This map is going to tell us how to get this.
So we go ahead and tell the translation or the map here, we want virtual address 1,024.
It looks it up in its map, it oh, virtual address 1,024 maps to physical address 2.
So it goes over here to physical address 2,
and it goes over here Now, if the data is not in memory, it goes and loads it from disk.
In this case, it is in memory, so we're going to take this data here and we're going to return it.
So we took virtual address 1024, translated it to physical address 2, and now we send this back so we get the data.
Now, we go ahead and do another instruction.
This instruction here is going to load virtual address 512.
So we go over to our translation, ask it where 512 goes, it hey, it to physical address 12.
So we get on to physical address 12 here, go ahead and get our data, and we send it back.
Now we do another instruction, this is an add instruction, it's just using registers.
So we don't need to do any translation here.
And then we go and we have another instruction, this is going to access virtual address 700.
Sorry, 786.
So we go to virtual address 786.
The map tells us it's on disk.
It's not in memory.
Okay, it's on disk.
So what do we need to do with to get it?
Well, we need to load it into memory.
So we go ahead and load this data into memory.
Once we've loaded in memory, now we go and update the translation.
Okay, so now we no longer want to translate address 786 to disk.
We want to translate address 786 to disk location and memory.
So update that to 4.
Now when we put in virtual address 786, we get out physical address 4.
We ahead and load it from data from the memory and we return the value.
So, program executes and load with a virtual address, the computer translates it into the
physical address,
if it's not in memory,
we it from disk, and then the computer reads the RAM using the physical address and returns it to the program.
That's how virtual memory works.
So a question.
What address is located here, so address r12 has the add, sorry, value and the program issues this load.
What location in RAM is going to be accessed?
Well, we need more information here.
The program is accessing virtual address 1536,
that's what this is going to do here, but we don't know what physical address that's going to be.
So here's our processor.
It's in the program's virtual address space and we do this load.
This load is going to generate virtual address 1536,
but we're going to have a map and the map's going to tell us which physical address it is.
Now, if I don't tell you what the mapping here is, you have no idea what location in RAM this address is going to access.
So we need more information to know what memory we're actually going to access when we issue this instruction.
There's another question about using too much If a program uses more data that can fit into RAM, where does the data go?
Well, it's going to go to disk.
If it doesn't fit into the memory, we're going to use virtual memory to map it to disk.
So here's a load.
So this load's going into our table and we didn't have enough space and memory in physical memory for this virtual address.
The translation table, the map here, will tell us that it's on disk and we'll know it's on the disk.
And so you can put the data on disk if it doesn't fit into memory.

さらなる機能をアンロック

Trancy拡張機能をインストールすると、AI字幕、AI単語定義、AI文法分析、AIスピーチなど、さらなる機能をアンロックできます。

feature cover

主要なビデオプラットフォームに対応

TrancyはYouTube、Netflix、Udemy、Disney+、TED、edX、Kehan、Courseraなどのプラットフォームにバイリンガル字幕を提供するだけでなく、一般のウェブページでのAIワード/フレーズ翻訳、全文翻訳などの機能も提供します。

全プラットフォームのブラウザに対応

TrancyはiOS Safariブラウザ拡張機能を含む、全プラットフォームで使用できます。

複数の視聴モード

シアターモード、リーディングモード、ミックスモードなど、複数の視聴モードをサポートし、バイリンガル体験を提供します。

複数の練習モード

文のリスニング、スピーキングテスト、選択肢補完、書き取りなど、複数の練習方法をサポートします。

AIビデオサマリー

OpenAIを使用してビデオを要約し、キーポイントを把握します。

AI字幕

たった3〜5分でYouTubeのAI字幕を生成し、正確かつ迅速に提供します。

AI単語定義

字幕内の単語をタップするだけで定義を検索し、AIによる定義を利用できます。

AI文法分析

文を文法的に分析し、文の意味を迅速に理解し、難しい文法をマスターします。

その他のウェブ機能

Trancyはビデオのバイリンガル字幕だけでなく、ウェブページの単語翻訳や全文翻訳などの機能も提供します。

始める準備ができました

今すぐTrancyを試して、ユニークな機能をご自分で体験してください。

ダウンロード