WEBVTT 1 00:00:06.060 --> 00:00:06.660 William Cheng: Testing. 2 00:01:00.600 --> 00:01:31.980 William Cheng: Good morning. Welcome to lecture 14 3 00:01:33.330 --> 00:01:37.290 William Cheng: Any question about the recorded lecture video 4 00:01:38.970 --> 00:01:45.420 Hardik Mahipal Surana: Well, good manga for so no questions actually. I'm just here to see if anyone else had an equal sign it an opportunity to go through the lecture yet. 5 00:01:46.470 --> 00:01:50.250 William Cheng: Yeah, I think I don't know people studying for that matter more people are 6 00:01:51.870 --> 00:01:56.340 William Cheng: You know, doing Colonel to or something like that. Any question about the Colonel, Simon. 7 00:01:57.600 --> 00:02:09.570 Hardik Mahipal Surana: I'm not yet. I went ahead and looked at the to make note the portable for some part. So we were able to create the devices. Now we're just trying to figure out how to communicate. 8 00:02:10.620 --> 00:02:22.230 Hardik Mahipal Surana: With the occasion like once their devices are created Keisha create will work. And then we were just trying to understand what the flow should be for actually communicating by typing on the keyboard. 9 00:02:23.610 --> 00:02:45.270 William Cheng: Right, so, so, so in Colonel to the Keisha is using the virtual file system. Right. So, you know, once you created the directly, I guess you need to create dev slash TTY zero RY slash dev slash knowledge that says what the budget device, you have to create and and then 10 00:02:46.740 --> 00:02:51.270 William Cheng: I think if you step through the Keisha code. I think Keisha I should call open right 11 00:02:52.020 --> 00:02:53.160 Hardik Mahipal Surana: Yeah, it goes to 12 00:02:53.970 --> 00:03:00.120 William Cheng: Right, so, so, so do open is pretty complicated, right, because open, it's going to do path same resolution. 13 00:03:00.600 --> 00:03:07.290 William Cheng: Right, so you need all the function name VI de see all those things has to work. So once it opens, then 14 00:03:08.910 --> 00:03:23.670 William Cheng: Then, then the Keisha can start calling you know guess they tried to print a prompt, so he has called right so you got to make sure that the do right will eventually get to the special the special right 15 00:03:24.720 --> 00:03:29.280 William Cheng: And then it will call do read to try to read a line from the keyboard. Right. 16 00:03:31.530 --> 00:03:32.280 Hardik Mahipal Surana: Okay, okay. 17 00:03:32.940 --> 00:03:39.570 William Cheng: So as a writer needs to work so you will see a prompt and then whatever you type really needs to work so that you will get a line from the, from the user. 18 00:03:40.170 --> 00:03:49.380 William Cheng: And then then then then the rest is will be similar to Colonel why right will parse the command line and try to sort of figure out what you want the THE CASE OUT TO DO, etc. 19 00:03:51.480 --> 00:04:03.540 Hardik Mahipal Surana: Yeah, actually I had a question regards to partner resolution why those implementing the local function. So I went to the floor. And I found that a ram offense is actually calling we get 20 00:04:04.140 --> 00:04:12.870 Hardik Mahipal Surana: Which caused the ref so when we're looking at for apart. Why do we need to implement the reference count of each component to that we are looking at for 21 00:04:14.280 --> 00:04:17.220 William Cheng: A big goes through the entire part 22 00:04:17.550 --> 00:04:20.280 Hardik Mahipal Surana: And for each component we call look upgrade. 23 00:04:20.760 --> 00:04:29.070 William Cheng: Right, so, so, so the, you know, the point is that if you want to do a correctly so that when you switch the colonel three everything will work. 24 00:04:29.490 --> 00:04:35.910 William Cheng: Then you should increment the reference count, you know, you can look at the REM FS Co. Everything is implementing RAM. There's no disconnect 25 00:04:36.750 --> 00:04:40.620 William Cheng: So, therefore, you don't have to worry about anything. But if you imagine that if you have a real disk. 26 00:04:40.950 --> 00:04:47.580 William Cheng: Then when you are performing that look up, you need to read one directory entry at a time. So you might have to go to the this multiple times. 27 00:04:47.910 --> 00:05:02.880 William Cheng: So in that case of Colonel throw fall asleep, and if you don't increment the reference cow. Maybe one time you're unlucky, you know, the you know the the the the the reference count go to zero for you because of some other thread or something like that, then you got to be in trouble. 28 00:05:05.520 --> 00:05:06.360 Hardik Mahipal Surana: Okay, so 29 00:05:06.840 --> 00:05:07.590 Hardik Mahipal Surana: We have done within 30 00:05:08.040 --> 00:05:13.140 William Cheng: Again, so you know where that's a very important point, right, because in the virtual process them if you 31 00:05:13.620 --> 00:05:23.190 William Cheng: If you have a pointer to one of these objects implement the reference to say I'm still using it. I'm not done with it. So, therefore, you better not delete it. Right. So that's why I increment the reference count. 32 00:05:24.930 --> 00:05:37.320 William Cheng: Okay, and later on when the function returns. I mean, it's a local variable, the stack will get POP So so so so you know the the reference is automatically removed, but if you don't document the reference call you're going to end up with over referencing 33 00:05:38.130 --> 00:05:40.650 Hardik Mahipal Surana: Exactly. So once you're done with the Luca 34 00:05:42.450 --> 00:05:52.110 Hardik Mahipal Surana: And the free from once we're done with the lookup, we should be. And again calling the put to discriminate the reference country because you're done with the look up and we no longer are using that we know 35 00:05:52.920 --> 00:06:00.210 William Cheng: Right, so, so if within the function, right. So, so let's say over here, right. Let's look at this right so you have a function right here. 36 00:06:00.720 --> 00:06:08.760 William Cheng: Okay, I'll be here. You say, you know, like, say, the node or something is there to object has reference can read the file has a reference call and the vino has a reference com 37 00:06:09.360 --> 00:06:15.810 William Cheng: So let's say you have a you know vino pointer over here, you point to something. Right. So as soon as you point to something you should increment the reference count. 38 00:06:16.320 --> 00:06:25.650 William Cheng: Increment reference count. Okay, so when the function is about to return. And this is a local variable, right. So the node star or something like that. Right. 39 00:06:25.980 --> 00:06:28.950 William Cheng: When this function return this pointer is going to disappear. 40 00:06:29.490 --> 00:06:33.210 William Cheng: Right. So, therefore, you have to document the reference com so that they sort of match out 41 00:06:35.010 --> 00:06:35.610 Hardik Mahipal Surana: Okay, okay. 42 00:06:35.910 --> 00:06:43.530 William Cheng: So this way. When you return, then the reference count will be correct. You got to be very, very careful because some of the functions over here will automatically increment the reference now. 43 00:06:44.520 --> 00:06:46.200 Hardik Mahipal Surana: Look up to automate caters increment. 44 00:06:46.230 --> 00:06:54.600 William Cheng: Right, so, so if it automatically included a reference count then then if you detriment. I mean, so, so again if you if you implemented again there will be an extra reference 45 00:06:54.720 --> 00:06:58.290 William Cheng: So therefore, we recommend you with the will remove the actual reference 46 00:06:58.830 --> 00:07:06.600 William Cheng: Right. But if you don't incremental. Are you document it because you say, oh, inside this function they automatically include the the wrestling calm and as soon as you've documented it will 47 00:07:07.020 --> 00:07:08.850 William Cheng: Not go to zero, and then it will get freed up 48 00:07:09.810 --> 00:07:16.110 William Cheng: So again, the matching over here. You need to do it very carefully explicitly increment and why you should definitely explicitly detriment it 49 00:07:16.440 --> 00:07:26.430 William Cheng: But if you if it's incremental implicitly, then you need to decide whether it's a good idea to document or not. Okay. I think most cases if it's, you know, if a function 50 00:07:27.390 --> 00:07:32.850 William Cheng: Sort of increase the reference how you should read the comment very, very carefully and 51 00:07:33.240 --> 00:07:43.770 William Cheng: Or look at the rim of our system CO and to see if its reasonable. I mean, you know, if you only create a reference temporarily or you know what this function return that reference should continue to go up. 52 00:07:44.790 --> 00:07:47.460 William Cheng: Right. So if the reference continue to go on what, then you shouldn't document it. 53 00:07:49.530 --> 00:07:50.760 Hardik Mahipal Surana: I see. Okay. 54 00:07:51.450 --> 00:07:59.820 William Cheng: Okay, so do I. I don't know if there's a fixed rule, you know, I mean, if it's a local variable. And you do this temporarily. Well, then, that in this case you should document it. 55 00:08:00.090 --> 00:08:05.490 William Cheng: But all the other cases, you need to think about it very, very carefully look at a comment and the decide what to do. 56 00:08:06.510 --> 00:08:12.990 Hardik Mahipal Surana: Okay, so if we take the example of the Navy, which takes apart as a string and does 57 00:08:13.290 --> 00:08:21.420 Hardik Mahipal Surana: A tentative look up on each component of the path. So until we reach the very end of the path. And we are done with looking up the last part, we should still store the 58 00:08:21.900 --> 00:08:29.910 Hardik Mahipal Surana: reference count as is right and as an where once we're done with their we need to be treated again and then sort of detriment the reference point for each component 59 00:08:31.650 --> 00:08:45.630 William Cheng: Um, I mean I you know I don't, I, I didn't write the code. So I don't know exactly whether I should do that or not. So I think, you know, again, I mean, I shouldn't really tell you a code right in this case. 60 00:08:45.990 --> 00:08:56.310 William Cheng: Yeah, so it's more appropriate to talk about that in the class Google group, right, you said that was inside the envy, you know, what do you guys think the, you know, there's a, there's a, I guess there's iteration going on. 61 00:08:57.360 --> 00:09:02.550 William Cheng: So again, you should sort of analyze the situation and find out whether you should you know where you should increment where you should detriment. I 62 00:09:03.180 --> 00:09:08.220 William Cheng: Go edit the point over here is that is that, you know, in Colonel to you're dealing with the RAM file system. 63 00:09:08.430 --> 00:09:14.250 William Cheng: So the ranch houses and never go to sleep. So, therefore, you know, you don't have to worry about it. But when you go to Colonel Thierry 64 00:09:15.240 --> 00:09:27.000 William Cheng: You know what, whatever function that that that you call it, there's a possibility that you'll Colonel, so we'll go to sleep. Well, in that case, if you have a pointer to an object that has a reference count, you should increment it as soon as function returns your document. 65 00:09:29.250 --> 00:09:30.600 William Cheng: So that would be a general rule. 66 00:09:31.800 --> 00:09:32.220 Hardik Mahipal Surana: Good. 67 00:09:33.060 --> 00:09:39.420 William Cheng: Whatever function that you call if you're Colonel second fall asleep and you have a pointer to an object that has a reference count. 68 00:09:39.660 --> 00:09:40.740 Hardik Mahipal Surana: Any question you have in 69 00:09:41.100 --> 00:09:43.200 William Cheng: Common and Decker minute right just to be safe. 70 00:09:43.590 --> 00:09:44.250 Hardik Mahipal Surana: Okay, okay. 71 00:09:45.840 --> 00:09:55.980 William Cheng: Now, what happened is that people use local variable to point to, you know, many different things instead of function, right. So, so, yes. So the question is that when you point to one thing you equipment, the reference car. 72 00:09:56.160 --> 00:10:05.850 William Cheng: And then we'll use the point of the point to some other thing that you have a document that references the reference is that a function will go up and down like crazy. Is that correct, well, if you do a very, very carefully. Then we'll be correct. 73 00:10:07.020 --> 00:10:10.890 William Cheng: So you want to make sure that you don't end up with extra references or you don't have, you know, 74 00:10:12.270 --> 00:10:13.020 William Cheng: Under referencing 75 00:10:15.480 --> 00:10:32.400 Hardik Mahipal Surana: God or more general question, not with respect to remix, but in general about Linux. So in a multi processing environment. If we were to manage reference counting to make that also thread safe or should we be using on the text, whenever we are you come into detrimental reference don't 76 00:10:34.020 --> 00:10:42.660 William Cheng: Well, so right now we're talking about reference caught in the kernel. Right. Well, you're talking about multi threading. Are you talking about that's already in the user space program. 77 00:10:43.110 --> 00:10:44.220 Hardik Mahipal Surana: Yeah, and the user space. 78 00:10:45.030 --> 00:10:50.460 William Cheng: Yeah, I mean, all these things happening is that a colonel, the user space program is not going to see it. So, you know, 79 00:10:52.350 --> 00:10:56.910 William Cheng: I mean, they use a space for like one month one and two a month you you don't even use reference counting 80 00:10:58.680 --> 00:11:06.810 Hardik Mahipal Surana: Yeah, we don't. But yeah, makes sense. So what would happen in the kernel. Then in a multi processing. Remember 81 00:11:07.440 --> 00:11:11.760 William Cheng: What's a minute understanding is that Linux is one step process. 82 00:11:12.840 --> 00:11:14.430 Hardik Mahipal Surana: Oh yeah, it's a one by one more. 83 00:11:15.210 --> 00:11:19.680 William Cheng: Right. But, but is that a colonel all the Colonel, everything works together, things are the colonel right 84 00:11:20.010 --> 00:11:23.010 William Cheng: Yeah so. So even if you think about the sort of the kernel. 85 00:11:23.250 --> 00:11:35.130 William Cheng: For the corresponding user through that once a user. So I come inside a colonel it become a colonel threat and all the Colonel's where they need to work with each other. So they all follow the rules, right. So, so, yeah. So therefore, they're all being planted correctly. 86 00:11:36.840 --> 00:11:39.780 William Cheng: I'm the application poem, it doesn't get to put a thread inside the carnal. 87 00:11:40.470 --> 00:11:45.930 Hardik Mahipal Surana: Yeah, it is. It really actually become the colonel Thierry runs it executes the trap and the controls. 88 00:11:45.930 --> 00:11:53.220 William Cheng: Right, so you don't have to worry about the user. The user. The user. So I will not do the right thing because as soon as it become comes out the Colonel. 89 00:11:53.520 --> 00:12:01.620 William Cheng: Then, then it you know it, then all the code is done. They're done by the colonel programmer, so therefore inside Colonel, everything will be done correctly. 90 00:12:03.240 --> 00:12:03.870 Hardik Mahipal Surana: Okay, yeah. 91 00:12:04.350 --> 00:12:06.510 William Cheng: I mean for Linux for football meanings, where 92 00:12:06.510 --> 00:12:09.960 William Cheng: We are the one that writing the code for the Colonel. So we need to make sure that they're done correctly. 93 00:12:17.250 --> 00:12:18.210 Hardik Mahipal Surana: Okay, thank you so much. 94 00:12:18.420 --> 00:12:18.720 Okay. 95 00:12:32.070 --> 00:12:40.710 William Cheng: Anyone else has a question about the lecture 14 or lectures in general or, you know, we seven discussion section. 96 00:12:41.340 --> 00:12:54.120 William Cheng: So I think what I'm trying to do what I'm going to do is that, you know, today I will record the week eight discussion section. So, so, just in case people want to work on Colonel to they can you know that they can look at all the materials. 97 00:12:58.860 --> 00:13:05.010 Lalit Gupta: I have a question regarding elect to functions and proud dot c in the Phoenix source code. 98 00:13:05.400 --> 00:13:05.790 William Cheng: Okay, so 99 00:13:06.480 --> 00:13:09.930 Lalit Gupta: We have to function which is talking for an analyst info. 100 00:13:11.520 --> 00:13:12.120 I'm wanting 101 00:13:15.780 --> 00:13:19.020 Lalit Gupta: Actually provided to us proc info and populist info. 102 00:13:19.470 --> 00:13:20.070 Right. 103 00:13:21.630 --> 00:13:25.140 William Cheng: Well, maybe. Maybe I should switch to take a look there. 104 00:13:37.200 --> 00:13:41.160 William Cheng: Practice see right here. So one is called proc 105 00:13:42.270 --> 00:13:43.740 William Cheng: List of Prague info. 106 00:13:46.920 --> 00:13:47.640 William Cheng: Okay. 107 00:13:50.970 --> 00:13:51.630 Lalit Gupta: What is this 108 00:13:53.250 --> 00:13:53.880 William Cheng: What is what 109 00:13:55.050 --> 00:13:56.730 Lalit Gupta: Is the 110 00:13:58.590 --> 00:13:59.010 Lalit Gupta: Path. 111 00:13:59.700 --> 00:14:04.170 William Cheng: Yeah, so I think this kind of code is used by Python. 112 00:14:05.460 --> 00:14:05.910 Lalit Gupta: Okay. 113 00:14:06.690 --> 00:14:12.630 Lalit Gupta: Yeah, so some of the colonel commands like, you know, Colonel info Colonel Prague, or something like that. 114 00:14:12.840 --> 00:14:22.320 William Cheng: Those are the GDP commands the GD commands are implemented in Python, and the Python is going to call all these you know info function. So there's also the proc list info. 115 00:14:24.870 --> 00:14:33.540 William Cheng: Okay, so, yeah. So I think when you type the command Colonel proc in GDP this code will get executed. 116 00:14:35.430 --> 00:14:37.560 Lalit Gupta: Okay, so if you type Colonel proc 117 00:14:37.860 --> 00:14:53.400 William Cheng: Right. I think this one or the other one is going to get executed. I don't know exactly which one it is. I tried to, you know, try to debug this ones that I couldn't figure out exactly how this work that hard to go from the Python code to call the C code and get all this to work. 118 00:14:54.540 --> 00:15:00.360 Lalit Gupta: Okay, so. But the thing is, in general in GDP, you can actually cause a function like temporarily to see what 119 00:15:01.950 --> 00:15:11.040 Lalit Gupta: Is it possible to call. I was trying to collect call this function of broccoli broccoli listed for directly from God, but I was not able to know 120 00:15:11.640 --> 00:15:24.780 William Cheng: It's not directly. So in we're in GDP, because they Colonel help anyway show you all the colonel GDP commands and then you will guess. One of them is Colonel Prague and then the otherwise Colonel 121 00:15:25.560 --> 00:15:38.340 William Cheng: I can't, I can't remember the you know the example I guess there's a list of command that that you can that you can use. And then what it will do is it will show you all this information if you if you give the right command. 122 00:15:40.320 --> 00:15:45.150 William Cheng: Okay, so let's see if we there's a Python directory CD to Python. 123 00:15:46.650 --> 00:15:52.170 William Cheng: Python. We next over here and then we can say see proctor Python right 124 00:15:53.280 --> 00:16:00.030 William Cheng: Okay. So over here, it will show you what are the possible commands. I guess it doesn't really show you what the commands are 125 00:16:05.040 --> 00:16:05.880 William Cheng: Yeah. Anyways, 126 00:16:07.140 --> 00:16:09.300 William Cheng: I'm not that good at Python. So 127 00:16:10.290 --> 00:16:18.540 William Cheng: Guys over here, you can see that there's a proc lists of something. Right. It says, you know, go to the winnings and listen to load the proc list function or whatever. 128 00:16:18.780 --> 00:16:28.530 William Cheng: And then it has these data structure that it will use and you will follow the pointer and then they will call proc right. Where's progress progress right I guess proc as a constructor for this class. 129 00:16:29.910 --> 00:16:34.740 William Cheng: Anyways, so if you are, you know, the Python programmer, maybe we can figure it out. 130 00:16:36.150 --> 00:16:41.370 Lalit Gupta: So the talking for is not a secret because I was in because some other secret. 131 00:16:43.110 --> 00:16:51.360 Lalit Gupta: In GDP, we can actually call the function and it can give us a certain value is it, is it not possible to do it in profile profitable. 132 00:16:52.350 --> 00:17:01.320 William Cheng: I have no idea. Okay. Okay. So, so the only thing I grab proc info, Colonel. Oops. 133 00:17:07.170 --> 00:17:11.010 William Cheng: Grab properly info Colonel star star see 134 00:17:12.180 --> 00:17:13.530 William Cheng: Guess it's not being used anywhere. 135 00:17:15.270 --> 00:17:16.470 William Cheng: Including 136 00:17:24.630 --> 00:17:28.260 William Cheng: provide detailed debugging information about a given process. 137 00:17:30.930 --> 00:17:37.920 William Cheng: Yes, I know. So in GDP. You say, Colonel help. And then there was sort of show you a bunch of options that you can try all these commands over here. 138 00:17:39.120 --> 00:17:40.800 William Cheng: So it's it's it's 139 00:17:41.910 --> 00:17:46.590 William Cheng: Called a word debug right so in this header file. There are these two things that are here says debug. 140 00:17:47.730 --> 00:17:56.040 William Cheng: I think they means debugging under GDP not you know debug under seat. So, of course, you know, you can also call these functions yourself. 141 00:17:57.210 --> 00:18:04.680 William Cheng: If you know you know what the passes the first argument over here at the first argument we hear his voice star. So, if you look at a co 142 00:18:05.460 --> 00:18:09.780 Lalit Gupta: Yeah services blogger underscore te the type of this pointer to that. 143 00:18:11.370 --> 00:18:12.000 William Cheng: Okay. 144 00:18:13.560 --> 00:18:24.750 William Cheng: Yeah. So over here, he was, he can see that they typecast this one to the prop data structure. So, so if you, you can actually call this function yourself if you want to print this out right well you're running your approval and when you run your code. 145 00:18:25.830 --> 00:18:31.140 William Cheng: So this one. What is argh over here. So proc lists info. Whoops. 146 00:18:37.470 --> 00:18:42.060 William Cheng: Oh, this one on the apprentice. If I should ignore the first argument. It just, you know, 147 00:18:43.800 --> 00:18:50.340 William Cheng: It the okay sir. Make sure the first argument is no so the progress the info less information about all the processes. 148 00:18:51.510 --> 00:18:57.630 William Cheng: Say I saw you and GDP. If you type a type Colonel proc so this function will get calls 149 00:18:59.010 --> 00:19:08.010 William Cheng: Coordinate. Okay. Yes. What is that, oh, OK. So I think I know what I was doing over here right i printer print the information into this buffer. 150 00:19:08.850 --> 00:19:17.730 William Cheng: So it doesn't get printed to standard out it will print into this to this buffer and this buffer is passed back to Python. So Python can actually print it onto the screen. 151 00:19:19.800 --> 00:19:22.740 Lalit Gupta: Are even allocating the buffer, because we're is this before. 152 00:19:23.910 --> 00:19:24.330 Lalit Gupta: Because 153 00:19:25.410 --> 00:19:28.740 Lalit Gupta: Python is a Python is basically allocating memory for the 154 00:19:29.160 --> 00:19:33.330 William Cheng: Enterprise. So I think if you want to call this function yourself, you need to allocate a buffer. 155 00:19:34.470 --> 00:19:35.010 Lalit Gupta: Okay. 156 00:19:35.490 --> 00:19:47.430 William Cheng: Okay, so, so, so you will do something like this, right. So what I would do is that, you know, so let's say I have a function here, right, like this, right, if I have a function over here. I say, Joe char, you know, 4096 or something like that. Right. 157 00:19:47.910 --> 00:19:58.830 William Cheng: Or you know above 4096 and then I will call proc lists info and then all right buff size of buff. 158 00:19:59.910 --> 00:20:10.350 William Cheng: And then over here. And when this function return this one should return a size t. Right. So you can say, you know, size to length equal to this. Right. 159 00:20:10.650 --> 00:20:18.090 William Cheng: And then you can call you know right you know the basically you can take the the buffer and just write it out to write, write it out to standard out 160 00:20:19.260 --> 00:20:23.490 William Cheng: Okay, so you can actually, I can do GDP does. Sorry. 161 00:20:26.250 --> 00:20:41.310 William Cheng: The big, the big 10% s and then maybe I had access and over here buff. Okay, so, so if I write it like this, then it only works if Bob is terminated by zero. 162 00:20:41.970 --> 00:20:49.440 William Cheng: Okay, then what it will do is it will you know if God debugging has tend to include include a then this way, it will print out this buffer. 163 00:20:50.970 --> 00:20:51.270 Oh, 164 00:20:52.920 --> 00:20:56.880 William Cheng: Okay, or you can say, you know, do right I do right 165 00:20:59.430 --> 00:21:08.910 William Cheng: I guess do right over here, require file descriptor so standard in is one and then you can say buff buff and length or something like that. 166 00:21:10.410 --> 00:21:15.150 William Cheng: Yeah, I'm just making this up. I assume that this is going to work out but you should try to see if this actually work. 167 00:21:15.690 --> 00:21:23.220 William Cheng: The stuff with the Python stuff is that if you make one little mistake Python is just going to crash. And then, you know, then, then you have to get out of that debugger and start all over again. 168 00:21:26.370 --> 00:21:29.070 William Cheng: So the yeah the Python stuff is pretty sensitive 169 00:21:34.590 --> 00:21:35.310 Lalit Gupta: So I have 170 00:21:37.080 --> 00:21:41.370 Lalit Gupta: Maybe a slight question on lecture 11 slide 33 171 00:21:42.030 --> 00:21:42.810 Okay. 172 00:21:52.320 --> 00:22:04.710 William Cheng: Let me go there lecture 1153 8383 173 00:22:12.090 --> 00:22:12.510 William Cheng: Okay. 174 00:22:14.130 --> 00:22:15.660 Lalit Gupta: So in this thing, this 175 00:22:17.100 --> 00:22:22.410 Lalit Gupta: What is on the right side of the file descriptor is is the part of the FS right 176 00:22:23.250 --> 00:22:25.650 William Cheng: Yeah, so, so this is a Fs. Yeah. 177 00:22:26.760 --> 00:22:28.170 Lalit Gupta: And what is this middle thing. 178 00:22:30.000 --> 00:22:30.180 William Cheng: The 179 00:22:30.540 --> 00:22:35.100 William Cheng: Table now that this whole thing is in the in the bfs. 180 00:22:36.630 --> 00:22:37.740 Lalit Gupta: Okay, so okay so 181 00:22:38.190 --> 00:22:42.150 William Cheng: Yeah, so the picture that I drove me here. It's an array of fall objects. 182 00:22:44.820 --> 00:22:53.430 William Cheng: Okay, so every one of those everyone roll over here is a file object right every file object has these four fields reference count access cursor position and the I know pointer. 183 00:22:56.730 --> 00:23:02.340 Lalit Gupta: Okay, this is dis dis data structure which is in the middle part of the HDFS 184 00:23:03.240 --> 00:23:13.380 William Cheng: Right. So this was, it's a system. Why, and I it's a system file table or the file object table. So it's a, you know, it says there's a data structure that holds all the file objects. 185 00:23:17.070 --> 00:23:19.050 Lalit Gupta: Or additional one table big table. 186 00:23:19.620 --> 00:23:30.060 William Cheng: Yeah so. So on the left hand side. This is the PR process file descriptor table. So every process is about discovery table in the middle data structure is shared by all processes. 187 00:23:33.030 --> 00:23:33.330 Lalit Gupta: If 188 00:23:35.040 --> 00:23:39.600 Lalit Gupta: You can you point like in Phoenix, what is a system wide table intervening 189 00:23:40.140 --> 00:23:41.160 William Cheng: Oh, there's no such thing. 190 00:23:41.940 --> 00:23:42.660 Lalit Gupta: There's no such thing. 191 00:23:42.780 --> 00:23:50.280 William Cheng: Well, it's just an abstraction that there's a there's a file object table, there's some kind of a data structure for you to find a file object. 192 00:23:50.940 --> 00:23:59.460 William Cheng: Okay, because when you will when you create a file object, you need to keep track of them. So there's going to be some sort of a data structure that keeps a collection of objects. 193 00:24:01.440 --> 00:24:13.500 William Cheng: Okay so i i don't know what kind of data structures. Maybe it's a link list. Maybe it's an array I doesn't really matter what kind of data structures. Right. So it's just a, you know, so it's just a way for you to keep track of a bunch of objects. 194 00:24:17.460 --> 00:24:29.520 Lalit Gupta: And do it. Does the middle thing. Do we have to. Is this the responsibility for our for our or is this is the middle table no responsibility for the as 195 00:24:31.170 --> 00:24:39.930 William Cheng: Well, I mean, you know, I mean, the whole thing is inside of Colonel right so you could call the right hand side. A FS right then the left hand side over here is going to be BFS. Right. 196 00:24:42.030 --> 00:24:44.640 William Cheng: I mean fall object is implemented inside BFS. 197 00:24:48.270 --> 00:24:51.900 William Cheng: Where every one of these things that fall object or fall object is a VM FS object. 198 00:24:53.580 --> 00:24:54.120 Cookie. 199 00:24:58.080 --> 00:25:01.830 William Cheng: Right. So in chapter one. We talked about the file object. Right. So the follow up jag is 200 00:25:02.820 --> 00:25:14.040 William Cheng: You know, which is independent of the, the actual file system. So what's inside apologetic. He has a reference count it has how you open the file. There's a cursor position. All these things are BFS concepts. 201 00:25:17.130 --> 00:25:21.300 Lalit Gupta: Okay, and where to go. Different would be a video or an iOS. 202 00:25:22.380 --> 00:25:28.380 William Cheng: So vino is a weenie x, y. So, so, so, so I know it's what's inside the actual file system. Right. 203 00:25:29.940 --> 00:25:37.920 William Cheng: Okay, so our way you create an object in the virtual file system to refer to the I note when x. That's called a be note. 204 00:25:40.920 --> 00:25:44.490 William Cheng: So, so in a way it's the VM FS representation of IOT 205 00:25:50.760 --> 00:25:51.660 William Cheng: So make sense. 206 00:25:53.460 --> 00:25:54.030 Lalit Gupta: Trying to 207 00:25:54.540 --> 00:25:57.510 William Cheng: Wipe it is. Yeah. But now, Jerry, you have an object inside 208 00:25:58.530 --> 00:26:08.070 William Cheng: Is that actual process. And this one is called. I know, right, then this I know his implementation dependent right it's a it's a FST pendant 209 00:26:09.510 --> 00:26:18.030 William Cheng: Okay, so how do we actually have a, you know, sort of keep track of this particular. I know we need an abstraction inside the virtual file system to keep track of this. I know I 210 00:26:19.950 --> 00:26:29.760 William Cheng: Mean in the example that I also give us in the Windows file system. There's no such thing as I know, right. So, so therefore I haha what do you point to inside the virtual classes ME THERE'S NO SUCH THING AS I KNOW. 211 00:26:31.980 --> 00:26:36.390 William Cheng: So you need to have another abstraction at the bfs level. So in weenies. This is called a vino 212 00:26:43.980 --> 00:26:45.090 Lalit Gupta: Oh key. 213 00:26:45.180 --> 00:26:50.640 William Cheng: Why because, because otherwise, all you have is a voice star pointer and you pointed this one. What can you do with a voice. There's nothing you can do. 214 00:26:54.870 --> 00:27:00.360 Lalit Gupta: Okay, so okay so this the node and okay so this vineyard in the VMware side and there is a note in the 215 00:27:01.590 --> 00:27:02.340 Lalit Gupta: FM side. 216 00:27:02.700 --> 00:27:04.050 William Cheng: Yep. Yeah. 217 00:27:04.080 --> 00:27:14.790 Lalit Gupta: Even though, even though they are on the different side they did. What is the boy, what is inside them has to be similar, because we have to like a bind them. 218 00:27:15.270 --> 00:27:15.540 William Cheng: So, 219 00:27:15.990 --> 00:27:22.590 William Cheng: Yeah, so you have to look at the source code, right. So let's take a look at an example over here. So let's go back to 220 00:27:27.840 --> 00:27:29.580 William Cheng: Okay, so, so let's look at the 221 00:27:30.960 --> 00:27:35.970 William Cheng: Colonel include FS vino hai. So let's see what a B. Notice 222 00:27:38.670 --> 00:27:43.440 William Cheng: Okay, so here's the Beano right you know struck me know right here, I can. You can see that right 223 00:27:44.160 --> 00:27:45.060 Lalit Gupta: Yes, yes, yes. 224 00:27:45.330 --> 00:28:02.610 William Cheng: Okay, so as a lot of stuff to keep track off right over here. Remember the I know number. Okay. So right here I n ot it's a Wii and Wii. No. So this is the vino numbers. I mean, we need you know number I know number. I think they're the same thing. 225 00:28:03.870 --> 00:28:17.220 William Cheng: There is the length of the file. It's called the node length and we and I over here. So here is a voicemail pointer, right, the voice point over here in the weakness implementation. They use his voice, not pointed pointed. I know. 226 00:28:19.770 --> 00:28:20.100 William Cheng: Okay. 227 00:28:21.810 --> 00:28:24.390 William Cheng: So let's take a look at the I know, Colonel. 228 00:28:26.190 --> 00:28:29.550 William Cheng: FS ram FS ram FS see 229 00:28:41.070 --> 00:28:44.790 William Cheng: Okay, so here is the I know data structure. 230 00:28:46.770 --> 00:28:52.800 Lalit Gupta: Yeah, so, so this seems very similar to what is in the diagram of the slide. Well, 231 00:28:53.190 --> 00:29:01.380 William Cheng: So. So the basic idea is here is that the the vino is pretty generic right because he needs to support any kind of I know so i. So, therefore, it's a much bigger data structure. 232 00:29:01.980 --> 00:29:07.320 William Cheng: So over here, this is the I know data structure. So in the referral system that I know data structure is very, very simple. Right. 233 00:29:09.420 --> 00:29:21.270 William Cheng: So this one is like a lecture slide where it has the file size, it doesn't really have ownership. It has, you know, device number and all that kind of stuff, and has a self reference. What I know number it belongs to 234 00:29:28.710 --> 00:29:34.470 William Cheng: Yeah. So anyway, so this this. I know it's very, very simple. So if we look at the system file, file system. 235 00:29:40.170 --> 00:29:44.730 William Cheng: Is the I know here and maybe it's in the include file. 236 00:29:54.300 --> 00:29:57.630 William Cheng: Okay, so here's the system, our system I node. 237 00:30:02.550 --> 00:30:05.700 William Cheng: Okay, anyways, so I guess. Yeah, let's not go through it. 238 00:30:09.090 --> 00:30:11.250 William Cheng: Let's take a look at the RAM file system again. 239 00:30:17.670 --> 00:30:22.770 William Cheng: I'm trying to find a way to get back to the V node. 240 00:30:24.090 --> 00:30:31.020 William Cheng: Okay, so all the referral system over here, you can look at all the functions over here coming with a be node. Okay, so you can actually see that 241 00:30:31.560 --> 00:30:40.080 William Cheng: What they will do is that you know there will use the V nodes V and I don't even remember that when we look at the vino at that age to be an AI is the voicemail pointer. 242 00:30:40.470 --> 00:30:51.810 William Cheng: They will take the voice or partner over here typecast to typecast into the RAM PA system. I know the I know data structure. So, therefore, you can convert a vino to I know right by following the pointer. 243 00:30:55.590 --> 00:31:02.160 Lalit Gupta: Okay, so we can convert so we know it is a big data structure in in that there is a field name V V and underscore I 244 00:31:02.640 --> 00:31:04.410 William Cheng: And that's the most affluent area. 245 00:31:05.370 --> 00:31:07.740 Lalit Gupta: And that we can type costs to the RAM, I note. 246 00:31:08.190 --> 00:31:15.240 William Cheng: And only the RAM file system can do that, right, because as a virtual file system. They have no idea what kind of point to it is because it's only a voice. 247 00:31:15.840 --> 00:31:22.560 William Cheng: BUT WHEN YOU GET INSIDE around faster than the referral systems as well. Of course I know, I know what it is, because I'm the one that set up this pointer. 248 00:31:25.770 --> 00:31:28.920 Lalit Gupta: Okay, but if it does not know what is we notice you notice 249 00:31:30.540 --> 00:31:34.710 William Cheng: Of course, all the FS they know exactly how to support the bfs. 250 00:31:35.970 --> 00:31:43.140 William Cheng: Okay, so, so, so when you write the actual file system for individual actual file system. You all have to know exactly what BFS look like 251 00:31:44.790 --> 00:31:47.730 Lalit Gupta: Also, if it is aware of the data structure of renewed 252 00:31:48.030 --> 00:31:48.810 William Cheng: Yes, yeah. 253 00:31:51.960 --> 00:31:54.120 William Cheng: Okay, so you can see all this implementation over here, right. 254 00:31:54.630 --> 00:32:07.050 William Cheng: Okay. Now over here, you know, this is the code for the RAM file system implementation of one of the via the the function. So, it will take the vino data structure. Of course, you know, you have to know exactly what's inside of you know data structure and then you can work on it. Right. 255 00:32:08.220 --> 00:32:15.660 William Cheng: Okay, right. So, this particular function. What it does is that it will actually initialize the vino based on what's inside the I know 256 00:32:16.950 --> 00:32:25.140 William Cheng: I mean, the name of this function is really weird. It's called ram FS read Dino. So I want you to call it initialized vino but somehow they call it the renal function. 257 00:32:25.620 --> 00:32:38.040 William Cheng: So in this function there was set up all the pointers inside of vino and we just saw that the vino data structure is a really big data structure. Okay, so some of the some of the information over some of the information is that'd be no they are initialized inside this function. 258 00:32:39.120 --> 00:32:48.030 William Cheng: So for example, you can see that, you know, vn i is equal to I know, right. So what does. I know, I know it over here is going to be one of the iOS inside the red ball system. 259 00:32:50.220 --> 00:32:50.610 Cool. 260 00:32:53.520 --> 00:32:59.130 William Cheng: Right. So inside is inside this function you you basically connect BFS to the FS 261 00:33:03.660 --> 00:33:06.720 Lalit Gupta: Okay, so this is some function that we have to somehow 262 00:33:10.290 --> 00:33:15.540 Lalit Gupta: That will actually that we have to buy it to like some function in the air in the 263 00:33:16.980 --> 00:33:17.940 Lalit Gupta: Study BFS. 264 00:33:18.210 --> 00:33:18.600 William Cheng: Yes. 265 00:33:18.630 --> 00:33:24.870 Lalit Gupta: In via telephone functions that we have to bind, which is which. I think one of this function, maybe them. 266 00:33:26.100 --> 00:33:28.920 Lalit Gupta: Or maybe I think maybe some career probably 267 00:33:29.550 --> 00:33:35.040 William Cheng: Well, it's some kind of a initialization function, right, because all the pointer needs to be set up when you initialize the data structure. 268 00:33:35.970 --> 00:33:40.860 William Cheng: If your data center 10 pointers law, then we initialize data we initialize that data structure. 269 00:33:41.040 --> 00:33:43.650 William Cheng: You got to set up all the temperatures, right, if you're going to use them. 270 00:33:44.730 --> 00:33:48.840 Lalit Gupta: Also, this is an answer reviewed be noted in is the initialization function. 271 00:33:50.100 --> 00:33:59.010 William Cheng: So, so, this function is used to initialize every vino so so ram FS read V node. So whereas that function defined 272 00:34:00.030 --> 00:34:12.360 William Cheng: Grab read V node Colonel includes start at H. It's in BFS Colonel include FS BFS that he 273 00:34:15.480 --> 00:34:26.130 William Cheng: OK. So again, this is a rail function pointer I the poly multifunction pointer. It's called the file systems operations. So every file system has, you know, this list of operations. 274 00:34:26.880 --> 00:34:37.560 William Cheng: surprisingly small is only a four, four functions over here. One is called Rubino the other ones could to leave, you know, the other one is called Caribbean. Oh, and then the other one is called amount the fastest them. 275 00:34:38.490 --> 00:34:48.540 William Cheng: So over here, it says Rubino will be passive vino blah blah blah and review them must initialize the family members of the provided penal data structure. 276 00:34:50.550 --> 00:34:53.430 William Cheng: Well guys at this function initialize is, you know, part of the Beano 277 00:34:57.750 --> 00:35:04.320 Lalit Gupta: Previously you were talking about ramps read been over to the difference between GDP node and you'd be good. 278 00:35:04.650 --> 00:35:16.020 William Cheng: Well, so, so, so this function over here it's appalling morphic pointer. So this one is called read vino so when you're using the RAM file system, you know, the functionality will point to will be the emphasis then Rubino 279 00:35:16.290 --> 00:35:21.150 William Cheng: When you're using the system boss is them, then this point I will point to the system file, file system Rubino 280 00:35:23.160 --> 00:35:23.700 Lalit Gupta: Okay. 281 00:35:24.420 --> 00:35:37.890 William Cheng: So, you know, anything that says ops. They are typically I guess in Phoenix, they try to name all these function in a consistent way. So whenever you see ops. That means that they are a real function pointers. 282 00:35:41.940 --> 00:35:47.040 William Cheng: Okay, so therefore they're probably more fake, you know, for, you know, for one. So in this case, this is the fastest them right 283 00:35:47.280 --> 00:35:53.790 William Cheng: file system operations. So for one type of analysis, then all these for function will point to, you know, for function is that the red boxes, then 284 00:35:54.060 --> 00:36:01.050 William Cheng: When you're using the system versus them all these four functions, they will point to the forefront, the corresponding for function in this isn't a PA system. 285 00:36:09.840 --> 00:36:10.410 William Cheng: So, 286 00:36:11.250 --> 00:36:12.360 Lalit Gupta: We got the system by 287 00:36:12.480 --> 00:36:17.490 Lalit Gupta: The file system like in Phoenix, like is there something we have to do first. 288 00:36:18.150 --> 00:36:23.700 William Cheng: System for our system is what you need to work, we need to use in chapter in Colonel three 289 00:36:26.040 --> 00:36:26.340 Lalit Gupta: Okay. 290 00:36:26.460 --> 00:36:27.720 Lalit Gupta: Just don't find file system is 291 00:36:27.900 --> 00:36:30.390 Lalit Gupta: Like you fall, Colonel three. Okay. 292 00:36:30.660 --> 00:36:37.080 William Cheng: Yeah, so your kernel to you're going to work with a very simple process and known as the ramp our system, the ram file system is a fake classes them. 293 00:36:37.560 --> 00:36:53.550 William Cheng: Because it's done in RAM right the RAM is a memory. So therefore, there's no disk. Okay, so if your implementation or BFS is perfect. When you switch to Colonel three, you should be able to work with the system pop them directly. And this isn't bosses and has a disconnect 294 00:36:54.690 --> 00:37:00.690 William Cheng: OK. OK, so, so, so if you implement your polymorphous and perfectly, you should, you know, the switch should be very easy. 295 00:37:04.680 --> 00:37:13.410 William Cheng: Never. It's almost impossible to do perfectly. So, so even if we have a perfect corner to where you go to Colonel three at the beginning you gonna have to, you know, fix some of your bugs. 296 00:37:14.040 --> 00:37:20.190 William Cheng: Because now there's a desk. If you have reference counting problem, you know, then then then then things get a little messy. 297 00:37:25.200 --> 00:37:28.260 Lalit Gupta: Also in ramps adored see if you go to 298 00:37:29.790 --> 00:37:32.010 Lalit Gupta: The ramps grammar for start the fire file. 299 00:37:32.580 --> 00:37:33.090 Okay. 300 00:37:35.820 --> 00:37:36.090 Lalit Gupta: So, 301 00:37:37.500 --> 00:37:43.080 Lalit Gupta: There are 2222 struck 302 00:37:46.860 --> 00:37:50.100 Lalit Gupta: Struck get there. To add a function pointer. 303 00:37:51.360 --> 00:37:56.520 William Cheng: Right. So again, this is you know LPS but anything that's ops. That means that the repetition pointers. 304 00:37:57.930 --> 00:38:03.810 Lalit Gupta: Yeah. So what is the difference between this or direct directory VR ops and the file via ups. 305 00:38:04.650 --> 00:38:15.360 William Cheng: Yeah so. So again, they named the variable pretty carefully. Right. So this is the real function pointer for directly file. This is a real function point of for a non directory file or regular file. 306 00:38:17.100 --> 00:38:28.020 Lalit Gupta: And why why why in the directory. We have a lot of we have like create which is not now an empty node which is normal and whereas in the file ops, we have these know is 307 00:38:28.140 --> 00:38:31.320 Lalit Gupta: There are two things about if you think about a directory file. 308 00:38:31.380 --> 00:38:33.810 William Cheng: What kind of operations to the director of our support. 309 00:38:35.820 --> 00:38:42.270 William Cheng: Right. So here is a directory. The, the operation that's supported by directory file right so directly does directly support read 310 00:38:42.720 --> 00:38:48.270 William Cheng: Well over here says no, right, does it directory support. Right. No, you're not allowed to write to a directory file. 311 00:38:49.230 --> 00:38:58.620 William Cheng: You are not allowed to memory map a direct file into your address space. Are you allowed to create a file inside a directory what the answer is yes. Right. And here is the function that would do it. 312 00:39:00.750 --> 00:39:01.620 Lalit Gupta: Oh, yeah. 313 00:39:02.190 --> 00:39:07.080 William Cheng: Does it directly allow you to create a device. The answer is yes, because here's a function that allow you to do a 314 00:39:07.380 --> 00:39:17.400 William Cheng: Does it directly an artist performer look up on June directory allow you to perform a link function that directory is support on link that directory support making a directory subdirectory 315 00:39:18.180 --> 00:39:23.790 William Cheng: The directory support remove a directory and then over here, you can read a directory entry or as a reader over here. 316 00:39:23.940 --> 00:39:32.220 William Cheng: Is how you read it directly entry. So you can actually call reader over and over and over again. And every time you call it, you will you will, you know, it will return the next directory entry. 317 00:39:33.000 --> 00:39:39.420 William Cheng: The directory also support the function call stat. Yeah. And we also don't know what the other ones are doing 318 00:39:39.900 --> 00:39:42.780 William Cheng: If you look at a file right so here's a, here's a regular file. 319 00:39:43.140 --> 00:39:55.140 William Cheng: A regular fall. What can you do with it what you can read from it. Right. You can read from it. You can write to it. You can also get the status of the file, but you cannot create something inside the file which kind of makes sense, right, 320 00:39:57.180 --> 00:39:59.010 William Cheng: And you can look you can link economically. 321 00:40:00.960 --> 00:40:01.410 William Cheng: Okay, so 322 00:40:03.360 --> 00:40:11.610 William Cheng: One more point here, right. These array of function pointers. They have exactly the same entry in the first one. The second one, because everything is a file. 323 00:40:11.850 --> 00:40:18.450 William Cheng: Or directory is a file a regular file the file. So therefore, they have to, you know, the we have an array of a function ponder that look like this. 324 00:40:19.800 --> 00:40:23.460 Lalit Gupta: Oh, so that we can we can type constant is like in the same manner. 325 00:40:23.550 --> 00:40:31.800 William Cheng: We use the same, same, same, a real function pointer to to to to to access function in the file or access function or directory far 326 00:40:32.460 --> 00:40:33.000 Lalit Gupta: Okay. 327 00:40:33.270 --> 00:40:42.570 William Cheng: So, so that's why before we use that function, we have to check whether it's equal to know are not visible to Know when we shouldn't call it because otherwise you're going to get a segmentation fault. Yeah. 328 00:40:46.800 --> 00:40:52.290 Lalit Gupta: And violated got before the orders, all these things. The reason 329 00:40:53.640 --> 00:40:54.450 William Cheng: I'm 330 00:40:55.920 --> 00:40:56.400 William Cheng: I 331 00:40:57.630 --> 00:40:58.080 William Cheng: Don't know. 332 00:40:59.250 --> 00:41:02.040 William Cheng: I think this is a event C programming. 333 00:41:03.060 --> 00:41:05.550 William Cheng: So I don't know what, what was the meaning of that. 334 00:41:09.150 --> 00:41:11.880 Lalit Gupta: Do we have to worry about this and map for control to 335 00:41:13.200 --> 00:41:13.740 William Cheng: Have to worry about. 336 00:41:14.820 --> 00:41:15.090 Lalit Gupta: And 337 00:41:20.220 --> 00:41:21.840 William Cheng: I think the only um 338 00:41:23.220 --> 00:41:28.320 William Cheng: Let's see a graph mm AP Colonel include started. Ah. 339 00:41:32.100 --> 00:41:36.270 William Cheng: Ok so MF is a system called we don't have to worry about system call until Colonel three 340 00:41:37.950 --> 00:41:42.720 William Cheng: So in Colonel three, you have to implement the system call 341 00:41:44.640 --> 00:41:45.810 William Cheng: I yeah 342 00:41:47.250 --> 00:41:52.110 William Cheng: And I guess the example that we just saw over here right for the directory file. 343 00:41:53.190 --> 00:41:56.640 William Cheng: A map is empty and also for regular father and map is also empty. 344 00:41:56.670 --> 00:42:01.110 William Cheng: As yeah maybe we don't so clearly for Colonel to we don't have to worry about a map. 345 00:42:02.070 --> 00:42:16.980 William Cheng: Okay, so, so, so, so for this fall system and map is not implemented. Right. And also we can also see that there's a lot of other other function over here, acquire release. I've no idea what they are. And then, you know, all these five functions over here. Again, nobody's implementing that 346 00:42:20.040 --> 00:42:26.490 William Cheng: Hey, if you look at the rest of the for the rest of the file is going to be the implementation of all these functions, right, create make know the, you know, look up 347 00:42:27.900 --> 00:42:33.090 William Cheng: So this is a, you know, detailed implementation inside the RAM file system for all these functions. 348 00:42:35.520 --> 00:42:44.910 Lalit Gupta: Also, is it would you recommend or is it is it even possible to go through line by line for ramp Stuart, Stuart. See like 349 00:42:45.030 --> 00:42:48.630 William Cheng: That's what you're that's what you're supposed to do. That's part of the call to assignment. 350 00:42:48.810 --> 00:42:51.300 William Cheng: Is to reach to the call and try to figure out what's going on. 351 00:42:53.430 --> 00:42:53.910 Lalit Gupta: Okay. 352 00:42:55.290 --> 00:43:04.110 Lalit Gupta: So we so we can under so if you try. We can under like it so it so we can understand what exactly every function is doing and 353 00:43:04.440 --> 00:43:09.210 William Cheng: What you're supposed to single step into the RAM file system code to devalue or Colonel to co 354 00:43:10.230 --> 00:43:10.770 Lalit Gupta: Op 355 00:43:10.980 --> 00:43:21.210 William Cheng: We can learn to code is not working. He said, How come it's not working well let's go into the referral system to see how it's the what's going on. And then, and then you should realize that you did something wrong in your kernel to code. 356 00:43:22.320 --> 00:43:22.830 Okay. 357 00:43:25.440 --> 00:43:32.910 William Cheng: So, so my week a discussion section I'm gonna you know I'm basically, I'm going to go through some of the stuff we just talked about. Okay. 358 00:43:38.250 --> 00:43:47.850 Lalit Gupta: So yeah, so right now I like yeah I'm trying to make a picture of it and looks like the whole thing. So yeah, I've currently I have this much question. 359 00:43:48.360 --> 00:43:56.520 William Cheng: Yeah so. So the way I sort of think about writing these kernel to code is that you get enough to get going, right, and then you try to sort of figure out what's wrong with your code. 360 00:43:57.690 --> 00:44:05.760 William Cheng: Okay. I mean, some people I know their programming style is that they need to understand everything perfectly before they start writing code, so that will be a little difficult. 361 00:44:09.990 --> 00:44:14.940 William Cheng: Right, because that means that you have to understand every line of code and the figure out which function that they should call 362 00:44:15.600 --> 00:44:22.740 William Cheng: But I think at this point, you have a pretty good guess right if you're in the if you try to implement it make notes make notes function in the VM Fs. 363 00:44:23.040 --> 00:44:29.820 William Cheng: What is your reach the emphasis that make know so so you don't really have to understand the entire emphasis them to just to see how that will work. 364 00:44:31.710 --> 00:44:32.310 Okay. 365 00:44:36.630 --> 00:44:37.170 Lalit Gupta: So, 366 00:44:38.940 --> 00:44:43.530 Lalit Gupta: So we can start him start writing the function even before reading for 30 367 00:44:44.850 --> 00:44:52.740 William Cheng: Yeah, you just trust that it works perfectly right. So, so read the comment below in the comment box says find the pointer. Why is that, well, we'll, we'll find what pointer. 368 00:44:53.280 --> 00:45:02.580 William Cheng: You look at the header file, you look at the source code and then you try to sort of make an educated guess to see what you know what point do you use and then make sure the pointer is not equal to know and then you call it. 369 00:45:04.050 --> 00:45:11.640 William Cheng: Okay. And if it doesn't work. You say, Why doesn't it work. Did I pass the wrong arguments to, you know, if you pass no pointer. Of course it doesn't work is going to crash. 370 00:45:12.270 --> 00:45:20.100 William Cheng: The round classes. And there's also a bunch of K assert right maybe should take it a little bit closer. Because if the assertion fail. Well, that means that you're passing the wrong argument. 371 00:45:21.570 --> 00:45:21.960 Okay. 372 00:45:31.500 --> 00:45:32.760 Lalit Gupta: Okay, I'll work on 373 00:45:33.540 --> 00:45:39.630 William Cheng: Yeah, so, so I mean this is you know where this is kind of pretty realistic when you go work for a company and they an internship or something like that. 374 00:45:39.810 --> 00:45:49.170 William Cheng: So well, they will do this a while. I want you to implement this new thing, but they all these existing co read existing code to find out what kind of code that you have to write. And then, you know, if you have questions, you can go bug these engineers. 375 00:45:49.560 --> 00:45:52.440 William Cheng: Okay but but don't pass the engineer to tell you every line of code, what you 376 00:45:52.470 --> 00:45:54.480 William Cheng: Need to write right so it's kind of like our assignment. 377 00:45:55.650 --> 00:45:55.950 William Cheng: Yes. 378 00:46:01.170 --> 00:46:02.610 Lalit Gupta: Yeah, the assignment. Interesting. 379 00:46:03.990 --> 00:46:07.140 William Cheng: Yeah. So I think these Brown University assignment. They're very clever. 380 00:46:08.430 --> 00:46:09.360 William Cheng: So there's a pretty good. 381 00:46:11.400 --> 00:46:15.780 Lalit Gupta: Like is there, like, at some point, I think you told like there are like 382 00:46:16.920 --> 00:46:20.070 Lalit Gupta: Two assignment which are provided by the ground in your city. 383 00:46:20.640 --> 00:46:25.740 William Cheng: Yeah drivers and this is the boss is them, they are written there. Yeah, they're written by the Brown University people 384 00:46:27.180 --> 00:46:35.250 Lalit Gupta: Are they able to do it in one semester because it seems like five like five, the fire assignment is like too much for one semester. 385 00:46:36.780 --> 00:46:46.830 William Cheng: Well, the, you know, if you look at the system file system. You know, it's actually pretty simple. Right. And also, if you look at chapter six. You know, we finished this Infosys them. 386 00:46:47.880 --> 00:46:51.960 William Cheng: In very short period of time since the proposal is very, very straightforward. 387 00:46:53.490 --> 00:46:55.950 William Cheng: So it is possible. So I think, you know, 388 00:46:57.390 --> 00:47:02.940 William Cheng: If I say not yet implemented, Colonel. 389 00:47:05.310 --> 00:47:10.170 William Cheng: Start see and then grab two says five Fs. 390 00:47:11.730 --> 00:47:16.260 William Cheng: There's nothing there. So what about one more level deep 391 00:47:17.880 --> 00:47:21.480 William Cheng: Okay, so to implement the system purposes. And there's only two files yet to implement 392 00:47:23.040 --> 00:47:34.980 William Cheng: Right, there's only two files one product here one part here. There's a bunch of functions over here, right. These are the function. I mean, these are the function that we just mentioned, right, instead of seeing grandpa system, you have to implement the corresponding system PA system. 393 00:47:36.300 --> 00:47:43.260 William Cheng: But in this case, there's a disk. So therefore you need to know how to interact with the disk and you need to put your kernel threat to sleep, you know, other kind of stuff. 394 00:47:47.880 --> 00:47:50.550 William Cheng: So I think in Brown University. 395 00:47:53.220 --> 00:48:06.570 William Cheng: I guess there's there's one way to take the operating system class is to actually take it as two classes. One is just the lecture and the other one is the last class. I think it's only half the credit of the regular class. And that's where they implement all the five programming assignments. 396 00:48:08.490 --> 00:48:09.090 Lalit Gupta: Oh, 397 00:48:09.960 --> 00:48:12.870 William Cheng: I think they actually divided them into, you know, two different classes. 398 00:48:19.380 --> 00:48:21.930 William Cheng: But anyways, a USC, you know, since 399 00:48:23.100 --> 00:48:32.400 William Cheng: You know, and also you Brian diversity. These are the costs are for undergrad students a USC CSV to can only be taken by grad students. So again, it's a little different. 400 00:48:39.660 --> 00:48:41.430 William Cheng: Classes more intense because 401 00:48:41.580 --> 00:48:45.000 William Cheng: Yes, and people in Glasgow, they should, they should put more into it. 402 00:48:48.060 --> 00:48:58.170 Lalit Gupta: I like I'm just curious like a little harder to figure the all the assignment because the thing is like without your health, like, pretty much. It is impossible to like figure out what to do. 403 00:48:58.620 --> 00:49:05.340 William Cheng: Yeah, so like, like I said at the beginning, you know, in the, you know, in 2012 when I got when I started this class. 404 00:49:06.060 --> 00:49:19.170 William Cheng: You know, at that time, the book was newly published the assignment was the idea that the although the wiki style was brand new to the world. So, at that time, the only documentation people here was the winnings documentation. 405 00:49:21.030 --> 00:49:33.990 William Cheng: Okay, so at that time. The problem is we're almost impossible to do, right. So over the years. You know, I am more stuff to the programming FAQ, you know, so, so now I think. I mean, you can see how long the problem FAQ is I 406 00:49:35.580 --> 00:49:36.120 William Cheng: Get this done. 407 00:49:38.820 --> 00:49:44.580 Lalit Gupta: Yeah. And the thing is, Dr. Yeah, I think it was like, I think, has a lot of interesting information like 408 00:49:46.200 --> 00:49:46.410 Lalit Gupta: Your 409 00:49:47.520 --> 00:49:50.820 William Cheng: Yeah, so without those information the kernels Sam is pretty much impossible, right. 410 00:49:51.360 --> 00:49:51.870 Yeah. 411 00:49:56.430 --> 00:50:00.270 William Cheng: So, so, by, by the way, you know, you could compare our class with a Brown University class right 412 00:50:01.050 --> 00:50:16.620 William Cheng: Since the class is taken by undergrads. The undergrads actually taking a lot of classes, you know, per semester I say a USC typically for gratitude and they're taking, you know, two classes per semester. So, therefore, you know, for classes to be more intense, which is which is also expected 413 00:50:19.020 --> 00:50:19.290 Of 414 00:50:21.090 --> 00:50:25.290 Lalit Gupta: What I think is goddess Java classes are also like pretty like this. 415 00:50:26.880 --> 00:50:29.730 Lalit Gupta: Slide is if you go from the undergrad classes. 416 00:50:29.790 --> 00:50:32.340 William Cheng: Yeah, supposedly yeah more work. 417 00:50:33.240 --> 00:50:37.020 Lalit Gupta: Yes, or her work and assignment or also make more difficult. 418 00:50:37.500 --> 00:50:37.830 Yeah. 419 00:50:39.570 --> 00:50:45.420 William Cheng: Yeah. So I think, you know, in the end for CSP to that people are willing to spend a lot of time on it in the end. Everything is doable. 420 00:50:45.990 --> 00:51:01.050 William Cheng: Right, given the colonel FAQ and stuff I and given that I'm here to help. Right. People should ask me question. You can see that in the class Google group. There's not enough discussion, which is kind of surprising, but you know I do expect people to have more discussion, the classical but 421 00:51:04.920 --> 00:51:07.170 William Cheng: Anyways. Is that happening. I can. There's nothing I can do. 422 00:51:11.100 --> 00:51:13.950 Lalit Gupta: Focus. I will try to look into, like, 423 00:51:15.120 --> 00:51:17.550 William Cheng: A semi question if you, you know, anything's not clear. 424 00:51:18.390 --> 00:51:19.260 Lalit Gupta: Yes, thank you. 425 00:51:19.920 --> 00:51:23.400 William Cheng: Okay, so I'm gonna I'm it says you're the only person in class, right. 426 00:51:23.640 --> 00:51:24.780 William Cheng: I'm just gonna end the 427 00:51:25.050 --> 00:51:28.650 William Cheng: End the classes. Alright, see ya. Bye bye.