WEBVTT 1 00:00:01.680 --> 00:00:07.290 William Cheng: This is the third part of lecture 13. So last time we mentioned 2 00:00:08.429 --> 00:00:08.910 William Cheng: I guess. 3 00:00:10.050 --> 00:00:17.279 William Cheng: I guess we just finished talking about how to support memory map file. So in this case, all you need to have extra 4 00:00:17.760 --> 00:00:23.790 William Cheng: Pairs of bass and bound register in the hardware and then you can support that. And as it turns out, the operating system and the compiler. 5 00:00:24.300 --> 00:00:30.300 William Cheng: There's a lot more work to do there to to to to use all this extra register inside the MMU 6 00:00:31.110 --> 00:00:36.360 William Cheng: Right. What about copy or. So as it turns out that with all these kinds of that we can actually do copy. All right. Okay. 7 00:00:36.630 --> 00:00:45.960 William Cheng: So remember, you know, the copy on write for a particular memory segment that memory segment is read and write for them every segment that memory subway is also private 8 00:00:46.290 --> 00:00:52.740 William Cheng: Okay. So in this case, the way we should implement copy on write is the following. First, again, let's review the definition or copy on write 9 00:00:53.040 --> 00:01:00.930 William Cheng: A process gets a private copy of a memory segment after a threat in the process perform a right for the first time. Okay, which means that 10 00:01:01.350 --> 00:01:10.290 William Cheng: Before you write for the first time, we just want to refresh my memory segment over here, then you're allowed to do that then. So what we're gonna do is that even though this memory seven is reading right 11 00:01:10.530 --> 00:01:14.610 William Cheng: We're going to actually set a protection bit over here for this memory serves to be read only. 12 00:01:15.060 --> 00:01:21.270 William Cheng: Okay. So, this way we can implement copy on write because when you just try to read from those memories like know what's going to happen, right. So this example over here. 13 00:01:21.510 --> 00:01:25.110 William Cheng: We're using or generating a reference to virtual address one of 312 14 00:01:25.320 --> 00:01:35.670 William Cheng: Which is 12 bytes into the data segment and we're performing read operation. So coming out of the inner core of the CPU. We're going to say that we're going to use the data segment register right here and the offset is equal to 12 15 00:01:36.000 --> 00:01:46.080 William Cheng: Guys. So in this case, the read operations compatible with read only 12 is less than 100 so therefore we at 12 to 2000 we're going to end up accessing tall bites into this memory segment. 16 00:01:46.440 --> 00:01:51.090 William Cheng: Okay, but what if we tried to do right for the first time, right, when we perform right for the first time over here. 17 00:01:51.300 --> 00:01:58.260 William Cheng: Now we're going to write to virtual address 212 everything's going to be the same, except that, you know, right. It's not compatible with a read only. 18 00:01:58.530 --> 00:02:07.620 William Cheng: Right, so this right. It's not compatible real really so now we're going to generate a fall into the inner court the CPU going to tap into the operating system. And now the operating system can actually fix it. 19 00:02:07.950 --> 00:02:17.490 William Cheng: How would the opposite and fix it. Okay, the obvious ism over here is going to perform copy on write because what it will do is that it will walk down that the linear list of as region over here. 20 00:02:17.880 --> 00:02:24.450 William Cheng: So try to sort of figure out which memory segment. It will also and then you will see that this particular memory segment that belong to the to the data segment. 21 00:02:24.900 --> 00:02:33.870 William Cheng: Okay, this one is rewrite and it's also private so therefore the opposite says, ah, you know this one. I set up the the the MMU this way so I can perform copy on write 22 00:02:34.140 --> 00:02:43.740 William Cheng: Okay. So in this case, how would you put one copy on write right so we need to copy the memory segment over here into another memory segment. So we're going to ask the first memory allocated to allocate another 100 bytes. 23 00:02:44.100 --> 00:02:46.530 William Cheng: For this memory segment guys have, for example, the memory. 24 00:02:46.950 --> 00:02:52.410 William Cheng: memory allocation over here is going to find 100 buyers right here. Yeah. And then we're going to copy this money's not going over here. 25 00:02:52.650 --> 00:03:00.090 William Cheng: So that this will have exactly the same data when we finish doing that, we need to change the MMA registered over here to point to the new address right here. 26 00:03:00.840 --> 00:03:09.930 William Cheng: That. So when we're done. It will look like this. Right. We create a new copy of this. So when we make a copy this memory segment started out to be exactly the same as the original one. 27 00:03:10.140 --> 00:03:20.130 William Cheng: And now we change the pace is registered over here to point to the the memory segment that though, the one that's new, the al Qaeda and one last thing we have to do is that we have to change the permission to rewrite from this one. 28 00:03:20.760 --> 00:03:22.380 William Cheng: Okay. So in this case, Robin is that 29 00:03:22.830 --> 00:03:30.960 William Cheng: We're still in the middle of the segmentation fault, but in this case the segmentation fault is something that the colonel can fake, so therefore it doesn't really not so. So in the end, 30 00:03:31.170 --> 00:03:33.390 William Cheng: It doesn't really end up with a segmentation fault. 31 00:03:33.630 --> 00:03:44.010 William Cheng: What it will do is at the colonel once they fix up all these things, making a copy and then change the registry instead MMU what it will do is that it will return to the user space program and tell the user space program to try again. 32 00:03:44.550 --> 00:03:53.100 William Cheng: Okay. So this guy is going to return back to the user space program. So it's kind of weird right because user space, Paul, I'm coming to Colonel with the segmentation fall. What, what is the second day. Well, how can I return. 33 00:03:53.490 --> 00:03:57.330 William Cheng: Okay, it's really not possible to return. So again, the people who do the CPU over here. 34 00:03:57.510 --> 00:04:07.260 William Cheng: What they have to do is to make sure that if you return from a segmentation fall. You got to try your memory reference. One more time. So what do we do, is that it would do this reference. One more time data segment offset equal to 12 35 00:04:07.440 --> 00:04:17.400 William Cheng: You want to perform a right operation. So now, right, is compatible with rewrite over here 12 is less than 100. So in this case, I'm going to add 12 to 600 and not the 2000 36 00:04:18.090 --> 00:04:22.110 William Cheng: Right. Because right now, you know, get you. Will you do it the second time in this case the base registers. 37 00:04:22.650 --> 00:04:33.660 William Cheng: Has changed. So this memory segment and this memory segment is a private memory segment. The only belong to this process. Okay. So, therefore, for plus 600 we're going to end up with access control bytes over here. The to this piece of memory. 38 00:04:34.380 --> 00:04:42.360 William Cheng: That and also from this point on all the rights into the data segment over here, they will not cause another page Hall, right, because on this one out over here. 39 00:04:42.570 --> 00:04:54.300 William Cheng: That this one is rewrite right we'd write it as memory location over here. All the future right into any one of these memory locations over here, since we have changed and maybe register to rewrite. Okay, so from this point on, there'll be no more painful. 40 00:04:55.500 --> 00:05:02.760 William Cheng: Okay, so, so this will show us how you can actually implement this new copy on write using this particular method and you will only get a segmentation fault. The first time. 41 00:05:03.000 --> 00:05:08.700 William Cheng: When he's had to write to them every segment from that point on, you know, you can even write all you want and also before that you can read all you want. 42 00:05:09.480 --> 00:05:14.880 William Cheng: Okay, so when you try to write for the first time, it's gonna cost you a little more because we need to go into the Colonel. The Colonel need to do all these 43 00:05:15.030 --> 00:05:22.890 William Cheng: You know, use the memory alligator and make copies all these kinds of stuff. And that could take a while, but once that's done, you will never get another page fall on this memory segment again. 44 00:05:24.210 --> 00:05:28.890 William Cheng: Okay, so, so, so this is how you implement, you know, copy on write inside, Colonel. All right. 45 00:05:29.820 --> 00:05:36.570 William Cheng: How do you implement the backing store. So again, the records over here is this is basically the system. So the swap space. 46 00:05:37.200 --> 00:05:44.400 William Cheng: You know, so when there's news no news no space for the new segment. So for example, if somebody has 47 00:05:45.090 --> 00:05:50.850 William Cheng: Some show to create a new memory segment, they run the first one memory alligator and the first American memory alligator says I'm out of memory. 48 00:05:51.510 --> 00:06:00.360 William Cheng: Okay. So in this case, what would you do, do you killed a new user process. Well, there's one more thing you can do is that you can actually take one of the existing memories that man you swap it out onto the desk. 49 00:06:00.960 --> 00:06:06.300 William Cheng: Okay, so over here. Here's a memory segment over here that I that I figure out. So what I will do that with skin memories that even over here. 50 00:06:06.480 --> 00:06:14.220 William Cheng: Find out which one is the most appropriate memories that may want to swap it out to this temporarily so they don't know what we need to we can actually bring it back on the desk into memory. 51 00:06:14.790 --> 00:06:22.560 William Cheng: Okay, so the place that you swap it out to the, this, this, this spot over here is it's a separate part of the desk is no as the swap space. 52 00:06:23.370 --> 00:06:33.090 William Cheng: Now, so now you know that you know inside the desk. Over here we have the file system hierarchy. We have the free blog. We also have the SWAT space and the software is a different part of the desk. 53 00:06:33.810 --> 00:06:36.630 William Cheng: Okay. So in this case, you know, all the memory segments. 54 00:06:37.140 --> 00:06:45.510 William Cheng: Over here you will you try to swap it out, you will read into the spa space inside the Colonel, you need to remember once being swapped out. So later on when you started putting you in 55 00:06:46.230 --> 00:06:50.100 William Cheng: That they don't want to access that the memory segment you need to remember how to bring it up. 56 00:06:51.030 --> 00:06:55.380 William Cheng: Okay, so therefore you in order for us to do that, we need to add another bit into the MMA register. 57 00:06:56.040 --> 00:06:59.340 William Cheng: Okay. So before we talk about money registered, we have the base and we have the bounce. 58 00:06:59.760 --> 00:07:08.490 William Cheng: We have the rewrite or the read only beds. Right. We also have extra money Register Now every pair me registered going to add one more bit and this bit is known as the validity bet. 59 00:07:08.940 --> 00:07:13.650 William Cheng: Okay, so V equals two, one, that means that this pair of base and bond register is valid. 60 00:07:14.130 --> 00:07:19.620 William Cheng: Okay, the equal to zero, that means that they are invalid when they're evaluating you try to use it, you're going to try to the opening says that 61 00:07:19.800 --> 00:07:25.290 William Cheng: And hopefully, you know, the opportunities that will be able to fix this particular segmentation fall so that the application for can try it again. 62 00:07:26.250 --> 00:07:31.050 William Cheng: Okay, so let's take a look at this example what happened over here. So if we decide to swap out this memory segment. 63 00:07:31.260 --> 00:07:38.430 William Cheng: I mean, I mean, why do you pick out this one. We don't really know. Yeah. In the second part of chapter seven. We're going to sort of talk about how do you choose which one to swap out 64 00:07:38.730 --> 00:07:42.030 William Cheng: Because, again, the reason we swap it out. Is that because we run out of memory. 65 00:07:42.660 --> 00:07:52.320 William Cheng: So in this case, we need to throw something out there. This once we swap it out, we're going to create space inside our is our physical memory. So now you can run them a memory alligator again to see if you can actually allocate memory. 66 00:07:52.800 --> 00:07:59.760 William Cheng: That. So when you try to write this one out over here, we need to make a note somewhere. Right. So again, this one over here correspond to the heap segment. 67 00:07:59.910 --> 00:08:06.240 William Cheng: So, for some reason, we decided to the heap segment for this process is reasonable to swap it out. So we're going to write it out to the desk. 68 00:08:06.360 --> 00:08:12.360 William Cheng: So inside the opportunities that we do keep track of, you know, this hip segment over here and we're going on to the desk right and now 69 00:08:12.600 --> 00:08:19.980 William Cheng: You know, it's gone from physical memory, so therefore it doesn't keep track of where it isn't physical memory that. So I'm going to draw a picture like this. 70 00:08:20.520 --> 00:08:29.700 William Cheng: Okay, to say the operating system over here is going to make a note using some data structure to remember that this memory side when over here is no longer in physical memory, but instead of sitting on desk. 71 00:08:30.360 --> 00:08:38.400 William Cheng: Okay, and you can see that this part of it once is freed up they become empty space right to be good. Go, go back to the feelers and now we can actually allocate memory again. 72 00:08:38.640 --> 00:08:44.550 William Cheng: Okay, so there's one more thing that you need to do is that you need to set the validity bit over here for this process to be equal to zero. 73 00:08:45.240 --> 00:08:56.130 William Cheng: Okay. Because, because if this process. Try to try to reference this particular memory location over here, then this is equal to zero. You want to travel in the ordinances that so we can bring the data from the swap space and back into memory. 74 00:08:57.480 --> 00:09:03.930 William Cheng: Alright, so again, the evidence is over there is the key, then you can keep track of all these kinds of stuff. So later on when you try to run this program. You know what to do that. 75 00:09:04.770 --> 00:09:10.110 William Cheng: Alright, so let's say that over here. Later on, you know, this particular memory segment has been swapped out already. 76 00:09:10.350 --> 00:09:15.150 William Cheng: And the program when it's not running again it will try to access virtual address 678 77 00:09:15.360 --> 00:09:28.770 William Cheng: That will be 78 bytes into the heap segment. So coming out the inner core of the CPU. It says, I want to use the heat segment register the offset equal to 38 over here. So immediately. You know, I will see that this entry over here is invalid right because be equal to zero. 78 00:09:29.430 --> 00:09:40.710 William Cheng: Okay. So yeah, I don't even get to compare the other stuff or check the other the other access over here. The first thing I would notice that validity equal to zero, then I'm not allowed to use anything inside this is that when you register. 79 00:09:41.250 --> 00:09:50.580 William Cheng: Okay. So this guy's I will try to get opportunities that it was a segmentation fault you come into the operating system. The system is going to walk that that list of as region and for this memory segment over here. 80 00:09:51.060 --> 00:09:57.510 William Cheng: Again, there's obviously some of your mid and know to say that this particular memory segment has been swapped out and he knows exactly where he went on desk. 81 00:09:58.170 --> 00:10:03.060 William Cheng: Okay. So this guy is what we should do the opposite of what you should do is that you should copy the data from the data into memory. 82 00:10:03.210 --> 00:10:09.180 William Cheng: Right, and then fix up the colonel data structure and then returned to the user space program. So the user space for and could try again. Try again. 83 00:10:09.540 --> 00:10:19.770 William Cheng: Okay, so what it will do is it will, you know, tell the device driver to copy this data into memory, again, that will take a long time. So the organisms going to go to sleep and then you can look around other program. 84 00:10:19.980 --> 00:10:27.150 William Cheng: Eventually when this operation is done, you're gonna wake up the Colonel. The Colonel says woken up, it knows that that data over here is copied into memory. Okay. 85 00:10:27.870 --> 00:10:32.400 William Cheng: So sorry I forgot what I forgot one more thing there. The first thing you need to do is that you need to 86 00:10:33.030 --> 00:10:37.800 William Cheng: Ask the first memory. Memory alligator to find a space that's big enough for 1000 bucks. 87 00:10:37.980 --> 00:10:43.110 William Cheng: Right. So once you find out where that is over here and then you can tell that this controller to transfer data into that memory, right. 88 00:10:43.290 --> 00:10:52.050 William Cheng: I sort of got that the step backwards so you allocate memory first and then you copy that into it and wipe out whatever data that's out there that and then once the data. 89 00:10:52.830 --> 00:10:57.690 William Cheng: Has has be transferred over here, you need to fix up the register and reset the validity of it back to one. 90 00:10:58.020 --> 00:11:04.470 William Cheng: That. So this is what you get a base register or the base registers should be the new location, you know, for the needs to be swapped in 91 00:11:04.860 --> 00:11:17.970 William Cheng: Right. In this example we saw previously this memory segment starts at 22 00 right so now the newly allocated address over here, as it turned out to be 1000 so therefore you need to go to the base register over here, changing to 1000 92 00:11:18.600 --> 00:11:26.910 William Cheng: The length of segment over here, again, you know, it's still the same, but you can also read that from the process control blah, the process control God tell you remember segment, you know, 93 00:11:27.240 --> 00:11:35.550 William Cheng: You know what will. What is the length of the segments are so don't forget you can update this if you want. And then, most importantly, you want to set this be close to what 94 00:11:35.880 --> 00:11:41.160 William Cheng: Okay, again, there are also other bits over here, such as a read only. And we write this. I mean, I'm running out of space. I don't draw them anymore. 95 00:11:42.030 --> 00:11:49.530 William Cheng: That. So the idea here is that once I sticks out the base amount register OB. I said, he goes to one. So now imagine all the colonel data structure. 96 00:11:50.160 --> 00:11:57.240 William Cheng: Is ok so now inside the operating system it will know that this particular memory segment is now mapped the physical memory. It's no longer sitting on the desk. 97 00:11:58.350 --> 00:12:04.710 William Cheng: Okay, so now you return back into the user space program again the user interface to the CPU is going to be surprised because it gets a segmentation fall 98 00:12:04.890 --> 00:12:09.840 William Cheng: Shopping with albinism, as it turns out you return from it, so therefore it's going to try this memory reference that yeah 99 00:12:10.020 --> 00:12:18.720 William Cheng: Go to the heap segment offsets 78 days of validity over here, equal to one can use it. So this access compatible with whatever the protection mode over here is 100 00:12:18.870 --> 00:12:26.760 William Cheng: 70 is less than 1000. So you asked 78 1000 so you're going to end up accessing 78 bytes into this memory segment and that's exactly what you want. 101 00:12:27.690 --> 00:12:36.360 William Cheng: Okay, so this is how you you know implement the swap right so so we hear what sort of saw that disk over here. So the system also need to manage the swap 102 00:12:36.870 --> 00:12:37.920 William Cheng: So in this case, you know, how do you 103 00:12:38.790 --> 00:12:49.320 William Cheng: How do you manage the swap. Right. So again, you need to be able to swap the entire segment into onto the desk. So in a way, on the biz, you also run some sort of a first fit alligator algorithm. So this way you can 104 00:12:49.950 --> 00:12:59.880 William Cheng: Move, move, a segment of back to this way or you can use the buddy system. But in that case will be a little more wasteful guys are again different offices and can decide what they want to do to manage the swap space. 105 00:13:00.630 --> 00:13:10.710 William Cheng: Yeah, so the sort of the general term for this philosophy is known as the backing store right because this data over here we're sitting in memory. You need to sort of back it up onto the day. So, therefore, this is also known as the back of the store. 106 00:13:11.190 --> 00:13:17.700 William Cheng: Okay, so the backing store over here. As it turns out, it could be the, you know, it could be inside the swaps days. What if you try to swap out 107 00:13:19.320 --> 00:13:21.210 William Cheng: What if you try to swap out a tech segment. 108 00:13:21.930 --> 00:13:30.900 William Cheng: Okay, so remember the tech segment is read only. And they actually come from the file system hierarchy was in that case, you don't really have to swap it out. All you have to do is to delete this memory segment over here. 109 00:13:31.110 --> 00:13:33.000 William Cheng: Because the tech segment is already sitting on a desk. 110 00:13:33.600 --> 00:13:41.280 William Cheng: Okay, so therefore, in that case, the backing store for the tech segment is inside your file system hierarchy. So, therefore, you don't need to swap it out to the to the swaps as 111 00:13:41.580 --> 00:13:47.250 William Cheng: Well, so yeah, they don't in chapter seven. We're also going to talk a little more about, you know, how do you actually implement a process. Yeah. 112 00:13:49.110 --> 00:13:53.550 William Cheng: All right. Um, so there's a little note over here you can swap out all the memory segments. 113 00:13:53.880 --> 00:14:02.850 William Cheng: Okay, so here's an example right every one of these men may 2 over here be all equal to zero. So, inside the operating system. You keep track off every one of these memories segment inside of swap face. 114 00:14:03.690 --> 00:14:11.580 William Cheng: Okay, so certainly that's doable. You want to swap out the entire your entire entire user program you can swap out you know all the memory segments. So this way you create space. 115 00:14:11.730 --> 00:14:18.390 William Cheng: Is that physical memory attention. I should run other programs. Right. I mean, clearly, if you're a pro only run once a day right on your laptop, you run 50 program. 116 00:14:18.600 --> 00:14:29.160 William Cheng: Some of them only run once an hour or something once a day was so therefore clearly can just write them out to the soft says okay, and later on when you need when you need them you'll bring them in from the distant memory, then 117 00:14:30.210 --> 00:14:36.510 William Cheng: The next coming over here is that you can start your program with all the memory segment, as if they were swapped out 118 00:14:37.470 --> 00:14:43.410 William Cheng: That. So here's an option when you start running your program. How do you start running your program. Right. So first, you're the parent process for covert trial process. 119 00:14:43.650 --> 00:14:48.330 William Cheng: And the child process is going to make the exact system call it the exhaust system call you wipe out the old 120 00:14:48.600 --> 00:14:57.240 William Cheng: The old the old address space and you build a new one. So now Robinson, when you build a new one. You don't have to read in any of the memory separate in front of this into memory. 121 00:14:57.990 --> 00:15:06.720 William Cheng: Okay, we're going to set up the Colonel, as if all the memories are swapped out. Okay. So, this way we are programmed with Star really fast because we don't have to copy all that 122 00:15:07.560 --> 00:15:12.840 William Cheng: We don't have a copy any of the data from the distant memory, we just set up the colonel data structure and we say your programs running 123 00:15:13.710 --> 00:15:19.710 William Cheng: OK, so now if your product is really, really running, then what it's trying to access the tech segment and then we're going to use the same mechanism. 124 00:15:20.040 --> 00:15:26.880 William Cheng: You know that that will mentioned before, we're going to start with the segmentation far and we're going to allocate a memory is the physical memory. And then we're going to copy data into her 125 00:15:27.060 --> 00:15:37.050 William Cheng: Just what we mentioned before, and now you can actually bring these memories. Segment one memory segment at a time. Okay, so. So the advantage of doing this is that it will look like your program. Get started really fast. 126 00:15:38.220 --> 00:15:39.930 William Cheng: Okay, so yeah, there are multiple 127 00:15:40.290 --> 00:15:46.950 William Cheng: Ways of doing it up in the system designer get to choose whether at the beginning, you want to read all the data from a distant memory, which can take a very long time. 128 00:15:47.130 --> 00:15:52.680 William Cheng: As I mentioned before, if you're running Microsoft Word. Sometimes you run Microsoft Word, just to change one word and then you quit your program. 129 00:15:53.220 --> 00:15:59.130 William Cheng: Okay, so in that case, if you take you, if it takes you a very, very long time to read the entire program and it is into memory and then you make one 130 00:15:59.850 --> 00:16:09.060 William Cheng: minor modification and then you you quit your program. They sort of feel really silly because you spend all your time reading the data from a distant memory and they have to return everything back to the desk. 131 00:16:09.990 --> 00:16:15.810 William Cheng: Okay. So, therefore, this might be a good alternative and later on when I sort of talked about it. You know how they actually do this. Yeah. 132 00:16:18.150 --> 00:16:21.540 William Cheng: Alright, so, so again you know when you try to implement your swap 133 00:16:21.810 --> 00:16:27.780 William Cheng: You know, you need to sort of determine where things go right, you need to walk down the aisle get inside the process control blah we point to the 134 00:16:27.960 --> 00:16:38.820 William Cheng: The address space again the address space your virtual memory map. It's a linked list of as regions or every as region is a memory segment is that every, every mistake. Well, we have to start address. We have the length 135 00:16:39.000 --> 00:16:50.400 William Cheng: We have the permissions, we have, whether it's shared a private. We also have a pointer can point to the file object. I also mentioned that there's something called an anonymous objects over here for the heap segment and and also for the 136 00:16:51.000 --> 00:16:57.060 William Cheng: You know, for, for the sock sock, man. So the purpose for all these objects is also to manage the backing store. 137 00:16:57.750 --> 00:17:02.490 William Cheng: Right. Because in the end, you know, when I tried to swap out a memory sideman where should I make a note inside the cardinal say 138 00:17:02.700 --> 00:17:10.590 William Cheng: This particular memory segment has been swapped out to the desk right so what I can do that can actually use all these objects over here to help me to locate you know 139 00:17:11.190 --> 00:17:16.440 William Cheng: to to to to locate the backing store for this particular memory for this particular memory segment. 140 00:17:16.800 --> 00:17:23.550 William Cheng: Okay, so when data needs to go back to the file over here. So, for example, the tech segment over here. I know where the data comes from. It comes from the desk. 141 00:17:23.880 --> 00:17:30.570 William Cheng: Right. So in this case, I don't need it back in store for it because this file object will be able to get to go through this and get me the entire tech segment. 142 00:17:31.200 --> 00:17:40.920 William Cheng: Okay, so normally the the data segment over here. Originally, that that is I'm gonna come from also the executable file. So again, I can use the Father. The Fall object over here, Shiva data. 143 00:17:41.400 --> 00:17:49.860 William Cheng: When I have a memory math all over here. So yeah, I have a file object. I know. Where did that you retrieve the data. So in this case, maybe I don't need a backing store there. Well, you know, 144 00:17:50.100 --> 00:17:54.720 William Cheng: Again, the back, you're still could be the actual file, especially if you, you know, sort of do a share mapping or disprove the file. 145 00:17:55.110 --> 00:18:04.890 William Cheng: And then for the private mapping over here for the heap segment and also for the stack segment. What they cannot be swap out into the fastest of hierarchy. So therefore, they have to go into the spa space. 146 00:18:05.100 --> 00:18:15.990 William Cheng: Okay, so therefore over here. As I mentioned before, now that there is this object noisy anonymous object and they are anonymous because the heap region and the region, they don't have a file system path name. 147 00:18:16.500 --> 00:18:22.260 William Cheng: Okay, so therefore they're nameless that would call them anonymous. So, so the anonymous objects over here are the ones going to keep track of. 148 00:18:22.500 --> 00:18:29.880 William Cheng: In case this memory segment. You need to be swapping to the swaps face the anonymous object over here where remember where they are inside this process. 149 00:18:30.990 --> 00:18:37.980 William Cheng: Okay, so this way later on when you get a pace, while we try to bring them in, you will ask you an ominous object to say, hey, go to the spa space and get the data for me. 150 00:18:38.220 --> 00:18:45.960 William Cheng: That if it turns out the data is inside of our system hierarchy, then in that case you will ask the file object to go to the File System hierarchy and then retrieve the data for you. 151 00:18:46.800 --> 00:18:56.460 William Cheng: That. So every user memory sideman no matter which one it is, you know, needs a corresponding disk image in case the user process needs to be swapped out. So every one of these, you know, 152 00:18:56.670 --> 00:19:02.910 William Cheng: As region over here you know that the entree point, who also needs to be able to retrieve the data from the backing store. 153 00:19:03.420 --> 00:19:07.260 William Cheng: That all right over here. There's a question over there said, what about the kernel memory. 154 00:19:08.010 --> 00:19:17.220 William Cheng: There. So, this picture is only for the user portion of the address space. Okay, what about what about the colonel portion. Okay. So as it turns out, the colonel portion. So remember, 155 00:19:17.700 --> 00:19:22.050 William Cheng: You know, we saw that in chapter one. Right. You know, when the user positive when they come inside of Colonel 156 00:19:22.260 --> 00:19:31.890 William Cheng: The Colonel is one giant process and the Colonel knows everything about the machine know everything about the opportunities that so therefore the colonel doesn't really need a data structure to represent the address space. 157 00:19:32.460 --> 00:19:36.270 William Cheng: Okay, why does the current on you the data structure to represent an address way for the user space program. 158 00:19:36.450 --> 00:19:47.730 William Cheng: Because every user space program. They're all different right when he comes out of Colonel the colonel are exactly the same. So, therefore, Colonel had their own data structure. So the colonel data started keeping the colonel Aerospace is not this data structure. 159 00:19:48.570 --> 00:19:52.530 William Cheng: Okay, so this data structure is only for the user space program that 160 00:19:53.970 --> 00:20:02.820 William Cheng: Instead of going over here again the implementation also can be witnesses independent. So, one example that excited over here is that in Windows. Some of the kernel memory can be swapped out 161 00:20:03.180 --> 00:20:10.800 William Cheng: Okay, so therefore, in that case, if part of your kernel memory can be swapped out, then you need some objective data Colonel to remember those kind of little memory that being swapped out 162 00:20:11.250 --> 00:20:18.690 William Cheng: As it turns off with this things like Linux and also for our Colonel seven weeks operating system, the kernel memory can never be swapped out 163 00:20:19.410 --> 00:20:31.470 William Cheng: Okay, so in that case again. All these things are independent implementation dependent different operating system can decide how they want to do this now so that they don't sort of the second part of chapter seven. We're also going to talk about this a little bit. 164 00:20:33.480 --> 00:20:36.510 William Cheng: Alright, so now we are done with the first part of 165 00:20:36.930 --> 00:20:47.820 William Cheng: You know, the implementation of the MMU and that's using segmentation segmentation is pretty. Oh, and now the next thing we're going to, we're going to look at pages and pages is the modern way to implement the mm you 166 00:20:48.210 --> 00:20:52.800 William Cheng: Go. So again, the same picture over here. Now we're going to look at different kinds of hardware that 167 00:20:54.030 --> 00:20:57.810 William Cheng: So what is wrong with you know what about what Ron was segmentation. 168 00:20:58.080 --> 00:21:06.780 William Cheng: Okay, so, so everything that we talked about over here when you try to allocate memory segment you do a one segment of the time you don't do one page at a time and the segment can be very, very long. 169 00:21:07.050 --> 00:21:11.250 William Cheng: Okay, so in that case, again, it's going to be very wasteful, you're going to end up with with with external fragmentation. 170 00:21:11.520 --> 00:21:23.610 William Cheng: Just like the first fit memory alligator and also the first few memory. I could is super slow right so its first memory allocated the performance order N word n is a number of free blocks. So the more free blocks that you have. So 171 00:21:24.540 --> 00:21:33.720 William Cheng: As your memories become more prevalent there then then the bigger the Ns and this guy is going to be super slow. So, therefore, you know, this is, you know, over the years, people sort of decide this is really not a good way to go. 172 00:21:34.020 --> 00:21:38.220 William Cheng: Okay, so today we don't see you know people using segmentation anymore. No. 173 00:21:38.850 --> 00:21:46.800 William Cheng: Paging in this case we're going to divide the outer space into fixed size pages and we're going to use the buddy list or the buddy system to manage memory that way. 174 00:21:47.490 --> 00:21:51.240 William Cheng: Okay, so in this guy is again the, the typical your smallest 175 00:21:51.810 --> 00:21:58.950 William Cheng: page size is four kilobytes. Even though in the good old days, you know, maybe in the 70s or 80s or the pay sizes. Typically, half a kilobytes. 176 00:21:59.280 --> 00:22:06.720 William Cheng: So today's eight times bigger is four kilobytes. Okay, so we're going to sort of sort of see, you know how to actually affect. Affect the design of the appendices them all that kind of stuff. 177 00:22:07.200 --> 00:22:11.100 William Cheng: So that since the minimum allocation site is for is for kilobyte 178 00:22:11.640 --> 00:22:21.030 William Cheng: So even if you ask for one by we're going to end up with allocating you four kilobytes. So in this case, we're going to end up with internal fragmentation. So you have to choose either external fragmentation or internal fragmentation. 179 00:22:21.210 --> 00:22:28.230 William Cheng: You cannot choose to say I don't want either, right, that will be not possible that. So in this case, we're choosing internal fragmentation. So again, if you allocate a four kilobyte 180 00:22:28.710 --> 00:22:35.790 William Cheng: Page over here. If the colonel only asked for one bite right that in that case, we're going to end up with 4095 buyers that are totally useless. 181 00:22:36.000 --> 00:22:46.320 William Cheng: It seems very, very wasteful, but inside the colonel speed is more important than the than the space, so therefore they decided to go with this approach and also we're going to see other advantage of using page. 182 00:22:47.070 --> 00:22:56.460 William Cheng: That. So remember now when the kernel memory. If you're using a buddy system you allocate to to the i times 4K. Right. So this guy's is always a power of two. 183 00:22:56.700 --> 00:23:05.940 William Cheng: Time four kilobytes over here. So, India. Yeah, you know what, we're going to end up wasting quite a bit of memory. But again, he's at a colonel. The speed is more important. Yeah. 184 00:23:07.530 --> 00:23:13.770 William Cheng: All right, so let's take a look at how this is done over here. So we're going to divide that so that the goal is exactly the same as 185 00:23:15.150 --> 00:23:20.970 William Cheng: Translation in the case for segmentation segmentation. Again, we're using me to either transition 186 00:23:21.240 --> 00:23:27.990 William Cheng: Now we switch the page in the allocation schemes, a little different, but the goal is still the same, we want to convert a virtual address into a physical address 187 00:23:28.350 --> 00:23:39.510 William Cheng: Yeah so. So again, so, so, so in this case, what happened is that we're going to divide, you know, the virtual address into pages and each page is four kilobytes law. So four kilobytes over here is equal to, to, to the 12 188 00:23:39.990 --> 00:23:48.120 William Cheng: Well, so if you take the entire virtual address, you can actually divided into two parts. The first leading 20 minutes over here is no as a virtual page number and 189 00:23:49.080 --> 00:23:53.460 William Cheng: The lease insignificant tablets is known as the pay the offset within a page. 190 00:23:53.910 --> 00:23:58.440 William Cheng: That. So the ratio thing about it is that if I have my virtual address space over here is four kilobytes. 191 00:23:58.770 --> 00:24:14.250 William Cheng: I'm going to divide them into four kilobytes pages. Sorry, over here, this is four gigabytes over here. Okay. And when divided into four kilobyte pages over here 4K 4K 4K right we always have. Okay, so I can think about my address space as an array of four kilobyte pages. 192 00:24:15.330 --> 00:24:19.830 William Cheng: Okay, so this is simply an array data structure as things that I read status or every element exactly the same. 193 00:24:19.980 --> 00:24:32.460 William Cheng: Exactly the same size. And in this case, the same side, they're all four kilobytes. So this one is going to be array. Next, I'm a zero. This one's gonna be really nice number one to all the way to the two to the to the 20th minus one. 194 00:24:33.930 --> 00:24:40.890 William Cheng: Okay, so tell God that's about 1 million pages over here, right. So again, the array index for your page over here is going to go from zero 195 00:24:41.100 --> 00:24:48.690 William Cheng: All the way to, to, to the 20th minus one. So, if you want any kind of address, you can actually do this in two different level. First, you need to specify a 196 00:24:49.110 --> 00:24:59.820 William Cheng: Re index the re index will tell you which four kilobytes of address you are looking at, and they use the last four days over here to address one by other the other the four kilobytes. 197 00:25:00.900 --> 00:25:04.440 William Cheng: Okay, so this is also you can sort of think about as a sort of a hierarchical addressee 198 00:25:04.650 --> 00:25:17.640 William Cheng: First I want to use the bleeding 20 days over here that will give me an array index to tell me which pays to look at and then I will use the second, the last hope is over here it's going to give me one buy into this four kilobytes of four kilobytes of memory. 199 00:25:18.930 --> 00:25:26.040 William Cheng: Okay, so in this guy so so so get the you know the array index over here we have a special name for it. We're going to call it the virtual page number 200 00:25:26.850 --> 00:25:29.310 William Cheng: That's it again every page has a virtual page number 201 00:25:29.760 --> 00:25:38.910 William Cheng: Please number 012 all the way to, to, to the 20th minus one and that will give you the entire address space and every page has four kilobytes kilobytes of data. 202 00:25:39.270 --> 00:25:46.410 William Cheng: Okay, so what we need to perform address translation. One way to sort of think about it is that we were going to do exactly the same thing to physical memory. 203 00:25:46.680 --> 00:25:54.870 William Cheng: There's over here is invisible. The physical memory is one gigabytes in size right here's one gigabytes physical memory. We can do exactly the same thing. You can divide them into one. 204 00:25:55.110 --> 00:26:00.840 William Cheng: Of four kilobytes pages over here four kilobytes four kilobytes four kilobytes. Not at all the way to last one over here. 205 00:26:01.230 --> 00:26:13.320 William Cheng: Okay, so one gigabyte over here is equal to, to, to the 18 right so in this case what is going to be our array index or a index is going to go from 012 all the way to, to, to the t minus one and that will give us the last page. 206 00:26:14.160 --> 00:26:20.640 William Cheng: There and then to find out what the physical address for one of the memory location over here is that you can also again to at this hierarchical the 207 00:26:20.910 --> 00:26:29.730 William Cheng: Given a physical page number that will give you a page and then you can use the offset within that page to give you one bite in one buy into that page of memory. 208 00:26:31.290 --> 00:26:43.410 William Cheng: Okay, so therefore, our goal is to start with a virtual address over here, we need to map it into a physical address so so so when we promote other translation. What, what we can do is that we can simply convert the virtual paste number to a physical page number 209 00:26:44.520 --> 00:26:47.790 William Cheng: Okay wow the offset over here. We're going to keep them exactly the same. 210 00:26:48.450 --> 00:26:58.740 William Cheng: Okay, so, yeah, we are not going to change the offset over here at the last episode, we're going to carry exactly the same. So what we needed to what we're trying to do over here is to map one virtual page over here to one physical page. 211 00:27:00.030 --> 00:27:08.670 William Cheng: Okay, so when you're doing paging the job of address translation is simply to convert a virtual patient number which is the leading 20 bits of a virtual address. Okay. 212 00:27:08.910 --> 00:27:16.710 William Cheng: To a physical page number, the physical page number. How many bits of it depends on how many memory. How much memory that you have, if you have only one gigabytes of 213 00:27:17.430 --> 00:27:24.030 William Cheng: physical memory over here, in this case, the physical a page number over here is going to be 1818 this law. What if you are four gigabytes of memory. 214 00:27:24.450 --> 00:27:29.220 William Cheng: If you have four gigabytes a physical memory. Well, in that case, the physical page number over here will be 20 bits law. 215 00:27:29.520 --> 00:27:36.930 William Cheng: Okay, what do we have 16 gigabytes of memory, right, that's four times longer. So in that case, we're going to end up with 22 bids over here. If your physical memory is going to be 216 00:27:37.980 --> 00:27:39.540 William Cheng: The physical memory is going to be 16 gigabytes. 217 00:27:40.620 --> 00:27:42.570 William Cheng: You have six and given by a physical memory. 218 00:27:43.590 --> 00:27:53.160 William Cheng: Okay, so we started out with the same thing, right, with the virtual page number. It's only it's only 20 minutes law. We need to use our MMU to give us the right size of the of the physical page number 219 00:27:53.670 --> 00:28:05.340 William Cheng: Okay, and then we simply a pen. The offset over here. And then we're going to get that the the physical address. OK, so the job of the MMU now is to convert a virtual patient number to a physical page number then 220 00:28:06.930 --> 00:28:13.740 William Cheng: Also have your address translation page income per virtual page number, the physical page number and also within the page stays the same. Yeah. 221 00:28:16.830 --> 00:28:27.180 William Cheng: So so ago on the right is that, again, this is our one gigabytes of physical memory over here at the page number go from 012 all the way through. So this number is two to the 18th minus one. 222 00:28:27.600 --> 00:28:33.930 William Cheng: Right. So yeah, we just covered one or a index for another array index and then also within a page. Keep exactly the same. Now, 223 00:28:34.500 --> 00:28:46.110 William Cheng: I saw a missile read through this where I went to a fixed size pages into physical memory into physical pages, the address. The address space is divided into virtual pages over here and the physical memory is going to get the buy in the physical pages. 224 00:28:46.680 --> 00:28:54.120 William Cheng: So, so what we need to do is that we need to perform a lookup operation, keeping a virtual page number, what is the corresponding physical patient number 225 00:28:54.870 --> 00:29:05.580 William Cheng: Guys, I was using the term map on the virtual just the physical address. You can also think about this is kind of a generic, you know, computer science problem. I guess a map data structure is is also for you to look 226 00:29:06.330 --> 00:29:15.510 William Cheng: Something up given one key value you try to give a one key to look up the value that. So, therefore, in general, what we are implementing inside the 227 00:29:17.040 --> 00:29:24.960 William Cheng: Inside a memory management unit is a look up data structure. Okay. Given a virtual face number of what is the corresponding physical page number 228 00:29:25.740 --> 00:29:30.840 William Cheng: OK, so the reason why I sort of want to bring this up is that they don't. We're going to see that there are different implementation of the same 229 00:29:31.050 --> 00:29:40.830 William Cheng: The same concept. Okay, or you can sort of think about the lookup table is an abstract data tied and there are different ways to implement this, right, and pretty soon in the next session, we're going to see how different ways to implement this. 230 00:29:41.040 --> 00:29:50.160 William Cheng: Yeah. So this little cave or math lab a virtual page number to a physical piece number or you can sort of think about it as translating a virtual page number into physical paper. 231 00:29:50.340 --> 00:29:54.630 William Cheng: Or you can think about it as translating a virtual address into a physical address. They're all the same thing. 232 00:29:55.680 --> 00:29:55.950 William Cheng: Yeah. 233 00:29:57.270 --> 00:30:04.860 William Cheng: One important terminology I want us to introduce over here is that an address is called a page a line address if it's least significant top it's all zero. 234 00:30:05.700 --> 00:30:12.630 William Cheng: Okay, so what's the page line address over here so memory location zero, even if no matter what the physical address or a 235 00:30:13.530 --> 00:30:19.080 William Cheng: virtual address. It's going to be all zeros over here. So, so the last hope is over here. They're all zeros right over here, we have 236 00:30:19.380 --> 00:30:30.540 William Cheng: Zeros over here and they have plenty zero in front of it. That's a virtual address or physical address address zero okay this is a page align address because the least significant topics over here. They're all zero. 237 00:30:31.020 --> 00:30:38.160 William Cheng: Okay, so in this picture for physical memory. I'll be here. Where does this memory address correspond to what to correspond to the first address within this page. 238 00:30:39.030 --> 00:30:49.200 William Cheng: That. So the idea of curious are the first address within every page has a page align address because all the least we can talk is over here, they're all equal to zero. So, again, why is that 239 00:30:49.590 --> 00:31:01.710 William Cheng: Right. Because over here. If the offset zero you're accessing the first memory location within a page. So, so if the last hope is over here. They're all zero, you have a page align address that. So a patient online to address again can be used. 240 00:31:02.100 --> 00:31:04.800 William Cheng: To describe a physical address or a virtual address 241 00:31:05.160 --> 00:31:15.090 William Cheng: Right. So when you're doing your kernel three as I met you want to see this term over and over again. But it's very, very simple. All you have to do is think about the last 12 bits inside an address is zero. That's a baseline address 242 00:31:15.480 --> 00:31:25.530 William Cheng: Okay, so if you want to get out get, you know, especially if you want to get a virtual address all you need to do is you need to add an offsite to it, why not case, you kind of get you going to get you there. You're going to get the actual virtual address 243 00:31:27.390 --> 00:31:34.050 William Cheng: Because if you can actually add zeros to anything. You're going to get exactly the same thing, right. So the if we can add always add offset to a to a baseline address 244 00:31:35.190 --> 00:31:42.000 William Cheng: Alright, so we're going to talk about a bunch of the hardware mapping technique over here to implement this lookup table at the Lincoln point this page table. 245 00:31:44.340 --> 00:31:49.680 William Cheng: The first thing we're going to look at is MMU and paste table. So again, and then use instead of hardware. What about the pace table. 246 00:31:50.070 --> 00:31:57.420 William Cheng: And we mentioned before, the pace table is a colonel data structure. So this, this thing is mostly in software. But as it turns out, it's a specialized 247 00:31:57.660 --> 00:32:04.320 William Cheng: Sort of a data structure, right, paste, paste a boy is the data structure that's that's Implementing software but it's understood by the hardware. 248 00:32:05.520 --> 00:32:10.170 William Cheng: Okay, so they have, what will you sort of construct a patient but you got to be very careful because if you're able to make one single mistake. 249 00:32:10.620 --> 00:32:19.470 William Cheng: Then the Emily was going to get totally confused and do all kinds of weird stuff. Okay, so it's a data structure that prepared by the Colonel, but it's used by the hardware. 250 00:32:20.460 --> 00:32:22.860 William Cheng: That so so again later. I'm going to sort of see see what those look like 251 00:32:23.250 --> 00:32:33.510 William Cheng: The other day inner circle when I look I also look at that's in the next lecture has a fancy name is known as a translation look aside buffer guys are has a funny name. It's all going to take a look at it a little later. Yeah. 252 00:32:34.980 --> 00:32:44.460 William Cheng: Alright, so before we actually sort of show you how the the the address translation is done are using page. It will also mentioned a very, very important external data structure is known as the page frame. 253 00:32:45.300 --> 00:32:53.280 William Cheng: Okay. So, so what is the page frame over here. So, so the idea of yours that you can think about is, you know, the analogy over here. It's like a picture frame. 254 00:32:53.610 --> 00:32:58.470 William Cheng: Right, if you have a picture frame. So what is the picture frame will guy right picture frame look like you know look like this, or something like that. Right. 255 00:32:58.890 --> 00:33:05.610 William Cheng: Oh, what's a picture frame at a picture frame is something that you put a picture inside of it. Okay, so we have a picture over here. I'm not putting inside over here. 256 00:33:05.940 --> 00:33:09.090 William Cheng: Okay, so why do I need to have a picture frame around a picture. 257 00:33:09.690 --> 00:33:18.180 William Cheng: Was it this way I can pick it up without leaving any fingerprints on it. And also, I can actually write all kinds of stuff on the side of the picture frame on the back of the picture frame. So this way. I won't forget 258 00:33:18.720 --> 00:33:26.460 William Cheng: Okay, so you do the same thing with the physical page. Okay, whenever you need to access the physical page. The first thing you need to do is to put it inside of a PageRank. 259 00:33:27.030 --> 00:33:38.970 William Cheng: Guys. Okay, here is my physical page over here when I, you know, when I asked the buddy system say hey, give me a page and when the buddy system return you to a page. And now that belong to the organism, the obvious is nobody will do is that they were sticking inside a PageRank. 260 00:33:39.990 --> 00:33:44.070 William Cheng: Okay. So on this page. I'm over here. So again, the reason we need to put these on a patient is that 261 00:33:44.250 --> 00:33:52.800 William Cheng: This you know page of data over here, it might belong to the user process. So therefore, the operating system is not allowed to touch is not allowed to leave any fingerprints on to this on. 262 00:33:53.340 --> 00:34:00.240 William Cheng: This page. So therefore, the openness is that if it needs to make any notes about this page what he will do is that they can actually write all over the page object. 263 00:34:01.260 --> 00:34:07.770 William Cheng: Okay, so when you're doing your carnal three, you're going to look at a patient my jacket that will be the first object, you have to deal with. Right. So again, look at a patient object. 264 00:34:07.920 --> 00:34:17.400 William Cheng: You can see that there's a bunch of data structure on top of it. You can keep track of a lot of information about this particular physical page. Okay. So, for example, one thing you want to keep on Wednesday, you know, try to keep that 265 00:34:17.760 --> 00:34:24.420 William Cheng: Is which virtual page number. It's correspond to those are in this case, you'll get you can't really write it into the physical page. So therefore you right into the page object. 266 00:34:26.250 --> 00:34:41.970 William Cheng: Okay. All right. So the pace reading that data center over here is used to maintain information about physical pages and their association with important Colonel data structure. So, so the link between a physical page and the rest of the operating system is basically stored inside patron. 267 00:34:43.020 --> 00:34:47.100 William Cheng: Okay, so it contains a virtual address for reading and writing that page. 268 00:34:47.730 --> 00:34:58.800 William Cheng: Okay, so, so good. I mentioned before, in order for you to write data into this page over here. So, so over here is I saw pointer that this page cities that a patient actually correspond to pay a physical page number three. 269 00:34:59.310 --> 00:35:03.630 William Cheng: Okay, how do I write data into physical piece number three. Why do I need to write page data into 270 00:35:04.020 --> 00:35:05.100 William Cheng: The physical page number three. 271 00:35:05.400 --> 00:35:12.900 William Cheng: Well, maybe I need to transfer data from the desk into memory. Sorry, I need to transfer data on the memory into this. So, therefore, I need to copy data into memory first 272 00:35:13.080 --> 00:35:17.580 William Cheng: And then tell that this controller and say, take this data and then write it in right right onto the desk. 273 00:35:18.060 --> 00:35:23.910 William Cheng: Okay, so in that case, I still need to write into into this this memory over here. How do I write data into this piece of memory. 274 00:35:24.480 --> 00:35:31.410 William Cheng: We mentioned before, the operating system doesn't know how to use a physical address. So if you have a physical address over here. There's no way for you to write this piece of memory. 275 00:35:33.000 --> 00:35:44.040 William Cheng: So, therefore, what you have to do is that inside the pace frame object over here, there's gonna be a data structure that remember what is the Colonel virtual address the colonel can use to write to other the other this particular page. 276 00:35:45.060 --> 00:35:54.870 William Cheng: So by using a kernel virtual address or Colonel virtual address over here for this page. So this kernel Roberto Jen is going to be a page align address it will point to the first memory location over here. 277 00:35:55.020 --> 00:36:04.050 William Cheng: So if you want the right to any memory location inside of physical page. All you need to do is to add offset to it and you can write to any physical memory or be here using a kernel virtual address 278 00:36:05.190 --> 00:36:16.680 William Cheng: Okay, again, the reason we do that is that because even the Colonel, can I use physical address directly there but it knows the correspondence between a virtual between between a page aligned virtual address and a page like Colonel 279 00:36:16.980 --> 00:36:24.390 William Cheng: Sorry, a page like, you know, a virtual address and a patient like physical address. Okay, so therefore you can actually, you know, give that 280 00:36:24.870 --> 00:36:35.100 William Cheng: That the virtual address to the colonel colonel can use that to read it to the right data into a physical page. It can also read it on the physical page right so if you transfer data from a distant memory. 281 00:36:35.340 --> 00:36:43.020 William Cheng: Once the data has been translated to memory over here. How does it kind of read a lot of the colonel has used the colonel virtual address in order to read this data into your program. 282 00:36:44.040 --> 00:36:52.650 William Cheng: Okay, so, so, so one, one important thing is that a pager over here is going to be the colonel virtual address at the colonel can use to read and write physical memory. 283 00:36:53.580 --> 00:36:57.330 William Cheng: There are they also come into physical page number right so the physical place number so 284 00:36:57.480 --> 00:37:04.470 William Cheng: So what you can do with the physical piece number is that you left shifted by tibbetts you're going to end up with a page a line address. Right. So how do you do the left shift right 285 00:37:04.650 --> 00:37:16.020 William Cheng: You take a physical page number over here, right, this one. The example that we saw at this law. Okay. If you love shifted by 12 days over here, you're gonna end up with 12 zero. And then over here. Well, that will give you a patient line address 286 00:37:17.310 --> 00:37:25.920 William Cheng: Okay. So, therefore, you know, it's very simple to start with a physical page number over here to get a page align physical address and if you add offset to it, you're going to get a physical address 287 00:37:26.850 --> 00:37:31.350 William Cheng: Now alright so so again this is what the current information that you will store instead of pace rain. 288 00:37:31.740 --> 00:37:40.920 William Cheng: And what's important to understand is that, and this turns out, this one's going to create a little bit of a mess over here is that there's a one to one mapping between a page friend and the allocated physical page. 289 00:37:41.640 --> 00:37:45.240 William Cheng: Okay, as I mentioned before, whenever you ask the buddy system to create a page for you. 290 00:37:45.720 --> 00:37:57.990 William Cheng: The first thing that you will do is that you were sticking out a patient I'm over here. So for every allocated the page for every page for for every page that's returned from the buddy system, there has to be a corresponding you know corresponding patient object. 291 00:37:59.400 --> 00:38:04.470 William Cheng: Okay. So, therefore, if you want to talk about a physical page, it will be the same thing as talk about the PageRank. 292 00:38:04.650 --> 00:38:14.940 William Cheng: If you want to talk about a patient and the same thing has talked about the physical page because there's a one to one correspondence. Okay, so here's the bad news. We're going to use the word page frame and physical page interchangeably. 293 00:38:16.020 --> 00:38:25.200 William Cheng: And so, people ask me, Why do you want to do that what because that's how you know obviously that people talk about page for him, how they talk about, you know, physical memory. So you're going to, you're going to see that in the textbook. 294 00:38:25.800 --> 00:38:30.540 William Cheng: A lot of times when it actually talk about patient patient, he said, that doesn't make sense, it clearly is talk about it's 295 00:38:30.720 --> 00:38:39.660 William Cheng: Talking about physical page. But again, you need to be. Remember that I'll be here in the textbook. They also use the word page frame and physical page interchangeably, because whenever there's a physical page. 296 00:38:39.930 --> 00:38:48.330 William Cheng: That's allocated, there has to be a corresponding PageRank. Okay. And also, whenever there's a page frame, there has to be a corresponding physical page. Yeah. 297 00:38:49.500 --> 00:38:54.780 William Cheng: Alright, so once also one sort of messy things about pastry. I'm over here is that PageRank can be sure 298 00:38:55.230 --> 00:38:59.850 William Cheng: Because the physical page can be sure if this particular physical page over here is inside of tech segment. 299 00:39:00.120 --> 00:39:14.310 William Cheng: Is used by by one program for the tech segment. What it says tech stack bank can be sure, then in that case, you know, multiple program over here, my share exactly the same physical page over here. So this guy is what it will do is it will actually share the same page frame object. 300 00:39:15.480 --> 00:39:19.110 William Cheng: Okay, so this one of the reason you know the patient market is a little more messy. 301 00:39:19.560 --> 00:39:28.590 William Cheng: Because you know one pager I'm object and then what will we talk about memory segment rather memory segment belong to a process guy, so it's nice and clean. Every memory segment over here belong to 302 00:39:29.250 --> 00:39:40.410 William Cheng: Belong to a process starting with a process control blah, you can point to the address space or the virtual memory map and they have a linear list of, you know, as region over here. The as region is not being shared with any other process. 303 00:39:40.710 --> 00:39:48.720 William Cheng: Okay, but then you know the region over here. What it will do is it will point to object that manage these pages rain and the PageRank can be shared by multiple processes. 304 00:39:49.080 --> 00:39:53.850 William Cheng: That's one of the reason your kernel three is going to be a little messier right because over here. When I have a lot of sharing going on. 305 00:39:54.420 --> 00:39:59.130 William Cheng: There. So again, don't worry about it now. And later on, what are you doing Colonel three deals do study upward 306 00:39:59.850 --> 00:40:07.950 William Cheng: Right here. I also have a really weird note over here is the winnings notes will Colonel three over here instead of patient magic over here, one of the fields is known as the page down 307 00:40:08.610 --> 00:40:10.800 William Cheng: Okay page is a page number, right, some people 308 00:40:11.160 --> 00:40:21.810 William Cheng: Sort of misunderstood the page now for a virtual page number or for physical page number. As it turns out, he has nothing to do with the virtual base number of his go page number. So again, the virtual page number of physical page number on the slide right 309 00:40:22.080 --> 00:40:32.430 William Cheng: This is the virtual page number. This is a physical piece number. Oh, so what's the page. Now that so a page. Now as it turns out, is just an array index and it's typical is a very, very small array index. 310 00:40:33.810 --> 00:40:40.110 William Cheng: Okay, so, so, so, for example, you want the map of fall from the desert into memory. So the fall over here. So let's say that the fall over here is 311 00:40:40.620 --> 00:40:48.210 William Cheng: I don't know 15 kilobytes long. Okay, so in that case it will take four pages to cover this particular file, right. So the four kilobytes four kilobytes. 312 00:40:48.510 --> 00:40:58.050 William Cheng: four kilobytes. And the last one over here, three kilobytes over here. So in this case in when the wind is helping his sister. They call this page. Page number zero page number one page number two page number three. 313 00:40:59.070 --> 00:41:04.980 William Cheng: Okay, so, so, so instead of when these kind of they use the page number over here to keep track of the mapping from the disk into memory. 314 00:41:06.300 --> 00:41:11.910 William Cheng: OK. So again, the page. Now I'm over here instead of patient, it's typically a very, very small array index. 315 00:41:12.420 --> 00:41:22.680 William Cheng: For you, for, for them to keep track of memory map files. OK. So again, don't confuse that with the virtual piece number and the physical number the original voice number and the physical copies number. Typically, they are very, very large numbers. 316 00:41:23.400 --> 00:41:30.030 William Cheng: Okay, so therefore, again, you know, when you see a patient, it means that patient and become a really large number that you know that you have a bug inside a carnal. Yeah. 317 00:41:32.220 --> 00:41:39.600 William Cheng: Alright, so the main purpose for the, the, the patient needs to perform that function right given a virtual address. What is the quarter. 318 00:41:39.810 --> 00:41:45.450 William Cheng: Given the virtual piece number, what is the corresponding physical page number. So, this can be done by using the patient object, okay. 319 00:41:46.020 --> 00:41:55.200 William Cheng: So, so this is known as the for look up. Okay, before we look up is that given a virtual I just have a process, find the pastry. And once you find the patient and the patient is going to give you their 320 00:41:55.530 --> 00:42:04.080 William Cheng: The physical page number, the physical page number you left shift by 12 bed at the offset into the virtual address over here the last four beds and then you got to go to physical address 321 00:42:04.650 --> 00:42:12.750 William Cheng: OK. So again, the idea here is that using a patient of object as long as you can find the right page rank, then you can do this. The conversion from a virtual address to a physical address 322 00:42:13.020 --> 00:42:24.060 William Cheng: That also more importantly is that, you know, you can use the page name to perform a reverse lookup given a PageRank find processes and virtual addresses that map to this page right 323 00:42:24.450 --> 00:42:32.040 William Cheng: Okay, so in this case the proper pull over here, they are done intentionally because one page rank can be shared by multiple processes. 324 00:42:32.220 --> 00:42:41.250 William Cheng: Can simultaneously exists in multiple addresses. So therefore, the reverse lookup is that given a patient, you need to be able to find all processes that are using the space, right. 325 00:42:42.480 --> 00:42:48.960 William Cheng: So instead of colonel colonel three, you're going to start dealing with some of the more complicated data structure such as a hash table or something like that. 326 00:42:49.470 --> 00:42:56.610 William Cheng: In Colonel guess it doesn't Colonel one, all you have to deal with our link list. So they're pretty straightforward and Colonel three things gonna be a little messy. 327 00:42:57.420 --> 00:43:07.890 William Cheng: Now, so the winning spatial data structure is a bit involved. We don't know going to talk about now when we talk about the second part of chapter seven, we're going to start talking about some of the the Phoenix patient data structure. Yeah. 328 00:43:09.030 --> 00:43:18.630 William Cheng: And again, I mentioned this already. And then when you start doing your carnal three. Make sure you read this kernel three FAQ against the colonel three FAQ is pretty long, but he should be the other way help you to understand 329 00:43:19.230 --> 00:43:21.720 William Cheng: You know what, what, what, what you have to implementing Colonel three 330 00:43:24.060 --> 00:43:32.580 William Cheng: Alright, so let's take a look at how do you get your home address translation. So we're going to start with the virtual address want to convert into a physical address right again this is the high level picture over here. 331 00:43:32.790 --> 00:43:38.100 William Cheng: On the on the left hand side over here. This is going to be the detailed picture for doing address translation. 332 00:43:38.520 --> 00:43:43.350 William Cheng: Okay, but guess what do you need to do is that you need to take the virtual page number convert them into a physical page number 333 00:43:43.560 --> 00:43:52.830 William Cheng: That the data structure that we're going to use is called a page table inside a page that will be here at simply an array data structure right this array is indexed by the virtual page number 334 00:43:53.190 --> 00:44:02.850 William Cheng: Okay, so yeah. What you would do is that you start with a 32 bit virtual address you chopped into two parts. The leading one debates over years no at the virtual page number and the remaining two tall is he is known as the offset. 335 00:44:03.480 --> 00:44:10.830 William Cheng: The offset doesn't really get involved at the beginning part of the outer sensation. We're going to take the virtual paste and re index to index RPS table. 336 00:44:11.340 --> 00:44:18.690 William Cheng: Okay, we mentioned before, the paper has 1 million entries over here, right at the virtual face number is 40 minutes long, to, to the 20 is about 1 million right 337 00:44:18.870 --> 00:44:28.200 William Cheng: So in this case, the virtual page number is going to be simply use as a really in depth into this page table every data structure over here. Is that a page table is known as a page table entry. 338 00:44:28.470 --> 00:44:32.700 William Cheng: Now, or we're sort of blow it up. Here's the page table entry, when you're working on the 339 00:44:33.000 --> 00:44:43.290 William Cheng: The Colonel assignment you will see the abbreviation coffee, tea, or lowercase p. Now, so they're talking about paste over entry. So it's one of 1 million entries that page table. 340 00:44:43.920 --> 00:44:49.620 William Cheng: Okay, the pace that branches over here look like this inside of a stillborn she's over here is the physical page number 341 00:44:50.640 --> 00:44:56.400 William Cheng: OK. So again, this. Yeah. So, from this picture you can see how they implement this one right. You take the virtual page number and then you 342 00:44:57.360 --> 00:45:06.390 William Cheng: You make it goes through the menu. So in this case, you know that inside the MMU what it will do is that it will do all these computation to use the page table over here to give you a physical page number 343 00:45:07.410 --> 00:45:13.470 William Cheng: Okay, so why is it a physical piece on with the rest is easy. Right. You love shifted by 12 minutes right and then you're going to get a page line address 344 00:45:13.680 --> 00:45:22.890 William Cheng: If you add the offset to the officer can be copied on the virtual address over here. So in this picture over here, we take the physical based number left shifted by Paul bears won't get it get a page line address 345 00:45:23.070 --> 00:45:29.070 William Cheng: We add the offset to it. And that will give us a physical address that. So that's how you perform address translation. 346 00:45:30.480 --> 00:45:40.320 William Cheng: Okay, so yeah, let's just do it the second time over here and this time it will be a when you try to access the pace table paste it over here instead of using array index. Okay, we can actually do pointer math. 347 00:45:40.800 --> 00:45:50.160 William Cheng: Okay we if we know that the base address of the page table over here. Every page table entries over here, how many bytes. Is this what the physical page number over here, we saw before their example of, you know, 348 00:45:50.580 --> 00:45:57.480 William Cheng: 1818 best at 2022 bids over here. So kind of that doesn't have a stable injuries you fit into four bytes of memory. 349 00:45:58.050 --> 00:46:04.320 William Cheng: Okay, so this will be a four by the memory. So if you have the face. I don't know paste a ball. If you want to compute the address for the page table entry. 350 00:46:04.620 --> 00:46:13.560 William Cheng: All you have to do is do you need you to take the virtual base number over here, multiply by four and then added to the size of the page table there. You got to get the address of the page table entry. 351 00:46:14.730 --> 00:46:23.220 William Cheng: Okay, so definitely this case again, what would you do any provider translation. So again, this is done, he said MMU they take the virtual drive chop them into to the leading 20 minutes over here. 352 00:46:23.430 --> 00:46:27.330 William Cheng: I'm going to multiply by four or left shifted by two bits. That's the same thing, right. 353 00:46:27.630 --> 00:46:36.450 William Cheng: Edit to the base. I go to the page table over here. I'm going to get a address for the page table entries over here, right. So again, the page tab over here. It's a data structure that that 354 00:46:37.260 --> 00:46:45.360 William Cheng: The patient. It's a kernel data structure. So, therefore, this address this entire table is sitting across the city across the bus and physical memory. 355 00:46:46.140 --> 00:46:57.840 William Cheng: Okay. So, therefore, you actually have to go across the bus to access the physical memory over here to read a page table entry from across the bus from the memory and then copy them into the MMU and then you can continue that operation. 356 00:46:58.110 --> 00:47:05.640 William Cheng: Okay, so once you copy them to the menu. Over here you get the physical address over here and then you left shifted by tall bids over here. Get a page, a lot of physical address 357 00:47:05.910 --> 00:47:17.460 William Cheng: At the opposite to and then you get the physical address and what you do with the physical address again. You take the physical address you put it onto the bus again there. And this way you can read them right memory. The real physical memory. 358 00:47:18.600 --> 00:47:29.700 William Cheng: Alright, so this is what you do when you perform address translation. Yeah. All right, what about all these other things are we going to paste a boundary. Okay, so, so we, here are the V over here is when we saw before, in 359 00:47:30.840 --> 00:47:41.250 William Cheng: In segmentation right the VM. Years of Living the bed right if the equals two, one, that means that the entire page table entry is valid. Okay, if he equals zero. That means that all these things are invalid. 360 00:47:42.300 --> 00:47:51.420 William Cheng: Guys. So in that case, if you try to perform at the translation. When the VB Id is equal to zero what will have a lot, you're trapping to the operating system. The opposite in this case will try to fix. 361 00:47:52.080 --> 00:47:56.640 William Cheng: So this is no longer call segmentation anymore, right, because now we're using page and so therefore this quarter page fall 362 00:47:57.270 --> 00:48:05.880 William Cheng: Okay, so when you perform address translation, if you see that the the bit over here, equal to zero you cause a fall into the inequality CPI you typing the ordinances there. 363 00:48:06.090 --> 00:48:17.160 William Cheng: With a page fall. And now, you know, instead of racism, they'll try to fix the page Hall. Right. So again, the idea here is very, very similar segmentation, except that now we're doing this one page at a time, instead of one memory segment of time. 364 00:48:18.000 --> 00:48:26.880 William Cheng: Now, right. So the V over here is that we saw before. What about the end bit over here. The end been over here said whether this thing or this particular page has been modified or not. 365 00:48:27.390 --> 00:48:36.600 William Cheng: Okay, so why is that every time we provide a translation when you try to write to a page, we actually are going to remember them inside the page table entries to say this particular page has been modified 366 00:48:37.050 --> 00:48:43.320 William Cheng: So what does it mean that this patient may modify okay that means that this particular page is different from the data in the backing store. 367 00:48:44.370 --> 00:48:46.890 William Cheng: Right, because you know these pages over here, you know, we 368 00:48:47.220 --> 00:48:57.720 William Cheng: Were talking we just, we just talk, talk about it. Right, we're going to start our process as if everything is swapped out right so when you swap something in front of this into memory, it will have exactly the same day that is sitting, sitting on the desk. 369 00:48:57.930 --> 00:49:03.990 William Cheng: Right. Why don't you modify this page over here, we need to remember that, hey, you know, this page now is different from football. Football 370 00:49:04.650 --> 00:49:08.100 William Cheng: Football off on watch on desk, guys. And this guy's we're going to set this 371 00:49:08.370 --> 00:49:17.520 William Cheng: Equal to one to say that this page over here is different than what's on this. So next time when we tried to swap it out. Why not, guys. We need to write this particular page back onto this before we can swap it out. 372 00:49:18.390 --> 00:49:23.970 William Cheng: Okay. The other possibility is that next level, we try to swap out this particular page. What is Mo, be able to zero. 373 00:49:24.780 --> 00:49:34.350 William Cheng: Okay if em over here you go to zero, then we know that the page and memory. It's exactly the same as page in this way because we don't have to write it to this. So this way. We're going to save time writing to the desk. 374 00:49:35.070 --> 00:49:42.420 William Cheng: Raspberry. Remember, you know, in order for you to have the fastest then look fast, you have to try to minimize the number of time you go to this. So that's why we do it over here in 375 00:49:42.660 --> 00:49:49.230 William Cheng: The page of yours on modify that means that exactly the same thing is that they don't have to do. So therefore, we don't want to do this and this way we can save a lot of time. 376 00:49:49.890 --> 00:49:53.430 William Cheng: Yeah, but the next myth of yours. No, it's a reference bit over here. 377 00:49:53.910 --> 00:50:05.910 William Cheng: In males, whether this page has been used or now has been referenced right so anytime when you try to provide your translation either to read or write memory. So this bill will be set to what if this equal to zero, that means that this page hasn't been used 378 00:50:06.750 --> 00:50:13.590 William Cheng: Okay, so if it hasn't been used one maybe this is actually a good clue you know for you to actually swap it out in case you need to actually find something, you know, 379 00:50:14.430 --> 00:50:23.160 William Cheng: For final page swap out to this guy so so good right now we don't know how to use this particular bear. So later on in the later part of chapter seven. What is how to use it. Use this particular bit now. 380 00:50:23.700 --> 00:50:28.650 William Cheng: The next part over here. So the protection bit right we saw before. We have read only. We have rewrite over here. 381 00:50:28.770 --> 00:50:40.890 William Cheng: We can also have the execute this in here. So that's what this is a choice as to bits. Wow. So maybe 00 is read only 01 is rewrite one zero is execute and then one one over here. Maybe it's some some some other permission. 382 00:50:41.370 --> 00:50:53.400 William Cheng: Okay, so when you provide a transition, you need to check whether you are trying to write to read only memory. So again, in this case, when you get the PACER or inches over here. You can check the protection bit to see if the operation you try to come 383 00:50:54.450 --> 00:50:57.540 William Cheng: To perform, whether it's compatible with this production, but over here. 384 00:50:58.080 --> 00:51:04.980 William Cheng: Okay, we also see that when you're implementing copy on write right we need to set this one to read only first and this way. Well, you try to write to it for the first time. 385 00:51:05.400 --> 00:51:10.050 William Cheng: We can try to the operating system. And we can actually, you know, to do copy. Right, right. 386 00:51:10.770 --> 00:51:18.720 William Cheng: Right. So there's a little note over here for the x86 CPU, there's only one bit. Okay. So, so sad to see below. There's only read only or rewrite 387 00:51:19.350 --> 00:51:28.350 William Cheng: x86 CPU. They also have something called the validity bit but they call it something else. They also have something different data instead of paper entry right so again this is the one that's presented by the textbook. 388 00:51:28.980 --> 00:51:39.570 William Cheng: While you're doing your kernel three since you are building the pace table. You need to know what it looks nice. And that's k, you need to consult the x86 programs manual. So in that case, you need to sort of figure out exactly what that look like 389 00:51:40.200 --> 00:51:41.910 William Cheng: Yeah. So again, that's what Colonel three 390 00:51:42.450 --> 00:51:52.290 William Cheng: Also, you can see that instead of pasting going to over here. There's no showbiz there's no private did there. Those information typically belong to the as region, they are not store insert a table entry. 391 00:51:52.620 --> 00:51:59.700 William Cheng: Okay, because when you provide a translation. You don't really care whether it's share or private. Okay. So, only instead of Colonel, you will care about that. Yeah. 392 00:52:02.040 --> 00:52:08.310 William Cheng: Alright, so a pay stub or inches over here to analogous to the base of the bands APPROACH. GOOD. WHY IS THAT analogous 393 00:52:08.760 --> 00:52:20.820 William Cheng: Okay, what, what is the corresponding you know base address for putting the page what the pace address is the physical page number over here left shifted by 12 to get a page long address. So the page align our address is the base register. 394 00:52:21.720 --> 00:52:32.460 William Cheng: Okay, so therefore the page table entry is your me register over here, right. What about the bounds over here. Well, as it turns out, when you're using paging there's no bounce right so therefore you can never be out of balance. 395 00:52:33.510 --> 00:52:38.160 William Cheng: Okay, so if you have a memory segment of your. So the example that I gave before, right, you have a 15 kilobytes. 396 00:52:38.400 --> 00:52:45.540 William Cheng: You know, some sort of a memory. So when you map on the distinct memory. We're going to allocate pages for four kilobytes four kilobytes four kilobytes. 397 00:52:45.750 --> 00:52:56.070 William Cheng: And the last one is three kilobytes. And again, we still have to allocate multiples of four kilobytes. So last one over here at the end over here. There's going to be unusable memory that are one kilobytes in size. 398 00:52:56.970 --> 00:53:03.120 William Cheng: That. So in this case, when you try to protect this last page over here. You either say this page is read only or rewrite 399 00:53:03.300 --> 00:53:12.570 William Cheng: You cannot say that the first three kilobytes over here is is rewriting the last part over here is no access. There's no way for you to say that we are using pages, right, because we don't have the bounds register. 400 00:53:13.530 --> 00:53:23.430 William Cheng: Guys are in this case, the protection boundary. When you're using pages is one page at a time. What the protection boundary for the for segmentation, you can actually go down to the bite level. 401 00:53:24.210 --> 00:53:35.430 William Cheng: Okay, so therefore the protection has lower resolution were using paging while protection using segmentation has a higher resolution, because you can specify to the by level exactly how many bytes is a memory segment. 402 00:53:35.970 --> 00:53:40.470 William Cheng: Okay, over here, this memory segment is going to be 16 kilobyte long, even though the 403 00:53:40.830 --> 00:53:52.170 William Cheng: Inside the inside as region is that every year it will say that this this memory segment is 15 kilobytes law. But India. We're going to protect 16 kilobyte at a time because there's no way for us to protect only 15 kilobytes. 404 00:53:53.040 --> 00:53:59.730 William Cheng: Okay, so there was going to be a little weird when you're using page. And over here you try to go beyond the end of the memory segment is actually going to be okay. 405 00:54:00.540 --> 00:54:07.980 William Cheng: Okay, because if you say that the first three kilobytes. We have access. The last kilobytes over here also have the same kind of access. So if you can write to 406 00:54:08.280 --> 00:54:12.840 William Cheng: You know that the last, you know, three kilobytes over here, you can also write a memory that doesn't really belong to you. 407 00:54:13.710 --> 00:54:18.630 William Cheng: Okay, so it sounds wrong but but again, once you get used to it. It's actually not so bad that 408 00:54:19.410 --> 00:54:25.470 William Cheng: Right, I finally are, you know, how do you actually get to more of the fork of gigabytes of physical memory, right. As I mentioned before, 409 00:54:26.160 --> 00:54:30.720 William Cheng: The patient, the physical piece number can be at this over here. If you have one gigabyte of memory. 410 00:54:30.930 --> 00:54:41.040 William Cheng: If you had 20 minutes over here is for four gigabytes of memory. So if you have 1616 gigabytes over here, right, that's four times four, we hear so you need to more best that will then this case, you will need 32 bits. 411 00:54:41.460 --> 00:54:46.620 William Cheng: Okay, so it actually is no trouble to go beyond four gigabytes of because about physical memory. 412 00:54:47.070 --> 00:54:57.030 William Cheng: Before into the actual call this a special flag. He said, instead of CPU to say that if you want to go beyond four gigabytes, you need to use physical address extension to use 413 00:54:57.450 --> 00:55:01.020 William Cheng: You know, the physical page number of beyond you know beyond 40 beds. 414 00:55:01.800 --> 00:55:09.480 William Cheng: Okay, why did they tell you that I have no idea why they do that. Right. But again, if you read the CPU manual basically if you wanted to have this physical page number go beyond 20 beds. 415 00:55:10.020 --> 00:55:15.720 William Cheng: There's another register. Is that a CPU, you have to set so that you are allowed to do this guys okay Intel's weird. What can I do 416 00:55:17.160 --> 00:55:26.010 William Cheng: Alright, so we're synchronize turn and synchronizing with the summer 2019 lecture. So, therefore, this is the place of break so so that 417 00:55:26.520 --> 00:55:30.270 William Cheng: Will be the end of lecture 13 so next time we're going to continue with chapter seven. 418 00:55:30.480 --> 00:55:39.810 William Cheng: We're going to finish the hallway stuff and then we're going to go, go to the second part of chapter seven and start looking at the operating system support to use all these hardware that we're talking about. Yeah.