WEBVTT 1 00:00:04.920 --> 00:00:05.910 William Cheng: Casting 2 00:01:25.320 --> 00:01:31.980 William Cheng: Welcome to lecture 17 3 00:01:38.670 --> 00:01:39.510 Andrew Strimaitis: I professor 4 00:01:40.650 --> 00:01:46.260 Andrew Strimaitis: I had a question on the conforming DVD calls for Colonel to 5 00:01:47.910 --> 00:01:56.490 Andrew Strimaitis: Like Colonel one, there were there were moments where I'm trying to figure out when to actually implement the conforming DVD halls as of now. 6 00:01:56.760 --> 00:02:09.390 Andrew Strimaitis: I know that what we have is while running our BFS test we're hitting a lot of stuff and where we're at a point where we're trying to figure out the actual implementation of of 7 00:02:10.740 --> 00:02:15.240 Andrew Strimaitis: When to actually put other DB G calls below. 8 00:02:16.950 --> 00:02:20.970 Andrew Strimaitis: DB G calls that are only called because of the bfs test so 9 00:02:21.510 --> 00:02:23.610 William Cheng: What this is for self checks. Right. 10 00:02:24.120 --> 00:02:26.340 Andrew Strimaitis: Yes, this subjects subjects. 11 00:02:27.510 --> 00:02:28.500 William Cheng: Right, so 12 00:02:29.430 --> 00:02:37.170 William Cheng: So the basic rule is that any code that you have written for for, you know, Colonel to to replace a 13 00:02:39.090 --> 00:02:40.860 William Cheng: You know, an idea implement a call. 14 00:02:41.070 --> 00:02:45.990 William Cheng: Right, whatever code that you have written, you have to identify the coast sequence. And at the end of the coast sequence. 15 00:02:46.620 --> 00:02:48.660 William Cheng: You need to add a component DVD call 16 00:02:52.950 --> 00:02:55.200 Andrew Strimaitis: Right, I think, I think we're just 17 00:02:56.730 --> 00:02:57.870 Andrew Strimaitis: Look looking on the 18 00:02:59.070 --> 00:03:06.210 Andrew Strimaitis: Conforming DVD calls. That's when there's like a in the instructions. It says when there's multiple and consecutive entries 19 00:03:07.380 --> 00:03:11.280 Andrew Strimaitis: Then you would you would put multiple DVD calls 20 00:03:11.610 --> 00:03:15.030 William Cheng: So that's what such a of the grading guidelines. That's not for self checks. 21 00:03:17.820 --> 00:03:26.250 William Cheng: So, so there are two reasons that you will use a conforming DVD called right. Number one is for Section eight of the grading guidelines and then number two is for self checks. 22 00:03:28.200 --> 00:03:28.500 Andrew Strimaitis: Right. 23 00:03:29.130 --> 00:03:41.850 William Cheng: So for Section eight of the grading guideline right so so section A every, every item has three parts has, you know, has section is like a and then followed by a sub test number right and then followed by a 24 00:03:42.690 --> 00:03:44.790 William Cheng: Up, up, up. Item number 25 00:03:45.420 --> 00:03:56.100 William Cheng: Okay, so when you you know so. So we try to claim credit for that you have the right K assert ik assert tea and then whatever whatever 26 00:03:56.100 --> 00:04:02.310 William Cheng: The requirements are, and then immediately after that you have to use a component DVD called the G. 27 00:04:02.910 --> 00:04:14.670 William Cheng: And then the big data, right, and then you know this this grading or something like that. Okay, so, so, so this come from individual is to satisfy section, aka aka sir requirement. 28 00:04:17.430 --> 00:04:27.600 William Cheng: Okay, so, but if you write something like this that means that this code will get executed if you simply start or stop the colonel sites I stop and start the colonel and then you type exit. 29 00:04:28.020 --> 00:04:35.400 William Cheng: That's how you start and stop the Colonel. So, so if you only write it like this, that means that this line will get executed if you simply start and then stop the Colonel. 30 00:04:36.030 --> 00:04:41.760 William Cheng: Okay, but if it turns out they have their care. Sir, cannot be reached. Well, in that case, I think in the grading guidelines. It says that 31 00:04:42.060 --> 00:04:50.790 William Cheng: In Section eight it says that you have to use two consecutive you know that the compliment DVD call. So that means that you need to add another one right below this, the big 32 00:04:51.390 --> 00:05:08.190 William Cheng: The big print IPR I empty and then grading, something like that. So, the second one is to tell the greater to say in order to reach this one to reach this line which test. Do you have to run. Okay so chances are it's going to be BFS tests. So in this case, he will say grading grading a 33 00:05:08.850 --> 00:05:11.940 William Cheng: Fall by, I can't remember what the name for the DFS test is it 34 00:05:12.330 --> 00:05:21.810 William Cheng: Sorry. So grading to to B or C or whatever. That's what the for the favorite test. So I know for the drivers that for the DFS tests. 35 00:05:27.090 --> 00:05:31.710 Andrew Strimaitis: Okay, so, but then in this example, that would be a self check right 36 00:05:32.250 --> 00:05:35.340 Andrew Strimaitis: Now this will not be right. So, so, this again is getting credit 37 00:05:35.520 --> 00:05:42.750 William Cheng: For session. A of the grading guideline. Right. So in this case, this one is specific to a to a, you try to get home harbor number of points. 38 00:05:43.050 --> 00:05:56.850 William Cheng: You know, in Section able to branding guidelines, but this code cannot be reached if you simply start the colonel you type exit. Right, so therefore you need to say hey greater please run a DFS test then disco will get executed and get credit for this case, sir. 39 00:06:00.840 --> 00:06:01.200 Andrew Strimaitis: Okay. 40 00:06:03.000 --> 00:06:13.110 William Cheng: Right, because it because if you don't write this line. Okay, the greater was started the kernel and then type exit and then this code will not get executed and you won't you won't get credit for 41 00:06:13.680 --> 00:06:22.740 William Cheng: All right. So in order for you to get credit for it. You have to tell the, you know, you have to tell the greater to say I know how to get here. And this is the test that you run 42 00:06:24.630 --> 00:06:24.960 Andrew Strimaitis: Okay. 43 00:06:26.250 --> 00:06:31.230 William Cheng: So then, then again, this is only for one item in Section eight of the grading guidelines. 44 00:06:31.800 --> 00:06:34.770 William Cheng: Okay. And there's the self check, that's a different story. 45 00:06:39.330 --> 00:06:41.010 William Cheng: Do you have question about the other self check 46 00:06:42.420 --> 00:06:43.410 Andrew Strimaitis: I think I get it. 47 00:06:44.550 --> 00:06:44.940 William Cheng: Okay. 48 00:06:46.530 --> 00:06:57.390 William Cheng: Yeah, the other self check. And the reason for that is that I want to make sure that there's no code that you know that you write that cannot be executed. He currently if we should delete those code. 49 00:07:08.790 --> 00:07:09.810 Hardik Mahipal Surana: On Good morning, Professor. 50 00:07:10.110 --> 00:07:13.410 Hardik Mahipal Surana: Morning. I also had a quick question regarding Conan, too. 51 00:07:14.460 --> 00:07:24.540 Hardik Mahipal Surana: So actually we were we were done with the submission, but just, I have a question about some of the error codes that are mentioned in the comment box for some of the functions. So, 52 00:07:25.740 --> 00:07:31.110 Hardik Mahipal Surana: Many of the some of the edit goals are actually never tested by any test case. 53 00:07:32.220 --> 00:07:40.320 Hardik Mahipal Surana: And because of that the conditions that we wrote to throw that particular error that was mentioned in the comments. Those are never getting reached 54 00:07:40.500 --> 00:07:43.680 Hardik Mahipal Surana: So in that case, should we just comment out and not 55 00:07:43.740 --> 00:07:46.200 Hardik Mahipal Surana: Handled those errors or should we 56 00:07:46.560 --> 00:07:54.600 William Cheng: Be that would be my recommendation. My recommendation is also is always not to write additional tests to to test those code. 57 00:07:55.980 --> 00:07:58.890 Hardik Mahipal Surana: Okay, so we should just comment them out and not handle them. 58 00:07:59.340 --> 00:08:07.770 William Cheng: Right. So, for example, right, if you say you know if right here's a condition right if condition and then you know this code never get executed. 59 00:08:08.850 --> 00:08:17.910 William Cheng: Okay, so one way to do is to write a new test. So, so that this condition will happen. And then you put a conforming DVD call at the end over here. So this way you don't lose points right 60 00:08:18.450 --> 00:08:18.870 William Cheng: Okay. 61 00:08:18.990 --> 00:08:31.290 William Cheng: The other way is to replace this entire thing with, you know, simply a statements as a k assert. Okay. Again, this is not section A of the grading on this is not this is this is just your cursor, you say not condition. 62 00:08:32.160 --> 00:08:32.580 Hardik Mahipal Surana: OK. 63 00:08:33.030 --> 00:08:38.220 William Cheng: OK, so this means that this condition can never be true. Right. So yeah, so therefore you don't have this one. 64 00:08:40.860 --> 00:08:41.220 Hardik Mahipal Surana: OK. 65 00:08:41.610 --> 00:08:41.880 So the 66 00:08:43.350 --> 00:08:48.510 Hardik Mahipal Surana: Army in aim is just to get the test cases to pass. We don't need to necessarily handle all of the other cases. 67 00:08:48.840 --> 00:08:54.000 William Cheng: Yeah, that's right. Because the common the common come from Brown University is their requirement. It's not a requirement. 68 00:08:55.710 --> 00:09:02.730 Hardik Mahipal Surana: Okay. And is there a chance that some of these error codes might get checked in, Colonel three 69 00:09:04.710 --> 00:09:18.060 William Cheng: So you can he what you should do is you do a string search, right, because right now what we're doing is that we look at BFS test. And we do string search, right, we can find out that you know this Erica is being used by then. 70 00:09:19.260 --> 00:09:27.240 William Cheng: So I think in Colonel three, there is a there's a section of code inside BFS tests that sort of commented out using if death. 71 00:09:27.840 --> 00:09:40.170 William Cheng: So if you don't have so so so I guess he tried to look for the symbols as five Fs yeah it fit so equal to one. There are some code inside. Inside BFS. There's, there are conditionally compiled 72 00:09:41.190 --> 00:09:42.540 William Cheng: Well, that's my theme Colonel to 73 00:09:42.780 --> 00:09:44.160 William Cheng: Those code will get executed. 74 00:09:45.720 --> 00:09:46.080 Hardik Mahipal Surana: Okay. 75 00:09:46.410 --> 00:09:53.970 William Cheng: So sorry. I will we get a colonel three. Well, he said, Colonel through, you have to say as far as F is equal to one. So in that case, you know those code will get executed. 76 00:09:56.130 --> 00:10:02.700 Hardik Mahipal Surana: Okay, okay. So even though we commented out for Colonel to we might need it back in current three 77 00:10:04.290 --> 00:10:04.950 William Cheng: Right, yeah. 78 00:10:05.370 --> 00:10:06.000 Hardik Mahipal Surana: Okay, okay. 79 00:10:06.030 --> 00:10:08.940 William Cheng: You should, you know, make some good notes to say that is 80 00:10:09.540 --> 00:10:14.730 Hardik Mahipal Surana: Yeah, because actually, we actually went out and you know wrote 81 00:10:15.900 --> 00:10:26.790 Hardik Mahipal Surana: Code to handle all of the possible error cases. And then you realize that okay some code is not reachable so for now. We did commented out but it's it's it's good to know that they might get hit in corner three, so we don't have to redo that part. 82 00:10:28.320 --> 00:10:35.070 William Cheng: Right. But yes, you check certain kind of air conditioner. Like some people always check the condition that you're out of memory. 83 00:10:35.640 --> 00:10:45.300 William Cheng: You know, like for example when you call the snap alligator the slab allocators as I have no more memory. So those kind of check. Pretty much, yeah. I don't think that kind of check should ever happen. 84 00:10:45.570 --> 00:10:50.190 William Cheng: Yes, because, you know, Colonel assignment you can you, as far as I know, you can never run out of memory. 85 00:10:51.240 --> 00:10:51.870 Hardik Mahipal Surana: Okay, okay. 86 00:10:51.990 --> 00:11:01.500 William Cheng: I mean, of course, if you have a slot allocated that return know, chances are, is because it because your memory corruption bugs and not not because you actually run out of memory. 87 00:11:02.850 --> 00:11:06.060 Hardik Mahipal Surana: Okay, okay. Yeah, thank you so much. 88 00:11:06.480 --> 00:11:06.720 Okay. 89 00:11:26.430 --> 00:11:34.740 Lalit Gupta: Lecture, I think it's probably something you said like the the null pointer points to boot block. 90 00:11:37.710 --> 00:11:48.780 William Cheng: Wow. So, you know, so what I was trying to say is that inside of our system, will you need a file system pointer. The point is usually just a block number right 91 00:11:50.280 --> 00:12:00.840 William Cheng: Okay so block number zero. Well, it refers to the blue block. So it's not really part of a useful part of the file system. So, therefore, zero. There should be no ambiguity zero. It just means that it's a no pointer. 92 00:12:05.940 --> 00:12:08.340 William Cheng: So even though brought them a zero. There's a real deal. 93 00:12:09.510 --> 00:12:16.110 William Cheng: There's a block right there, but it's impossible that any part of your actual file system will actually use block number zero right 94 00:12:17.670 --> 00:12:19.800 Lalit Gupta: So who can actually use this block number zero 95 00:12:20.040 --> 00:12:24.150 William Cheng: Nobody just like a virtual memory location zero nobody should use it. 96 00:12:25.500 --> 00:12:27.870 Lalit Gupta: Okay, so it's like pointing to nothing. 97 00:12:28.110 --> 00:12:28.800 William Cheng: Yeah yeah 98 00:12:30.570 --> 00:12:39.180 William Cheng: So so so he he. If you have a pointer that's supposed to have a block number in that point that that blog number equals zero, because you say, Oh, that's a null pointer. 99 00:12:44.010 --> 00:12:44.520 Lalit Gupta: And 100 00:12:46.350 --> 00:12:52.890 Lalit Gupta: So in the SI intellectual you talk about the architecture of this si es Fs. 101 00:12:53.190 --> 00:13:00.210 Lalit Gupta: Uh huh. You have this, I noticed and we have this disk disk map and thing. 102 00:13:01.260 --> 00:13:01.740 Lalit Gupta: So, 103 00:13:03.210 --> 00:13:07.590 Lalit Gupta: So is it possible that we can run out of this. 104 00:13:08.790 --> 00:13:09.660 Lalit Gupta: I noticed 105 00:13:10.740 --> 00:13:14.640 Lalit Gupta: Before we run out of the dismiss the block and said this. 106 00:13:15.150 --> 00:13:23.340 William Cheng: Right. So I think if you create tiny files right every file is just one this block. Um, yeah, I think it's possible that you will run out of notes right 107 00:13:25.590 --> 00:13:25.830 Lalit Gupta: Oh, 108 00:13:27.570 --> 00:13:33.630 William Cheng: So in that case, when you try to create a new file law, then the evidence is the most a while now. You can't do that because I run out of my notes. 109 00:13:36.240 --> 00:13:45.570 Lalit Gupta: Okay. And, for I know we are using this bitmap bitmap kind of algorithm and various for the for the for the three blocks. 110 00:13:46.590 --> 00:13:55.140 Lalit Gupta: We are using different algorithm. Why we are using different algorithm or two for the for the different part for I noticed and this 111 00:13:55.920 --> 00:13:59.610 William Cheng: Yeah, because I think the, I think the reason is that I know is a small data structure. 112 00:14:00.630 --> 00:14:15.210 William Cheng: You know, it's only you can actually look at the RAM file system and the system Barbosa the I know it's pretty small, and a blog. So that's it. A block is, you know, eight kilobytes or 16 kilobytes, you're going to end up putting a lot of I note inside one block. 113 00:14:16.320 --> 00:14:27.270 William Cheng: Right. So there'll be in this case you need a different algorithm to manage to manage different kind of data structure right there in the data region every this block is just one page or, you know, every, every, every block is just 114 00:14:28.410 --> 00:14:32.790 William Cheng: It's just an empty block. So in that case, it's easier to keep track of that. 115 00:14:35.970 --> 00:14:43.110 Lalit Gupta: Okay, so, so you're kind of trying to say that since we have a small number of I noticed it is 116 00:14:43.650 --> 00:14:47.580 William Cheng: No such a small so so if you put them inside a blog. 117 00:14:48.000 --> 00:14:50.820 William Cheng: They then inside a blog. There are many, many I notes right 118 00:14:57.330 --> 00:15:00.000 Lalit Gupta: Yes, inside of the block the remaining a notice, yes. 119 00:15:00.630 --> 00:15:04.350 William Cheng: Right. So the way you manage this stuff, you know, use a different algorithm to manage it. 120 00:15:09.780 --> 00:15:18.720 William Cheng: Right. So one of the most common operation, you know, for a file system is to create a file with deleted file creative ideas. So when you try to create a file, you need to. I know, right. You also need a nice 121 00:15:19.140 --> 00:15:25.800 William Cheng: Nice, nice. I'm data blog. So you need some, you know, data structure over here to manage the free I notes and also the free data blocks. 122 00:15:26.580 --> 00:15:34.980 William Cheng: By the data blocks it sort of makes sense to just, you know, use a linguist data structure, but the I noticed you know the structure is a little more complicated because you know they so 123 00:15:35.520 --> 00:15:40.680 William Cheng: I know is not one I know per block. So therefore, they have a different you know different way to maintain that information. 124 00:15:49.680 --> 00:15:53.940 Lalit Gupta: But if you want, we can do the same way right the way we are doing for the 125 00:15:55.230 --> 00:15:58.320 Lalit Gupta: Blocks. Right. Because it, it just we have 126 00:15:59.820 --> 00:16:13.620 Lalit Gupta: You can use the same kind of technique that we are using for data region to to maintain the free blocks that we are having a having a super block and the superblock having and trees and that point, just the next free blogs that have anti 127 00:16:14.640 --> 00:16:18.660 Lalit Gupta: Block can be trying to use this same algorithm for the list. 128 00:16:19.410 --> 00:16:30.900 William Cheng: So you are talking about data structure like this, right. So let's try this. Right, so, so, so is that there's a super blog over here right there is a you know 100 pointer over here. 129 00:16:31.380 --> 00:16:32.220 William Cheng: Yes. Okay. 130 00:16:32.280 --> 00:16:35.160 William Cheng: So this case 100 point it will be. I know pointer. 131 00:16:36.030 --> 00:16:45.840 William Cheng: But the I know pointer is it doesn't really point to a block it. So, so here's a block right this block has because, you know, many, many I knows because I know data structure is very, very small. 132 00:16:46.320 --> 00:16:52.440 William Cheng: So what do you point to your point to one of the items over here to be a free. I know that doesn't doesn't seem to make sense. 133 00:16:55.080 --> 00:16:57.750 William Cheng: Right because within the blog. There are many, many free I notes right 134 00:16:59.790 --> 00:17:12.780 William Cheng: You know, maybe instead this this block half of you know, half the iOS are free and have the iOS are not free. So over here, if you want to point to it. That doesn't seem right. And you don't really have an entire blog. That's all of them all the items are free, or the islands are not free. 135 00:17:15.540 --> 00:17:24.360 Lalit Gupta: Yeah, but I listed the different in the in the layout. You said we have a booth. We have a super rock and then we have idealist. And then we have a data region right 136 00:17:24.780 --> 00:17:25.290 William Cheng: Right, yeah. 137 00:17:25.740 --> 00:17:32.610 Lalit Gupta: The entire data region be split into into blocks of it blocks blocks of study block size. 138 00:17:33.150 --> 00:17:43.200 William Cheng: Right, so, so, so instead of civil law if you have a free list right if you have the head of the free list every one of them point to a block number right so the entire block is either free or not free. 139 00:17:43.980 --> 00:17:57.540 William Cheng: Yes, but if you, if you look at the iOS and entire blog, maybe half with the iOS are free. I have the iOS are now free so that doesn't, you know, I mean, using the same kind of data structure doesn't you know it looks difficult 140 00:17:58.650 --> 00:17:59.280 Lalit Gupta: Okay. 141 00:18:02.490 --> 00:18:13.440 Lalit Gupta: Okay, so in the eilish we can have a block and that that can have a, like a bunch of New Bern bunch of I know number that are free and bunch of item number that are like huge 142 00:18:13.800 --> 00:18:17.520 William Cheng: Right, they have to go scan it every time so that seems very inefficient. 143 00:18:19.140 --> 00:18:22.500 Lalit Gupta: Because that's right. It's better to use this bitmap and 144 00:18:22.710 --> 00:18:27.810 William Cheng: Well, I don't really know. This is the best way to go and have it. That's just one possible way to go. 145 00:18:29.250 --> 00:18:37.590 William Cheng: So again, this is the introductory operating system class. I don't know what the modern operating system used. You know what, what, what is the best, you know, state of the art that way of doing this. 146 00:18:39.870 --> 00:18:43.470 William Cheng: I would assume that it's keep changing. You know, people are coming out with new clever ideas. 147 00:18:45.600 --> 00:18:47.520 Lalit Gupta: And in lecture. 148 00:18:48.600 --> 00:18:50.580 Lalit Gupta: 13 and slide 23 149 00:18:51.420 --> 00:18:52.860 William Cheng: So which which lecture again. 150 00:18:53.430 --> 00:18:56.520 William Cheng: Lecture 30 3013 151 00:18:57.180 --> 00:18:57.600 Yes. 152 00:19:00.630 --> 00:19:01.680 William Cheng: What's number 153 00:19:02.640 --> 00:19:02.910 Three. 154 00:19:09.660 --> 00:19:10.140 William Cheng: This one. 155 00:19:11.490 --> 00:19:12.900 Lalit Gupta: Duty. Yes. Do not not 156 00:19:17.910 --> 00:19:18.330 William Cheng: Okay. 157 00:19:18.900 --> 00:19:35.160 Lalit Gupta: Yes, so in this, you're saying that for for creating the file, we have to we have to do do have first get a free blog and then get a free, I note I thought like it should be the reverse. Right. First we have to get a free. I know. And then we have to get a free blog right 158 00:19:36.660 --> 00:19:37.830 William Cheng: Away. I mean, you know, 159 00:19:38.790 --> 00:19:52.770 Lalit Gupta: Because what because until we have. I know it's not make sense to have a free blog because in the in the new data structure, we will have we will have entries and that will point to it will have like Fresh Direct pointers and then indirect pointers and 160 00:19:54.480 --> 00:20:00.960 William Cheng: By the way, this slide, doesn't mean step one and step two, just all it means is you need both. You need to update all this kind of information. 161 00:20:08.670 --> 00:20:13.680 Lalit Gupta: Yeah, but it makes sense that makes sense to like first ask for free eight or 10 for free block. 162 00:20:15.120 --> 00:20:21.240 William Cheng: Well, you know, supposedly, you should be able to create a I know without any data block right you should be able to create an empty file. 163 00:20:21.540 --> 00:20:23.250 William Cheng: So in that case, you don't really need a 164 00:20:23.610 --> 00:20:26.820 William Cheng: You don't really need a data block. Right. Yes. 165 00:20:28.830 --> 00:20:36.720 William Cheng: But typically, what you do is that you know you open a file and then you start writing into it. So yeah, you know, not many people will create an empty file so 166 00:20:40.680 --> 00:20:47.190 William Cheng: Yeah. So again, again, this list is not every possible scenario is just sort of what typical, you know, typically what happens 167 00:20:51.480 --> 00:20:51.750 Lalit Gupta: And 168 00:20:51.990 --> 00:20:57.120 William Cheng: Similarly, right, whichever delete a file. I mean this could be empty file in the freezer empty father's nothing to return to the 169 00:20:57.300 --> 00:20:58.110 William Cheng: You know, free list. 170 00:21:01.410 --> 00:21:02.130 Lalit Gupta: Yes. 171 00:21:13.230 --> 00:21:14.850 Lalit Gupta: Okay lecture 14 172 00:21:15.570 --> 00:21:16.920 William Cheng: Okay lecture for 173 00:21:22.740 --> 00:21:23.940 William Cheng: Which number 174 00:21:24.630 --> 00:21:25.350 Probably 175 00:21:27.360 --> 00:21:37.350 Lalit Gupta: 22 or 23 years from two to maybe only 20. Oh, I forgot. Oh, I think it's 18 1818 176 00:21:37.980 --> 00:21:38.730 William Cheng: Okay, so 177 00:21:41.190 --> 00:21:42.450 William Cheng: At yeah 178 00:21:46.710 --> 00:21:52.860 Lalit Gupta: Yes. So actually, in the lecture use actually but but i like under 179 00:21:54.690 --> 00:22:04.020 Lalit Gupta: Thought was like we have this virtual address and like the first starting from the start. The first and we will look at the first 10 bit 180 00:22:04.740 --> 00:22:14.820 Lalit Gupta: And then we will corresponding to this we will say, what is the index. And then we look at the CRT register and we just added the index and we will read the page directory entry. 181 00:22:15.390 --> 00:22:21.450 Lalit Gupta: And then we will, and then we will look we will go to the like base of the base. 182 00:22:22.050 --> 00:22:32.310 Lalit Gupta: Of the page, the base of the PhD work corresponding to that. And then we'll look at this, like the other page. The page 10 bits and then we will basically 183 00:22:33.000 --> 00:22:42.690 Lalit Gupta: See, what is the what is the index that correspond to then we basically add up the BEAST. BEAST to the base, we add the index and we will get the page double entry. 184 00:22:43.260 --> 00:22:55.260 Lalit Gupta: And then we will use the offset and then we will get the offset to correspond to index and then it will give us the exactly exact position in the physical page. 185 00:22:55.560 --> 00:22:56.040 Correct. 186 00:22:57.570 --> 00:23:14.040 Lalit Gupta: But like I think in this video. You said we have two left shift in the page directory table, we have two left shift it by 12 it and in the page table also we have selected by 12. It's like, can you talk about 187 00:23:14.370 --> 00:23:19.800 William Cheng: Yeah, because you know inside the page directly entry we store the physical page number right 188 00:23:21.570 --> 00:23:27.480 William Cheng: The physical page number, you need to love shifted by 12 bit to get us to do to to get a page align address 189 00:23:29.460 --> 00:23:41.910 William Cheng: Right. Similarly, in the page directly in the page table entry we store the physical page number. So again, the number is not a it's not an address, you have to left shifted by 12 days to get a page line address 190 00:23:45.360 --> 00:23:48.090 Lalit Gupta: Or is that is the page number 20 minutes long. 191 00:23:49.230 --> 00:23:54.390 William Cheng: If you have four gigabytes of physical memory. Yeah, if you have one gigabyte of memory that's eight inches long. 192 00:23:55.350 --> 00:24:02.820 Lalit Gupta: For the father for this, for this example that you're talking about, like, how many bits are you, what are you considering 193 00:24:03.840 --> 00:24:04.470 Lalit Gupta: The left ship. 194 00:24:04.800 --> 00:24:10.590 William Cheng: It depends on you know it's called ON THAT LET ME SAY TO SEE IF WE HAVE THE PICTURE. 195 00:24:14.670 --> 00:24:16.920 William Cheng: Right, so, so, so it looks like this. Right. 196 00:24:19.470 --> 00:24:24.990 William Cheng: Yes, let me see right over here. It says, if there's more than four gigabytes of physical memory. 197 00:24:25.290 --> 00:24:36.660 William Cheng: You need to use, you know, then the physical page number is more than 20 minutes long and for Intel, you have to turn on physical address extension, all that kind of stuff. Right. So. So is that a page table entry. Over here we have a physical page number 198 00:24:37.290 --> 00:24:42.600 William Cheng: So if you have four gigabytes of physical memory then then that then the physical page number is 20 minutes long. 199 00:24:44.040 --> 00:24:50.460 William Cheng: If you have 16 if you have 16 gigabytes of physical memory, then the physical page number will be 22 bits law. 200 00:24:56.040 --> 00:25:06.480 William Cheng: And if you take. So over here, you know, this picture over here, you know, this arrow means that you left shifted by 12 beds and then you get a page on line address and then you add the offset to and then you get a, get a physical address 201 00:25:10.590 --> 00:25:20.490 Lalit Gupta: Yeah. Yep. In this thing I was able to understand, but when you have this tool to level paging I was a bit confused like how the two double shifts are occurring. 202 00:25:20.820 --> 00:25:26.580 William Cheng: It was obsessive so no matter how many levels, you have the page table entry always look the same. 203 00:25:28.110 --> 00:25:35.040 William Cheng: Okay. So, similarly for the page directly entry, you know, they also look exactly the same. So they all contain the same kind of information or 204 00:25:35.070 --> 00:25:39.420 Lalit Gupta: They have the exact almost same data in the page. 205 00:25:39.600 --> 00:25:40.740 Lalit Gupta: Andrea Yes. 206 00:25:42.300 --> 00:25:50.700 William Cheng: Yeah, they just call it a different name. But, you know, but but that's why we sort of call it the multi level page table because every entry is exactly the same thing, right. 207 00:25:55.860 --> 00:25:56.130 Well, 208 00:26:00.570 --> 00:26:06.990 William Cheng: Right, so, so, so let's take a look at the the org and this is the entire example. Right. You take a 10 page over here. Users array index. 209 00:26:07.260 --> 00:26:12.540 William Cheng: That will give you a page directly entry and paste directly and you look exactly the same as a page table entry. 210 00:26:12.780 --> 00:26:26.610 William Cheng: Right. So there's a validity bit. There is the read and write all that kind of stuff. And then there's a physical page number over here. If you take the physical page number you left shifted by 12 bits that will give you the first memory location for the next page table. 211 00:26:27.990 --> 00:26:33.150 William Cheng: Okay. So then again you use the middle templates of you as an array index and that will give you a page table entry. 212 00:26:33.330 --> 00:26:38.940 William Cheng: Is that a page table entry. There's validity period. There's rewrite and stuff like that. And then there's a physical page number 213 00:26:39.180 --> 00:26:53.700 William Cheng: Up to the physical page number again left shifted by 12 is that will give you the base address or the page outline address for this physical page and they use the offset as array as a bite index into this page. So in that case, you know, you will get a physical address 214 00:26:56.610 --> 00:27:09.540 Lalit Gupta: Why are you shifting by the same amount. The same page number because if we do, then we will get off. We are shifting by the bits for page director table and we are shifting again by little bit for the page table. 215 00:27:10.380 --> 00:27:13.680 William Cheng: Because that's the definition of a page physical page number 216 00:27:15.330 --> 00:27:20.280 William Cheng: Or physical page number is the leading bits you know of physical page. 217 00:27:21.750 --> 00:27:35.010 William Cheng: Right, and then the, you know, then every page every page is is every page has four kilobytes long. So, therefore, you know, it's so, so four kilobytes able to to to the 12 so therefore you have to shift it by 12 days to get a page line address 218 00:27:45.240 --> 00:27:48.180 William Cheng: Right, the physical page number can point to any physical page. 219 00:27:52.530 --> 00:27:53.430 Lalit Gupta: That yes 220 00:27:53.700 --> 00:27:59.340 William Cheng: Sir, so remember when we started talking about paging right we say here is your physical memory. 221 00:28:00.660 --> 00:28:11.370 William Cheng: physical memory over here we're going to divide the physical memory into pages they page number zero page number one every one of them is four kilobytes long right this is the patient of the physical page number 222 00:28:12.690 --> 00:28:24.840 William Cheng: So the physical page number is an array index into physical memory. Right. And what are the array element every element is four kilobytes four kilobytes in size. So therefore, the physical page number is just the array index. 223 00:28:26.580 --> 00:28:34.920 William Cheng: Okay. So whenever you have an array index. You want to get the physical page number. All you need to do is to multiply by two to the 12 or you left shifted by 12 is that will give you the same thing. 224 00:28:43.500 --> 00:28:44.670 William Cheng: That does that make sense. 225 00:28:47.670 --> 00:28:51.180 Lalit Gupta: Yeah. Well, yeah. What do you think makes sense but 226 00:28:54.480 --> 00:28:57.960 Lalit Gupta: I'm still confused on like this, this 227 00:29:00.120 --> 00:29:00.810 Lalit Gupta: The shifting 228 00:29:01.950 --> 00:29:03.990 Lalit Gupta: Twice in the page director table and page table. 229 00:29:04.650 --> 00:29:12.330 William Cheng: Yeah, so, so, so good will happen is that right, if you're in a race. Let's say I have an integer. Ray Rice or a over here integer, you know, 20 or something like that. Right. 230 00:29:12.630 --> 00:29:28.200 William Cheng: If I tried to find out you know the address of the address of AI right the address of AI over here, what would I do write the answers. May I will be here is going to be equal to the address of a plus right i times the size of it right 231 00:29:29.610 --> 00:29:30.540 Lalit Gupta: Yes, right. 232 00:29:30.570 --> 00:29:39.630 William Cheng: It over here is a zero right the address the first memory location, plus the array index multiplied by the size of the theory element. 233 00:29:40.290 --> 00:29:48.150 William Cheng: Yeah, okay. So if all we here we have a page with a page over here right page over here and then this one will be known as the physical page number right 234 00:29:48.720 --> 00:29:58.350 William Cheng: OK, and now you have a re index i over here. Well then, this one will be equal to the physical page. The first one is equal to zero then plus i times four kilobytes. Right. 235 00:29:59.490 --> 00:30:07.980 William Cheng: So four kilobytes. So this is equal to i times to to the 12 OR is equal to i left shifted by 12 it's either the same thing. 236 00:30:09.990 --> 00:30:19.050 Lalit Gupta: Yeah, this thing I was able to understand like we have, like, because the second thing is the officer and the first thing is like we're finding which they will be 237 00:30:22.530 --> 00:30:24.990 William Cheng: Okay, let's go back there. 238 00:30:26.220 --> 00:30:27.780 William Cheng: So it's 14 239 00:30:31.530 --> 00:30:40.860 William Cheng: Or so, so I'll be here right this is just a physical page on breaking point to any physical page, right. So if you want a physical address, you need to left shifted by Talbots 240 00:30:42.960 --> 00:30:48.150 William Cheng: Right, and then that will give you, you know, the based address for this four kilobytes of page table. 241 00:30:49.740 --> 00:30:55.080 William Cheng: Right, I mean this photo, just like any other four kilobytes. Right. It just that we use it for as part of the 242 00:30:56.070 --> 00:31:05.760 William Cheng: Other page table. There's nothing special about this four kilobytes pay this four kilobyte page and this four kilobytes page look exactly the same, right, all they do is that they have a different physical patient number 243 00:31:09.240 --> 00:31:13.470 William Cheng: Key right and this is also four kilobytes are all these four kilobytes. They're all exactly the same. 244 00:31:13.650 --> 00:31:21.120 William Cheng: Anytime you need any of these four kilobytes, you as the buddy system say hey, give me four kilobytes. And then you will you and then you're going to end up with one of these pages, right. 245 00:31:21.300 --> 00:31:31.440 William Cheng: And then you put data in there, right, if it's a page table that you put in, you know what a 10 1024 entries in them there. If it's a regular page for data input data. 246 00:32:04.650 --> 00:32:08.010 Lalit Gupta: Okay, so. Okay, so my, my understanding was this thing. 247 00:32:10.350 --> 00:32:17.670 Lalit Gupta: To do to find the entry in this page or directory entry, I have to look at this 10 first 10 bits and I have to figure out like 248 00:32:18.180 --> 00:32:29.700 Lalit Gupta: What this, what is this if I if I figured out the index. What this first entry index correspond to and then I will just add into the car tibbetts Alicia, and I will get the page directly entry. 249 00:32:30.780 --> 00:32:36.840 William Cheng: Right. OK. So the car through register contain the physical address of the base address of the page directory table right 250 00:32:37.320 --> 00:32:52.080 William Cheng: Yes. Okay. So if you take. So every page. They went to your peers four bytes long right and so there's 1024 entries. Over here I so to to the 10s 1024. So if you take the first 10 bit, it will give you the you know the array index into the pace directory table. 251 00:32:53.340 --> 00:32:53.820 Lalit Gupta: Yes. 252 00:32:54.120 --> 00:32:55.050 William Cheng: Right, and you can 253 00:32:56.520 --> 00:33:08.130 Lalit Gupta: Yes. Can you can you explain the same. Can you currently explain it, because what we're shifting does has to be equivalent to what the word conceptually, I'm thinking right 254 00:33:08.430 --> 00:33:19.020 William Cheng: But as a shifting the same thing as multiplying, right. So if you ship by two bit is the same thing as multiplied by four U shaped by 12 beds is the same thing as multiply by for, you know, for 4000 and it says 255 00:33:29.160 --> 00:33:33.150 Lalit Gupta: Yes. What rich, rich thing are we actually shifting like the virtual address 256 00:33:34.830 --> 00:33:41.190 William Cheng: Okay, so we only shift the the. Okay, so, so are you talking about the shifting of two beds are shipping or tablets. 257 00:33:42.330 --> 00:33:46.560 Lalit Gupta: Yeah, we have four distinct example in Australia, but then I'm talking about all 258 00:33:47.400 --> 00:34:02.310 William Cheng: The topics. Right, so I'll be here. So less than that, over here, there's a physical page number i, the physical page number is the re index of this, you know, four kilobytes, you know, array. So therefore, in order for us to find the physical address, we need to multiply by two to the 12 259 00:34:07.500 --> 00:34:20.820 William Cheng: That's that that's exactly the equation that I would just showing over here. Okay, in order for you to find the the physical address, you need to take the physical page number and the left shift to 12 it's or equivalent to multiply by 4096 260 00:34:23.310 --> 00:34:24.270 Lalit Gupta: Okay. 261 00:34:25.710 --> 00:34:25.920 Lalit Gupta: Well, 262 00:34:28.110 --> 00:34:40.020 William Cheng: Okay. So over here I think the notation over here is a little messed up. So this is the physical memory, the physical memory, right, and then the I over here is the physical page number right so over here is the physical page number 263 00:34:40.470 --> 00:34:45.570 William Cheng: And the physical page numbers over here is a physical page number left shifted by targets. 264 00:34:49.620 --> 00:34:53.520 Lalit Gupta: Will read. Yes. Why are we doing this for k multiplication in this one. 265 00:34:55.110 --> 00:35:03.060 William Cheng: Well, because of the way we organize memory, right, you know, what is the picture that I took away. We take physical memory over here. So this is the physical 266 00:35:03.750 --> 00:35:09.540 William Cheng: Memory. Okay, we divide them into four kilobyte pages, right, each one of them is four kilobytes. Right. 267 00:35:09.870 --> 00:35:20.010 William Cheng: Okay, so this is physical address zero and this will be physical page physical page number zero and physical page number one and physical page number two. Right. 268 00:35:20.820 --> 00:35:27.870 William Cheng: Yeah. So if you look at physical page number two. What is the first address over here. Well, it's equal to two times two to the 12 right 269 00:35:29.610 --> 00:35:37.770 Lalit Gupta: Okay, okay. So okay, so page entry basically contains the first address of this first base. I'll be the first starting out as 270 00:35:37.950 --> 00:35:41.490 William Cheng: A page table entry hat has the physical page number 271 00:35:42.570 --> 00:35:48.030 William Cheng: Well, so that's why you need to multiply by two to the 12 to get the first phase of first physical address 272 00:35:52.260 --> 00:35:53.070 Lalit Gupta: Yes. 273 00:35:53.130 --> 00:35:56.220 William Cheng: Right. So instead of page table enter you store the array index right 274 00:35:59.910 --> 00:36:00.720 Lalit Gupta: Okay, yes. 275 00:36:02.100 --> 00:36:07.620 William Cheng: And this array every element is four kilobytes in size right so size of the elements equal to two, two to 12 276 00:36:09.720 --> 00:36:15.090 Lalit Gupta: Okay, so we have this bass, bass value and okay that okay mix nomics 277 00:36:15.840 --> 00:36:16.170 Okay. 278 00:36:21.270 --> 00:36:26.190 Lalit Gupta: Okay. And since each page of guesting we have to shift it by the same amount. That's okay. 279 00:36:26.640 --> 00:36:31.740 William Cheng: Right so multiply by two to the top. The same thing that's left shifted by top. It's very cold. 280 00:36:32.820 --> 00:36:36.900 Lalit Gupta: Okay, this trial bit is is related to the page size. 281 00:36:37.470 --> 00:36:50.220 William Cheng: Exactly right. Because the pace is equal to 12 right so that's why, that's why we shifted back, Bob. It's right so we here says the offset over here is 12 minutes long, right, because the paid side page sizes. People do the pace is equal to four kilobytes. 282 00:36:51.660 --> 00:36:52.170 Lalit Gupta: Okay. 283 00:36:53.580 --> 00:36:59.550 Lalit Gupta: So basically, we will make the first 10 bits. And then we have to multiply it by the the 284 00:37:00.750 --> 00:37:15.420 Lalit Gupta: Power 12 and then we will get the index. And then we have the same thing we have to this second 10 and 10 enter in the virtual address. And then we have again multiply it by the to aspire to. And then we will get the entry in the page table. 285 00:37:16.260 --> 00:37:17.010 William Cheng: get that done. 286 00:37:17.970 --> 00:37:20.940 Lalit Gupta: And then we have to just take the offset into the 287 00:37:21.180 --> 00:37:33.570 William Cheng: Well, then, then this page table entry again has a physical page number right anytime we get a physical page number. The first thing we need to do is to multiply by two to the 12 so we get the base address but going to page line address. And then finally, we can add the offset to 288 00:37:41.370 --> 00:37:45.090 Lalit Gupta: Yes, yes, to get the mentors and then we get we can add dogs. 289 00:37:45.270 --> 00:37:46.350 William Cheng: Yes, yeah. 290 00:37:48.180 --> 00:37:51.660 Lalit Gupta: Okay, so, so now it makes sense. So if no matter how many 291 00:37:53.460 --> 00:38:00.780 Lalit Gupta: Level of pitching. We have, we have to multiply every time by or two. I'll do it if that is a pizza. 292 00:38:01.320 --> 00:38:07.770 William Cheng: Right so so that's what this is called the multi level page table because no matter how many levels you have we're doing exactly the same thing at every level. 293 00:38:10.170 --> 00:38:10.950 Lalit Gupta: OK. 294 00:38:14.760 --> 00:38:16.500 Lalit Gupta: Ok now admissions yesterday. 295 00:38:19.020 --> 00:38:20.460 Lalit Gupta: And I saw one question. 296 00:38:21.840 --> 00:38:25.440 Lalit Gupta: In the lazy evaluation of the DMV. 297 00:38:27.150 --> 00:38:28.140 Lalit Gupta: So when we do this. 298 00:38:28.950 --> 00:38:29.880 Lalit Gupta: Yeah, that 299 00:38:31.740 --> 00:38:35.730 Lalit Gupta: Table. I said before you got to work in one of the slide, not in this one. 300 00:38:36.030 --> 00:38:36.840 William Cheng: Do you have us 301 00:38:41.040 --> 00:38:44.520 Lalit Gupta: It's probably the same lecture. The slide is probably different. 302 00:38:46.110 --> 00:38:47.160 Lalit Gupta: But maybe is it 303 00:38:51.510 --> 00:38:53.430 William Cheng: Okay, so here's the tip stuff. 304 00:38:54.360 --> 00:38:58.380 Lalit Gupta: Yes so lazy evaluation. I think there's some somewhere lazy evaluation. 305 00:38:59.970 --> 00:39:02.430 William Cheng: To be doesn't do lazy evaluation. 306 00:39:06.900 --> 00:39:07.830 Lalit Gupta: Okay, I'll tell you. 307 00:39:10.800 --> 00:39:14.250 Lalit Gupta: I think it's like 52 somewhere. Okay. 308 00:39:20.220 --> 00:39:22.530 William Cheng: Right, so this is. Yeah. So it's the Fed's policy. Yeah. 309 00:39:24.570 --> 00:39:32.040 William Cheng: This is about, you know, on demand paging. Will you try to bring a page on this into memory. You do it as late as possible. 310 00:39:39.630 --> 00:39:40.680 Lalit Gupta: Okay, so 311 00:39:43.350 --> 00:39:44.850 Lalit Gupta: Can you can you go to the select 312 00:39:44.850 --> 00:39:47.220 5555 313 00:39:50.190 --> 00:39:57.570 Lalit Gupta: Yes so interesting. Interesting. Right now the page table is completely like invalidated. Everything is zero right 314 00:39:57.780 --> 00:40:02.430 Lalit Gupta: Exactly. But at this point of time, we have to have the valid CRT right 315 00:40:03.210 --> 00:40:04.110 William Cheng: The valid one. 316 00:40:04.710 --> 00:40:08.250 Lalit Gupta: car to car to register because 317 00:40:08.580 --> 00:40:12.660 William Cheng: The car to register point to the physical base address of the page table. Yeah. 318 00:40:15.060 --> 00:40:22.500 William Cheng: I mean, again, well this this picture over here, we use the two level page table right if you're using Intel, you know, in reality, it's going to be a multi level page table. 319 00:40:24.990 --> 00:40:30.180 Lalit Gupta: Is this the article just a fix for every process or is this is a constant for every 320 00:40:31.440 --> 00:40:35.460 Lalit Gupta: Four years every process or then we change to process is a CRT has to be updated. 321 00:40:36.000 --> 00:40:38.820 William Cheng: Yeah, so every process has their own pace table. 322 00:40:39.480 --> 00:40:48.570 William Cheng: Right, because the page name boys to do address translation. So if you want, you know, different processes to access different part of physical memory. Every one of that has have a different page table. 323 00:40:49.200 --> 00:40:54.450 William Cheng: So when you switch from one process to another process, you have to change the CIC register inside the mmm 324 00:40:55.980 --> 00:41:04.830 Lalit Gupta: Okay, so when we just about to start the process me how and and literally anything. So the CRT has to be updated, even though the everything is invalidated. 325 00:41:05.100 --> 00:41:09.210 William Cheng: Well, so when you when you create a new process, you have to create a page table. 326 00:41:10.440 --> 00:41:30.870 William Cheng: Right, so, you know, so, so the colonel one assignment, people are doing that already. If you look at the colonel one FAQ. It was, you know, it was sort of tell you how to set the page directory so so so there's something I guess you know current proc or proc right arrow P pager. 327 00:41:31.950 --> 00:41:32.460 Lalit Gupta: Yes. 328 00:41:32.520 --> 00:41:41.460 William Cheng: Man, that one needs to be set to something. Right. So the idea here is that what you're supposed to do is that you take the parents page table, make a copy of it and then give it to the child. 329 00:41:42.660 --> 00:41:45.420 William Cheng: So this way, every process has their own you know page table. 330 00:41:50.010 --> 00:41:52.290 Lalit Gupta: Yes. So when we make a copy of the child. 331 00:41:54.000 --> 00:41:56.850 Lalit Gupta: Is the CRT also kaput like the same for 332 00:41:58.050 --> 00:42:04.920 William Cheng: You make a copy. When you make a fork system call right but when you call exact you're going to wipe out the address space you're going to build a brand new address space. 333 00:42:05.130 --> 00:42:09.210 William Cheng: When you do that you will take the pace table and he was zero them out. Right. So everything go to zero. 334 00:42:13.620 --> 00:42:16.110 William Cheng: Because you want to do on demand. You want to do on demand paging 335 00:42:23.040 --> 00:42:36.000 William Cheng: Right. Because when I make the exact system call. I'm going to wipe out the address space. So therefore, all of these pointer and none of them are valid anymore. So therefore, I said the entire page table by 00 the entire page, they will out right so this way, none of the entries are valid. 336 00:42:36.840 --> 00:42:41.310 Lalit Gupta: So even the beach beach. So okay, so, so, okay. So basically, she's also not private 337 00:42:41.490 --> 00:42:52.140 William Cheng: So the base register still point to the page table right so so if you're running this process, the base. You know, so if you're running a process, the base address 338 00:42:52.500 --> 00:42:58.680 William Cheng: The CIC register always point to the same page table if you switch to a different process they you need to change the CO2 register. 339 00:43:00.780 --> 00:43:04.200 William Cheng: Because every, you know, because every process has their own pace table. 340 00:43:07.740 --> 00:43:16.770 Lalit Gupta: Okay, so when we formed a process and do the accepting. So is this a. Is this a page table female three years, the parent or the space several different 341 00:43:16.980 --> 00:43:17.880 William Cheng: You make a copy 342 00:43:19.320 --> 00:43:23.160 William Cheng: So so so physical, it's different. But in the beginning, they have the same content. 343 00:43:27.030 --> 00:43:27.240 You 344 00:43:28.290 --> 00:43:28.620 Lalit Gupta: Call 345 00:43:29.460 --> 00:43:38.070 William Cheng: When you make the exact exact call you wipe out the address space. So, therefore, you know, for your pace table all the entries are invalid. So, therefore, you said equal to zero everywhere. 346 00:43:41.850 --> 00:43:54.720 Lalit Gupta: Okay, so, so this seems to me that the Parent, parent and the parent page table and the one language has been formed has the same value for the beach register. 347 00:43:54.990 --> 00:44:09.840 William Cheng: But because you made a copy. No, no, no, we make a copy you don't end up with two page table rising years page table one, or here's a stable to write a stable to they are copies of each other. So they have exactly the same content, but this address and this address are different. 348 00:44:11.760 --> 00:44:16.740 William Cheng: They have different virtual address. They also have different physical address right because there are separate data structures inside the Colonel. 349 00:44:17.820 --> 00:44:18.870 Lalit Gupta: Oh key. 350 00:44:19.200 --> 00:44:20.610 William Cheng: Made a copy of it. 351 00:44:22.230 --> 00:44:27.030 Lalit Gupta: Okay, so they are different, but the data, data inside is actually a copy 352 00:44:27.420 --> 00:44:34.590 William Cheng: Well, because you make a fork system call right the forces them all dependent on how they have exactly the same content in their address space. 353 00:44:35.430 --> 00:44:47.010 William Cheng: So therefore, in the, in that case, at the beginning, you can you can you can share all you want. Right. And then, you know, the memory segment there a copy on write in that case, when you modify them then they start becoming different but at the beginning they should be exactly the same. 354 00:44:48.660 --> 00:44:55.050 Lalit Gupta: Okay. And after the exact system called everything inside the second page table will be invalidated. So Richard 355 00:44:55.320 --> 00:45:02.820 William Cheng: Because you destroy your address space, right. So, all these address translation. They're all wrong because you got rid of the original address space, right. Oh. 356 00:45:03.810 --> 00:45:07.620 William Cheng: So they all pointed the wrong things and so therefore you you make everything invalid. 357 00:45:30.420 --> 00:45:34.410 William Cheng: Okay, so I think this slide right. I think I have a typo right here. Maybe that's part of the 358 00:45:35.670 --> 00:45:36.540 William Cheng: Exact 359 00:45:37.710 --> 00:45:48.000 William Cheng: address space is created and paste table is created. So over here I mean this is shouldn't shouldn't be created, right, because we still use the same page table. We just need to set all to be equal to zero. 360 00:45:51.510 --> 00:45:51.960 Lalit Gupta: Okay. 361 00:45:52.380 --> 00:45:56.280 William Cheng: So I think there's this is a error in my all my slides. 362 00:46:01.530 --> 00:46:03.690 Lalit Gupta: And in, in, in 363 00:46:05.640 --> 00:46:09.270 Lalit Gupta: Eternity. Did you said that we have only one level pitching. 364 00:46:10.890 --> 00:46:11.250 William Cheng: A 365 00:46:11.310 --> 00:46:18.300 William Cheng: Website, so, so, so this is what I call a two level page table right where they have 1 million entries over here, right. 366 00:46:18.840 --> 00:46:36.000 William Cheng: Okay, because so because uh you know the the virtual page number is 2020 beds i two to 20 is equal to 1 million. Okay. So, therefore, if you think about the basic page table that only has two level. Then there's 1 million entries 367 00:46:38.280 --> 00:46:42.630 William Cheng: Okay. So over here, this page table is a is a two level page table. 368 00:46:46.320 --> 00:46:47.280 Lalit Gupta: Okay, and 369 00:46:47.340 --> 00:46:53.010 William Cheng: Yeah, but Intel has Intel the 32 bit Intel has, you know, three level page table. 370 00:46:55.320 --> 00:47:02.010 William Cheng: Okay, but the way we're going to use it was that we wouldn't pretend that it's a two level page table because that makes our programming interface. A lot easier. 371 00:47:03.030 --> 00:47:05.670 William Cheng: A lot easier to to to to program. 372 00:47:09.240 --> 00:47:15.030 Lalit Gupta: Okay, and something is going to be behind the scene that is actually talking to this three Page three level pH level. 373 00:47:15.330 --> 00:47:31.830 William Cheng: Right. So in the Windex source code. There's a file called page table dot c a p e a c. Okay. So inside of that file the interface to to to to the page table is a is a two level page table but internally, they will convert that into multi level. 374 00:47:33.450 --> 00:47:38.850 William Cheng: Because you can also think about this one as a hardware abstraction layer code, right, because you know maybe different CPU. 375 00:47:39.030 --> 00:47:47.910 William Cheng: Have a different way to implement the multi level it's right to implement the, the basic to level page table. So maybe four different CPU the page that will implementation will be completely different. 376 00:47:59.550 --> 00:48:08.520 Lalit Gupta: And I think I was seeing there was some assembly code written in the cardinal three, do we have to worry about it. Like, do we have to worry about reading it. 377 00:48:09.750 --> 00:48:10.440 William Cheng: Grading it 378 00:48:11.190 --> 00:48:15.150 Lalit Gupta: Did assembly code in the days of assembly code in the kernel. 379 00:48:15.240 --> 00:48:21.780 William Cheng: 321 this assembly code, right. So inside the switch function will you need this call swap context. 380 00:48:21.990 --> 00:48:25.920 William Cheng: So context is implemented, I think. So I'll kinda is is implementing using assembly code. 381 00:48:27.270 --> 00:48:28.140 Lalit Gupta: Okay, okay. 382 00:48:28.350 --> 00:48:34.980 William Cheng: So all the assembly code has been written for you guys already. So all you need to do is to make the right function call. Oh. 383 00:48:39.900 --> 00:48:42.960 Lalit Gupta: And in card number two. I have one more question. 384 00:48:45.420 --> 00:48:49.500 Lalit Gupta: I think there's a test name VSS. 385 00:49:13.980 --> 00:49:15.090 Lalit Gupta: FS test, which is 386 00:49:16.110 --> 00:49:20.580 Lalit Gupta: There is a line which is fewer than four copies should exit safely. 387 00:49:22.200 --> 00:49:26.250 William Cheng: Okay, so let me try to get there. So, 388 00:49:29.010 --> 00:49:29.970 William Cheng: What file is it 389 00:49:31.560 --> 00:49:34.920 Lalit Gupta: The file is fever fever FS test see 390 00:49:35.640 --> 00:49:36.600 William Cheng: Okay. 391 00:49:37.110 --> 00:49:38.160 Lalit Gupta: In Colonel Fs. 392 00:49:40.170 --> 00:49:43.440 William Cheng: All right, hold on one second. Let me switch 393 00:49:50.070 --> 00:49:53.040 William Cheng: Okay. Do you know what line number you're looking at 394 00:49:53.850 --> 00:49:55.050 Lalit Gupta: Oh yeah, I can tell you 395 00:49:59.640 --> 00:50:01.470 Lalit Gupta: The line number is 246 396 00:50:04.710 --> 00:50:05.940 William Cheng: The FS Yes. 397 00:50:06.510 --> 00:50:08.490 Lalit Gupta: Yes command with 398 00:50:08.700 --> 00:50:12.120 Lalit Gupta: The circumstances fewer than four copies should exit safely. 399 00:50:13.230 --> 00:50:18.390 Lalit Gupta: But it seems that it shouldn't exceed the it should be fewer than three copyright because 400 00:50:19.650 --> 00:50:24.060 Lalit Gupta: It because if you have, if you have, if you have three copy, if you call it. 401 00:50:25.980 --> 00:50:28.620 Lalit Gupta: Feet. The fever desperate and value is equal to tea. Right. 402 00:50:29.010 --> 00:50:33.330 Lalit Gupta: Okay, then we will have more processes, then the number of nodes. 403 00:50:36.480 --> 00:50:41.610 William Cheng: Ah, yeah. So maybe this comment is not correct. I guess it's common is really old. 404 00:50:47.040 --> 00:50:55.290 William Cheng: Yeah, this is this code was written by Professor Ted favors, so I don't you know I don't know exactly what the common meant 405 00:50:57.030 --> 00:51:02.370 William Cheng: You know, because over here says access safely. You know, I mean, they never crashes, so 406 00:51:02.640 --> 00:51:03.450 Lalit Gupta: Okay, okay. 407 00:51:03.510 --> 00:51:06.150 William Cheng: Yes, I don't, I don't really know exactly what he meant by this. Yeah. 408 00:51:07.860 --> 00:51:08.190 Lalit Gupta: But 409 00:51:09.300 --> 00:51:12.630 Lalit Gupta: It never catches for firewalls or network or seven also but 410 00:51:12.720 --> 00:51:19.530 William Cheng: Yeah, but even if you run. I know eventually this, you know, the system will recover and everything will be fine, right, because it can run this command over and over and over again. 411 00:51:20.370 --> 00:51:24.900 Lalit Gupta: Yeah, but it recovers for like more than four also 412 00:51:26.550 --> 00:51:37.260 William Cheng: A right so it says, yeah. So again, I don't know exactly what he meant by this particular comment, you know, more will run out of. I know. So if you do five you also run. I know it's right. 413 00:51:37.290 --> 00:51:47.130 William Cheng: Yes. So we know that the the none of this code will fail. It would just sort of exercise you know your your your actual file system. 414 00:51:48.360 --> 00:51:52.560 Lalit Gupta: Yeah. So I was thinking like it should be probably three right because for 415 00:51:53.970 --> 00:51:58.980 Lalit Gupta: The three. The first number. That should give the problem because for two is should be okay. 416 00:51:59.400 --> 00:52:01.950 Lalit Gupta: Good. I see it actually changes comment to 417 00:52:01.980 --> 00:52:06.000 William Cheng: You know 2222223 to be more correct, yeah. 418 00:52:07.140 --> 00:52:09.060 Lalit Gupta: Okay, yeah, I think it's just minor 419 00:52:09.420 --> 00:52:13.230 William Cheng: Yeah, nobody mentioned this ever to me that there's a comment like that so 420 00:52:15.360 --> 00:52:18.720 William Cheng: No, I think you're right. I think it should be three. Okay. Yeah. 421 00:52:34.920 --> 00:52:36.300 William Cheng: Anything else 422 00:52:36.390 --> 00:52:41.580 Lalit Gupta: Yeah, I think, yeah, probably. I have nothing in mind. I think that's it. Thank you very much. 423 00:52:42.000 --> 00:52:43.020 William Cheng: Okay. All right. 424 00:52:45.960 --> 00:52:50.310 Andrew Strimaitis: I was hoping to ask really quickly about shadow paging sure um 425 00:52:50.340 --> 00:52:51.720 William Cheng: Let me switch to that. 426 00:52:51.780 --> 00:52:53.460 Andrew Strimaitis: Yeah, that was in the most recent lecture. 427 00:52:53.940 --> 00:52:54.570 Yes. 428 00:52:58.680 --> 00:52:59.280 William Cheng: Okay. 429 00:53:00.960 --> 00:53:03.660 Andrew Strimaitis: Um, okay. So I think it's 430 00:53:06.150 --> 00:53:09.480 Andrew Strimaitis: Slide either 109 or 110 431 00:53:10.050 --> 00:53:12.000 William Cheng: Panoramic all the way to the end. 432 00:53:12.780 --> 00:53:16.230 Andrew Strimaitis: I mean, it's all about shadow page trees so 433 00:53:23.850 --> 00:53:24.300 William Cheng: All right. 434 00:53:25.260 --> 00:53:26.130 Yeah, so 435 00:53:27.900 --> 00:53:35.940 Andrew Strimaitis: We see that the blue block is continuing to move back up until it's at the root level. 436 00:53:36.240 --> 00:53:40.290 Andrew Strimaitis: Right then. Oh no wait, it's it's it's sad, I'm 437 00:53:41.490 --> 00:53:42.930 Andrew Strimaitis: 112 438 00:53:43.350 --> 00:53:51.300 Andrew Strimaitis: Okay, you create one of the root level and then you see that there's the arrow pointing to the I know the file indirect blocks on the left as well. 439 00:53:51.480 --> 00:53:56.880 Andrew Strimaitis: Yes. Um, so can you explain a little bit about that arrow and what's going on in that process. 440 00:53:57.300 --> 00:54:01.140 William Cheng: Well, so over here, you generate this blue block by making a copy of this one right 441 00:54:01.380 --> 00:54:04.770 William Cheng: Right when you copy the pointer at this point to point A to places. 442 00:54:05.490 --> 00:54:16.230 William Cheng: You know, the original an original want to, I guess, that they actually two pointers over here. So maybe the picture is a little, you know, misleading because they sort of come from the same place. But, in this example, they actually there are two pointers there. 443 00:54:18.000 --> 00:54:18.360 Andrew Strimaitis: OK. 444 00:54:18.720 --> 00:54:20.550 William Cheng: So maybe the picture. Oh, it does poorly drawn 445 00:54:22.050 --> 00:54:30.480 Andrew Strimaitis: So. So the whole point of this is just, just make a copy of the I know tree on the left on the shadow on the tree on the left. 446 00:54:30.750 --> 00:54:31.620 William Cheng: Right. Yes. 447 00:54:32.340 --> 00:54:37.320 Andrew Strimaitis: Okay, and then is the are the location of the blue box. 448 00:54:39.000 --> 00:54:44.070 Andrew Strimaitis: Important like in the diagram in front of us, like I like it being listed 449 00:54:45.900 --> 00:54:57.630 William Cheng: Yeah, so that's on the next slide right when the root location is written to disk. Right. So. So is that a super blog, it will need to declare that say that from this point on the blue. The blue is the database. The new route, I note. 450 00:54:58.470 --> 00:55:03.270 William Cheng: Then we made a commitment to set up from this point on, you know, we move to the new version of the file system. 451 00:55:04.320 --> 00:55:21.570 Andrew Strimaitis: Hmm, OK. And then, so the shadow page tree. This is all about just creating a copy of the tree, but is it something where once it's created than the program shifts focus to this tree, or does it stay on the original roots tree. 452 00:55:22.020 --> 00:55:32.130 William Cheng: Right, so, so once you make the commitment, right. So, so, you know, so when you modify the the super blog to say that here is the new route, right, then you can actually go ahead and free up all the other stuff. 453 00:55:33.570 --> 00:55:47.730 William Cheng: Okay, so, so, so, so, so this way, the file system now moved to a new version. Right. And then you can crash it anytime you. There you go back to the previous version of the file system or the new version of our system. So the file system will always be in a consistent state. 454 00:55:50.910 --> 00:55:51.330 Andrew Strimaitis: Okay. 455 00:55:55.830 --> 00:56:04.440 William Cheng: So even though they don't explicitly run transactions in the end they have the same kind of, you know, semantics, or the sort of the nice features of running a transaction. 456 00:56:07.980 --> 00:56:08.820 Andrew Strimaitis: Okay, great. Thank you. 457 00:56:09.210 --> 00:56:09.480 Okay. 458 00:56:24.990 --> 00:56:31.140 William Cheng: Any other questions. So if there's not, I will, you know, I will stop the recording. Okay.