WEBVTT 1 00:00:04.620 --> 00:00:17.070 William Cheng: Welcome to lecture 20 so Colonel three is do in a week. If you have co from previous semester, don't look at them. Don't copy them best to get rid of it. And also, again, it's important 2 00:00:17.609 --> 00:00:28.380 William Cheng: To understand to read through FAQ and understand all the lecture material. If you're sort of falling behind, you should sort of, you know, through some catching up. Also, watch the week 10 discussion. 3 00:00:28.950 --> 00:00:43.530 William Cheng: Section video. You know what I talked about, you know, through the object dumb. So you can look at those, those, those assembly code again Colonel three grading guidelines, a little different. So again, you should, you know, take a look at it because sort of tried to sort of figure out 4 00:00:45.210 --> 00:00:49.710 William Cheng: You know how to get as many points as you can. So in the end, 5 00:00:50.400 --> 00:01:00.420 William Cheng: It might not be. It might be the case that you cannot finish the entire Colonel three. So again, you should start looking at where the point distributions are and try to sort of figure out how to get the most number of points. Okay. 6 00:01:01.200 --> 00:01:10.470 William Cheng: After you made a submission. Make sure you verify your carnal submission. So again, for current one and two. Some people really didn't do that. And the ends and it cost them a lot of points, you know, 7 00:01:11.280 --> 00:01:13.140 William Cheng: For them to fix some really silly bugs. 8 00:01:14.010 --> 00:01:19.230 William Cheng: So again you know as soon as you make your final submission, you should you should you should verify your current submission 9 00:01:19.470 --> 00:01:24.840 William Cheng: I know that it takes a long time to verify no submission. But again, you know, I mean you you spend so much time working on it. 10 00:01:25.410 --> 00:01:30.240 William Cheng: You should be a little paranoid that you know when you make a final submission. What did you make a mistake. 11 00:01:30.960 --> 00:01:38.160 William Cheng: Okay, so in that case, again, you know, go go through the procedure and you know so. So at least compile your code. Make sure you put your code. 12 00:01:38.640 --> 00:01:45.990 William Cheng: To make sure that your code and compile yeah alright so so it ready so that has maybe you can just run through the last few tests that they, you know, they're supposed to work. 13 00:01:46.530 --> 00:01:58.140 William Cheng: So again, you know, don't lose any silly points. Yeah. And if you're stuck, you know, please contact me as early as possible. Don't wait until the last day, you know, if you contact me on the last day there's really nothing I can do. Yeah. 14 00:01:58.920 --> 00:02:06.960 William Cheng: All right. So right now we are you know sort of nine days into kernel three. So, you are supposed to be in phase two. 15 00:02:07.350 --> 00:02:14.250 William Cheng: You should be, you know, getting for can work your way towards implementing shadow object, you should, you know, implementing do fork. 16 00:02:14.850 --> 00:02:23.460 William Cheng: So again, you know, we look at the Colonel's we have the accounts we FAQ. So, so give you a hint of what to do to implement do for now. 17 00:02:24.000 --> 00:02:30.000 William Cheng: This weekend you should try to get a spin in it toward again. That means that you should implement do em map and do em on that. 18 00:02:30.360 --> 00:02:42.360 William Cheng: And try to get the the Malik to work, you know, inside the user space program. And then, you know, finally, the last week I usually try to get as many tests in Section D to pass as possible. Yeah. 19 00:02:44.070 --> 00:02:56.790 William Cheng: Alright, so, so we're still talking about virtual machines. So last time we talked about, you know, three ways to get around pack and GoPros theorem. So, so let's take a 20 00:02:58.050 --> 00:03:07.950 William Cheng: Little more detail. So last time already mentioned, you know, what is the the sort of solution for VMware. So over here we just sort of, I just want to mention that 21 00:03:08.580 --> 00:03:25.500 William Cheng: You know, this is a, you know, a sort of a very profitable, you know pattern for for VMware if you look up at the top 10, you know, technology pattern in the in the world, the VMware patent over here is way up there because you know with this pretty good technology. 22 00:03:26.610 --> 00:03:34.170 William Cheng: Certainly made them all the money yeah so so that's be aware of the we have something called Virtual Box. So he's VirtualBox doing something similar. 23 00:03:34.530 --> 00:03:36.660 William Cheng: Okay so Virtual Box was originally 24 00:03:37.080 --> 00:03:47.880 William Cheng: You know, I guess they were implemented by Sun Microsystems, I mean, Sun Microsystems, they're the one that that that they implemented workstation. They have their own, you know, a Solaris operating system. So they are serious operating system people 25 00:03:48.480 --> 00:03:55.290 William Cheng: So in the end, what they did is that they basically do something similar, but they don't want to infringe on the patent or VMware so once you, you know, sort of, sort of, 26 00:03:55.500 --> 00:04:00.270 William Cheng: Once you have a patent people can actually look at it and they will find some different ways of doing exactly the same thing. 27 00:04:00.660 --> 00:04:09.300 William Cheng: Then so Virtual Box appears to do the same thing. Very, very similar to VMware without infringing on their patent. Yeah. So you can actually, you know, read this. 28 00:04:10.230 --> 00:04:21.960 William Cheng: This URL over here you know for some of the details, where the Virtual Box people's would explain. Well, you know what they did, yeah. So Virtual Box. Of course, one of the great thing is that it's free. You can just download it and run it right 29 00:04:23.520 --> 00:04:31.860 William Cheng: All right. The second approach was to fix the hardware. So Intel, they come up with sort of a new CPU. They call it the vendor pool, you know, technology. 30 00:04:32.430 --> 00:04:41.250 William Cheng: So Robin is out if you install you know, less than a few install Linux on the real hardware not. Is that a virtual machine if he installed in a real hardware. 31 00:04:41.820 --> 00:04:54.120 William Cheng: Will you finish, you know, what will you finish booting openness is them if you get if you get a console window if you get a terminal, you can actually type to come in the LM S G get so the MS MS, you will be 32 00:04:54.630 --> 00:05:09.240 William Cheng: will display all the messages that that the colonel prints out. I want to try to do the operating system. Okay. I mean, well, you run, we need you see a lot of stuff a flyby at the beginning for Linux. There's the same thing, right. But, but, you know, typical liberal Unix 33 00:05:10.350 --> 00:05:16.080 William Cheng: Linux, we're gonna see a graphical user interface all the messages were hidden away from you, then, so to see all the 34 00:05:16.320 --> 00:05:26.160 William Cheng: Messages, you can use the D MEMS messages and then you can actually look for the string BTS. If you can see the string BTS, then you are you know your CPU is using the vendor. 35 00:05:27.000 --> 00:05:33.180 William Cheng: The vendor put technology, right, what does the vendor put technology, the vendor portal technology, you know, add one more ring. 36 00:05:33.630 --> 00:05:38.430 William Cheng: You know, to to to to to go into. So instead of having four rings the add another ring. 37 00:05:38.790 --> 00:05:48.120 William Cheng: This is called ring negative one. Good. This is, this is not read dash 100 minus one. So even more privileged than zero, right, zero is the most privileged. This one is more 38 00:05:48.420 --> 00:05:58.290 William Cheng: Privilege, they call it the room out. So all the other other mode that I had before. It's called a non GMO guys are clearly the rumor is reserved to run the virtual machine mother to run hypervisor. 39 00:05:58.740 --> 00:06:07.320 William Cheng: That they also want to sort of do this in a in a pretty generic way, not, not just to fix the pop up, you know, a problem there basically says, Well, you know, 40 00:06:07.800 --> 00:06:18.330 William Cheng: In kind of operation that you execute you know in different things, if it meets the criteria you need to actually track into into the hypervisor you're trying to the the the virtual to monitor 41 00:06:18.630 --> 00:06:25.980 William Cheng: Then, so they call this VM x it so you are running that virtual machine and you exit the virtual machine and then you go into the going to the hypervisor. 42 00:06:26.310 --> 00:06:32.250 William Cheng: Yeah, so what the weather will do is that you know when when when when you first put your charity pull into the 43 00:06:32.580 --> 00:06:44.010 William Cheng: Reporting to remind us why is that we put into the room. Oh, and then what it would do is it will use configuration file to specify when you execute code inside with 012 and three under what kind of condition. You need to come into supervisor. 44 00:06:44.640 --> 00:06:52.200 William Cheng: Okay, sorry. You need to come into the hypervisor. So they have a lookup table to say if you execute pop evergreen zero why in this case you will need to come 45 00:06:52.380 --> 00:07:03.420 William Cheng: Up, it will cause a VM exit and you end up in the hypervisor or even get a paintball, you will come into the hypervisor. You can do you know all the other condition they sort of done in a table driven way. 46 00:07:03.930 --> 00:07:12.180 William Cheng: So that you know so so you can actually set things up and bring minus one. And then when you go into your virtual machine when those conditions happened you 47 00:07:13.230 --> 00:07:17.370 William Cheng: You're going to end up you know inside the, you know, he's not a hypervisor. 48 00:07:17.820 --> 00:07:22.590 William Cheng: OK. So again, this is what another way to get around, you know, Pope, I can go Burke's theorem. 49 00:07:22.830 --> 00:07:32.340 William Cheng: Because if you use the extra mode over here and then you specify under what condition you exit the VM and go into the hypervisor. Again, you get it, you can actually get around the problem. 50 00:07:32.820 --> 00:07:43.950 William Cheng: Yeah, so the way that they do this right, they do they all these conditions that can, you know, can, can cause BMX it, such as pop up and also some other you know instruction that the that that 51 00:07:44.460 --> 00:07:49.860 William Cheng: That also prevent into up on building a virtual machine you list all those instruction we accidentally construction now. 52 00:07:50.280 --> 00:08:03.000 William Cheng: You tap into the hypervisor. Okay. They also include whenever you get a pace fault, you know, inside your virtual machine. Why, in this case, you will actually do you actually come into the hypervisor the hypervisor can actually emulate a pitfall. Yeah. 53 00:08:04.170 --> 00:08:13.170 William Cheng: Alright so this room mode is only used by the hypervisor. So if you don't have a hypervisor then know that everything is backwards compatible. Yeah. 54 00:08:13.770 --> 00:08:25.080 William Cheng: So these days, I think, you know, if you are. I don't know if you have ever used seem OS windows. If you get to run CMC windows, you can actually set up to see whether whether your CPU support virtualization or not. 55 00:08:25.440 --> 00:08:29.940 William Cheng: So you describe a separate virtualization. That means that he uses the vanderpool technology. Yeah. 56 00:08:34.260 --> 00:08:45.360 William Cheng: Alright, the last approach was to do what was the power virtualization. So again, once you do virtualization, you can take all the code inside of Colonel, so that's also the easy way to get around the pole pack and GoPro camera. Yeah. 57 00:08:46.440 --> 00:08:54.000 William Cheng: Alright, so that's that that's how you you know that that's how you defeat that paper. And that's how you virtualize the CPU. 58 00:08:54.660 --> 00:09:04.050 William Cheng: What about IO virtualization. Right. So. So again, you know, one of the main problem with the you know with with Intel CPU or with windows and doors and these kind of stuff. 59 00:09:04.410 --> 00:09:10.110 William Cheng: Is that there are too many device driver. If you try to virtualize every device driver that's too much work. Yeah. 60 00:09:10.800 --> 00:09:22.680 William Cheng: So so so the main problem over here is going to be scalability. If you want to scale, you have to virtualize all the device driver. So typically, you know, inside virtual machine. We don't try to virtualize all the devices, right. So, so we try to do as few as possible. 61 00:09:23.850 --> 00:09:31.230 William Cheng: So, so let's take a look at you know what what what needs to be done so. So originally if you're running a machine, right, the machine looks like this. Right. We have the user space. 62 00:09:31.470 --> 00:09:40.170 William Cheng: We have the Colonel, we have the hardware at the bottom. So again, there are two kinds of hardware. There's devices and they're CPUs. Okay. And then inside the operating system right when you 63 00:09:40.530 --> 00:09:47.100 William Cheng: Try to use the devices, you're gonna you're gonna use device drivers. OK. So again, the scalability problem is that for system like Windows 64 00:09:47.670 --> 00:09:55.830 William Cheng: You know, the, the number of devices over here is it's astronomical. So in this case, you have to virtualize all these device drivers that in that case will be too much work. 65 00:09:56.130 --> 00:10:03.480 William Cheng: Now, alright. So if you run this inside a virtual machine. And what does that look like, right. So again, this particular machine is going to go up into in 66 00:10:04.350 --> 00:10:11.190 William Cheng: The kernel and the user space, they're going to go into the user space of the virtual machine. So, so, so, so, in a sense, everything is done move up a level. 67 00:10:11.610 --> 00:10:17.670 William Cheng: Okay, so therefore the picture will look like this. Right, this is no no this is going to be the real machine, the user spaces right here. 68 00:10:17.880 --> 00:10:26.130 William Cheng: The Colonel is going to be the hypervisor is going to be the virtual machine monitor and then at the bottom over here is going to be the real hardware. Right. So again, the hardware devices and the processes over here. 69 00:10:26.430 --> 00:10:33.960 William Cheng: Inside the inside hypervisor over here, you're going to end up with your virtual devices, your virtual CPUs. Right. So we hear the instead of joining us 70 00:10:34.260 --> 00:10:40.770 William Cheng: Device. Now this is a virtual device. This is a virtual CPU and the guests are witnesses and you know the Go go go into the user space over 71 00:10:41.580 --> 00:10:46.470 William Cheng: There. So now again whenever we try to use the device drivers over here, you know, every, you know, 72 00:10:47.400 --> 00:10:52.860 William Cheng: Every instruction that you execute inside. Inside the device driver. The end up going to the bus and talking to the 73 00:10:53.760 --> 00:10:59.880 William Cheng: Particular device on the bus, all these things needs to be emulated you know emulating inside the virtual machine monitor 74 00:11:00.360 --> 00:11:03.720 William Cheng: Okay, so in that case, again, we're going to end up with a with a scalability problem. 75 00:11:04.650 --> 00:11:14.370 William Cheng: There. So as it turns out that you know so. So instead of VM M over here. So, so when you try to virtualize all you know all these operations over here. What do you need to do is that eventually you know what we try to implement 76 00:11:14.820 --> 00:11:20.130 William Cheng: Each other, Emily. All this operation over here, you need to talk to the real device, right. So, therefore, you know, where you 77 00:11:20.370 --> 00:11:29.670 William Cheng: Execute a memory map I own structure. You can attract into the VMware and VMware will issue you know operation to talk to the real device and the real device over here, we'll talk to you know 78 00:11:30.900 --> 00:11:39.510 William Cheng: The real device driver and the divisor will talk to the real device get an operation go going and then the Colonel's who is going to fall asleep. Eventually when the the operation is done. 79 00:11:39.780 --> 00:11:44.610 William Cheng: What you would do is that it will wake up the VM. And now the BMS needs to, you know, perform a call. 80 00:11:44.790 --> 00:11:55.110 William Cheng: Into the interrupt service routine of the operating system to simulate a pretty operations that right. So again, this is all that's done inside emulation that's performed by the hypervisor that's performed by the by the VM M. 81 00:11:55.560 --> 00:12:02.970 William Cheng: Okay, so if you look at the system over here to the device driver over here. I mean, the bottom part here. This is basically a new operating system. Right. 82 00:12:03.600 --> 00:12:14.850 William Cheng: Okay, so this is the virtual machine. This is virtual machine monitor is the operating system for the new machine and now you're going to end up with a lot of device driver. If you are trying to make this compatible with you to try to get this running on the windows. 83 00:12:15.180 --> 00:12:18.150 William Cheng: The Windows Vista, Windows can actually have a zillion devices. 84 00:12:18.690 --> 00:12:25.890 William Cheng: Okay, so in that case again our VM me to be able to talk to every one of these real devices. So, so, you know, the person who's writing VMware 85 00:12:26.070 --> 00:12:32.430 William Cheng: Need to write all the device driver. So you're going to end up the person who's implemented the man has to run hundreds of thousands of drivers. 86 00:12:33.180 --> 00:12:41.250 William Cheng: OK. So again, this is really not scalable, you know, for the desktop operating system. But what about, you know, what about for server machines. 87 00:12:42.000 --> 00:12:49.170 William Cheng: OK. So the claim over here is that this particular architecture can actually work for server machine that's inside the cloud that's inside of computing center. 88 00:12:49.530 --> 00:12:59.940 William Cheng: Okay, because he's got a computer center over here you know there are a lot of devices that don't make sense. Is that a computing center right so so if you think about it, right, you know, is that a computer community that you need. You need a driver for a webcam. 89 00:13:00.870 --> 00:13:13.920 William Cheng: While you probably don't. Right. I mean, if you think about all the devices that actually works on Windows. A lot of them are you know your your your digital camera your webcam's your, you know, the silly devices over here make noise and 90 00:13:15.120 --> 00:13:24.480 William Cheng: You know, listen to music and things like that. All those devices, you don't have the right device driver saw that. Okay, if you know this particular machine can only run inside the cloud. 91 00:13:25.350 --> 00:13:35.040 William Cheng: Okay, so therefore, in the end, you know, if you want to, you know, do for for, you know, the equal to implement this architecture for a server machine that's inside the cloud. You only have to implement a few device driver. 92 00:13:35.430 --> 00:13:38.160 William Cheng: Right. So, for example, what kind of device driver that they have the implant. 93 00:13:38.610 --> 00:13:44.220 William Cheng: Right. So inside of cloud over here, chances are you have high speed networking. So in this case, you will have a high speed network device. 94 00:13:44.640 --> 00:13:49.260 William Cheng: So over here, the devices over here has been the height you know device. So in that case, you need to add a device driver for it. 95 00:13:49.890 --> 00:13:59.040 William Cheng: Okay, maybe there's a high speed test every day. Maybe there's network storage that that's inside of that. So, India, you have to write a few you write a few device drivers over here. 96 00:13:59.220 --> 00:14:10.710 William Cheng: High speed printer high speed high speed that okay so India, maybe you have to write 20 to 50 device drivers over here and then you can actually go into the business of providing you know have a virtual machine service inside the cloud. 97 00:14:11.670 --> 00:14:17.460 William Cheng: Okay, so this architecture will actually be workable. If you're doing this inside the cloud. But what about for the desktop. 98 00:14:18.300 --> 00:14:26.490 William Cheng: Now for the desktop. Nobody can actually implement we implement all these device drivers that so therefore the desktop machine VMware actually come up with a different solution. 99 00:14:28.260 --> 00:14:35.580 William Cheng: Yeah so. So VMware called this the guest host model. And that's what we sort of all the term farm. Guess how many system and a host operating system. 100 00:14:35.850 --> 00:14:42.180 William Cheng: The host operating system in VM word. This is going to be a general purpose operating system. Why did they pick a general purpose. Nobody's is that 101 00:14:42.540 --> 00:14:48.030 William Cheng: Because the general purpose of new system come with all the device drivers. So the device drivers over here. You don't have to write any new eyes. 102 00:14:48.330 --> 00:14:59.310 William Cheng: Okay. Because, because we're going to use an existing host operating system. So this is going to be Windows is gonna be Mac OS X over here so we don't have to write any of the device drivers over here. So in this case, where is the VM. 103 00:15:00.210 --> 00:15:07.950 William Cheng: That. So the virtual machine monitor over here now is going to become or the hypervisor right here. These two terms are interchangeable. They're going to be part of the host operating system. 104 00:15:08.370 --> 00:15:14.850 William Cheng: For Windows guess there is something called the VM driver. Okay, so, so that will be a device drivers, as it turns out you windows. 105 00:15:15.510 --> 00:15:22.560 William Cheng: Unique and you can basically to, you know, write a layer of code inside the operating system kernel and he can install the into the kernel and this will be called a driver. 106 00:15:22.980 --> 00:15:30.360 William Cheng: Okay, so a driver doesn't really have to control a physical device. It can also be a module inside, Colonel. Okay, so, so here. Here's the address will 107 00:15:30.990 --> 00:15:42.270 William Cheng: Have a phobia and where they call it the VM driver over here. So once you install that into the kernel, you can do the courage to say hey you know i'm going to provide you a bunch of callback function. So when this is not happening inside the colonel so 108 00:15:44.220 --> 00:15:52.290 William Cheng: When this is happening inside the application instead of handling by your operating system. You'll give those events to me. And then in that case I will handle it. 109 00:15:52.770 --> 00:16:02.220 William Cheng: Okay, so for example if the guest operating system over here, do something that caused a page for you will trap into the real ordinances that which is the host operating system and what it will do is that it will look, look. 110 00:16:02.940 --> 00:16:10.050 William Cheng: Look up this table to see if there's anything that the VM driver would like to handle. If that's the case, and then what it would do is they will pass the event to the VM driver. 111 00:16:10.770 --> 00:16:18.540 William Cheng: Okay, so this way. Anything happening is that a virtual machine, will you, will you travel into the household, Mrs them, they will pass it off to the VM driver and now the VM driver can actually handle it. 112 00:16:19.050 --> 00:16:26.100 William Cheng: Okay, so the VM driver over here is going to be the virtual machine monitor is going to be the hypervisor and any Windows terminology. It's just a driver inside the Colonel. 113 00:16:26.670 --> 00:16:33.840 William Cheng: Okay, and that this driver over here you can specify a bunch of callback function. And we, as we mentioned before window, you know, the window that you have these callback function. 114 00:16:34.020 --> 00:16:40.950 William Cheng: You can specify with something happening inside the kernel, which will be the host companies is that you can you can provide callback function so that you actually call this function. 115 00:16:41.220 --> 00:16:47.160 William Cheng: Right, so all these callback function or inside the VM driver. So you can actually take over events are happening inside the virtual machine. 116 00:16:48.090 --> 00:16:55.320 William Cheng: Then, so this way you know when all these trap happen, you will be able to handle it and you don't want the host operating system to handle these Hawks. Yeah. 117 00:16:56.430 --> 00:17:03.480 William Cheng: Alright, so. So in this case, what happened is that, you know, when the company system what we hear, try to use the particular device over here. Right. What it will do is that 118 00:17:03.720 --> 00:17:12.720 William Cheng: You know, you know, you're traveling to the host operating system because it's the memory map. I'll that will be illegal. So therefore, again, you're traveling the most obvious is there and the harnesses and says, Oh, 119 00:17:13.050 --> 00:17:22.080 William Cheng: You know, you try to access, you know, a memory location that you're not supposed to, in that case, I'm going to pass it to the VM driver. So in this case, the VM divert to say, oh, you know, this is supposed to happen. 120 00:17:22.410 --> 00:17:33.420 William Cheng: Right, so therefore we will have to do is it will actually need to issue instruction to the real device driver to transfer data from the data into memory, right. So, in that case, the picture will look like this. Right. You, you, you come 121 00:17:34.470 --> 00:17:39.630 William Cheng: You're executing your device driver instead of hosts albinism you cause a trap you the host often is this ad 122 00:17:39.810 --> 00:17:48.630 William Cheng: And then it will get delivered into the VM driver and now the VM drivers over here will call up the actual device driver and then eventually when it's done, it will make an appt call into the guest operating system. 123 00:17:49.140 --> 00:17:52.500 William Cheng: to to to to execute the other day, the interrupt service routine. 124 00:17:53.250 --> 00:18:01.440 William Cheng: Okay, as it turns out that VM work decided not to do it this way. Right. Because why because you know the VM driver of years to implement informed by by the VMware people 125 00:18:01.620 --> 00:18:10.680 William Cheng: If you tried to talk to the device driver directly. That means that every time the Windows operating system change, you know, make some changes in the kernel. In this case, you have to follow all the changes. 126 00:18:10.890 --> 00:18:17.310 William Cheng: Right, because otherwise you will not be compatible with the device driver or if the data structure, it changes that means is that a colonel in that case. 127 00:18:17.820 --> 00:18:21.870 William Cheng: The again you have to, you know, rewrite your code inside the inside the driver. 128 00:18:22.410 --> 00:18:32.010 William Cheng: Okay, so what they do with something clever. Okay, they don't give you another star on, you know, on top of this, this thing over here in user space there is a VMware application called VM app. 129 00:18:32.940 --> 00:18:40.320 William Cheng: That. So instead of the VM driver over here, talk to the device driver directly inside windows and have to keep track of all the changes inside the window. 130 00:18:40.500 --> 00:18:45.780 William Cheng: What it does it actually make an app called over here. And then as the VM map over here to use the device driver. 131 00:18:46.110 --> 00:18:52.620 William Cheng: Okay, how would the VM up over years. Divide you ever ride BMX and regular application. So when they try to use any kind of device, it will make a system call 132 00:18:53.550 --> 00:19:02.880 William Cheng: Okay, so therefore you know when Microsoft trying to make changes inside the opportunities that typically is that they don't change the system called interface, right, because if you change this isn't going to base, everybody will be unhappy. 133 00:19:03.630 --> 00:19:11.190 William Cheng: Okay. So in this case, what you would do is that, you know, instead of, you know, calling the device driver directly you can go up to the VM app over here. Go VM Colonel into the user space. 134 00:19:11.370 --> 00:19:17.520 William Cheng: And now the user Facebook right over here will actually make a system call and the SSD by driver. OK. So the picture look like this. 135 00:19:18.390 --> 00:19:24.270 William Cheng: There. So again, once you go into the host operating system begins to the VM driver. And now what you would do is that, you know, 136 00:19:25.170 --> 00:19:31.050 William Cheng: These guys over here you will make an appt call into the VM app over here and over here will use a system called the axes, the 137 00:19:31.680 --> 00:19:44.670 William Cheng: Access device and eventually when the operation is done, it will return the result we get back to the VM app and the BMW will return a data back to the VM driver and now you can you can actually make it up call to handle the interrupt instigates system. 138 00:19:45.810 --> 00:19:52.980 William Cheng: OK, but so but but but you can see that this putting your architecture is going to be slower right so VM world was clearly they're aware that this is gonna be slower. 139 00:19:53.160 --> 00:20:01.200 William Cheng: But they choose convenience over performance. This way or the VM driver doesn't have to keep up with all the changes inside Microsoft Windows or Mac OS X. 140 00:20:02.490 --> 00:20:10.260 William Cheng: Okay, so it's pretty clever, right. And also, we see that, you know, we actually talked about this before this VM app is sitting at the same place as a window manager. 141 00:20:11.490 --> 00:20:17.040 William Cheng: Okay, so remember the window manager right the window manager over here, you know, basically, you know, that sense of the picture over here looks exactly the same. 142 00:20:17.160 --> 00:20:23.940 William Cheng: Right. Whenever something has happened over here to go into the window manager and then again, it's going to write data into the kernel over here and then again pick up the application. 143 00:20:24.750 --> 00:20:31.680 William Cheng: Okay, so I think I do a mirror image over here, but both typical but basically this picture look exactly the same, like the picture window Window Manager. 144 00:20:32.040 --> 00:20:42.810 William Cheng: And we know that window manager was was very successful because it's only one application, you can optimize the heck out of her. So in the end, you know, be aware of the exactly same thing. There's only one application they need to make it super efficient. 145 00:20:43.110 --> 00:20:49.740 William Cheng: And this is sitting at the same place as a window manager. So you can actually come up with a solution, so that this particular path. In the end, it ends up to be pretty efficient. 146 00:20:50.820 --> 00:20:56.370 William Cheng: Okay, so, so these days when we're using the VMware technology, as it turns out that you know that actually works pretty well. 147 00:20:56.790 --> 00:21:00.300 William Cheng: Because they also sort of figure out how to actually do this efficiently. Yeah. 148 00:21:01.080 --> 00:21:12.240 William Cheng: Alright. So in the end, you know, for VMware, you know, choosing convenience over performance turns out to be the right decision. So their desktop solution is very popular right inside their server again they go with a different kind of solution. Yeah. 149 00:21:14.580 --> 00:21:27.090 William Cheng: Alright, so. So again, that's how you, how you do the do virtualization. And again, you know, the reason we sort of talked about this is that, you know, being where they are there to ensure virtualization. So in that case, you have to take 150 00:21:28.080 --> 00:21:38.040 William Cheng: Basically other to handle all these all these operations. Yeah. Wonderful perverse ization raw power virtualization, meaning that you know the guest operating system has been modified 151 00:21:38.550 --> 00:21:43.590 William Cheng: Okay, so once you have modified it gets ominous ism to take out all the pop up instruction old instruction like that. 152 00:21:43.800 --> 00:21:57.510 William Cheng: And if you know that I own churches are very, very inefficient. Right. We just saw over here, this I own. So she is very, very inefficient. Okay. So, since you are changing the guest operating system. Why don't you actually do something else to make the operation as efficient as possible. 153 00:21:58.560 --> 00:22:09.210 William Cheng: Okay, so once you start doing virtual virtualization. Once you can take out some of the code inside your kernel. Why did you take out all the inefficient code because you need to compare a you because you need to compete against the VMware people 154 00:22:10.110 --> 00:22:20.640 William Cheng: Okay. So, therefore, what they actually do is as soon as the IO virtualization are very, very slow. So for the peril virtualization people they will actually took out all the device drivers. Okay. Because the device driver is super inefficient. 155 00:22:21.210 --> 00:22:28.950 William Cheng: Okay. So in this case, if you take out a divider. We need to replace it with something. Right. So basically what they will do is that they will try to make a direct communication to the VM. 156 00:22:32.610 --> 00:22:36.930 William Cheng: To the, to the hypervisor. Okay, so there's the hyper visor can actually do work for them. 157 00:22:37.440 --> 00:22:43.230 William Cheng: Okay, so, so, so, so instead of, you know, going up and down. You know you the kernel space and the user space program. 158 00:22:43.560 --> 00:22:51.810 William Cheng: Doing those weird, you know, juggling what they will do that it directly make a call to the hypervisor. Now one of the company that did. That's very, very successfully. It's called Zen. 159 00:22:52.590 --> 00:23:03.360 William Cheng: Yeah, so, so, so, so, what it will do is that, you know, so they call every virtual machine or domain. So here's domain you want domain YouTube domain use three or Amendment virtual machine. They also have something called a 160 00:23:03.720 --> 00:23:07.260 William Cheng: Domain zero so domain zero is kind of like the host operating system. 161 00:23:07.680 --> 00:23:17.970 William Cheng: Okay, so if you want to talk to the real device, who do you talk to, right. You talk to the host operating system. So what I would do is I will take one of these virtual machine over here, remove all the device driver CO and then they will actually, you know, 162 00:23:18.270 --> 00:23:26.970 William Cheng: They do actually change the code to to to change it into a communication co to talk to the host the host operating system. But again, the host opposite over here is good but domain zero 163 00:23:27.150 --> 00:23:31.230 William Cheng: So in this case, you can actually make them communicate using the most efficient method. 164 00:23:31.800 --> 00:23:36.270 William Cheng: Okay, so what is the most efficient method for, you know, for, for, for, you know, for you know for virtual machine over here. 165 00:23:36.630 --> 00:23:42.090 William Cheng: To talk to a host options. Is that right, the most efficient solution over here is to use share memory communication. 166 00:23:42.900 --> 00:23:51.270 William Cheng: OK, so the world can do this is that we can actually set up a shared. Remember, whoever you're talking about share memory. Yes, but the basic idea over here is we're going to have to, you know, sort of two processes. 167 00:23:51.690 --> 00:24:01.290 William Cheng: You know, sort of sharing, sharing. I just face. Okay, so we're here, we're going to share a bunch of memory over here again you map it into the address space of two processes and now they can actually communicate is ensure memory. 168 00:24:01.800 --> 00:24:09.900 William Cheng: That. So in this case over here. We're going to take out an iOS device code over here. I'm going to replace with communication call that will write data to the shared memory over here and then 169 00:24:10.140 --> 00:24:23.040 William Cheng: You know, on the other side over here, the host the host happens is that will take the data over here, receive the instruction, talk to the real iOS devices, for example, to transfer data from the desert into memory when that is done, it will write results over here. Back to you know 170 00:24:24.510 --> 00:24:32.850 William Cheng: But back to the host operating system over here. So again, the host operating system has been modified so nobody will actually receive all these data and then you can continue to to to work on that. 171 00:24:33.390 --> 00:24:38.460 William Cheng: Okay, because once you take out all the iOS device driver driver code over here you can replace it with any color you want. 172 00:24:39.030 --> 00:24:50.970 William Cheng: Okay, so therefore you will do the most efficient thing possible. And now you can actually emulate the end high I O subsystem, you know, inside a guest operating system. Right. So remember the guess happens is it now has been completely modified then 173 00:24:51.990 --> 00:24:54.390 William Cheng: Alright so this picture. I will show you that you know for for them. 174 00:24:54.780 --> 00:25:05.880 William Cheng: To do CPU virtualization, they still have the VM M over here. So, so in order for them to provide to virtualization or the user that they that they did the, the very silly that they used to make zero 175 00:25:06.270 --> 00:25:12.300 William Cheng: You know, to, to, to, to, to share memory to communicate with the with the guest operating system that 176 00:25:13.650 --> 00:25:21.570 William Cheng: All right. Alright, so I guess it also there's white one. So the interesting thing that the company's then do is that, you know, the application over here, they're all running rings three 177 00:25:21.900 --> 00:25:26.310 William Cheng: They actually have the guest operating system run in bring one of the Intel CPU. 178 00:25:26.670 --> 00:25:32.940 William Cheng: Now, and in VM M over here that will run in with zero because you know when they invented this technology. There's no way minus one yet. 179 00:25:33.240 --> 00:25:44.940 William Cheng: So what they will do is it will actually. Oh yeah, why don't you modified it. Guess how many certainly can actually have to guess I'll just them run a meeting bring one inside a virtual machine. Okay, so this way, the virtual machine monitor will be the one that you run. Yeah. 180 00:25:46.200 --> 00:25:53.910 William Cheng: Alright, so again the remember we here is only four CPU virtualization and all the other stuff is what I virtualization yeah alright so 181 00:25:54.660 --> 00:26:00.930 William Cheng: Let's talk a little bit more about the design architecture. So again, we're just going to go to the concluding slide over here. 182 00:26:01.380 --> 00:26:13.230 William Cheng: Okay, so in summary we we've seen, you know, three with you see two different kind of virtualization. One is for virtualization and the example that would give us VMware and the otherwise parallel virtualization and the example that we give is 183 00:26:13.830 --> 00:26:22.080 William Cheng: OK for for virtualization. If you want to virtualize the CPU VMware use dynamic binary writing as a solution to do IO virtualization. 184 00:26:22.440 --> 00:26:27.060 William Cheng: They basically they use the guest host model and then they also have to split driver inside the VM and 185 00:26:27.540 --> 00:26:36.210 William Cheng: You know you. Is that a hose audiences and they use a driver in order for them to virtualize the iOS. Okay. And also, they also use an application called VM Appleby here. 186 00:26:36.510 --> 00:26:41.790 William Cheng: That will make system calls. So this way we don't have to keep track of changes inside of host operating system now. 187 00:26:42.300 --> 00:26:50.190 William Cheng: For parallel virtualization to to virtualize the CPU you take out all the instruction that give you trouble and you place them with direct hypervisor call and to 188 00:26:50.460 --> 00:26:57.960 William Cheng: You know, to virtualize IO to virtualize I oh they take all the drivers code over here and they replace them with superfast communication codes, then 189 00:26:58.950 --> 00:27:06.300 William Cheng: There's also another kind of virtualization over here that we didn't really talk about in class. So I think I got the slides from Professor given them. 190 00:27:06.750 --> 00:27:13.290 William Cheng: So he sort of briefly talked about, you know, one of the popular architecture out there is called containerized options isn't always container. 191 00:27:13.620 --> 00:27:22.020 William Cheng: You probably hear you know some of the company. They're pretty famous Open VZ Linux container Docker. I think Dr was purchased by one of the, you know, the big company. 192 00:27:22.530 --> 00:27:28.530 William Cheng: So, so they are actually very, very successful in competing against VMware and also the company inside the cloud now. 193 00:27:28.950 --> 00:27:32.280 William Cheng: But if you look at the picture over here. They actually have only one operating system. 194 00:27:32.880 --> 00:27:41.850 William Cheng: Okay, they make it look like you know you have actually have a guest operating system running inside of host. I'll be in scissor but in reality, there's only one openings is them. So in this case, they can also be pretty fast. 195 00:27:42.330 --> 00:27:51.300 William Cheng: But they call the container, eyes open houses app so that your office and make it look like you're running in isolated you so you're running cities that are isolated environment. 196 00:27:51.840 --> 00:27:56.700 William Cheng: Because you know when you go into the cloud and you tried to buy sort of a virtual machine. 197 00:27:57.090 --> 00:28:07.140 William Cheng: That share the same hardware with other companies. You want to make sure that if you pay for one 10th of a virtual machine, you get one 10th of the CPU either one 10th of the mental you get one 10th of I only got one 10th of every day. 198 00:28:07.920 --> 00:28:19.590 William Cheng: Okay, so they so so now for these kind of company. They want to make sure that will you again when you pay for only a fraction of the and higher and higher hardware you get exactly give the proportion that the proportion that that 199 00:28:20.070 --> 00:28:27.120 William Cheng: That that you pay for. Okay, so therefore they want to create the illusion that you know when you are, you will you know when you're running inside always container. So again, I 200 00:28:27.390 --> 00:28:33.810 William Cheng: Always consider something something that contains a guest appearances them and the gifts, how often is it over here. It's the same kind of appearances and as the host operating system. 201 00:28:34.260 --> 00:28:40.200 William Cheng: Yeah. But in this case, you know what they focus on his performance isolation. Okay, which means that you know 202 00:28:40.560 --> 00:28:46.560 William Cheng: Even if you have a memory Hall, you have a CPU hog. They're running. They're using the same hardware. In the end, you get exactly what you pay for. 203 00:28:47.370 --> 00:28:53.220 William Cheng: Them. All right, so. So again, I don't really want to get get too much into it because, again, this is not inside a textbook. 204 00:28:53.670 --> 00:29:02.070 William Cheng: So when you go interview and somebody says that they are, you know, using the virtual machine or they're implementing virtual machine, you should find out we kind of virtual machines. They're doing you know either pure virtualization. 205 00:29:02.340 --> 00:29:09.090 William Cheng: Virtualization or they're using containerized operating system always containers, man. So again, these other typical three choices. 206 00:29:12.240 --> 00:29:19.920 William Cheng: So we all have one thing left to cover of your virtual memory. So we're going to actually jump to a Chapter seven tours in the chapter seven. There's something that we skipped. 207 00:29:20.160 --> 00:29:27.690 William Cheng: Okay, because we because we talked about chapter seven. First, we haven't really talked about virtual machines. So therefore, we couldn't talk about how to virtualize virtual memory. 208 00:29:28.260 --> 00:29:32.040 William Cheng: Okay, so what does that mean to how to virtualize virtual memory, right. So, so, you know, so 209 00:29:32.550 --> 00:29:42.480 William Cheng: Let's talk about it. Okay, so our application over here running inside a virtual machine right it's using virtual memory. But now, since inside a virtual machine, we should actually call it Virtual. Virtual Memory. 210 00:29:43.020 --> 00:29:50.010 William Cheng: Okay, so the first the first virtual here refer to that you're inside a virtual machine. And now the virtual memory over here is going to be the virtual memory is had a virtual machine. 211 00:29:50.490 --> 00:29:57.630 William Cheng: Okay, what about a guest operating system. Now the guest operating system things that is using physical memory. But now we know it's virtual physical memory. 212 00:29:58.050 --> 00:30:05.580 William Cheng: Right. So, therefore, you know, for the guest operating system. It's actually using virtual real memory or virtual physical memory. Well, who's actually using the real memory. 213 00:30:05.850 --> 00:30:11.160 William Cheng: Well, the real memory is actually used by the VM M and the real memory is actually being used by the by the hypervisor. 214 00:30:11.580 --> 00:30:18.960 William Cheng: Yeah, so therefore, in this case, you know, the VM M is the one that actually knows, you know, ha ha ha ha, how to actually reach physical memory. 215 00:30:19.770 --> 00:30:25.740 William Cheng: Okay, so in that case, you know, how can we actually virtualized Virtual. Virtual Memory. So what does that mean 216 00:30:26.580 --> 00:30:37.740 William Cheng: So let's take a look at the example we get right to say, you know, if we have an application over here, run inside of guest operating system, right, because obviously it's going to build a page table for it. What is the purpose of this page table. 217 00:30:38.430 --> 00:30:43.800 William Cheng: Guys. Okay, this page table easy inside the guest operating system which is running in the user mode of the 218 00:30:46.020 --> 00:30:57.870 William Cheng: user of the real machine. Okay. But again, the opportunities and thing that is running on the real hardware. Right, so, so, so the job of the page table is the provider translation it translate a virtual address into a physical address 219 00:30:58.740 --> 00:31:07.500 William Cheng: So remember I paste table is used for translation. It takes a virtual address translate into a physical address. But now, since we are we're sitting inside a virtual machine. 220 00:31:08.010 --> 00:31:14.040 William Cheng: You know, now this page table actually what it does is that it converts a virtual virtual address into a virtual physical address 221 00:31:14.760 --> 00:31:19.110 William Cheng: Okay, a virtual physical address. It's not a physical address right so you need one more level of translation. 222 00:31:19.320 --> 00:31:26.490 William Cheng: To go from a virtual physical address to the real physical address right so in this case you need another page table. So this page, a voice inside VMware 223 00:31:27.000 --> 00:31:39.720 William Cheng: Okay, so he's IBM over here. There's another page table that will take a virtual physical virtual physical, you know, you know, the verge of physical address. And now what it will do is that it will convert into the actual physical address 224 00:31:41.130 --> 00:31:47.400 William Cheng: So therefore, we actually need to perform two levels of accurate translation in order for us to start with a virtual virtual address 225 00:31:47.580 --> 00:31:56.010 William Cheng: And eventually convert that into virtual physical address right because in order for us to to run our program inside the virtual machine. Well, we try to execute code when we try to 226 00:31:56.280 --> 00:32:02.250 William Cheng: Address transition, all these things need to be done inside that, you know, he said, the real hardware right using the real MMU 227 00:32:02.850 --> 00:32:11.100 William Cheng: Okay, so therefore we actually, we need to build a separate separate page stable so that they can actually perform to that will address translation in one shot. Yeah. 228 00:32:11.550 --> 00:32:22.620 William Cheng: So the terminology that we use over here is that, unfortunately, literally, use the word shadow. This is called the shadow paste a boy has nothing to do with with shadow paging. It's also had nothing to do with shadow objects, you know, 229 00:32:24.720 --> 00:32:34.080 William Cheng: Good old girls on it. So in this case, the shadow page table is basically just a combination of this page table and this page table. Okay, you're going to put these two pages together. 230 00:32:34.740 --> 00:32:37.110 William Cheng: By by merging them into a shuttle payable. 231 00:32:37.560 --> 00:32:47.010 William Cheng: Because how do you actually merge the stable right so let's take a look at you know what's going on over here, right, if you think about the first level page, page table is going to convert a virtual virtual address to a virtual physical address 232 00:32:47.490 --> 00:32:56.460 William Cheng: That. So the first entry is over here, virtual page number. So this is the virtual virtual page number zero is going to get converted into a virtual physical page number one. 233 00:32:57.510 --> 00:33:03.600 William Cheng: Then the second level page table over here tells you how to convert a virtual physical page to the real physical pain. So this guy's 234 00:33:03.780 --> 00:33:13.200 William Cheng: We are using virtual physical page number one over here. So you need to follow the point are we at the point of this entry. This is virtual physical page number one, it needs to get translate into the physical page number three. 235 00:33:13.830 --> 00:33:21.210 William Cheng: Okay. So, therefore, if you want to merge these two tables together. Then in this case, the first entry is I'll be here for the virtual virtual page number zero 236 00:33:21.780 --> 00:33:28.740 William Cheng: Now, what should we need to translate into into real physical physical page. Well, in that case you need to get translate into physical page number three. 237 00:33:30.240 --> 00:33:36.390 William Cheng: Okay, so by combining this entry and this entry, you can actually feel the first entry over here inside the shadow page table. 238 00:33:36.780 --> 00:33:41.580 William Cheng: Okay, so again I should do this for every page table entry over here. So the second and third over here. We're going to start with. 239 00:33:41.850 --> 00:33:51.090 William Cheng: The IBS. That's what you Bella. So if this is invalid. This should also be invalid if this next countries over here is the invalid. The show's been about that. What about the virtual virtual page number three. 240 00:33:51.420 --> 00:33:56.460 William Cheng: Why so this one, get it, get this one is right here. Virtual. Virtual page number three over here, right. 241 00:33:57.000 --> 00:34:04.320 William Cheng: It gets converted into virtual physical page number two and virtual physical page number to get converted into physical page number one, so therefore you right number why right here. 242 00:34:05.250 --> 00:34:13.830 William Cheng: Okay, so what you would do is that you will go through these two pages table and build a shadow page table. And now what you would do is that you will give this page table over here to the real 243 00:34:16.170 --> 00:34:17.070 William Cheng: The real MMU 244 00:34:18.120 --> 00:34:22.680 William Cheng: There. So remember, you know, sort of, I think, in the last lecture, I mentioned that 245 00:34:23.070 --> 00:34:31.770 William Cheng: You know, when the you know the guess how many systems, says the car three register. Again, we look at the entire three hours to actually get the value of x, right, what does x 246 00:34:32.250 --> 00:34:42.930 William Cheng: The x is going to be the virtual physical address for this for this patient of all. So in this case, again, this is a virtual physical page number right again. And in this case, you need to actually give it to a real physical number to 247 00:34:43.110 --> 00:34:53.550 William Cheng: The physical physical address to put it into the CRC register. So in the end over here, we build the shadow page table over here in the physical address for the shadow page table. This is the one that I call x prime 248 00:34:54.240 --> 00:35:02.250 William Cheng: Okay, so in the real CPU. I'm gonna say see our three is going to get x prime over here. What inside a virtual CPU, the various CBC are three is we've got a value of x. 249 00:35:03.840 --> 00:35:11.550 William Cheng: OK. So again, when you change the address, you know, what will you change the content of the CIC register, you have to trap into the virtual machine monitor 250 00:35:11.700 --> 00:35:17.760 William Cheng: And the virtual machine monitor have to emulate this operation by building the shadow page table going through every entry is over here to build this 251 00:35:18.450 --> 00:35:26.430 William Cheng: Build is pretty much a stable and then, you know, I find out what the physical addresses for the paper that will be exploited and you put x prime into the car to register. 252 00:35:27.630 --> 00:35:35.790 William Cheng: Okay, so you can actually see that this particular operation is going to be very costly every time when you tried to change the CRC register over here, you actually have to, you know, build a space table and then 253 00:35:36.600 --> 00:35:47.220 William Cheng: This operation now. Alright, so the main problem. Over here, over here is going to be poor performance and also every time when you try to change the pace table entries over here. So let's say I change this one to five or something like that. 254 00:35:47.760 --> 00:35:55.770 William Cheng: Okay, so in that case again. What I can do is that I can actually, you know, set up by address translation over here so that when I tried to access these memory location over here. 255 00:35:55.950 --> 00:36:06.000 William Cheng: That correspond to that page table again this page table appears four kilobytes in size, right. So can we use the multi level page level. So when we try to access any one of these memory location over here we're going to end up trapping in 256 00:36:07.380 --> 00:36:10.650 William Cheng: A while we tied to the performer right into the page table entries over here. 257 00:36:10.860 --> 00:36:14.370 William Cheng: And we can actually set up a copy on write. So we're going to tap into the virtual machine monitor 258 00:36:14.520 --> 00:36:23.070 William Cheng: And then in this case, what we're trying to the virtual machine monitor, we can actually sort of figure out what we need to change this one too. So we need to cover this five will be here. Look up the secondary page by page table here. 259 00:36:23.280 --> 00:36:26.280 William Cheng: Find out what number is. And then we can actually modify the space table entry over here. 260 00:36:26.850 --> 00:36:32.850 William Cheng: Okay, so again every time you modify page table entry, we're going to end up champions as a virtual machine monitor so you can emulate this operation. 261 00:36:33.300 --> 00:36:36.990 William Cheng: Well, so again, you know, the main problem will be here is going to be poor performance. 262 00:36:37.530 --> 00:36:45.900 William Cheng: So what are the solutions over here, right. Number one is that you can do a pair of virtualization, you can take out all the slow operation over here and you replace them with a hypervisor call 263 00:36:46.110 --> 00:36:50.670 William Cheng: But the problem with this particular solution is that even if you replace it with a hypervisor call is still going to be slow. 264 00:36:51.540 --> 00:37:01.830 William Cheng: Right, because, you know, so, so, so, so in this case you don't tap into the hypervisor. But once you get into the hybrid. But if you can make a direct call but he's our hypervisor over here. You still have to do exactly the same operation. 265 00:37:02.460 --> 00:37:08.550 William Cheng: Okay. So in the end, this is still going to be pretty slow. So, so the real solution over here is actually doing hardware. 266 00:37:09.450 --> 00:37:16.920 William Cheng: But since we have two page table over here right one, it was, again, it was solved before via this is one level page table over here from 267 00:37:17.220 --> 00:37:22.980 William Cheng: You know, a provider transition from, you know, virtual virtual address to go to physical address and the second level page. 268 00:37:23.370 --> 00:37:30.660 William Cheng: Table, you know, convert a virtual physical address to the real physical address we can actually do do these two levels of translation directly hardware. 269 00:37:31.140 --> 00:37:41.460 William Cheng: Okay so Intel actually have a solution for that they call this the extended paste table. So this is what up guys are, again, you know, when you you know if he installed Linux into 270 00:37:42.540 --> 00:37:53.580 William Cheng: The real hardware. When you finish booting Linnaeus, you can write you can type II me SG right and look at the print out and look for a PT if he if he if he said in that case they're using this particular technology. 271 00:37:54.150 --> 00:38:02.370 William Cheng: OK. So again, the first page table over here is point to buy the CRC register over here, right, the second page table over here is going to be another register in this 272 00:38:04.080 --> 00:38:14.760 William Cheng: In this new technology. Okay, so when you provide the translation, you actually go through to level address translation. And this way you will be, you will be able to get a physical address without, you know, 273 00:38:15.960 --> 00:38:26.370 William Cheng: Without you know having a hypervisor involved. Yeah. So the picture. So look like this right now. When you provide your translation. So again, for 32 CPU. You start with the virtual address you chop it into three parts. 274 00:38:26.940 --> 00:38:34.140 William Cheng: So the beginning. Are we here is a page directory, the page directory number. So in this case, you know the the first 275 00:38:34.380 --> 00:38:44.220 William Cheng: page table view is appointed by the car through it. Sure you use this as an array index over here. You read a page table entry and the pace of war entries over here is going to give you a virtual physical page number 276 00:38:45.120 --> 00:38:46.140 William Cheng: Right. So, therefore, since the 277 00:38:47.070 --> 00:38:51.930 William Cheng: This this this page number over here. He used to be a physical page number. Now, since you're inside a virtual machine. 278 00:38:52.110 --> 00:39:01.830 William Cheng: Now, this one will be approach or physical page number. So in this case you need to go to the seven second level address translation. So, so therefore, in this case, you going to use the second level paste a ball and there's a another 279 00:39:02.370 --> 00:39:07.290 William Cheng: Register instead of CPU that will point to the second level page table. Yeah. So, therefore, you know, in order for you. 280 00:39:08.100 --> 00:39:17.670 William Cheng: To actually get the base table the page address the base address for the second level page table, you have to go to the second level paste a ball, you're using the other register. So in reality it was gonna look like this. 281 00:39:18.420 --> 00:39:26.700 William Cheng: Then we're going to take the virtual the society, the virtual physical page number over here. Right. And then we're going to go to the second level to get you a real 282 00:39:26.970 --> 00:39:34.020 William Cheng: To get you a physical page number and the physical base number will give you the second level page table and they use the middle 10 visible because every index. 283 00:39:34.260 --> 00:39:40.170 William Cheng: And yeah, you know what, you get this value over here is going to give you a virtual physical page number 284 00:39:40.740 --> 00:39:51.420 William Cheng: Okay, so that needs to go to the second level address translation over here in the in the data center registered over here and. And again, this one will convert a virtual physical page number into a physical 285 00:39:51.960 --> 00:39:57.480 William Cheng: Physical page number and now the physical page number will give you the base address for the actual page and you add the offset to her. 286 00:39:57.720 --> 00:40:02.370 William Cheng: And now you're going to end up you know get get getting a physical address and that will be the address you put onto the bus. 287 00:40:03.300 --> 00:40:11.520 William Cheng: Well, so again you can see that the importance of having a very, very, you know, very, very good translation Lucas, I bought for her because 288 00:40:12.000 --> 00:40:16.440 William Cheng: Because, you know, in order for you to perform disaster translation. How many times do you have to go across the bus. 289 00:40:16.680 --> 00:40:30.570 William Cheng: Right to get this page table entry over here as one time and then you need to go to two times and three times and then four, five and six. So for a 32 3444 432 bit address translation, your, your overhead over here will be 600% 290 00:40:31.200 --> 00:40:34.830 William Cheng: Okay, and what if you actually have a 64 bit CPU. Why this guy is going to be even worse. 291 00:40:35.400 --> 00:40:40.980 William Cheng: Okay, so therefore that's why Intel use the a way said associative cash flow to implement those transitions, because I have offer 292 00:40:41.310 --> 00:40:49.050 William Cheng: Because you got to make sure that the history is very, very high. Otherwise, in the end, you know, but this pretty risky. It's gonna be, it's gonna be really slow. 293 00:40:49.770 --> 00:40:57.720 William Cheng: Guys. So again, the key over here is to have a very, very high performance translation, because I prefer okay so this way when you try to provide your transition like the like this. 294 00:40:58.080 --> 00:41:03.930 William Cheng: Most of the time you gotta get hits inside the translation, because that buffer. So, therefore, you don't have to go to the bus. Yeah. 295 00:41:06.360 --> 00:41:13.410 William Cheng: Oh I so I guess this is a good breaking point. So now we, you know, finished virtual machine. So again, that's one 296 00:41:13.740 --> 00:41:23.850 William Cheng: Approach to shrink the size of the colonel and the second approach over here and we're going to look at the second part of the lecture and look at Michael Colonel to make the colonel as small as possible. Yeah. All right.