WEBVTT 1 00:01:40.260 --> 00:01:42.510 William Cheng: Welcome to lecture 16 2 00:01:49.200 --> 00:01:52.230 Lalit Gupta: I have one question, like in a corner one we have 3 00:01:53.400 --> 00:01:55.740 Lalit Gupta: The we have this driver is equal to one. 4 00:01:56.250 --> 00:02:04.140 Lalit Gupta: Yes. So you said that there is a part of the code that is provided to us like already written 5 00:02:05.280 --> 00:02:09.540 William Cheng: Yeah, so in the. So let's see. 6 00:02:11.850 --> 00:02:16.440 William Cheng: Actually, there's a file called Live drivers. 7 00:02:17.550 --> 00:02:22.170 William Cheng: Are s dot dot A that's inside the kernel directory 8 00:02:23.310 --> 00:02:32.250 William Cheng: So, that that is a library files. So what the Brown University people did was that they took you know their driver solution and then create a library file for it. 9 00:02:33.750 --> 00:02:37.680 William Cheng: So this will contain all the code that are not yet implemented for the drivers assignment. 10 00:02:40.920 --> 00:02:47.820 Lalit Gupta: Where does it implement. Can you tell like like the border versus like or thing actually do 11 00:02:47.850 --> 00:03:02.490 William Cheng: Yeah, so if you do grab grab drivers, the capital t ri ve R s and and you know in the colonel directory. The Colonel ke R and he stars star Darcy. 12 00:03:03.240 --> 00:03:15.210 William Cheng: And also try the same thing with, you know, one more, star, star Darcy. Okay, so try to look for the word all capital drivers and you will see a bunch of nice implemented a code in there. 13 00:03:17.310 --> 00:03:22.320 William Cheng: So I think it's the, you know, it's the, it's the terminal drivers the keyboard driver. You know, there's a 14 00:03:24.000 --> 00:03:27.930 William Cheng: You know the stuff that interact with the user. So that you know that that's 15 00:03:28.140 --> 00:03:29.340 William Cheng: That that's what they have implemented. 16 00:03:31.800 --> 00:03:32.400 OK. 17 00:03:33.450 --> 00:03:33.720 Lalit Gupta: I see. 18 00:03:33.810 --> 00:03:38.520 William Cheng: Also the hard drive interface. Yeah, I think the. They also have had to implement a dis driver. 19 00:03:42.420 --> 00:03:49.950 Lalit Gupta: Okay, so it doesn't. So data in Cardinal to we have we have to set up some kind of TT by device that 20 00:03:51.210 --> 00:04:02.790 William Cheng: You have that encounter one right in kind of one at the end of kind of wine. You said drive or equal to one. So you pick up all this code. So this code is running at the end of Colonel one. So even Colonel one is using the driver code. 21 00:04:10.530 --> 00:04:19.890 William Cheng: And kernel, two, and three, you continue to use the same driver code because that's the driver for your keyboard and for your display. What, what are the keyboard code. There's no way for you to get character of on the keyboard. 22 00:04:25.080 --> 00:04:29.220 Lalit Gupta: But in Colonel to it seems like we have to we have to make note TTY 23 00:04:30.870 --> 00:04:41.040 William Cheng: You have to make know TTY but, you know, so, so, so, what would you, what you're doing is that you're actually making connection to the device driver code because the device driver code has written for you already. 24 00:04:43.500 --> 00:04:47.760 William Cheng: So the code is sitting there. So you just need to make sure that you get there in the right way, by going through via 25 00:04:47.850 --> 00:04:49.230 Lalit Gupta: OK. OK. 26 00:04:49.980 --> 00:04:58.350 William Cheng: Yeah, so, so, Colonel one bill. What they do is that there's a backdoor they they they they use to to access these device driver without using the virtual file system. 27 00:05:01.710 --> 00:05:03.360 Lalit Gupta: Oh look, and 28 00:05:06.030 --> 00:05:12.780 Lalit Gupta: And that that is actually an actual file system. So when we are making connections. Make note we're making a connection to the actual 29 00:05:12.810 --> 00:05:17.340 William Cheng: Is the actual file system, right, because the actual file system is storing data on the desk. 30 00:05:18.600 --> 00:05:30.330 William Cheng: So, so, you know, so it's it's part of the sort of the, you know, part of the file system right but but the file system is layered at the bottom layer. There's we have the device drivers. 31 00:05:33.150 --> 00:05:41.550 William Cheng: Rest of the fosters and because of the thing about the he has BFS. Right. And then you know you have a DFS right and then there's something called you know 32 00:05:43.470 --> 00:05:49.440 William Cheng: What are they call it the, the, the, the, the, I guess the there's a block device. And then the the 33 00:05:50.460 --> 00:05:58.530 William Cheng: The block device and the the by device interface. Yeah, then at the bottom over here. There's the drivers. 34 00:06:01.350 --> 00:06:03.150 William Cheng: And then you have the hardware at the bottom right. 35 00:06:04.200 --> 00:06:12.900 William Cheng: OK, so the drivers are implemented stuff at the bottom right here for the drivers layer and then in Colonel so so what you're doing. What we do your kernel to 36 00:06:13.320 --> 00:06:22.560 William Cheng: You know you're writing code over here and the actual file system is the RAM file system, the blog and the by device they are part of the wind is Colonel so they are always there. 37 00:06:23.910 --> 00:06:27.690 William Cheng: So, you know, so, so, so you so you just have to use it. 38 00:06:30.180 --> 00:06:42.900 Lalit Gupta: So in in Colonel one which which which direction are we actually doing like when because in Colonel when we haven't even gotten the bfs. So when we do our driver is equal to one. What exactly how are you 39 00:06:43.320 --> 00:06:50.430 William Cheng: So my guess. I mean, I, yeah, I don't have the solutions. I don't know exactly how things work. Right. So, so we're not, we don't have these two right 40 00:06:50.640 --> 00:07:04.410 William Cheng: So in Colonel one. I guess the back doors to go directly into the the the by device in the block device I guess there's no need for the bar device because in Colonel one. There's no desk. Okay, so I think they use directly used by device interface. 41 00:07:08.520 --> 00:07:21.810 Lalit Gupta: And in Colonel TO AN ENCOUNTER TO we are not going through this backdoor, we are actually going to the VM Fs, and the VM FS actually kind of the FS and Fs actually connecting to the block device and so on. 42 00:07:22.230 --> 00:07:30.150 William Cheng: Right, yeah. So if you're working on your kernel to you see this already. You see the block device in the by device right in a special file read in a special file right 43 00:07:31.230 --> 00:07:34.260 William Cheng: You know, they, they, you have to use the by device interface. 44 00:07:36.960 --> 00:07:40.230 Lalit Gupta: Okay, so we're just making things proper in Colonel to it's 45 00:07:40.560 --> 00:07:42.600 William Cheng: Just make more connect you 46 00:07:43.050 --> 00:07:44.490 William Cheng: You start making the right connection. 47 00:07:51.720 --> 00:07:57.480 William Cheng: Yeah. So what he did was that they implemented completely working operating system and then they start taking co op 48 00:07:57.870 --> 00:08:05.460 William Cheng: So they take all this code and then I found out that while you need a way to actually go into the by device directly. So they sort of, you know, create some ways for you to get there. 49 00:08:06.390 --> 00:08:21.300 Lalit Gupta: Yeah, the thing is, I was actually thinking like, since there is some QA device in Colonel one, we should have some developer dev directory. But when I searched like like when all the initialization done the developer directory is not there are like 50 00:08:22.320 --> 00:08:23.670 Lalit Gupta: It's something not 51 00:08:24.900 --> 00:08:32.490 William Cheng: So, so what they do is that they go directly into the by device interface of the Brown University people. They're pretty clever. You know, they come up with a scheme like that. Right. 52 00:08:33.270 --> 00:08:34.230 William Cheng: To to to get to it. 53 00:08:36.570 --> 00:08:36.960 Lalit Gupta: Through 54 00:08:38.100 --> 00:08:44.580 William Cheng: The opportunities and programming assignments. They are very, very difficult to come by, you know, for, especially for teaching purposes. 55 00:08:45.180 --> 00:08:55.800 William Cheng: So there's not too many sort of a successful operating system project. So I think the Brown University people did a really clever job, you know, they make all these things available to you know to program. 56 00:09:15.030 --> 00:09:16.530 William Cheng: You are asking the right question. So 57 00:09:18.420 --> 00:09:18.690 William Cheng: Yeah. 58 00:09:25.530 --> 00:09:27.660 Lalit Gupta: Yes, there is another thing I remember 59 00:09:27.870 --> 00:09:28.260 Sure. 60 00:09:29.430 --> 00:09:32.010 Lalit Gupta: Then when we, when we do the initial invasion. 61 00:09:33.330 --> 00:09:41.130 Lalit Gupta: And so, so we will give you, we will initialize this DFS route. Right, so we will first we will do the first we will 62 00:09:42.360 --> 00:09:46.890 Lalit Gupta: Call there is some there is some call function which will call the amount function. 63 00:09:47.400 --> 00:09:47.910 Lalit Gupta: And that 64 00:09:48.330 --> 00:09:52.350 Lalit Gupta: Function will allocate the things and that will actually initialize the DFS route. 65 00:09:52.920 --> 00:09:53.280 Yes. 66 00:09:54.780 --> 00:09:58.590 Lalit Gupta: And then when everything was initialized by the mount 67 00:09:59.640 --> 00:10:07.440 Lalit Gupta: When I was looking at this and Vienna underscore endless pages. It was do, why should I thought it should be one. 68 00:10:08.370 --> 00:10:10.650 William Cheng: A VN underscore what the end 69 00:10:11.640 --> 00:10:14.880 Lalit Gupta: There's two things. One is VN underscore F count. 70 00:10:15.990 --> 00:10:16.470 William Cheng: Out. 71 00:10:16.860 --> 00:10:21.690 Lalit Gupta: And the other thing is VN underscore and just pages. 72 00:10:22.230 --> 00:10:36.300 William Cheng: Yeah, so look at the colonel FAQ. I think the FAQ is either in colonel colonel three so so so look for those strings, you know, the, the number of Resident resident pages and the rough count. 73 00:10:38.310 --> 00:10:52.080 William Cheng: Oh, so there's some explanation about you know why, you know, where, where are the two things. So basically, the idea here is that is that the, you know, when you bring these pages on the disk. They are inside the actual file system. 74 00:10:53.190 --> 00:11:08.130 William Cheng: So you need to sort of keep track of the counter. So when the number of references is exactly the same thing as a number resident pages. Well, that means that you know only the actual file system is using it and nobody else is using it. So in that case, we can free up those data structure. 75 00:11:09.390 --> 00:11:14.040 Lalit Gupta: Yes, yes, but you're saying. Makes sense to me. So we have to have at least 76 00:11:15.210 --> 00:11:19.170 Lalit Gupta: One page, right. This means like when we have reference count one 77 00:11:20.160 --> 00:11:29.340 William Cheng: Yeah so reference count right so so yeah so so so inside the actual file system. They also need to, you know, keep track of all these data that brought in on the desk where 78 00:11:35.250 --> 00:11:40.980 Lalit Gupta: Does the the. Okay, so when we, when we do all the mounting 79 00:11:42.840 --> 00:11:46.290 Lalit Gupta: We, it seems like we have to have at least one pages in the cash right 80 00:11:48.870 --> 00:11:59.490 William Cheng: On the new it needs to be there. Right. The, the, you know the the rule, the file system, right, because the idea here is that you haven't lost no hierarchy, right. So in the beginning, you know the the route over here. 81 00:11:59.730 --> 00:12:01.590 William Cheng: You have to cash inside the 82 00:12:02.640 --> 00:12:10.260 William Cheng: Yeah, you, you, you have the cash to be no right and the root is only freed up but you shut down the system. So I guess there's a 83 00:12:11.310 --> 00:12:16.110 William Cheng: There's some kind of a shutdown BFS shut down or something like that, you know, at the end of the idol proc 84 00:12:17.040 --> 00:12:26.130 William Cheng: So, so when everything dies, then what it will do is it is that it will document the RAF ground on the on the Rubino and then everything should, yeah, everything should get freed up 85 00:12:27.180 --> 00:12:28.920 Lalit Gupta: So is it possible to have like 86 00:12:30.180 --> 00:12:33.390 Lalit Gupta: A number of different periods zero and the ref count is one 87 00:12:37.980 --> 00:12:41.850 William Cheng: Um, I mean the ref count is the ref count on the Wii node. 88 00:12:43.170 --> 00:12:54.780 William Cheng: Okay, the number resident pages is what's happening inside AFL CIO. So, supposedly, you know, the higher level of the colonel can't really see what's going on, you know, Co. Can I really see what's going on down below. 89 00:12:55.650 --> 00:13:09.780 William Cheng: So therefore, those, those numbers. It is possible that the you know the Beano reference equal to one, but you haven't really used that that data. So therefore, the data is not inside the actual file system yet and later on when you try to ask for it, it will bring you in on a distant memory. 90 00:13:10.740 --> 00:13:11.370 Okay. 91 00:13:12.540 --> 00:13:12.720 Yeah. 92 00:13:14.490 --> 00:13:19.770 William Cheng: Yeah, so it's okay for the rough comes to be bigger than, you know, to, to bigger than a number resident pages, right. 93 00:13:20.940 --> 00:13:37.290 William Cheng: So I think in lecture 16 I have a, you know, towards the end, I have an example like that I showed up the object at the bottom is supposed to have three page frame x y AMP Z. As it turns out, the only has x and z. It doesn't have why so so so in that case the white the white is not resident 94 00:13:38.400 --> 00:13:38.640 Lalit Gupta: Cool. 95 00:13:38.970 --> 00:13:42.270 William Cheng: So therefore, the number of Resident pages over here will be equal to two and i equal to three. 96 00:14:13.710 --> 00:14:21.180 Lalit Gupta: Okay, in, in the file the file type we have, there's a mode mode, it can be read mode, right. 97 00:14:21.690 --> 00:14:23.610 William Cheng: Are you looking at the the winning source code. 98 00:14:25.200 --> 00:14:26.070 Lalit Gupta: Yeah. 99 00:14:26.640 --> 00:14:27.000 Lalit Gupta: Yes. 100 00:14:27.570 --> 00:14:29.040 William Cheng: Let me switch the 101 00:14:33.960 --> 00:14:36.060 William Cheng: Okay, so which file. Are you looking at 102 00:14:37.080 --> 00:14:42.120 Lalit Gupta: Maybe filing the one pitch defined file underscore te the file, file. 103 00:14:43.170 --> 00:14:47.370 William Cheng: Okay, so, Colonel include FS file that ah 104 00:14:49.620 --> 00:14:50.010 William Cheng: OK, so 105 00:14:50.070 --> 00:14:51.630 Lalit Gupta: I think you'll find out it 106 00:14:51.930 --> 00:14:52.320 William Cheng: Right. 107 00:14:53.280 --> 00:14:57.240 Lalit Gupta: Yeah. So yeah, so what does this f more dependent means do we have to worry about it. 108 00:14:57.360 --> 00:14:59.910 William Cheng: Yeah, that's the protection mode right I'll be here. It says, you know, 109 00:15:00.240 --> 00:15:08.790 William Cheng: Read Write or a pen or something like that. So when you open a file, you need to remember. Remember, this is the file. After the follow up Jake is the one who has those four fields. 110 00:15:09.060 --> 00:15:20.970 William Cheng: The reference column which is right here. Right. And then you know how you open the file right you open for read, write, or a pen and then here's the crystal position. Right. And then the last one over here is the I know pointer that we will call in class. 111 00:15:21.990 --> 00:15:31.470 William Cheng: Yes. Reza, so this is the one that's inside the system file table right this is the one that the file table of a file descriptor entry will point to this this object. 112 00:15:32.580 --> 00:15:37.920 Lalit Gupta: Yeah. So, from my understanding, I thought like read means like the file can only be right means the file. 113 00:15:38.610 --> 00:15:44.700 William Cheng: Over here we just remember how you open the file right so if you open the file for read only. 114 00:15:44.880 --> 00:15:53.340 William Cheng: And then later on when you try to write to it. Well, then in that case it's incompatible with the way the file is open, then in that case you should fail that you know fulfill that system call 115 00:15:54.300 --> 00:16:03.270 William Cheng: Okay, right. So if a file is open, right. So, so the idea here for the fall object is that the file object only exists if you successfully open the file. 116 00:16:04.890 --> 00:16:13.260 William Cheng: Okay, so once you have successfully open up. I said, Oh, how did they open it. I need to memorize, you know, how did they open. So I open it right here. Right. So this is high. Remember, right. 117 00:16:16.650 --> 00:16:30.210 William Cheng: So I think for weenies, you know, over here, it says, you know, is supports read, write and a pen and then will you try to look at the open system called there's a lot more options right so so once the file is open. You only have to remember whether you open up for reading and writing or 118 00:16:34.050 --> 00:16:34.650 Lalit Gupta: Okay. 119 00:16:34.800 --> 00:16:38.400 William Cheng: And we can also look for this this keyword grip. 120 00:16:41.040 --> 00:16:42.690 William Cheng: Curnow include 121 00:16:44.700 --> 00:17:02.520 William Cheng: Okay, so. Oh, so this is the same thing. It's in your father that he asked right here. Right, so, so, so these are the only three, you know, different I guess these are bits, or I want to enforce their single bit so you can order them together. So in the end there, you know, a different combinations 122 00:17:05.010 --> 00:17:06.780 William Cheng: I guess zero is not an option. Yeah. 123 00:17:07.320 --> 00:17:07.980 Lalit Gupta: Yes, yes. 124 00:17:11.340 --> 00:17:14.790 William Cheng: Yeah. And also, I think, reading a pen. I don't know. I don't know if they're compatible. 125 00:17:15.540 --> 00:17:18.420 Lalit Gupta: Yeah, actually, this is the same thing I was thinking like how like 126 00:17:20.100 --> 00:17:33.690 William Cheng: Yeah, so, so my recommendation is that you know the requirement for our class is to pass BFS test. So you look at the code for BFS test to see what kind of, you know, combination, do they, do they today test, right. So if I look for a pen. 127 00:17:35.040 --> 00:17:46.440 William Cheng: Colonel tests DFS has BFS test our seat. Okay, it's only test one a pen. Right. And this is a pen for rewrite, you know, plus a pen. 128 00:17:47.610 --> 00:17:52.590 William Cheng: So that's the only case you have to, you know, for for our programming assignment. That's the only case you have to get to work. 129 00:17:54.570 --> 00:17:59.190 William Cheng: When it went well. It says I. That's the only case you have to work when the pen flag is used 130 00:18:02.760 --> 00:18:03.840 Lalit Gupta: Read right 131 00:18:08.310 --> 00:18:18.720 William Cheng: Where you can also look for this right grab. Oh, rewrite Colonel include started each nope at their star slash start at H 132 00:18:19.980 --> 00:18:24.240 William Cheng: In file control kernel include FS FC and to 133 00:18:25.260 --> 00:18:25.530 William Cheng: Yeah. 134 00:18:27.600 --> 00:18:40.680 William Cheng: Yeah, so, so for for, you know, for the Linux kernel. These are the ones that are supported at the virtual file system level. Well, I actually didn't know this is actually support at the users, the user level. 135 00:18:41.130 --> 00:18:47.820 William Cheng: So when the user called open, they can you know use, or two, or all these bits together. And there's six different bits that you can or together. 136 00:18:53.970 --> 00:19:00.480 William Cheng: Okay, I don't know if we do old trunk or not. So again, can grab old trunk Curnow include Stardust say 137 00:19:01.410 --> 00:19:18.630 William Cheng: We need to look for the DFS Test, test DFS test. Yeah, let's see. Okay. So trunk is not used at all right so therefore this. We don't have to implement that again for for our class would have to implement a pen. We saw only used in one place right that's grew up again. 138 00:19:22.740 --> 00:19:25.410 William Cheng: Right, it's only using one place. What about create 139 00:19:32.010 --> 00:19:33.420 William Cheng: So Korea is just quite a lot. 140 00:19:35.040 --> 00:19:35.670 Lalit Gupta: Of times to be 141 00:19:36.510 --> 00:19:49.500 William Cheng: Right, so, so, so, so will you do this you know that, you know, these are the combination, you have to make it work with. Right. Oh. Create, Read combined with only it says that it should succeed. Right. And I'll be here says this, you fail or KOREAN Oh 142 00:19:50.100 --> 00:19:58.800 William Cheng: Rewrite and then it says it's not a directory. So in this case, this is not a valid directory path right so so the code over here tell you exactly why they should fail. 143 00:20:03.480 --> 00:20:09.780 Lalit Gupta: Okay. Oh, yeah. Okay, so it's it's tell us like rich cultured field and which color should succeed. 144 00:20:10.110 --> 00:20:18.990 William Cheng: Right, so, so when you, you know, run this test. If your air number is not enough dirt then then then it's a bug in your code. 145 00:20:21.690 --> 00:20:21.960 Cool. 146 00:20:24.780 --> 00:20:25.140 Lalit Gupta: Oh, 147 00:20:31.800 --> 00:20:32.250 Lalit Gupta: Okay. 148 00:20:33.450 --> 00:20:37.320 William Cheng: Yeah so. So our goal is only to pass BFS test and nothing else. 149 00:20:39.270 --> 00:20:42.180 William Cheng: Because otherwise, it will take forever to implement these programming assignments. 150 00:20:44.130 --> 00:20:47.100 Lalit Gupta: What about the other tests, you said we have disfavored also 151 00:20:48.150 --> 00:20:49.590 William Cheng: There's the favor. 152 00:20:50.820 --> 00:21:04.080 William Cheng: FS thread test and the favor FS dirt test. So those tests are testing your implementation of BFS, together with multi threading all together with, you know, you know, multiple processes inside the Colonel. 153 00:21:06.480 --> 00:21:13.230 William Cheng: Okay, so, so you got to make sure that you pass the FS test first and then multi threading is going to you know again mess things up for you. 154 00:21:14.580 --> 00:21:20.070 William Cheng: So, so, so, so you should do that. Only after you pass you know most of the PFS this 155 00:21:23.610 --> 00:21:37.950 William Cheng: Is this is pretty extensive there's like 599 test there, you know. So when you pass all that, then you're in pretty good shape. Right. But you don't have to pass all the tests in order for you to to to pass their test. And the third test. 156 00:21:40.410 --> 00:21:40.710 Lalit Gupta: Oh, 157 00:21:46.440 --> 00:21:50.130 Lalit Gupta: And I think I have one probably one 158 00:21:51.420 --> 00:21:55.680 Lalit Gupta: If you go to this VM FS is called Odyssey in 159 00:21:55.800 --> 00:21:57.840 William Cheng: Which one is called RC. 160 00:22:04.200 --> 00:22:04.530 William Cheng: Okay. 161 00:22:05.580 --> 00:22:05.820 William Cheng: And 162 00:22:05.850 --> 00:22:08.790 Lalit Gupta: I think in this we have to implement this read directory 163 00:22:11.100 --> 00:22:12.120 William Cheng: What's the name of the function 164 00:22:12.750 --> 00:22:13.680 Lalit Gupta: The interview. 165 00:22:20.130 --> 00:22:25.080 Lalit Gupta: Probably, I think it is do get den entry directory anti DM 166 00:22:25.500 --> 00:22:26.040 William Cheng: Yeah, this one. 167 00:22:27.510 --> 00:22:30.450 Lalit Gupta: Yes, yes it is saying it should return 168 00:22:32.580 --> 00:22:33.360 Lalit Gupta: It should return the 169 00:22:34.590 --> 00:22:37.380 Lalit Gupta: The number of bytes kaput to do your end 170 00:22:37.740 --> 00:22:38.070 William Cheng: Yeah, but 171 00:22:38.130 --> 00:22:55.590 Lalit Gupta: I just, I just realized that the dir end and the end and the tight end the end the end the type of Dr. E and D, just type that direct under an underscore te. They are not compatible. They are just one data structure extra in the end. 172 00:22:55.920 --> 00:22:59.460 William Cheng: They are not compatible or what is what. What is not compatible. 173 00:22:59.670 --> 00:23:04.980 Lalit Gupta: So if you will look into. Do your end if you will look at the data structure of Dr. Ian and 174 00:23:05.130 --> 00:23:05.580 40 175 00:23:06.780 --> 00:23:08.580 Lalit Gupta: So this will be. Oh. 176 00:23:08.970 --> 00:23:09.630 Crap. 177 00:23:13.770 --> 00:23:19.740 William Cheng: Okay, Colonel include FS or rent that right. So this is the directory entry right 178 00:23:20.160 --> 00:23:27.000 William Cheng: Yes. Okay, so in class. I mentioned that the direct to entry has a component name, and I don't number right 179 00:23:27.750 --> 00:23:31.260 William Cheng: Yes. Okay. So, this one has one more thing. They call it the offset. 180 00:23:35.640 --> 00:23:36.510 William Cheng: Okay, and 181 00:23:37.080 --> 00:23:45.600 Lalit Gupta: And the roadmap first direct and if I look into the drummer first drummer first direct entry type. It only two things. 182 00:23:47.610 --> 00:23:53.820 William Cheng: Yeah, because you know the the seat point over here. That's the, what do you call that that's the 183 00:23:55.830 --> 00:24:01.170 William Cheng: That's, that's a crystal position right so the Christian religion belong to the virtual file system. 184 00:24:05.940 --> 00:24:12.750 William Cheng: So remember directory. So, so a directory is a file right so this one sort of remember the Sikh point of the next entry. 185 00:24:14.490 --> 00:24:26.880 William Cheng: Okay, so, so beta depend on where you are says when we started this directory entry your cursor positions or someplace. Right. And then if you add the size of the directory entry over here. Sorry. It's not decided directory entry. It's, it's, it's the size of the 186 00:24:28.200 --> 00:24:33.150 William Cheng: It's a number of bytes as returned from the actual file system, right, then you get the seat point over the next century. 187 00:24:39.540 --> 00:24:43.620 William Cheng: Okay, so let me switch back to somewhere I can draw okay. 188 00:24:47.760 --> 00:25:00.270 William Cheng: Right, so, so remember that, you know, the, you know, so let's say this, you're a FS right this is a FS is that Fs. Here is a directory file is a directory file, right, the director of ours that has all these directory entry over here. Yeah. 189 00:25:01.020 --> 00:25:11.730 William Cheng: So each one of them is a directory entry, but the directory entry over here is the actual file system specific one. So they might they might be different for every different actual file system. 190 00:25:12.150 --> 00:25:22.530 William Cheng: That. So at the bfs layer over here you have the abstraction that directory, it's a it's an array of directory entries over here, this is the directory for her. And again, this is the directory entry. 191 00:25:23.640 --> 00:25:32.640 William Cheng: There E and t over here, right. So we are going to copy some of the information over here from the actual file system to the to the virtual versus them. 192 00:25:33.300 --> 00:25:40.890 William Cheng: But also next time. Will you try to read the next century. In case you need to do a seek you need to know how far to go. Okay. So, therefore, what you would do is that 193 00:25:41.460 --> 00:25:49.710 William Cheng: You know, you have the size of this directory entry. And if you add it to the previous cursor position and that will tell you where the next one starts 194 00:25:55.260 --> 00:26:05.910 Lalit Gupta: Okay. So, this what you're saying it. It makes sense. But the thing is, in the end, the do get directory entry we have to call I think GDA or 195 00:26:07.200 --> 00:26:08.310 Lalit Gupta: Of the efforts well 196 00:26:08.430 --> 00:26:18.600 William Cheng: Right, you have to use the polymorphous pointer to to to to to to to get the data and then what the actual file system will do is it will take this one and they will fill out a data structure right here. 197 00:26:22.680 --> 00:26:30.030 William Cheng: Right, the actual process and know what the virtual file system look like and the virtual bosses and doesn't know what the actual processes and look like because it's actual file system independent right 198 00:26:34.860 --> 00:26:39.990 William Cheng: So it's the job of the actual file system. So I guess we can go back there to see how the ramp our system does it right 199 00:26:40.230 --> 00:26:42.360 Lalit Gupta: Yeah. Yeah. Yes. Can you look into this VM Fs. 200 00:26:43.680 --> 00:26:44.010 William Cheng: Yeah. 201 00:26:46.650 --> 00:26:48.810 William Cheng: No offense RAM. 202 00:27:06.930 --> 00:27:08.850 William Cheng: Okay, where's the function 203 00:27:17.550 --> 00:27:21.300 Lalit Gupta: returning the if you will go call do cursor, but 204 00:27:22.380 --> 00:27:22.680 Lalit Gupta: Don't 205 00:27:23.100 --> 00:27:27.090 William Cheng: Have. So this is a function that call leader. Right. Yes. 206 00:27:29.460 --> 00:27:35.970 Lalit Gupta: And she will see the oddity read it is basically the size of RMS underscore di di N T underscore te 207 00:27:37.980 --> 00:27:40.440 William Cheng: Right, it's hard to compute the cursor position. 208 00:27:42.120 --> 00:27:43.050 William Cheng: For the next entry. 209 00:27:47.280 --> 00:27:53.730 Lalit Gupta: Yes, but it does. But this isn't a multi multiple of this size of NFL underscore, underscore, te 210 00:27:54.540 --> 00:27:55.500 Them worldwide. 211 00:27:57.330 --> 00:27:58.080 Lalit Gupta: So, and 212 00:27:59.400 --> 00:28:00.120 Lalit Gupta: Whereas 213 00:28:02.040 --> 00:28:11.940 Lalit Gupta: The do get directory entries. It is saying that it is we should return the number of successful bites corporate to be underscore te but this is 214 00:28:12.990 --> 00:28:16.980 Lalit Gupta: Ram FS underscore DNS entry underscore piece of their 215 00:28:19.890 --> 00:28:20.190 Lalit Gupta: Work. 216 00:28:20.850 --> 00:28:28.020 William Cheng: Yeah, so the actual classes in the data structure might be different. Right, so, so, so what what is to do is need to return the 217 00:28:29.670 --> 00:28:35.100 William Cheng: You know, so let's say add I are. Let's see the reader function over here. 218 00:28:42.540 --> 00:28:46.980 William Cheng: Okay, so this is the only place that they have using the directory entry. 219 00:28:50.400 --> 00:28:51.870 William Cheng: Yes, over here. Oh. 220 00:28:53.340 --> 00:29:00.720 William Cheng: They said the offset equal to zero to be unused. Okay, so they don't really care about this field and in the in their code. 221 00:29:01.590 --> 00:29:14.400 William Cheng: So, so again. So in this case, what it will do is that it will copy the I know number from the actual file system into the bfs. I don't number and then copy the component name into the component name inside the the 222 00:29:15.450 --> 00:29:18.360 William Cheng: The actual file system into the virtual file system and the offset over here. They don't care. 223 00:29:19.110 --> 00:29:30.990 Lalit Gupta: Yeah. During the scoping the things and like they are returning the thing, according to their file system that is the size of rappers underscore the underscore te not di n underscore te 224 00:29:31.320 --> 00:29:39.690 William Cheng: Yeah, so, so, so this is about. By the way, this is the read function. Right. So the real function basically they have, they typically what they do is either return a number of bytes that has been read 225 00:29:41.310 --> 00:29:49.650 William Cheng: Okay, so therefore, in this case, I think that return value over here. I don't know why they write it in such a convoluted way but the return value should always be the size of that data structure. 226 00:29:51.900 --> 00:30:02.040 William Cheng: I mean, I think the return value should always be size of RAM FS Duran T i don't know why, you know, they, I mean this differences hobby always want unless there's some really weird stuff going on. 227 00:30:05.130 --> 00:30:09.780 Lalit Gupta: Yeah. Yes. I thought, yes. Target entry and director into should be equal to 228 00:30:10.980 --> 00:30:22.050 William Cheng: The difference either one. Yeah, so this loop over here, right, even though they said I can loop, you know, many times. IF IT ALWAYS ONLY ONES. Then, you know, then, then the difference is always the same. 229 00:30:22.170 --> 00:30:23.490 Lalit Gupta: All right, I heard it should be. 230 00:30:24.540 --> 00:30:24.990 Lalit Gupta: Zero. 231 00:30:27.060 --> 00:30:29.280 William Cheng: Okay, yeah, they're all the same, right. 232 00:30:29.370 --> 00:30:32.850 Lalit Gupta: Because if you're gonna see it before the while they did offset and 233 00:30:34.140 --> 00:30:36.930 Lalit Gupta: Target is equal to direct entry before 234 00:30:37.320 --> 00:30:39.330 William Cheng: So so so anyways. I mean, I, you know, 235 00:30:39.720 --> 00:30:45.360 William Cheng: I mean, I don't have a solution that can really run through this code. So I'm just reading the code to sort of tell you what I think it is. 236 00:30:45.420 --> 00:30:49.650 William Cheng: Okay. I mean, I mean, in order for you to get to this call, you have to write Colonel twofer. 237 00:30:50.430 --> 00:30:50.880 Yeah. 238 00:30:51.900 --> 00:30:57.360 Lalit Gupta: So basically what the idea is to pass this thing and if it is not passing them. You have to do something. 239 00:30:58.650 --> 00:31:03.060 William Cheng: You did debug this code by stepping into it to see, you see, you see what it does, right. 240 00:31:03.810 --> 00:31:10.350 William Cheng: Okay. And then also, you know, read the, the reader function. So grab read or Colonel include 241 00:31:12.900 --> 00:31:17.340 William Cheng: Okay, so this is envy note right include FS vino ah 242 00:31:20.040 --> 00:31:33.660 William Cheng: OK, it reads one directory entry from the dirt into the struck right and then it returns the amount of offset should be increased to obtain the next directory entry with a subsequent call to reader. 243 00:31:34.050 --> 00:31:41.580 William Cheng: I mean, I think, theoretically, it's probably possible that you know your directory entry. Maybe there's an empty slot there. 244 00:31:42.450 --> 00:31:49.980 William Cheng: Yes, if there's an empty slot then then then you know the the return value might be bigger than the you know the size of the directory entry. 245 00:31:51.540 --> 00:32:00.630 William Cheng: Right, because what happened is out. Let's say you have you have a directory file that has 1000 entries in them and then you delete one of the, you know, usually one of the component 246 00:32:00.960 --> 00:32:05.640 William Cheng: So one thing that you can do that. You can copy all the other stuff too. So that so so that there's no hole. 247 00:32:06.240 --> 00:32:15.570 William Cheng: But that seems to be very expensive. So one thing that you might want to do is that you might just wanted to do the entry and leave a holder. So in that case, the readers should adjust based on that the size of the whole 248 00:32:20.220 --> 00:32:21.120 William Cheng: Does that make sense. 249 00:32:23.070 --> 00:32:23.760 Lalit Gupta: Can you repeat 250 00:32:24.330 --> 00:32:26.550 William Cheng: Yeah. So let me draw the picture here. 251 00:32:30.330 --> 00:32:41.820 William Cheng: Okay, so let's say that in my actual file system. I have a bunch of directory entries. Over here I ok so i i tried to delete a file inside this directory. So what I try to delete this file, I can just mark this one to be invalid. 252 00:32:43.050 --> 00:32:50.880 William Cheng: Okay, so in this case there's a hole there, right. So if I always return the size of a directory entry next time when I try to get a directory. I will end up studying reading from here. 253 00:32:51.090 --> 00:33:04.020 William Cheng: And that will be incorrect. So in this case I need to have a way to set of calculators there. Okay, so right now I'm returning this directory entry and next time I actually need to skip past two entries, because there's a whole there's a whole inside my directory far 254 00:33:06.390 --> 00:33:06.840 Lalit Gupta: Okay. 255 00:33:06.930 --> 00:33:12.540 William Cheng: So I don't really know if that's how its implemented, but if you read the entire code for where I'm at fast. Maybe you can maybe that's 256 00:33:12.900 --> 00:33:17.850 William Cheng: How you actually unlinked something right because when you're learning something. Remember this, this directory ANGIE HAS A 257 00:33:18.180 --> 00:33:23.730 William Cheng: You know, every directory ANGIE HAS I know number I know number over here and then followed by the component name. 258 00:33:24.540 --> 00:33:30.930 William Cheng: Okay, so if you want to make it in beta one easy thing is to zero. The whole thing out, then it becomes invalid. So if you look at a component 259 00:33:31.140 --> 00:33:39.270 William Cheng: In a component name is empty string. Well, then this is invalid. So, so, so in this case, you can actually keep scanning until you until you find it next entry. 260 00:33:40.380 --> 00:33:45.480 William Cheng: Or for some reason their desire is to say that you actually have to count the number of bytes over here. So this way. 261 00:33:47.070 --> 00:33:49.710 William Cheng: So so so this way you know exactly where to go next. 262 00:33:50.970 --> 00:33:51.150 Oh, 263 00:33:54.960 --> 00:33:57.450 William Cheng: Yeah, there's, there's two ways to do a one is that 264 00:33:58.890 --> 00:33:59.130 William Cheng: You know, 265 00:34:02.100 --> 00:34:10.440 William Cheng: When the previous entry you set up with the next entry or the other ways to say every time when you try to look for something you you start searching for 266 00:34:10.620 --> 00:34:16.680 William Cheng: And yuki you trying to make sure that the component of that because that empty it's empty, that you can look for another one. Look for another and look for another one. 267 00:34:19.560 --> 00:34:24.030 William Cheng: So I think the Brian versus the people decide to go with the first approach. Yeah. 268 00:34:25.080 --> 00:34:35.550 Lalit Gupta: Also like I like it. Does the reference I wanted to try to make the connection between the reference content. The link count because I think link onto the related to this. 269 00:34:35.970 --> 00:34:39.240 William Cheng: Link is in the file system, the reference car is in memory. 270 00:34:41.340 --> 00:34:45.120 William Cheng: The link count count the number of hard links that link to a file in the actual file system. 271 00:34:47.040 --> 00:34:51.210 William Cheng: The reference Kyle is when you have an object in memory. You have a number of pointers that points to it. 272 00:34:57.840 --> 00:34:58.530 William Cheng: Does that make sense. 273 00:34:59.940 --> 00:35:04.350 Lalit Gupta: Yeah. Earlier, saying, making sense. Like, we're like, I'm trying to make the picture more 274 00:35:04.560 --> 00:35:06.900 William Cheng: So, so when the link count goes to zero. 275 00:35:07.440 --> 00:35:09.030 William Cheng: That means that the file needs to be deleted. 276 00:35:11.550 --> 00:35:13.560 Lalit Gupta: Okay, so there is and 277 00:35:14.550 --> 00:35:18.270 William Cheng: Go to zero when reference number zero that means that you can free the object memory. 278 00:35:18.990 --> 00:35:20.700 William Cheng: But it doesn't change the actual file system. 279 00:35:22.410 --> 00:35:29.310 William Cheng: The actual bosses Amazon desk right i mean force Colonel to use the file system. So it's kind of funny, right, because on this is the same thing as the memory. 280 00:35:30.030 --> 00:35:37.080 William Cheng: But in the real actual file system is sitting on this. So in that case, when the link and go to zero. You actually have to delete a file inside the actual file system. 281 00:35:37.650 --> 00:35:46.350 Lalit Gupta: Okay, so when the link on goes to zero we we can delete the things from the desk and when the reference codes, you know, we can we can 282 00:35:47.370 --> 00:35:48.750 Lalit Gupta: Feed I think from the memory. 283 00:35:48.990 --> 00:35:49.680 William Cheng: Right, yeah. 284 00:35:50.310 --> 00:35:52.830 William Cheng: So, so if it corresponds to the object on it is 285 00:35:52.890 --> 00:35:55.320 William Cheng: Whatever that's under this is still whatever it was. 286 00:36:00.480 --> 00:36:03.150 Lalit Gupta: But since in this simple scenario. 287 00:36:07.440 --> 00:36:10.680 Lalit Gupta: As long as we have no hardly no extra hard link. 288 00:36:11.880 --> 00:36:16.020 Lalit Gupta: Deference coach should be in correspondence to the link on right 289 00:36:16.290 --> 00:36:19.200 William Cheng: Now, no, no, no, the reference guide and nothing to do with the link 290 00:36:20.070 --> 00:36:20.460 And nothing 291 00:36:21.720 --> 00:36:33.780 William Cheng: Yeah, so, so, so for example I would draw the picture. Like, here's the directory right here's the directory this directory contains to file, file wine and file to over here. Yes. Okay. So in this case, the link on a file one 292 00:36:34.470 --> 00:36:39.750 William Cheng: Should be one, right, because it's because you know the inside the directory file. There's a link to this file. 293 00:36:40.320 --> 00:36:49.320 William Cheng: Yes. Okay. If you remove this this link over here, then the link on of this fall will go to zero. What, in this case, there's no way to reach this file. So therefore, the family to be deleted. 294 00:36:50.130 --> 00:36:50.460 Okay. 295 00:36:52.170 --> 00:36:56.910 William Cheng: Right, so this is happening is that the actual file system. It has nothing to do with what's going on in memory. 296 00:37:02.460 --> 00:37:02.850 Lalit Gupta: And 297 00:37:04.860 --> 00:37:06.300 Lalit Gupta: Renders the reference count. 298 00:37:10.710 --> 00:37:12.360 William Cheng: The link of the reference call 299 00:37:13.140 --> 00:37:16.620 Lalit Gupta: Yet that yet. You already talked about this link contract. Yeah. 300 00:37:17.130 --> 00:37:21.030 William Cheng: So the only way to document the link on is to make the link system call 301 00:37:23.070 --> 00:37:36.330 William Cheng: Okay, so, so, so if you're in a directory. Right. You say unlinked. Right. One of the functions directory is unlinked. So in that case, you, you did recommend a link on over here. And then I have the, you know, this file the link and go to zero, then that means that you needed to read the file. 302 00:37:39.990 --> 00:37:42.720 William Cheng: delete the file inside the actual file system on desk. 303 00:37:48.360 --> 00:37:54.960 Lalit Gupta: But OK. And can you also talk about this reference count like from some from some diagram. 304 00:37:56.220 --> 00:38:08.790 William Cheng: Yeah. So one of the reference kinda we need to deal with this vino right so you have a note. I've been over here, right, there's a reference cow reference it count the number of pointers that point to it. So if there are three pointers that replica she should be able to three. 305 00:38:12.300 --> 00:38:21.690 William Cheng: Whereas Robin is that whenever you have a vino you pass it around, is I your, your insight, your operating system any you know any code that keep a pointer, you know, on this vino you need to income in the reference count. 306 00:38:25.980 --> 00:38:33.180 William Cheng: Okay, so, so, I mean, here's an example right if you have x ray, X over here is that x over here. You say, you know, be 307 00:38:35.010 --> 00:38:50.760 William Cheng: T right star be and is equal to, you know, be get or something like that, right, be get or something like that. So, oh, you, you, you create a vino. So there's been no right I reference counting go to one right and then you call. Why have you know bn 308 00:38:52.350 --> 00:39:03.480 William Cheng: Okay, so, so, so, so, so instead of why over here. So here's a couple why right why for somebody that you create another variable called V and one equals to be equal to be an 309 00:39:04.140 --> 00:39:12.630 William Cheng: Owner, so we are one point to the same place. Now you add another point of this one. So you need to write. So in so you need to call the ref IV ref over here. The end. 310 00:39:14.040 --> 00:39:22.950 William Cheng: Yeah, right. So, these two things goes together right because you add if you add a pointer to to the same object. So, so you have to explicitly include increment the reference count. 311 00:39:23.910 --> 00:39:34.500 William Cheng: Now and then I say you called z with VN one right all right inside co for Bo for z over here for some reason you do the same thing. He had VM two equals to 312 00:39:35.070 --> 00:39:42.660 William Cheng: You know, the argument over here is called the end of yours. You go to the end. So, therefore, you have to go into the ref again because now you end up with three pointers. One is it the same object. 313 00:39:43.740 --> 00:39:54.300 Lalit Gupta: Oh I ok and now it makes more sense. Okay, so basically we have a pointer and like how many, how many other pointer referencing the same pointer. We have to reference cone according to that. 314 00:39:54.600 --> 00:39:57.990 William Cheng: Was a reference count count the number of pointers that pointed this object. 315 00:39:59.940 --> 00:40:05.550 William Cheng: Whereas, in this case, we have one over here we have the second one over here where the third one over here. So the reference reference should be able to see me. 316 00:40:08.010 --> 00:40:21.300 Lalit Gupta: Yes. Okay, so basically you can even think of it is, and I think, and as an extracting we have a pointer and whenever like some day create another variable which point to the same pointer, can we increase the reference count and 317 00:40:22.950 --> 00:40:31.020 William Cheng: Well, so, so it's not a point, point to read this one is an object. Right. Okay. The vino is an object, right, you have multiple pointers point is the same object. Right. 318 00:40:31.770 --> 00:40:32.400 Lalit Gupta: Yeah, that's 319 00:40:32.880 --> 00:40:40.530 Lalit Gupta: Not correspond to some object. Yes, definitely. But this the node this object is we are referencing it by a pointer. Right. 320 00:40:41.700 --> 00:40:42.180 William Cheng: Right. 321 00:40:43.620 --> 00:40:52.860 William Cheng: Yeah, so I'll get this code is kind of silly right x, y, y equals z that we can also, you know, so, so let's say that this x function. This is in one 322 00:40:53.310 --> 00:41:08.430 William Cheng: One Colonel process. Right. Another Colonel process also called x. And then the third Colonel process also called x. Okay. So in this case, when you are when you called V get, I guess. Again, if you read a COA began began will try to look for it if it can find it. Then he would just, you know, 323 00:41:09.540 --> 00:41:12.030 William Cheng: So, so in that case it will actually increment the reference count by itself. 324 00:41:12.810 --> 00:41:24.390 William Cheng: Yes. When I say that because again we're going to end up with. So in this case, we don't have to call all be wrapped because you know that one is done for you already. Okay, so now you have three pointers pointing to it because there are three processes that are using the same vino 325 00:41:28.650 --> 00:41:30.660 William Cheng: Okay, so that's that's another way to go. Right. 326 00:41:31.470 --> 00:41:39.690 Lalit Gupta: Yes. So every file every file correspond to a V note right has every file has a data structure which which is a renewed pointer. 327 00:41:39.990 --> 00:41:53.520 William Cheng: No, no, we just saw the, you know, we just saw the fall object, right, the file object has four fields. The last few days, I know pointer. So in winnings is called a vino pointer. Right. Yes. So every file has a vino pointer. Right. 328 00:41:59.580 --> 00:42:04.260 Lalit Gupta: Yes. And so is it is directory, not a file. 329 00:42:05.100 --> 00:42:06.330 William Cheng: Directory is also file. Yeah. 330 00:42:07.530 --> 00:42:09.270 William Cheng: So, the director has a corresponding vino 331 00:42:14.730 --> 00:42:24.240 William Cheng: If you look at the code inside her name be doing it be, you know, the vino what's sometimes called a file, sometimes called a dirt road because it can be, you know, either one. 332 00:42:25.290 --> 00:42:27.930 Lalit Gupta: And what about this empty node is empty node or file. 333 00:42:28.710 --> 00:42:29.820 William Cheng: What's an empty node. 334 00:42:30.210 --> 00:42:33.600 Lalit Gupta: M AMP. A and make me can make note. 335 00:42:33.810 --> 00:42:35.580 William Cheng: Make though is to create a device. 336 00:42:36.870 --> 00:42:41.340 William Cheng: And the device is also a file, right. So, therefore, there's, I think there's also been on it. 337 00:42:43.800 --> 00:42:47.790 Lalit Gupta: So then when the device created it should be should have a corresponding note right 338 00:42:48.540 --> 00:42:52.800 William Cheng: Yeah. When you say you know opens slash slash TTY zero 339 00:42:53.850 --> 00:42:59.160 William Cheng: Right, you can end up with the phone. He's not a father is a vino and the vino will point to you know that that that particular device. 340 00:43:02.490 --> 00:43:05.940 William Cheng: Right. I mean, I've been appointed. I know. And the I know will point to wherever it points to 341 00:43:25.440 --> 00:43:25.860 Okay. 342 00:43:27.600 --> 00:43:38.070 Lalit Gupta: So let's say I have this routine or let's say this backslash started from there and I created. I want to create a directory. Let's take some acceptor etc directory 343 00:43:39.630 --> 00:43:40.110 Lalit Gupta: So, 344 00:43:40.170 --> 00:43:45.270 William Cheng: Okay, so, so I think in Colonel to right. You start with the route. Right. And then you need to get a slash debt right 345 00:43:45.570 --> 00:43:46.320 Lalit Gupta: Yes, Lester. 346 00:43:46.860 --> 00:43:49.230 William Cheng: Right, so you need to call make dirt to create a directory 347 00:43:58.710 --> 00:44:02.310 William Cheng: Right, there's a function. So do make her make her 348 00:44:05.610 --> 00:44:10.410 Lalit Gupta: Yes, so in so in do make Derby basically have to like call 349 00:44:11.730 --> 00:44:14.400 Lalit Gupta: The polymorphous pointed at correspond to them Fs. 350 00:44:16.440 --> 00:44:17.850 Lalit Gupta: Manifest make the right 351 00:44:18.300 --> 00:44:21.270 William Cheng: Yeah, because you know we have as doesn't know how to do this. 352 00:44:24.000 --> 00:44:25.110 Lalit Gupta: Yeah, but it seems 353 00:44:26.430 --> 00:44:27.810 Lalit Gupta: Never create renewed 354 00:44:29.220 --> 00:44:32.970 Lalit Gupta: Sorry design methods make do never create a field. 355 00:44:33.570 --> 00:44:37.140 William Cheng: Or so let's go take a look at that code for the 356 00:44:43.320 --> 00:44:44.400 William Cheng: Or no 357 00:44:45.900 --> 00:44:48.000 William Cheng: FS the FS 358 00:44:53.190 --> 00:45:11.280 William Cheng: Okay, so to do make their over here. It just, you know, do the path over here, right. So what are you supposed to do, is you're supposed to do, you know, do a path to resolution. Yes. Right. And then in the end you end up, you know, creating, you know, 359 00:45:13.440 --> 00:45:14.820 William Cheng: Creating a directory. Right. 360 00:45:16.470 --> 00:45:20.610 William Cheng: So let's look at ram FS your current O FF Fs. 361 00:45:29.460 --> 00:45:34.020 William Cheng: Whereas over here to show you that you know you need a directory. Right. So if you say, you know, 362 00:45:35.970 --> 00:45:41.610 William Cheng: So if I want to make her so I guess I'll be here to make her slash gap. 363 00:45:43.200 --> 00:45:54.990 William Cheng: Right, right. So, in that case this this directory. It needs to be the root, the root, the note right and then the name over here needs to be dev 364 00:45:55.350 --> 00:45:57.840 William Cheng: Yes. And the name lays over here man has to be equal to three. 365 00:45:58.230 --> 00:45:59.100 Lalit Gupta: Yes, exactly. 366 00:45:59.220 --> 00:46:02.040 William Cheng: So when you get here, you got to make sure that those other arguments. 367 00:46:04.170 --> 00:46:10.320 Lalit Gupta: But okay, my thing is if you will go to the manifest create it, it has, it has a 368 00:46:12.090 --> 00:46:15.300 William Cheng: Ram FS creates so that's for creating a file right 369 00:46:16.350 --> 00:46:19.920 Lalit Gupta: Yes, then we have to basically written available for that. When you create a file. 370 00:46:23.490 --> 00:46:32.700 William Cheng: Yeah, but this. Okay, so, so, by the way, to make their function doesn't return any vino right. All it does is to create, create a directory inside the actual file system and doesn't do that in memory. 371 00:46:34.770 --> 00:46:35.220 Lalit Gupta: OK. 372 00:46:35.610 --> 00:46:48.090 William Cheng: OK. So again, there's two things right. There's the there's the actual file system and there's memory. So if you want to create something in the actual file system, nothing happens in the, in the, nothing happened in memory. So your memory. Everything is temporary. 373 00:46:51.630 --> 00:46:52.050 Okay. 374 00:46:54.570 --> 00:46:57.300 William Cheng: Okay, so we hear you said create 375 00:46:58.050 --> 00:47:03.360 Lalit Gupta: Yes, yeah. So when we can tell if you will see the star star result. 376 00:47:03.750 --> 00:47:06.840 William Cheng: So right return value. Right. Yes. 377 00:47:07.410 --> 00:47:09.240 Lalit Gupta: Yeah, at some point, it is basically 378 00:47:10.350 --> 00:47:12.450 Lalit Gupta: Creating a renewed and updating this result. 379 00:47:12.870 --> 00:47:15.990 William Cheng: rather call we get right now so 380 00:47:17.880 --> 00:47:22.710 William Cheng: You had a call Baker right here and then return the result as a star recycles a VPN. 381 00:47:23.340 --> 00:47:28.530 Lalit Gupta: Yes. And that for that. Doesn't that is the thing that will keep readers for that file. 382 00:47:30.090 --> 00:47:39.780 William Cheng: What temporarily right because what happened is that when you, when we call make dirt. You know, you need to manipulate these data structure for a while and then in the end when you're done you free up all these data structure. 383 00:47:46.200 --> 00:47:50.310 William Cheng: Right there is the, what is this kernel. 384 00:47:51.750 --> 00:47:52.920 William Cheng: Fs. 385 00:47:54.180 --> 00:47:59.490 Lalit Gupta: The College's file, different from the directory like when we're creating some file. And when we continue to recruit 386 00:48:01.980 --> 00:48:03.090 William Cheng: Try to see 387 00:48:04.140 --> 00:48:06.990 William Cheng: Grip make her Colonel Fs. 388 00:48:10.410 --> 00:48:13.080 William Cheng: Okay, so this is done inside it. 389 00:48:21.540 --> 00:48:30.360 William Cheng: Yeah, so, so, so inside. So the Maker is only inside Cisco Darcy, right. So, therefore, you have to implement there, right there. 390 00:48:31.920 --> 00:48:46.500 William Cheng: So, so, so, so in that case you will need to create a you know a B. Note that you need to perform path and resolution when you find there, you need to create a crew create a directory file inside of it right by making all these other other function calls 391 00:48:50.400 --> 00:48:55.020 William Cheng: So temporarily, you're going to end up with the Beano so when you're done with that be no you need to delete it. 392 00:48:58.470 --> 00:48:59.520 Lalit Gupta: So, so we 393 00:49:00.600 --> 00:49:06.480 Lalit Gupta: Got the thing is the V. The only way we will get the keynote is when we do create at some point if we 394 00:49:09.270 --> 00:49:14.580 Lalit Gupta: First created, we know when the, when it is when I think that mfs create function is called 395 00:49:15.780 --> 00:49:32.130 William Cheng: Right, so, so, so again this to make there is in the VM FS level right so you should only use the bfs functions. Right. So if you want to create. You know, as if you want to create a directory. So let's see what kind of functions are available. Yeah, Cisco see 396 00:49:43.230 --> 00:49:50.070 William Cheng: To link to rename to change to get then LC stats and none of these function look right. 397 00:49:59.340 --> 00:50:04.380 William Cheng: Yeah, so I think you need to perform path of resolution and then eventually you need to 398 00:50:05.310 --> 00:50:15.660 William Cheng: You know, he, I think, you know, once you perform path of resolution, you're going to end up with the Beano pointer and where the vino point or you can call the function like, you know, to create a call to creates 399 00:50:16.680 --> 00:50:18.630 William Cheng: The, the actual file systems career function. 400 00:50:20.940 --> 00:50:22.440 William Cheng: Right. So what does that 401 00:50:27.720 --> 00:50:28.680 William Cheng: This 402 00:50:36.030 --> 00:50:38.190 William Cheng: Is over here, you can see that right in the 403 00:50:39.300 --> 00:50:42.210 William Cheng: So I guess there's some of these creative functions over here. 404 00:51:17.520 --> 00:51:32.190 William Cheng: Directory. So if you have a directory vino right so what it was. What I'm saying right if you have a directory vino they have this field called. You know, the vino ops. Right. So if you call the creative function over here you will reach around passes and create 405 00:51:36.450 --> 00:51:46.500 William Cheng: Okay. So, therefore, the goal is, what is that when you perform path and resolution eventually you're going to end up with a V node and he's had a vino all these functions are available for you if it's a directory. The, you know, 406 00:51:54.720 --> 00:51:55.710 William Cheng: Does that make sense. 407 00:51:56.490 --> 00:52:06.900 Lalit Gupta: What you're saying makes sense. But the thing is like to call this to call this refresh create on the directory. We have to have a V note for that directory 408 00:52:07.290 --> 00:52:17.160 William Cheng: Yeah you perform path of resolution. Right. So the patent was in the end. So, so, again, the example is that when you call me later. Right, so do make her slash death right 409 00:52:17.820 --> 00:52:22.950 William Cheng: Yes there. So then what happened is that the vino is going to be the vino on slash right 410 00:52:24.960 --> 00:52:27.810 Lalit Gupta: Yes, W. In order to be has to be for the slash. Yes. 411 00:52:27.930 --> 00:52:32.700 William Cheng: Right. And then so, so, so, now, now you have a directory vino right 412 00:52:33.900 --> 00:52:41.280 William Cheng: inside the beltway de vino there's a real function pointer. So then you call, you know, call the creative function, it will be able to create something for you. 413 00:52:42.630 --> 00:52:49.170 Lalit Gupta: Yes. So, so, okay, yes. So we have a vineyard for the slash and we can call create to create this directory. Right. 414 00:52:49.380 --> 00:52:52.170 William Cheng: Right, you just need to pass the right argument, right. So over here. 415 00:52:56.730 --> 00:52:59.430 William Cheng: Right. So in this case, that the name will be equals to 416 00:53:00.900 --> 00:53:08.100 William Cheng: You know, Deb right and the name land over here, equal to three. And then you take the return value. So the return value is going to be the newly created keynote. 417 00:53:09.720 --> 00:53:12.930 William Cheng: Right, so you'll create a slash dev vino 418 00:53:16.560 --> 00:53:23.400 William Cheng: Right, and also inside the actual file system, they will actually create a, you know, create, you know, create a create a component called death. 419 00:53:30.270 --> 00:53:35.280 William Cheng: And then you have to set the file type to, you know, whatever directory file or something like that. 420 00:53:42.330 --> 00:53:45.750 William Cheng: Oh, sorry. There's a you shouldn't call create 421 00:53:47.130 --> 00:53:48.990 William Cheng: The phone you can make different. That's why you should call 422 00:53:50.820 --> 00:54:02.220 Lalit Gupta: Yeah, but at the mic. Yes. So we have this vs vs we had, we had this renewed for the slash and we're calling on that we know the parameters MK dir and it is 423 00:54:02.370 --> 00:54:03.330 Lalit Gupta: Getting a directory 424 00:54:03.450 --> 00:54:03.990 Yes. 425 00:54:05.700 --> 00:54:13.050 Lalit Gupta: And let's say next time we want to create another directory that is slash dev slash some XYZ 426 00:54:13.680 --> 00:54:15.360 Lalit Gupta: Right, so 427 00:54:15.750 --> 00:54:22.410 William Cheng: I mean this is again. Right, so, so, so it doesn't really matter what this is right. I mean, this can be slash slash x, y, z. 428 00:54:23.580 --> 00:54:35.670 William Cheng: I mean, it's the same thing. Right, well you perform path of resolution. So in the when you call to make her then this will be, you know, slash def sizes, x, y will be the directory and then you try to create a component called Z right 429 00:54:36.660 --> 00:54:46.890 Lalit Gupta: Yes, yes. So, so yeah, so you can you want to create. Let's say z. Right. So we want to have the vino corresponding to slash laughs laughs X x Y. Right. 430 00:54:47.250 --> 00:54:49.740 William Cheng: Right by doing path and resolution eventually we'll get there. 431 00:54:50.670 --> 00:55:00.570 Lalit Gupta: Yes. So, but when we, when we started from slash enemy and we call make the make the do make Dr then it calls for mfs make Dr. But 432 00:55:01.740 --> 00:55:03.510 William Cheng: You can't do that. 433 00:55:04.290 --> 00:55:17.940 William Cheng: Okay, so when I say do make the step size x, y, z, you're required to first check if this is a valid path right even slash Deb, there's no there's no sub directory called x then make their fails. 434 00:55:20.130 --> 00:55:25.590 Lalit Gupta: Yeah yeah I'm going step by step. Let's start from step one. Step one. We have the 435 00:55:26.430 --> 00:55:30.180 William Cheng: Presence of over here. You need to do this right, you need to keep doing this. 436 00:55:31.200 --> 00:55:35.040 William Cheng: Right, you have to do make do this, you know, four times in order for all them to work. 437 00:55:36.000 --> 00:55:49.680 Lalit Gupta: Yeah, so the thing I'm not able to figure out is, like, how does this will even work because then okay let's I created the dev directory in the slash, that's fine. And then I want to create an extra directory inside the dev directory 438 00:55:50.100 --> 00:55:55.320 Lalit Gupta: Right for that I have to have to have a reward for that slash dev right 439 00:55:55.440 --> 00:55:57.330 William Cheng: You know, you have to stop on beginning again. Right. 440 00:55:58.620 --> 00:56:03.630 William Cheng: Remember the do make their over here. When you're done, you know, there's no be node. 441 00:56:04.680 --> 00:56:20.910 William Cheng: The vino is temporary. Okay Raza next time we call to make their over here. Again, I start with no be no i do path resolution, I keep getting vino temporarily and eventually when I'm done over here. I need to create a file that the directory called X inside the actual file system. 442 00:56:21.990 --> 00:56:24.270 William Cheng: Right. And then again, I'm going to destroy all the notes. 443 00:56:28.560 --> 00:56:31.500 William Cheng: Right, because these function doesn't have any be no no they only have a path. 444 00:56:35.880 --> 00:56:38.610 William Cheng: Already, is it sounds inefficient, but it's okay. 445 00:56:39.570 --> 00:56:40.710 William Cheng: It's a toy operating system. 446 00:56:42.450 --> 00:56:48.510 Lalit Gupta: And only if the last thing is the file actual file, then we can actually 447 00:56:50.010 --> 00:56:54.120 Lalit Gupta: Call create and we have an actual we note for that because that is has to 448 00:56:55.620 --> 00:56:57.150 Lalit Gupta: Remain in the men and women in the 449 00:56:58.860 --> 00:56:59.040 Lalit Gupta: In 450 00:56:59.730 --> 00:57:04.980 William Cheng: The Career function is. I think it's the same thing, right, the creative function. In the end, our returns an integer. 451 00:57:05.370 --> 00:57:09.600 William Cheng: So again, the, the also return of vino right so, so I think they're all temporary 452 00:57:10.680 --> 00:57:25.350 Lalit Gupta: Know, I think it can be temporary, because for create, we have a renewed. It is temporary. Then we if if I keep the review note for that if if create returns and I keep the reload, and I always and i and i never destroyed, then it 453 00:57:26.070 --> 00:57:27.420 William Cheng: Right, so, so this function. 454 00:57:27.420 --> 00:57:29.730 William Cheng: Returns a returns of vino right 455 00:57:30.120 --> 00:57:34.830 William Cheng: This Lino you know when you're done, you can just, you know, recommend the reference count, then the 456 00:57:35.400 --> 00:57:40.890 William Cheng: Then in that case the you know the vino will get freed up but again inside the actual file system so far has been created already 457 00:57:42.510 --> 00:57:47.520 Lalit Gupta: Yes. So this is not temporary when we do create right only make do is just temporary 458 00:57:48.420 --> 00:57:52.770 William Cheng: None of our major, major is permanent inside the actual file system. 459 00:57:52.980 --> 00:57:53.550 Lalit Gupta: Yes. 460 00:57:53.880 --> 00:57:59.730 William Cheng: So again, you need to distinguish between what happened inside the actual passes and I also will happen in you know be know which is which is doesn't memory. 461 00:58:01.290 --> 00:58:09.840 William Cheng: Right vino vino it's a it's a VM FS data structure, right, it has, it doesn't really correspond to you know what's going on the desk. 462 00:58:11.610 --> 00:58:21.780 Lalit Gupta: Okay, so. Okay, so we have a list of in the process. We have a list of file descriptor. And this file descriptor actually points to a file, right, and shall 463 00:58:21.840 --> 00:58:22.440 Object. 464 00:58:24.690 --> 00:58:27.180 Lalit Gupta: Object in in memory. And that should have a V naught write 465 00:58:27.330 --> 00:58:33.450 William Cheng: Your own. So is that every fall agenda. These four fields right reference calm and stuff like that. And the last one is the Beano pointer. 466 00:58:34.050 --> 00:58:36.360 Lalit Gupta: Yes, yes, yes. Oh, yeah. 467 00:58:36.690 --> 00:58:44.040 William Cheng: And so, and, very importantly, you only get a fall object. If you open if you make the open system called open was successful. 468 00:58:45.480 --> 00:58:47.730 Lalit Gupta: Yeah, extremely successful. 469 00:58:48.000 --> 00:58:52.860 William Cheng: So, so, so this is the only way for the vino to exist in memory. 470 00:58:54.210 --> 00:58:56.550 William Cheng: You know when you're finished with all your system calls right 471 00:58:57.360 --> 00:59:03.840 William Cheng: Yeah, because you got to have a sort of a list of pointers that will point to air so so if you go with the file descriptor. 472 00:59:04.050 --> 00:59:09.330 William Cheng: The file descriptor entry point to the Fallout. Fallout I pointed the vino and now there's a way to reach it. Right. 473 00:59:10.020 --> 00:59:12.780 Lalit Gupta: Oh yeah, no, I didn't really works and yeah 474 00:59:13.320 --> 00:59:18.900 William Cheng: He don't keep a long term point to the point an object. What then in that case the object should be freed up 475 00:59:19.590 --> 00:59:20.460 Lalit Gupta: Yes. Okay. 476 00:59:22.860 --> 00:59:23.820 Lalit Gupta: Yeah, mix here. 477 00:59:24.900 --> 00:59:25.590 William Cheng: We are asking now. 478 00:59:26.400 --> 00:59:28.350 Lalit Gupta: Yes. Yeah, I think. 479 00:59:29.490 --> 00:59:31.950 Lalit Gupta: Yeah for yet for right now. I think that's it. 480 00:59:32.370 --> 00:59:34.200 Lalit Gupta: Okay, thank you very much. 481 00:59:34.710 --> 00:59:38.700 William Cheng: Alright, so I'm going to end. You know, the lecture today since you're the only person. 482 00:59:39.150 --> 00:59:40.320 William Cheng: Yeah, okay. 483 00:59:41.130 --> 00:59:42.480 William Cheng: Bye. All right. Bye bye.