WEBVTT 1 00:00:03.330 --> 00:00:15.240 William Cheng: So this is Week seven discussion section and today I'm going to introduce Colonel to to you. So this way you can start as early as you can. 2 00:00:16.590 --> 00:00:27.630 William Cheng: I thought, as I mentioned in lecture are there to new things in Colonel to a number one is probably more for them. And so the idea is that the bfs should be able to work with any 3 00:00:28.290 --> 00:00:34.290 William Cheng: Actual file system in Colonel to the actual file system is ran fastest them. So there's no desk. 4 00:00:34.920 --> 00:00:40.350 William Cheng: In Colonel three we're going to turn on the system file system. So in that case, there's a disconnect 5 00:00:41.070 --> 00:00:47.370 William Cheng: The basic ideas here is that if you implement BFS correctly, then when you switch on Colonel to the colonel three 6 00:00:47.850 --> 00:00:52.500 William Cheng: You don't have to change a single line of code because, you know, Polly Muslims can work perfectly. Yeah. 7 00:00:53.220 --> 00:00:59.010 William Cheng: So you should, you know, read this the sort of the kernel source code. So it's very, very important to read the corn kernel source code. 8 00:00:59.430 --> 00:01:07.230 William Cheng: For the Rand Paul says them because you don't have the kernel source code for the system PA system. So when you get to Colonel three. You just have to sort of imagine 9 00:01:07.740 --> 00:01:17.760 William Cheng: That this is above us them the code looks very, very similar to the emphasis them except that the data structure on that this is a little different. And also you have to wait for the desk. So how do you wait for this. 10 00:01:18.210 --> 00:01:24.210 William Cheng: You started IO operation using the device driver, which of course you also don't have to cope with that because what I imagine 11 00:01:24.420 --> 00:01:29.670 William Cheng: You're gonna make some function calling them started off the device driver and your kernel threat. It's going to go to sleep in Iowa cute. 12 00:01:30.270 --> 00:01:38.580 William Cheng: When the interrupter deliver your current author will go get woken up and then they will return from the device driver you know function call and then we will continue from 13 00:01:39.570 --> 00:01:46.740 William Cheng: There. So again, it's, it's really important to understand exactly how the grandpa system works. And imagine that the system proper system work the same way. 14 00:01:47.640 --> 00:01:57.630 William Cheng: The number two difficulty is in reference counting, so, so, so, so again, I mentioned before, you know, the ideal because I if you have an object is object has a reference count. 15 00:01:57.990 --> 00:02:05.310 William Cheng: Okay if as a reference call to come, the number of pointer point to it right over here 123 point oh point to it. So in this case, the reference should be equal to three. 16 00:02:05.640 --> 00:02:14.130 William Cheng: Okay. Will you remove a pointer over here, you need to document the reference Council will go to to we remove it the other way with document to one. And finally, when we move it down to zero. 17 00:02:14.310 --> 00:02:22.320 William Cheng: Will you remove it. You know when you call the function to document the reference count it will check it the reference can go to zero if it goes to zero, that this object will be free. 18 00:02:23.220 --> 00:02:31.440 William Cheng: Yeah, I mentioned before they are you know you might over reference you might under reference right if you over a reference then so. So this example. If you over our friends. 19 00:02:32.010 --> 00:02:36.180 William Cheng: This object, you have two pointers pointing to it. But the reference count over here is going to be equal to three. 20 00:02:36.480 --> 00:02:43.800 William Cheng: So in this case, when you free up when you when you call it a bunch of the document. It will go to two and then it will goes to one. And then this object will never get free 21 00:02:44.430 --> 00:02:55.860 William Cheng: Okay, so in Colonel one or you know when you don't free up a an object in memory is not a big deal in Colonel to there shouldn't places that if you do this the end the colonel will refuse to shut down. 22 00:02:56.520 --> 00:03:03.330 William Cheng: Okay, so in that case, you're going to end up with a problem. OK. So again, read the grading guidelines to see how many points you will lose if you, you know, have this kind of problem. 23 00:03:03.930 --> 00:03:08.880 William Cheng: What's even worse is that under reference problem right over here, you have, you know, a three pointer pointing to it. 24 00:03:09.090 --> 00:03:19.740 William Cheng: And then the reference how we're able to to so when you remove one point to your detriment to why we will have a second and they will detriment down to zero. And now this object will get freed up. So this object is gone. Right. 25 00:03:19.980 --> 00:03:30.060 William Cheng: But whoever the host the third pointer still think that the object is valid. So this object get reallocated that all the data inside is optic will change. And now we end up with the memory corruption, but 26 00:03:30.840 --> 00:03:39.510 William Cheng: Yeah, so, so one good example for that is that you know i i just you, even though I guess somebody told me about one of their boss. 27 00:03:39.930 --> 00:03:43.260 William Cheng: Is saying Colonel one you know all the processes. 28 00:03:43.590 --> 00:03:52.230 William Cheng: The process control blah, they are linked together in a live list right so double looking glass over here. Yeah. So the process can do about doesn't have a reference count. Right. So, therefore, you have to do yourself. 29 00:03:52.410 --> 00:04:00.600 William Cheng: So what happened is that you know somebody actually have one of these puzzles control bar. They actually they free it up, but they they forgot to unlinked from this link less 30 00:04:01.500 --> 00:04:07.230 William Cheng: Okay, so in that case what will happen, right. So if you free this object up over here, you forgot to remove them from a linked list. 31 00:04:07.500 --> 00:04:12.300 William Cheng: Next time, somebody's going to trigger this link list and they will think this object is good. What is this Optimus 32 00:04:12.570 --> 00:04:17.850 William Cheng: reallocated if it's reallocated and all these pointers going to mess up. So next time when you turn it to visit you know you 33 00:04:18.300 --> 00:04:26.220 William Cheng: Know the segmentation fall again this is a memory corruption bug okay because you're pointing to memory that's supposed to be gone. That's it was 34 00:04:27.090 --> 00:04:33.900 William Cheng: That supposed to be garbage. A you're still using it right so so this point over here is pointing to that object. And this pointer is pointing to a bad object. 35 00:04:34.050 --> 00:04:44.310 William Cheng: Because you forgot to remove the object from the language as well. Yeah, that's another type of memory corruption bug. There are other things that array out of bounds or, you know, things like that. So there's tons of different ways to corrupt memory. 36 00:04:45.120 --> 00:04:48.300 William Cheng: So that's why the Member crushing bug is very, very difficult. Fine. Yeah. 37 00:04:48.900 --> 00:04:59.580 William Cheng: Anyways, so the basic idea is very simple, right, the number of pointer point to the object. Right. So this these are for the agenda has a reference count the number of pointed pointed the object is reflected in the reference count. 38 00:05:00.420 --> 00:05:07.380 William Cheng: Okay, so this, this means that every time when you try to add a pointer to an object that has a reference how you need to call the function to increment the reference how 39 00:05:07.560 --> 00:05:16.770 William Cheng: Anytime. Will you remove the the pointer to the object, you need to remember to call the function to document the reference count this way when the reference can go to zero it will automatically get freed up 40 00:05:17.220 --> 00:05:22.800 William Cheng: Okay, so, so normally this is not so difficult to do. But again, you know, if you're inside a function and you have a local variable. 41 00:05:22.980 --> 00:05:33.120 William Cheng: Will you create a local variable right you point to some idea you you you will remember to increment the reference car. But when the function returns the local variable is gone. So therefore, the pointer is automatically removed. 42 00:05:33.630 --> 00:05:42.570 William Cheng: Right. So in this case, it's your responsibility that if you increment the reference county that function. Maybe you should think about it, when the function return over here. Should you your document the reference call 43 00:05:43.320 --> 00:05:51.150 William Cheng: Okay, so how do you decide, right. So again, you need to count the number of points are part of this object. If there's an extra point to that point to a while that in this case you have to document the reference got 44 00:05:52.740 --> 00:06:02.550 William Cheng: Okay, some function it whatever return an object, it needs to implement the reference count because you know when he was when he returned object. Well, that means that the function that called the function that call this function. 45 00:06:02.790 --> 00:06:14.250 William Cheng: Actually will have a point of point of this object. So again, you need to sort of keep track of how to do this properly, even know conceptually is very, very simple accounts number, point, point and the point to where you need to sort of figure out when do you know what 46 00:06:15.540 --> 00:06:19.620 William Cheng: You know, when does number point is to get incremental and when what is actually good detrimental. 47 00:06:20.670 --> 00:06:23.490 William Cheng: Okay, so this is one of the new thing you have to learn, you know, in 48 00:06:25.590 --> 00:06:37.110 William Cheng: So why don't you said the FS equals two. Why, right. So again, you need to keep drivers equal to one and then BFS to go to why you do Magnolia implement it, you're going to see that for Colonel to their dysfunction. You have to implement 49 00:06:37.770 --> 00:06:43.410 William Cheng: So sort of divide them based on these files over here. The first two are inside vino Darcy. 50 00:06:43.980 --> 00:06:54.600 William Cheng: So, so the first question is, what is the Beano. So remember, in chapter one, we say that instead of file object. There are four things right. There's the reference count. There is the cursor position. 51 00:06:54.870 --> 00:07:02.550 William Cheng: There is the demo, they open the file And. And then the last one is called I know pointer. So in your kernel assignment. This is called vino pointer. 52 00:07:03.300 --> 00:07:09.600 William Cheng: Okay, because it because the because this point is in the in the virtual file system. So instead of calling it I know pointer because I know point will be wrong. 53 00:07:09.990 --> 00:07:12.870 William Cheng: I know point, it sounds like something belongs to the actual file system. 54 00:07:13.230 --> 00:07:24.600 William Cheng: Okay, so therefore in VM Fs, they called the vino pointer. Yeah. So again, go back to that that picture there is that every file object last the last feel over there is called the I know pointer. It's got a vino point during Linux. 55 00:07:25.440 --> 00:07:33.420 William Cheng: You have to implement or two functions over here. One is called special fiery especially I was a special file, right, so remember that in in Linux and also in Phoenix. 56 00:07:34.080 --> 00:07:43.680 William Cheng: A special file mean that it's a device. Okay. So, this function is a device read and this one is a device, right. So at the virtual file system. Do you know how to read from a device. 57 00:07:44.040 --> 00:07:48.960 William Cheng: What, of course, you have no idea how to do that. And so therefore, in this case, again, because the device, you know, the 58 00:07:49.410 --> 00:07:56.430 William Cheng: The all these things are implementing that the actual file system. So in this case, what you need to do is that you need to you know basically asked the actual file system. 59 00:07:56.940 --> 00:08:09.240 William Cheng: For help. So in this particular cases over here, since these files or device file. So basically what you have to do. So you have to use one of the pointers over here that will point to the device. And then, you know, call that function indirectly right because again we're gonna 60 00:08:10.350 --> 00:08:15.750 William Cheng: We're what we're trying to do is that inside the virtual POS system over here. We also needs to be device independent 61 00:08:16.380 --> 00:08:21.060 William Cheng: Okay, so therefore, in order for us to be device independent, we need to access the, you know, as, as a device. 62 00:08:21.630 --> 00:08:29.250 William Cheng: In exactly the same way no matter what kind of device it is mastered this case, again, we need to go to function pointer. So, so, so when you try to implement 63 00:08:30.060 --> 00:08:37.980 William Cheng: These phones, you know, via as it turns out, it's pretty simple. Because the only thing you can do is to find the pointer and then, you know, call the call the partner to call the pointer indirectly. 64 00:08:39.690 --> 00:08:44.310 William Cheng: Okay, so, so, so, you know. So in a sense, there's very, very little code that you have to write 65 00:08:44.520 --> 00:08:56.040 William Cheng: Because all you need to do is to figure out which point, you're usually use and then make an indirect function call. Right. So if you don't know how to use indirect function call. Look at the Colonel's to source code, see how other places are making the indirect function call now. 66 00:08:57.390 --> 00:09:02.640 William Cheng: The next one over here. This is going to be the one that give you a lot of trouble at the beginning. So this is, it's called name v over here. 67 00:09:03.000 --> 00:09:12.270 William Cheng: Is for path name resolution right so in class, we talked about what path and resolution is you forgot what it is. Please review the electric material. So here we're going to so 68 00:09:13.290 --> 00:09:15.720 William Cheng: There are three functions. One is to look up so so 69 00:09:16.230 --> 00:09:28.950 William Cheng: What does it look up right so look up. Is that your edit directory. OK. So again, there's a, you know, the directory path home slash BCS lash out at all right so your edit directory already over here and then you try to look up a component name. 70 00:09:29.790 --> 00:09:38.640 William Cheng: Okay, so for example you're inside home already now instead of slash home directory. So you need to look up the component and NBC to say to me, I know number 71 00:09:39.450 --> 00:09:43.980 William Cheng: Wrestling class was a gimme, gimme number in the winning says I'm over here it says give me a vino 72 00:09:44.700 --> 00:09:54.630 William Cheng: Right, because you know once you turn it into a vino so now we're in the we're in the we're in the virtual file system over here all we have our vino we don't have those anymore because I know belong to the actual file system. 73 00:09:55.290 --> 00:10:08.550 William Cheng: So this guy is look over here is that given a component name and given where I am in a directory you know inside this directory. Does this component name exists if it exists, return to me a vino that represent that the that particular component 74 00:10:09.330 --> 00:10:14.730 William Cheng: Okay, so that's look up. I'm sure nobody here. And then there's some higher level function over here, basically, that will, you know, 75 00:10:15.120 --> 00:10:25.050 William Cheng: Perform path of resolution starting from the root directory and you tried to, you know, do this one step at a time. So that's the that I think that's an empty function okay to go through this thing, you know, sort of, 76 00:10:27.810 --> 00:10:31.020 William Cheng: The. I think that's fine. Just sort of go through them individually until you 77 00:10:32.490 --> 00:10:38.010 William Cheng: Until you get to the last part. Yeah. And the open envy over here, sort of a high level of function. 78 00:10:38.430 --> 00:10:45.510 William Cheng: That when you try to open a file. First, you need to call this function and this call this function will be the one that cause don't envy and the dirt and we will be the one that caused look up 79 00:10:46.320 --> 00:10:48.840 William Cheng: OK. So again, that's sort of the basic sequence. Yeah. 80 00:10:49.440 --> 00:10:58.710 William Cheng: All right. And then there's a bunch of system called here. So these are the system called in the virtual phone system. So again, Colonel to is completely inside the Colonel. There's no user space program. 81 00:10:59.190 --> 00:11:07.050 William Cheng: So even though these are called system call. Okay. The basic idea over here is that they have the system called functionality, but they're completely implementing that a colonel. 82 00:11:07.380 --> 00:11:12.960 William Cheng: Okay, so we're going to end up with a bunch of these do function you already see some of the two functions already, right. Those are the kernel version. 83 00:11:13.170 --> 00:11:20.040 William Cheng: Of this function like to exit to wait P ID or do wait like the way to AP ID. So now we have all the file system. 84 00:11:20.370 --> 00:11:31.800 William Cheng: You know the person that system call so they are the counterpart. Is that a kernel for the reasonable for the races of over the closest phone call and for all the other long list of system calls, such as doop do to make know make her 85 00:11:33.030 --> 00:11:38.730 William Cheng: So, so I'm sort of briefly go through all these functions are right, read this, you know, your, you should be familiar with read and write and close 86 00:11:39.240 --> 00:11:45.300 William Cheng: Do we talked about in class due to is a slightly different version of dupe so again read them and page on then as the final what it does. 87 00:11:45.900 --> 00:11:53.400 William Cheng: Make note is to create a device, guys. Okay, how do you create a device right devices, represented by two numbers, one of the major device number 88 00:11:53.610 --> 00:11:58.680 William Cheng: The otherwise the miners device number again at the virtual forces them to you know how to create a device. 89 00:11:58.920 --> 00:12:06.990 William Cheng: Of course not. Right, so therefore you need to ask the actual file system for how you know you need to find a pointer and then call THROUGH AND THEN MAGICALLY the actual festival created for you. 90 00:12:07.530 --> 00:12:14.730 William Cheng: Okay. So, okay, you can take a look at the file system code to see how great the device. OK. So again, all it needs is to numbers and it can create device. 91 00:12:15.240 --> 00:12:26.340 William Cheng: Alright, the next one over here is make directory your unit directly already been creating our directory so you can make her removed directory you want to remove it. There it subdirectory on link is to remove a hard link. 92 00:12:26.820 --> 00:12:34.650 William Cheng: Day and then link is create a hard link, whereas we talked about, you know, hardening a soft link. So I think we need. They don't have symbolic link or something. So they only have hardly 93 00:12:35.610 --> 00:12:42.810 William Cheng: Rename it's hard to rename of our so if you want to rename the file. Basically what you have to do that you have on link and then you have to perform a link 94 00:12:43.500 --> 00:12:52.560 William Cheng: So that's how you rename the file so you can also read by moving out into another directory. So in this case you will be online, followed by creating a new entry in another directory there. 95 00:12:53.130 --> 00:13:01.650 William Cheng: There's also a system called change directory. Right. We also talked about that get directory entries over here. So again, we open it directly file. 96 00:13:02.220 --> 00:13:06.930 William Cheng: Okay, so you will open a directory file. Once you open a directory of all the directory file is a 97 00:13:07.560 --> 00:13:12.210 William Cheng: It's a data structure. It's an array of directory entry, whereas over here. Direct to n g 98 00:13:12.720 --> 00:13:16.230 William Cheng: There is a component name right component name you know.or, something like that. 99 00:13:16.380 --> 00:13:21.720 William Cheng: Followed by the I O number and then there's a da da, you know, followed by I don't number and then a bunch of stuff we talked about that in class. 100 00:13:21.840 --> 00:13:31.050 William Cheng: That. So every one of these entries know as directory entry. So get done is to get a directory entry right good deeds directory EMT is the order entry. 101 00:13:31.170 --> 00:13:38.370 William Cheng: So will you make this you know we made this function call. You are returning that directory entry one at a time and you have a data structure that you need to fill out. 102 00:13:38.850 --> 00:13:46.170 William Cheng: The data structure is no as directory entry or rent of your TR E and D, E, and to be as a director and Jade. 103 00:13:46.650 --> 00:13:58.890 William Cheng: Okay, so, so that's so so that directly entry is the data structure inside virtual file system, when you look at it around file system code, you will see that inside the referral system for the actual file system, the data storage is a little different on the desk. 104 00:14:00.000 --> 00:14:09.120 William Cheng: Okay, so what happened is that, you know, no matter what the data structure. It looks like on the actual file system when you return it directly entry into the virtual file system, you have to return that mean the same format. 105 00:14:09.390 --> 00:14:12.960 William Cheng: This way the rest of the operating system can be actual file system independent 106 00:14:13.980 --> 00:14:17.820 William Cheng: OK, so again this is, you know, one of the sort of the major confusion and Colonel to 107 00:14:18.300 --> 00:14:25.080 William Cheng: Because we have multiple implementation of the directory Angie in the virtual file system. It's just a data structure in the agile process them. 108 00:14:25.230 --> 00:14:36.030 William Cheng: It's a data structure on disk and also they also. Will you read the data center for this and the memory. You also have a data center in memory. But again, that will not be the same as the virtual file system data structure. So you have to copy things over. 109 00:14:36.330 --> 00:14:41.550 William Cheng: So in the actual classes and then there might be more information. So also, you only need to copy what you need. Yeah. 110 00:14:42.300 --> 00:14:47.070 William Cheng: Alright, the next one is LLC, right, we cover that in chapter one and then final one. This is the stack. 111 00:14:47.520 --> 00:14:53.520 William Cheng: The standard is the status function for every file, you can find out what this, you know what, what is the status of the file. 112 00:14:54.030 --> 00:15:00.990 William Cheng: So that includes. It's a big data structure, you need to fill out. So again, I think in the virtual classes, then you don't know how to do. So, therefore, you find the actual policies that 113 00:15:01.230 --> 00:15:08.640 William Cheng: And the actual file system will fail that that data structure for you that data. So there is no s struck struck stat. 114 00:15:10.350 --> 00:15:17.430 William Cheng: I think, I think that's the the the Danish Danish. Are you actually using Unix and Linux system. So it's a very generic did the data structure. 115 00:15:17.880 --> 00:15:24.090 William Cheng: So you so so so you can you can call stack to try to find out what is the size of the file will kind of file type is 116 00:15:24.330 --> 00:15:34.440 William Cheng: And on systems that has, you know, user ID and group ID, you can actually find out all these kinds of information by calling the stat system call. Right. So there's a system Coco stat as ta te 117 00:15:34.950 --> 00:15:38.910 William Cheng: So we make that a system called a common set of Colonel and called use that will give you all that information. 118 00:15:39.240 --> 00:15:44.460 William Cheng: Or do you also contain information about when was the last time the file was modified. When was the time the file is created. 119 00:15:44.880 --> 00:15:50.190 William Cheng: So again, for we nice. It's a simple operating. You know, it's a toy operating system. So it doesn't really have a lot of the information 120 00:15:50.430 --> 00:15:59.700 William Cheng: So again, look at the header file to find out what kind of data structure. Yes. And what you need to fill up that was okay. You don't need to fill it out. You just need to ask the actual, actual file system to do all the work. Okay. 121 00:16:01.680 --> 00:16:11.190 William Cheng: All right. And then last one is open so open. There's a to open so open has to, you know, I guess they have three different argument. The argument is optional. The first one is the file system path. 122 00:16:11.820 --> 00:16:17.040 William Cheng: So in this case, what you should do is that you should call it the path of resolution functioning over here to see if you can open the file. 123 00:16:17.610 --> 00:16:20.400 William Cheng: You know, if it doesn't exist, it will fail and all this kind of stuff. 124 00:16:20.940 --> 00:16:29.820 William Cheng: The second argument is how you want to open a file you want open for we'd only read only. You want a pen. So again, you need to read the definition of a pen. So, I think. Will you try to a pen something 125 00:16:30.420 --> 00:16:44.160 William Cheng: So if you open a file for a pen, every time. Will you try to write to the file, you have to adjust the cursor position, all the way to the end of the file and then you can, you know, then the name that case you can you can write data to it. So that's what it means to a pen to a file. 126 00:16:45.330 --> 00:16:56.520 William Cheng: Alright, so again it's. These are the functions over here. That's all to do Colonel to us are divided into two phases. Number three is number one over here is to get cash out to work in Colonel to 127 00:16:57.030 --> 00:17:04.200 William Cheng: Okay. Your occasional incarnate to is different from Keisha internal one, even though the basic commands are the same but Colonel 128 00:17:05.040 --> 00:17:15.360 William Cheng: Colonel to Keisha uses the virtual file system. Okay. In Colonel one you probably, I don't know if you wonder that in Colonel one you have Acacia. How does the case, I'll talk to the terminal. 129 00:17:16.980 --> 00:17:26.250 William Cheng: OK. So again, it's you know it's it's kind of a tricky code. So basically they you know in kind of one you didn't implement a device. There's no device driver. How does it talk to determine. Oh, wow. So again, 130 00:17:26.430 --> 00:17:32.370 William Cheng: The Brown University will set up special co so that you can talk to the terminal. Okay. And also, you know, it says a lot of it is that 131 00:17:32.850 --> 00:17:41.340 William Cheng: You know the Keisha actually know how to talk to a device driver and that advisor, I will take over and then talk. And then, you know, we'll be able to talk to that the keyboard and this way device. 132 00:17:42.000 --> 00:17:49.740 William Cheng: So God wants to turn on Dr. Or equal to one, you able to actually talk to the devices. But in that case we can only use the case show because the 133 00:17:50.040 --> 00:17:59.460 William Cheng: Current one Keisha was done in a special way. Okay. Current on two occasions, a more general because they use the virtual file system. So do what so what it will do is it will actually, you know, call to open 134 00:17:59.820 --> 00:18:03.720 William Cheng: To open the device get and then what it needs to the right to the device, it will 135 00:18:04.290 --> 00:18:10.170 William Cheng: It will call do. Right. And in this case, do right eventually she reads special file right to write to the device. 136 00:18:10.470 --> 00:18:19.890 William Cheng: Okay. And also we ensured a riff on the keyboard. You will call do reach out to riff on the keyboard and then in this case you do we will eventually call a special file read to read from the keyboard. 137 00:18:21.150 --> 00:18:27.960 William Cheng: Okay, so, so, so incredible to over here. You also need to write to the regular file. So this guy is again to read and to read will reach a different place. 138 00:18:28.110 --> 00:18:37.680 William Cheng: You can also see that this is polymorphous them at work, you start it up on the same function, you can talk to the device you can talk regular file. So again, a device. It's just a different kind of adds a special file. 139 00:18:38.100 --> 00:18:42.600 William Cheng: Okay. So, therefore, you know, at the virtual file system. They all treated exactly the same, they're 140 00:18:44.070 --> 00:18:52.530 William Cheng: All right, so, so again, so. So the first phase, you have to get a shell to work and BFS. If you just turn on the offense equal to one. And they're going to run. Nothing's going to work. 141 00:18:53.280 --> 00:19:00.660 William Cheng: So what do you need to do is that, you know, Insider Program, or there's a comment block to say if that VM Fs. So once the DFS defy 142 00:19:00.870 --> 00:19:12.060 William Cheng: You need to write some additional code over here. So you need to implement mater and you need to implement make know and also you need to create all the basic devices. Okay, so in the beginning when you run we need 143 00:19:12.690 --> 00:19:23.070 William Cheng: We need x minus and right when you say minus. And that means that you're going to start your winnings operating system with an empty desk. Okay, so what's an empty desk. What's inside the empty desk, what 144 00:19:23.670 --> 00:19:29.160 William Cheng: What's inside empty. This is that there's only one. I know. Inside the empty days and that will be the route. I know. 145 00:19:30.420 --> 00:19:33.690 William Cheng: Okay, so that will make sense. That's what empty this little guy. There's a rude. I know that's in there is a 146 00:19:34.290 --> 00:19:45.540 William Cheng: Note over here. So by units convention in order for you to create devices all the devices has to be the slash Deb directory. So the first thing that we implement implement maker. Right. You need to create dev directory 147 00:19:45.930 --> 00:19:54.690 William Cheng: Inside the root directory. Okay. And then after that you need to insert Slashdot directory you need to create all the devices over here. So again, read the comments idle proc run 148 00:19:55.080 --> 00:19:59.820 William Cheng: They would tell you what kind of devices, you have to create. So I think you have to create dev size zero 149 00:20:00.510 --> 00:20:06.420 William Cheng: So that's zero device so that device when you try to reframe it all, you get zero. There's a device called slash 150 00:20:07.110 --> 00:20:23.340 William Cheng: Slash notes the node device where you tried to print it another device or the character will disappear. Okay, so it's like a terminal, but it has no display. Then there's also the, the, the, the terminal device that will be TTY zero. So I think you're supposed to create 151 00:20:25.290 --> 00:20:33.570 William Cheng: To say, Okay, these are the teletype it's not scalable, you know, devices over here. So there's really no terminal in the Phoenix operating system. 152 00:20:34.290 --> 00:20:46.110 William Cheng: Now and then it says you need to create all these directories over here device, you also need to perform path of resolution so so so in this case you have to implement all the functions in name V Darcy, although through function just mentioned over here. 153 00:20:46.440 --> 00:20:58.320 William Cheng: So this way you can use the path of resolution will work right because the, the rule is that when you try to create slash Deb, you got to make sure that slash death doesn't exist. Otherwise, you know, it's an error. 154 00:20:58.860 --> 00:21:05.550 William Cheng: Okay. And then when you try to select Chris last steps like zero, you're going to make sure that it doesn't exist. Otherwise, so therefore you need to perform path of resolution. 155 00:21:06.900 --> 00:21:12.660 William Cheng: Alright, so once you're done with this, then, you know, then, then what you will you will be able to do is 156 00:21:13.410 --> 00:21:19.140 William Cheng: You'll get into cash out right so you put it in a proc run so your current one in the proper at the end. 157 00:21:19.350 --> 00:21:27.600 William Cheng: You're using Keisha so in this case Keisha I will be the colonel to version of the Keisha and then what it will do is it will open the device like dev side. 158 00:21:27.960 --> 00:21:33.240 William Cheng: TTY zero. Yeah. So that will be the the the the the the Venus console. 159 00:21:33.750 --> 00:21:38.220 William Cheng: Raza. Remember, you know, when you run in Colonel one. Once you turn on the bedroom where you have a console window. 160 00:21:38.370 --> 00:21:49.770 William Cheng: Rather console window you can tech Acacia command and something like that. So in Colonel to that device will be slash deaths ICT y zero. So, therefore, opens your work. So that means that you have to implement not will do open and then you have to 161 00:21:50.190 --> 00:21:54.930 William Cheng: Implement do read if you want to refund the keyboard. You have to implement do right that you want to write to the device. 162 00:21:55.500 --> 00:22:02.490 William Cheng: So and also you have to have to close because India while you're down to the device, you have to close it. So when your process is going to die. 163 00:22:02.850 --> 00:22:07.110 William Cheng: If you have any open file descriptor. You're supposed to close this file, you have any discussion now. 164 00:22:07.590 --> 00:22:14.850 William Cheng: So again, do we should reach special file read because you'll read such depth like TTY zero, it's a special file, so therefore you should we specify read 165 00:22:15.300 --> 00:22:18.870 William Cheng: To write or should read special file, right, because again, you're writing to a device. 166 00:22:19.590 --> 00:22:27.240 William Cheng: That is over here says using polymorphous end to end right can read from a file or refund the device. So again, that will reach function there. 167 00:22:28.140 --> 00:22:34.590 William Cheng: So once you get all these functions that I think this is all you need. So again, if it turns out I was wrong. You have to implement other function. Let me know. 168 00:22:35.010 --> 00:22:41.550 William Cheng: Okay, but I think this is the basics that you need that. So once you finish doing all that kind of stuff. Then in this case phase one will end with 169 00:22:41.910 --> 00:22:48.030 William Cheng: You know the help and the educational commercial work again. Also the echo, you know, occasional convention where I forgot to mention that right ECHO's 170 00:22:48.630 --> 00:22:56.100 William Cheng: echo commercial work because that was the original, original three commands and also I think once you get this to be done. Can you run favorite test. 171 00:22:59.250 --> 00:23:03.060 William Cheng: Yeah, that hydro. I don't remember whether you'll be able to run 172 00:23:03.630 --> 00:23:07.380 William Cheng: A test or not. Yeah. So anyways, once you get her up here, you're ready to get into phase two. 173 00:23:07.560 --> 00:23:18.120 William Cheng: Phase two, you should add occasional command and he's just a shell command, you should create a child process and instead of child process, you should set the first procedure of the child process to be BFS test may 174 00:23:19.020 --> 00:23:28.320 William Cheng: Okay, so that's the main test, you have to pass and Colonel tools will get read the grading guidelines right there's section A, there's actually be, I think, Section C is basically pass all the bfs test. 175 00:23:28.770 --> 00:23:32.550 William Cheng: Okay, you don't have to run, you know, pass favorite test or so so hot anymore. Yeah. 176 00:23:33.120 --> 00:23:38.220 William Cheng: Alright, so, so I just want to mention over here. So, so the rest of it is, do whatever it takes. Right. But don't overdo it. 177 00:23:38.400 --> 00:23:50.730 William Cheng: Okay, so remember the comment box inside all the function that you're supposed to implement all the function that we saw before the Naya important function. They are requirements for the Brown University, they are not necessarily for us. 178 00:23:51.540 --> 00:24:01.650 William Cheng: Okay, what is all requirement, right, our requirement is our Colonel spec is our grading guidelines. Those are the only tested that you will pass integrating guys will Colonel to says you have to pass all the BFS has 179 00:24:01.920 --> 00:24:05.370 William Cheng: The FFS I think there's a gazillion testing there there's 500 something testing them. 180 00:24:05.760 --> 00:24:10.920 William Cheng: I mean, the numbers are pretty scary, but something we implement one function, you know, you're gonna pass hundred of those tests. 181 00:24:11.250 --> 00:24:15.090 William Cheng: Okay, so, so getting the end as it's written so value just have to implement all those function. 182 00:24:15.660 --> 00:24:18.780 William Cheng: One good thing about BFS test. Is that the way she tells you 183 00:24:19.140 --> 00:24:30.360 William Cheng: You know, the, the result for every little test. Okay, it will say that, you know, this function is your fail. What if the issue is to return an error code or minus 32 or something like that. So, so you actually know exactly what to do. 184 00:24:31.080 --> 00:24:39.030 William Cheng: Guys, remembering the FS most of the stuff that you have to do you know that you don't know how to do. So, therefore, you going to ask the actual file system for how 185 00:24:39.300 --> 00:24:47.730 William Cheng: Are the stuff that you are really, you know, have to do are the one of the path of resolution or the open and all that other kind of function right for everything else, you basically asked do 186 00:24:48.030 --> 00:24:56.760 William Cheng: You know, I suppose. OK, you need to review chapter one. Chapter one, which we'll talk about what's inside the FS everything related to the file object, a part of the FS 187 00:24:57.480 --> 00:25:02.550 William Cheng: Okay, anything that's related to the I know point or the I know they're happening in the actual file system. So, in that case. 188 00:25:02.820 --> 00:25:07.920 William Cheng: All you need to do is to find the pointer called the point or indirectly, and then the actual process and will do for you. 189 00:25:08.130 --> 00:25:19.500 William Cheng: And when the actual versus returning will return with an error code right lots of function, the error code zero means their success. Again, you need to read the, you know, read the comment. Read the man pages to find out what they're supposed to be. Yeah. 190 00:25:21.240 --> 00:25:33.000 William Cheng: If you write something to implement something mentioned in the comment blog, but it's not required by our colonel. Well then, again, anything that you write to replace and I are employed a bunch of they're all subject to the self check rules. 191 00:25:33.450 --> 00:25:47.730 William Cheng: Okay. So, therefore, if you right. You know, so, so, so if you follow the comment blah implement a special check over here and turns out our Colonel has no way to reach that the recycle sequence. Well, in that case, you can end up losing points in self checks. 192 00:25:48.780 --> 00:25:53.580 William Cheng: Okay, so one thing that you can do is that in in Colonel to a self check in Section D. 193 00:25:53.760 --> 00:26:04.860 William Cheng: So you can write additional testing section DS and this guy's you will call them the one d to the three or something like that to exercise these extra code that you have written my recommendation is don't do that just delete those code. 194 00:26:05.640 --> 00:26:12.990 William Cheng: Okay, when you implement something to implement something that's mentioned in the comment, blah, but it's not required for our Colonel just delete the code. 195 00:26:14.040 --> 00:26:23.490 William Cheng: Let some people say, oh, maybe I needed for Colonel three. So, therefore, I want to keep it so again if you keep her. You better have a way to check it. Otherwise, the greater has to deduct points from it, then 196 00:26:25.110 --> 00:26:31.830 William Cheng: I mean, some people say oh my internal one. I didn't get points deducted, you know, sometime in the grid or something will miss things. So again, you know, if you're lucky. 197 00:26:32.040 --> 00:26:45.570 William Cheng: And you and somehow the grid. I didn't get the data points for something, Colonel one maybe the greater when I make the same mistake and Colonel to do so. So anyways, I mean, again, you know, the greatest supposed to follow the grading online to the best of his ability. Yeah. 198 00:26:48.150 --> 00:26:55.620 William Cheng: Alright, so, so I guess that's sort of the overview. I'm going to sort of briefly take a look at some of the colonel to, you know, the colonel two files. 199 00:26:58.380 --> 00:27:04.410 William Cheng: That is something below that, see where the special file really in a special file right over here. So again, here's the V note over here. 200 00:27:04.950 --> 00:27:12.060 William Cheng: Right. You're supposed to read from is a particular offset and the device, you have to read it into the buffer. Here's the size of the buffer. So again, 201 00:27:12.300 --> 00:27:18.960 William Cheng: You don't know how to do this because this is done inside the actual file system. So all you have to do over here says if the file is a bright device. 202 00:27:19.590 --> 00:27:24.030 William Cheng: You know, then find the thoughts by device to even tell you what data structures are looking for. So again, 203 00:27:24.270 --> 00:27:32.610 William Cheng: Just search that the data structure inside the kernel source code and then you know also search all over the places that are current source go to see if anything else is using this 204 00:27:32.880 --> 00:27:40.200 William Cheng: If other party inside of kernel is using this data structure to reach the actual process them or to reach the device driver while you just do the same thing. 205 00:27:41.130 --> 00:27:49.050 William Cheng: Okay, some people say, oh, I don't know how to make a function called indirectly it. Well, maybe they look at the rest of the Colonel. See how they do it in directly. It's and then you do the same thing. It's that simple. 206 00:27:50.130 --> 00:27:55.500 William Cheng: Okay, so again read a comment blog and try to understand if you don't understand us that email to me and I'll help you to read it. Yeah. 207 00:27:56.100 --> 00:28:02.100 William Cheng: Alright, so if find this you know it find this a real function pointer and then he called the real function on so again. 208 00:28:02.250 --> 00:28:09.300 William Cheng: It's an array of function pointer. You just need to call the right one. Or, then in that case you invoke the right function that device driver. Right. That's how polymorphous them work. 209 00:28:09.510 --> 00:28:21.360 William Cheng: It works this way for the device driver also work the same way for the actual file system now right over here is that if the file is a block device then return minus e na support it. 210 00:28:22.170 --> 00:28:33.690 William Cheng: OK. So again, you know, this comment blog is from Brown University. Do you have to implement this right so if you implement this, you got to have a way to, to, to test it. If it turns out there's no way to tested, the greater will have to take points off. 211 00:28:34.080 --> 00:28:40.230 William Cheng: What is the best thing for you to do is that it out you know if there's no way to reach the call. I should do the the CO. 212 00:28:40.590 --> 00:28:53.070 William Cheng: Special far right is exactly the same, right. So you need to come and blogs. The same thing name Rida see over here is passing resolutions, so look up your a directory. Right. You try to look up a component name. 213 00:28:53.670 --> 00:28:57.540 William Cheng: So we here at the component name is not is not a string. 214 00:28:58.140 --> 00:29:03.090 William Cheng: Okay, so for example, if I'm looking at slash home slash bc Slashdot over here, right. 215 00:29:03.330 --> 00:29:14.460 William Cheng: The name over here could be appointed to be see over here that directory over here will be a directory in slash home. So inside our home. I look up a component name for BC and this guy's length or b equals to to 216 00:29:14.640 --> 00:29:19.200 William Cheng: I'm only look for a component name, where the first two characters is equal to is equal to BC. 217 00:29:20.610 --> 00:29:31.440 William Cheng: Okay, so that's the requirement over here. So if it turns out I have another directory anchovy clerical PC XYZ or something like that. Well, in that case, that will also be a possible match because in this case I only look for two characters. 218 00:29:32.100 --> 00:29:39.870 William Cheng: There. So I think that when you get here, over here, the name over here. It's going to be, you know, there's no guarantee that it will be zero Terminator well 219 00:29:40.800 --> 00:29:49.710 William Cheng: So I'm going to sell you know if you find that particular component. Then you then you find the I know for that. I know you to create a V node and then you return to vino in the last argument. 220 00:29:50.040 --> 00:29:58.020 William Cheng: Okay, so again, this function return two things. One is the return value over here are the return zero if it's successful a return a negative number, there's an error. 221 00:29:58.440 --> 00:30:09.000 William Cheng: When they return zero then the result over here, you need to pass an address of a vino so this way you will receive the vino that represent this particular I know inside the actual file system now. 222 00:30:10.230 --> 00:30:18.720 William Cheng: If the directory has no look up. So as it turns out that this directory is over here. Again, this is the vino point over here you get, you know, we using polymorphous then there's a real function pointer. 223 00:30:18.960 --> 00:30:24.870 William Cheng: So what do you need to do is that we use an arrow function pointer before you call that function, you got to make sure that the function is not not 224 00:30:25.440 --> 00:30:29.160 William Cheng: Okay, the function is. No, no. That means that that function is not implemented. 225 00:30:29.400 --> 00:30:38.070 William Cheng: Okay, so therefore you tried to perform a look our function in the actual versus them you first you have to check that there's a pointer inside the dirt that will point to the actual file systems. Look up function. 226 00:30:38.370 --> 00:30:48.630 William Cheng: If that you know that function is, you know, is now, then you should you should return the value of each nodder which says that this directory over here is actually not a directory 227 00:30:49.440 --> 00:30:57.000 William Cheng: Okay, so what it means that for some reason you reach the we look a function over here. And you thought there is a directory and then when you try to perform look up function. 228 00:30:57.870 --> 00:31:05.220 William Cheng: So what kind of a file will have a look up. I'm Jim doesn't regular file has a look up on your wall know right because over here is is that we need to find a component name. 229 00:31:05.460 --> 00:31:19.500 William Cheng: Instead of directory. So as it turns out, only at directory file over here for vino right so again vino could represent all kinds of our regular file directory valid device file. They're all files. So in this case, if it doesn't have to look up on June that it's not a directory 230 00:31:21.330 --> 00:31:31.650 William Cheng: Okay, so. So as it turns out, it's really easy to determine whether a vino as a director and I could just look at the look of function if it has a pointer. There's the directory. If it doesn't have a pointer, one that case, you know, it's not directory 231 00:31:32.070 --> 00:31:39.180 William Cheng: Guys over here again the hand over here tells you you know what will. You know what, what kind of air conditioned to return. 232 00:31:40.380 --> 00:31:48.900 William Cheng: That also by the way you know sometimes some of these functions, you need to return more air condition. So, again, when you run BFS test, it would tell you what can air conditioned, you have the happy return 233 00:31:49.320 --> 00:31:55.170 William Cheng: So in because if it's not supporting this function, maybe it's in the function that call this function, you have to support a particular area code. 234 00:31:55.860 --> 00:32:07.980 William Cheng: So gun. Now, this part of the exercise, we need to figure out where is the appropriate place for you to return an error code that it should. It should, yeah. So inside an MP dot see there are three function, you know, the first function is the second or third function. Okay. 235 00:32:10.140 --> 00:32:16.860 William Cheng: All right, this one is surname be over here. So over here, it gives an example. So you need to try to understand that this function. 236 00:32:17.430 --> 00:32:26.490 William Cheng: Dirty and v over here. The first argument is the fastest and path. The second one over here, you pass the the address of the name. And so the second argument is the return value. 237 00:32:27.150 --> 00:32:36.450 William Cheng: Okay, so this one is actually return value. The third one over here is an address of a character point. So again, this one is the return value. The fourth one over here is no and the four of us base. 238 00:32:37.110 --> 00:32:41.490 William Cheng: Basis. The place where you need to perform path name resolution. So in this case, you know, 239 00:32:42.270 --> 00:32:47.610 William Cheng: If this argument is not that means that you have to start doing at the file system hierarchy that rural faster than hierarchy. 240 00:32:47.790 --> 00:32:54.270 William Cheng: And of course, you know, since this first character over here. It's a slash character on that case you need to perform path and resolution and starting from the root. 241 00:32:54.810 --> 00:33:03.390 William Cheng: Okay, if it turns out this is a relative path writing lecture I talked about a relative path is that in this case the base over here. Typically the base is going to be your current working directory 242 00:33:04.020 --> 00:33:07.440 William Cheng: Guys. Okay. Your current working directory is going to be a vino so you start 243 00:33:07.890 --> 00:33:15.120 William Cheng: To perform path and resolution from your current working directory. Right. So if this was now let me say you're starting from the, from the, from the root of the director of hierarchy. 244 00:33:15.870 --> 00:33:24.060 William Cheng: That. So in this case, the last argument over here, again, you know, this one is going to perform path of resolution in the end is going to return the vino. So what does the vino represent over here. 245 00:33:24.510 --> 00:33:31.290 William Cheng: Okay. So, so what it will do is that, you know, if you're given a pass them over here I'm need to perform path name resolution, the one I talked about in class. 246 00:33:31.500 --> 00:33:38.490 William Cheng: Go from the root directory to the next direction next directory. So next directory, all the way to the end over here at the last component over here is going to be a file. 247 00:33:38.970 --> 00:33:50.970 William Cheng: Okay. So as it turns out, the last component will be here if it's just a component name is file if it turns out it's you know it's LS slash at the end over here if you end up with a slash, that means that this component you expect it to be a directory 248 00:33:52.080 --> 00:33:58.320 William Cheng: Okay, so. But yeah, the last character is also very important at the last character is a slash over here. That means that you that you're supposed to find a directory 249 00:33:58.500 --> 00:34:03.510 William Cheng: If the last character over here is not a slash. That means that you're supposed to find a regular file or device follow cetera 250 00:34:05.010 --> 00:34:12.990 William Cheng: So this guy's waiting for one path of resolution, the return value over here. It's going to be the last component. So the name length over your point to the LS characters over here. 251 00:34:13.410 --> 00:34:21.210 William Cheng: Sorry, the name of that over here. Alice has two characters long. So in the end, when this function return, namely should be equal to two and name should be appointed appointed or less. 252 00:34:21.900 --> 00:34:30.540 William Cheng: Okay. So, okay, this kind of like the same argument for look up, look up over here, you know, the last one. Oh pls and that will be the name and the land. They have we go to capture 253 00:34:30.930 --> 00:34:44.550 William Cheng: That. So in this case, when this function return is going to return the last part of your fastest and path which is going to be the file name or directory name and then we will also Rico, you also return a vino that represent a file or directory 254 00:34:46.050 --> 00:34:52.200 William Cheng: Or so you can actually imagine now inside this function. This is where I need to go individually and do the path of resolution. 255 00:34:53.490 --> 00:35:02.940 William Cheng: OK. So again, you know, it's very important to understand this example. So, you know, you know what, what is the expected result right then you write code to make sure that that happens. Yeah. 256 00:35:05.250 --> 00:35:08.820 William Cheng: All right, the open. Maybe you're given a file system path over here. So again, 257 00:35:08.970 --> 00:35:17.160 William Cheng: The second argument over here. This is going to be the same argument as the open system call my the open system for the sake of argument, you want to open the file for read only rerouted or something like that. 258 00:35:17.610 --> 00:35:22.230 William Cheng: So in this case, you know, you need to perform path of resolution for this particular file name. 259 00:35:22.500 --> 00:35:28.560 William Cheng: And the base over here is going to be a current working directory or if it's now. That means that you're going to start doing path of resolution for the root of the 260 00:35:28.860 --> 00:35:38.940 William Cheng: Hierarchy. And again, this one over here is going to be the return value right so you can see the connection between open name V and also between envy function. Okay, as a basic over here. It says, Open name v. 261 00:35:39.900 --> 00:35:44.520 William Cheng: Somewhere, it's going to say, Yeah, over here, is it calls during envy to perform the functionality. Okay. 262 00:35:46.470 --> 00:35:56.280 William Cheng: All right, BFS. This got over here again read the Linux man pages to find out what they are. So again, don't overdo it. Because Linux men pages are some of the function may be really, really long. Okay. 263 00:35:58.080 --> 00:36:07.680 William Cheng: All right. The last one is the open right open. Here's a file system path. And here are the flags, you know, read only rewriting over here again the comment blog over here says a lot of stuff. 264 00:36:08.070 --> 00:36:14.580 William Cheng: So again, you don't have to implement all of them, you know, just implement what's enough so that you pass the test. Okay. 265 00:36:15.810 --> 00:36:24.000 William Cheng: Alright, so that's the end of the slide over here. So what I will do is I will actually look at some of the code over here that are posted 266 00:36:25.290 --> 00:36:25.620 William Cheng: Is it 267 00:36:29.610 --> 00:36:36.060 William Cheng: Alright so I'm in a weakness directory over here, right. So in this case, you know, on the discussion section. 268 00:36:36.990 --> 00:36:46.890 William Cheng: Web page. This says that, here are the codes in slice Duran FC MTL over here, all those files are in the kernel. I'm going to change the directory, Colonel. 269 00:36:47.460 --> 00:36:52.770 William Cheng: Include FS right all this header browser there, right. So if I do an ls over here, you can see that all these files are here. 270 00:36:53.160 --> 00:37:00.720 William Cheng: I'm going to sort of briefly go through all of them are there ran over here is a direct, direct way entry what's inside the directory Angie over here, you can see that 271 00:37:01.230 --> 00:37:04.020 William Cheng: Director engine over here has the I know number 272 00:37:04.620 --> 00:37:16.350 William Cheng: OK. So again, over here, just integer i will be here, followed by the offset. This is the seat pointer for the next entry over here. So in this case, what you need to do is that you can, you know, you can go to a directory structure. 273 00:37:16.830 --> 00:37:29.790 William Cheng: So this one over here with how you you know so well, whereas the offset inside of directory file. Now the next one over here is the component name they call a D underscore name name length over here. So what is the name lane. 274 00:37:32.550 --> 00:37:34.440 William Cheng: Colonel, sorry. 275 00:37:37.200 --> 00:37:42.240 William Cheng: Guys, a name. A over here equals 28 right so we hear this is 29 characters plus 276 00:37:43.290 --> 00:37:52.890 William Cheng: You know, four characters or four bytes over here. So this is 33, you know, plus some other you know four bytes. Not long number over here. So again, this is the directory entry data structure. Okay. 277 00:37:54.810 --> 00:38:05.910 William Cheng: Alright, the next one is FC NTL ah. So what does FC on to the API. So, so I'll be here. These are the way you make the open system Hall. The second argument can be 278 00:38:06.570 --> 00:38:08.010 William Cheng: You know, some of these values over here. 279 00:38:08.280 --> 00:38:15.090 William Cheng: And the bottom over here sort of give you a bunch of additional things that you can offer them together with right. So again, if you look at all these number 280 00:38:15.270 --> 00:38:20.670 William Cheng: They all have a single bit say if you look at the binary representation. They have a single business. So therefore, they can be or together. 281 00:38:20.970 --> 00:38:27.810 William Cheng: Okay. Read Only is equal to zero. Right on equal to one. Rewrite is zero. You know, so we had to go to to 282 00:38:28.680 --> 00:38:39.510 William Cheng: Create over here is zero, x 110 k. So, again, create over here is that when you know when somebody tried to open up awful Korea, you need to check whether the file is there or not, if the file is there already, then creation fail. 283 00:38:40.050 --> 00:38:53.310 William Cheng: That truncation over here is that when you open up this if this was already there. You should truncate the file size zero. So basically zeroing out the file. Okay, a pan over here. So this is a pen to file. 284 00:38:53.880 --> 00:39:01.320 William Cheng: So again, I mentioned that already. So, so remember that some of these smaller income, things are incompatible. So when you start to create does it make sense to truncate 285 00:39:03.000 --> 00:39:08.850 William Cheng: Um, so I guess when you create you're supposed to create a father, that's not there when you trunk kill your truncated father was already there. 286 00:39:09.630 --> 00:39:17.040 William Cheng: I'm not sure whether they're incompatible. And also, again, what you should do is look at these flags and see where are they are us. So let me go back. 287 00:39:20.550 --> 00:39:25.650 William Cheng: So if I if I do a grip. Oh, create over here and the fall is 288 00:39:26.040 --> 00:39:44.940 William Cheng: Is a bfs test right it's in Colonel test BFS test BFS Src guy, so he can see that these are all the places in BFS test that they use to create that. So I'll be curious, as you know, let's say, oh, creates here. Right, so I could do that and then prep or trunk. 289 00:39:46.800 --> 00:39:50.040 William Cheng: Over here, so I guess there's no place that's using Oh, create an old trunk. 290 00:39:50.850 --> 00:40:01.680 William Cheng: You know, in on the same line. So, so, so, yeah, all these things over here it says VM FS called success. That means that this course to be successful. And over here, it says we have called fair to say that this line should fail. 291 00:40:01.950 --> 00:40:08.460 William Cheng: And it also tell you exactly what the air number is supposed to be. So therefore, in your implementation of this particular system call 292 00:40:08.670 --> 00:40:23.160 William Cheng: You can call open is going to call through the path of resolution at the end, you better return he not der otherwise you're going to fail this VM FS test. Okay so so via if I said is great because it tells you exactly what should be the correct Erica, then 293 00:40:24.540 --> 00:40:29.070 William Cheng: Alright, so that's NFC empty out the file control and then 294 00:40:30.240 --> 00:40:38.970 William Cheng: Let's see file dot h over here. So what's he's a father. Ah, so this is the file object I follow up is called file to it has the cursor position. 295 00:40:39.210 --> 00:40:49.380 William Cheng: He has the MO they open the file where there's a reference count. And then there's a vino restaurant exactly what I said before, right, the lecture last one will call the I know pointer. So now over here will be the Beano pointer. 296 00:40:49.650 --> 00:40:57.240 William Cheng: Okay. There's also a function called F. Get that will so F. Get over here. So, so what we'll do is is that, here's a 297 00:40:57.690 --> 00:41:08.220 William Cheng: file descriptor. So go to the file descriptor table to see if this entry is there or not. If this entry is there. What you would do is that you, I think you're supposed to increment the reference count or something like that. 298 00:41:08.580 --> 00:41:13.650 William Cheng: And if you know if this particular file descriptor is the 299 00:41:14.430 --> 00:41:23.730 William Cheng: The pointer is equal to know. In that case, I think you're supposed to create a file object that you're going to create a file object and then you have to set a reference count for the file object to one. 300 00:41:24.030 --> 00:41:31.890 William Cheng: Okay. So, by the way. So remember the difference between a file object in the vino every file object. The for field is that a file object is the vino pointer. 301 00:41:32.700 --> 00:41:38.130 William Cheng: OK, so the one thing that you can even sort of thing about is that, you know, for every file. There's a be note. Okay, and 302 00:41:38.670 --> 00:41:43.350 William Cheng: For every vino it belongs to a file the file cannot exist without the vino vino can exist without a pop 303 00:41:43.860 --> 00:41:58.470 William Cheng: That so I'll be here. So we whenever you create a file, there must be a vino that associated with that. So, starting from the file you can find to be no. All right. The F acquire, I think. You don't have to do anything if ref over here is increased the reference count. Okay, so I think 304 00:41:59.670 --> 00:42:01.230 William Cheng: In F gets over here, it will call 305 00:42:02.010 --> 00:42:11.580 William Cheng: Us. I think the code for F gets written for you already. So just, I guess the code for all these are written for you already. So you should read the file object implementation over here to see it. So I understand how everything works. Yeah. 306 00:42:11.910 --> 00:42:15.000 William Cheng: I put over here is the one that document the reference count. Okay. 307 00:42:16.200 --> 00:42:23.610 William Cheng: That's okay, you shouldn't manual, the increment the reference kind of document reference how you should call this function because they're written written already for you so you just need to understand them now. 308 00:42:24.300 --> 00:42:38.640 William Cheng: The next one is LLC dot h over here. So I'll see that Kasia. So this is what we talked about in the in lecture right there. Success see cursor seek and over here. What about open that he over here. 309 00:42:39.720 --> 00:42:49.980 William Cheng: Okay, open that edge over here. There's do open. There's a get empty file descriptor. So again, for process over here. You can find the next available file descriptor table entry. 310 00:42:50.490 --> 00:42:58.500 William Cheng: So in this case, you call this function and then the standard h over here. This is the one I mentioned before, right over here. Here's the stat data structure a call struck stat. 311 00:42:59.190 --> 00:43:06.270 William Cheng: There are all kinds of stuff the mode of the file. The I know number of the device number to our dev numbers I 312 00:43:06.810 --> 00:43:12.390 William Cheng: Think that's the wrong device that was okay. You know, you don't know how to fill this out, but the actual file system know how to fill this out. So again, you 313 00:43:12.870 --> 00:43:18.300 William Cheng: Have to file system for help. The count the number of hard link to this file user ID group ID. 314 00:43:18.780 --> 00:43:26.100 William Cheng: So I think our weenies doesn't have user doesn't have group. So in this case, I don't really know how they're filled out. So again, read the actual file system call the size of the file. 315 00:43:26.790 --> 00:43:39.300 William Cheng: The time, the last time this file was access the last time this file was modify the file creation time the block size, the number of blocks that this file occupy. So again, you know, for system for file system. We talk about what the 316 00:43:41.010 --> 00:43:48.750 William Cheng: The this map is right so that this map over here, you know, point two blocks and all that kind of stuff. So here's a statistics about the number of blocks over here. 317 00:43:49.500 --> 00:43:55.590 William Cheng: That there's also this thing called the vino mask over here. So, so, so the the mode over here. 318 00:43:56.160 --> 00:44:03.660 William Cheng: So this is not protection mode this mode is actually the fall, Mo, which, which is what kind of father this right. This could be a regular file could be a directory power. 319 00:44:04.170 --> 00:44:10.320 William Cheng: It's also the author of a bunch of these bits together right can, again, you can look at the all these bits are they all these patterns over here. 320 00:44:10.530 --> 00:44:17.370 William Cheng: Every pattern has a single bit turned off. So therefore, the mode over here is going to be a bit wise or have some of these symbols over here. 321 00:44:17.760 --> 00:44:25.590 William Cheng: Okay, so if you want to find out whether a vino, you know, so sorry. So you so so when you try to find find out you know 322 00:44:26.430 --> 00:44:27.810 William Cheng: Find a particular faster than path. 323 00:44:28.020 --> 00:44:34.200 William Cheng: You want to see if it's a directory or. Now, what are you supposed to do, right, you're supposed to make the staff system call once you make the sexism call 324 00:44:34.320 --> 00:44:42.930 William Cheng: You gotta have this data structure filled out and then you check the ST mode over here. And you see, see if a corresponding bit is that, so for example over here for the directory 325 00:44:44.100 --> 00:44:49.950 William Cheng: Right over here, this bit of his directory. Yeah. On this been over here if it said that means is the directory 326 00:44:50.340 --> 00:44:54.660 William Cheng: Okay, so this bit of said that means that it's a character special there is a character device. 327 00:44:55.110 --> 00:44:59.700 William Cheng: This one is blocked special. I mean, this is a block device. As it turns out, they're two different kinds of devices. 328 00:44:59.910 --> 00:45:05.400 William Cheng: They have different array of function pointers. One is a character device that allow you to read and write and stuff like that. 329 00:45:05.550 --> 00:45:17.160 William Cheng: And the other one is called a block device you can only read this data, what not only you can you can get data from, you know, from this device by by reading a block of data at a time. Okay. So look at the difference between sequential I O and block. 330 00:45:18.300 --> 00:45:24.240 William Cheng: Right. So this one means that it's a regular file this one means is as soon as bollock Lee and this one is implemented. This means that 331 00:45:24.750 --> 00:45:34.350 William Cheng: It's actually a Unix pipe. So I think for weenies we are not implemented the UNIX pipe. So again, okay, ignore this. And also you can if you give a mo to one of these 332 00:45:34.680 --> 00:45:42.090 William Cheng: Macros over here if you want to find out if something is the directory or not, you will take your call this this macro. So is there. 333 00:45:42.330 --> 00:45:51.360 William Cheng: Am over here. So what do we do, is that it actually do this call to see if the type over here is contained this particular bit if it contains pretty good one, then it's a directory 334 00:45:51.810 --> 00:46:02.070 William Cheng: OK. So again, you know, this you know this, the staff out ah over here is very important because if you need to find out whether it's a regular file or directory file, you should use the the macros inside this file. 335 00:46:04.140 --> 00:46:15.630 William Cheng: BFS dot h over here. What does that look like over here. So over here, these are the the file system operation over here. Okay, so, so here's the FS FS that's will file system. 336 00:46:16.200 --> 00:46:31.200 William Cheng: The file system operation over here. You can read the vino you can delete a vino you can add you can create a vino a you cannot amount of vino okay so so they don't. When you look at some of the colonel to code what it would do is, I will you start using the disk, right. So, I guess. 337 00:46:32.250 --> 00:46:34.710 William Cheng: The first part. Yeah. 338 00:46:37.290 --> 00:46:44.670 William Cheng: I'm trying to remember where the first part you have to worry about mounting the bfs hard drive or not. I actually can't remember whether you have to do that or not. 339 00:46:45.360 --> 00:46:50.190 William Cheng: Alright, anyways. So there's the thought system operation over here. So they sound kind of weird. 340 00:46:50.670 --> 00:47:00.480 William Cheng: You know, so, so, yeah, when you try to read data on a disk over here. You're going to read one block at a time so so so in this case you need to actually go to read the entire vino from particular file. Okay. 341 00:47:01.650 --> 00:47:03.000 William Cheng: Then there are these 342 00:47:04.080 --> 00:47:13.620 William Cheng: You know, do these other pointer over here for the file system operations over here. FS opti that's the data structure. We just saw before. FS opti over here. 343 00:47:14.130 --> 00:47:21.930 William Cheng: So inside of our system over here for fastest them. We're going to also have an array of function ponder in them so so so that that's what I just saw it over here. 344 00:47:22.470 --> 00:47:33.120 William Cheng: So, by the way. So in the weenie source code, every time, will you see something's something's off the LPs that's operations. That means that it contains an array of function pointers. Right. So if we look at this one. 345 00:47:34.740 --> 00:47:43.650 William Cheng: If we look at FS up over here, you can see that this is right, this code over here, you know, if you go to all the comments over here. Again, it's, it's an 346 00:47:44.220 --> 00:47:50.190 William Cheng: Asterix surrounded by period parenthesis. It's a function pointer return nothing, and then the argument over here is the vino 347 00:47:50.700 --> 00:48:02.910 William Cheng: All these functions over here look the same, right. The last one will be allowed the first, the argument over here. It's the fastest them and not a vino there. So again, this is just an array of function pointer. Anytime you see, oh, PS, that's a real function pointers. 348 00:48:04.350 --> 00:48:12.000 William Cheng: Alright, so this is what does it look like it's instead of device. And there's a file system type, you know, and then I guess once you 349 00:48:12.960 --> 00:48:25.020 William Cheng: Turn on mounting so again mounting by Dr. Equal to fall. So don't implement any of these things over here. There's an array of function point over here for the file system. And then there's a way of function pointer over here for the vino 350 00:48:26.160 --> 00:48:30.540 William Cheng: OK. So again, every vino we're using polymorphous ever been or has a real function pointer over here. 351 00:48:31.080 --> 00:48:39.060 William Cheng: So over here, it says, you say, Here's a real function pointer for the root process that right. So again, when you started out with our system. There's only one 352 00:48:39.360 --> 00:48:47.550 William Cheng: There's only one. I know there's one vino and that's Ruby now. So the Rubino over here, we need to be able to tell the Rubino to to to to create a file. 353 00:48:47.970 --> 00:48:58.920 William Cheng: The site to create a directory to do all kinds of stuff. So therefore, we better have a pointer to the Rubino ok so the idea here is that every file system, we're going to end up having a vino to the Ruby note. 354 00:48:59.490 --> 00:49:03.960 William Cheng: Okay. So guys, starting with the the root of the file system hierarchy. This way you can reach the entire file system. 355 00:49:04.740 --> 00:49:10.290 William Cheng: Okay, so yeah. For every file system that you use, if you want to, you know, traverse the entire file system hierarchy. 356 00:49:10.560 --> 00:49:14.850 William Cheng: All you need is a pointer to this data structure because once you find a data storage and assist them. 357 00:49:15.060 --> 00:49:23.730 William Cheng: You can use the FS root field to find the root of the process them and the root of the process that is going to be a vino once you find the email you can traverse the entire file system hierarchy. 358 00:49:25.020 --> 00:49:33.270 William Cheng: Alright, so again this is going to be the starting point. So, so if you have multiple process. I'm going to end up with multiple FS underscore te over here. So again, this one is just a 359 00:49:34.740 --> 00:49:35.910 William Cheng: Just a data structure over here. 360 00:49:37.560 --> 00:49:43.260 William Cheng: Okay. So you mean as you are encouraged to the, the other foster son is going to be the ranch houses them. 361 00:49:43.470 --> 00:49:53.970 William Cheng: So again, it's gonna be a poly morphic you know fosters and data structure is going to be rough houses that when you go to Colonel three. It's going to be the system five offices them. So again, we're going to use exactly the same data structure to point your different pointers. Okay. 362 00:49:55.020 --> 00:49:58.380 William Cheng: All right over here. There's a goal variable called VM FS route via 363 00:49:59.280 --> 00:50:07.440 William Cheng: Via so this, you know, this point is of, you know, pointer. So, so again, just like current proc or something like that. Right. They tell you what the current process and running out of CPU. 364 00:50:07.620 --> 00:50:16.770 William Cheng: We also going to have a current thousand sad and this is going to be the DFS reach Ruby yet right so you always know where the root of the file system as 365 00:50:17.490 --> 00:50:25.920 William Cheng: Well, so again weenies were doing a toy toy toy operating system. There's only one file system. So anytime you want to go to the root of us as well. Use the global variable. 366 00:50:26.430 --> 00:50:32.670 William Cheng: Okay, this global variable. I think if you read the comment block insider proc run it says I Insider Program. 367 00:50:32.970 --> 00:50:42.390 William Cheng: This is where you need to set you know said this variable, right. So, so why does it get out of idle pod run this variable should be initialized. So, therefore, you can do all kinds of stuff with your file system. Yeah. 368 00:50:43.290 --> 00:50:53.010 William Cheng: All right, DFS shut down. I think this is called at a later time. They're also look up their name be all right. Anyway, so there's a bunch of function over here. So at the end over here. 369 00:50:55.320 --> 00:51:06.720 William Cheng: There's a bunch of, you know, guess cwt over here. So again, we're not implementing that we're not implement mounting so so ignore all that kind of stuff. Yeah. Alright, the next one is BFS Cisco over here. 370 00:51:07.560 --> 00:51:14.280 William Cheng: Okay, so if you look at the function over here. So again, these are the function that we saw before. So again, you're not doing mountain so so so you don't have to do that. 371 00:51:16.050 --> 00:51:25.650 William Cheng: That's we still have a few minutes. Let's look at the phase ones that will be here on the right will then look at idle proc run Colonel so going to go back 372 00:51:26.940 --> 00:51:38.190 William Cheng: Curnow main right K Mendes. See that look for capital BFS right so Insider Program. These have this not yet implement it. So, so in this case. 373 00:51:38.730 --> 00:51:47.700 William Cheng: You have to basically follow the instructions there, right. What else is there BFS when it shut down over here, this code will be unable, again, this is inside idol proc run 374 00:51:48.180 --> 00:51:58.080 William Cheng: Okay, so we're here when you should be familiar with this code, right. This is called word wait for the idol. The unit process to die when they process to die, it will start executing this co 375 00:51:58.320 --> 00:52:03.810 William Cheng: MT p is equal to zero. So, this co won't be executed this co won't be executed at Colonel one 376 00:52:04.290 --> 00:52:12.240 William Cheng: VM FS is fall. So, therefore, this code is not executed, not in Colonel to what he would do is that it will start printing this message over here to say DFS shut down. 377 00:52:12.540 --> 00:52:24.300 William Cheng: And then it will call the put on the current working directory. So again, we put his detriment the reference count on the vino right so in this case current proc has a current working directory. So that should be a vino 378 00:52:24.810 --> 00:52:27.960 William Cheng: Make sure it doesn't point to know because otherwise you're going to get you going to crash right here. 379 00:52:28.230 --> 00:52:40.650 William Cheng: And then he will shut down BFS. If it turns out you cannot shut down BFS over here, you're going to see a VM shutdown fail. And then if you look at the wedding gamma is gonna lose points because in this case, he will never get to the how the cleaning message. 380 00:52:41.400 --> 00:52:54.630 William Cheng: Or has it again if you don't get to how to clean a message over here, you're gonna end up losing points. So make sure that the FS shut down we associate done correctly. So again, if you're a reference counting is wrong BFS will refuse to shut down. So in that case will be bad. Yeah. 381 00:52:56.160 --> 00:53:06.180 William Cheng: Alright, so that's idle proc Ron and then to make her over here. So we saw those functions already. So let's take a look at, again, push the 382 00:53:09.720 --> 00:53:13.470 William Cheng: Oh, so we need to look at, you know, BFS Cisco Darcy. 383 00:53:14.670 --> 00:53:28.470 William Cheng: Colonel FS BFS Cisco Darcy to make her. Okay, so this one is not yet, not yet implemented to make node. Okay, this one is also not implemented. 384 00:53:29.040 --> 00:53:36.810 William Cheng: So inside this fall over here. Is there anything implemented redesign implemented right okay so this part, I guess none of the functions over here, implement it. 385 00:53:38.250 --> 00:53:43.770 William Cheng: Or is there something that's implemented okay yeah I guess none of the function of your employment. So you have to implement them. 386 00:53:45.030 --> 00:53:48.420 William Cheng: So good. Find the pointer. So again, reading section there. And then, you know, 387 00:53:48.780 --> 00:53:59.790 William Cheng: Then, and then follow the instruction. I mean, some of them are a little more complicated. Okay, so over here. So this is, I read over here, you can see that the read over here is a little more complicated. Okay. And the right is going to be more complicated. 388 00:54:00.420 --> 00:54:08.010 William Cheng: But some of the functions over here. It's going to be, you know, like do make note over here. I mean, you know, again, DFS doesn't know how to do anything like 389 00:54:09.390 --> 00:54:16.380 William Cheng: Anything about it. So, therefore, he has to call the actual file system. There are also some functions that are completed as I PFS right for example LC 390 00:54:19.200 --> 00:54:22.800 William Cheng: LC functions function we're just changing the cursor position. So this case. 391 00:54:23.370 --> 00:54:28.080 William Cheng: You sort of need to know how big the of the fall. So in that case, you might need some help from the actual versus them. 392 00:54:28.470 --> 00:54:35.850 William Cheng: OK. So again, he said this fall over here, some of the functions are mostly in BFS, some of the functions are mostly in actual file system. So, again, as you define a function, Paul. 393 00:54:36.300 --> 00:54:48.000 William Cheng: funk function pointer and then call that some of the function a little more involved. Just like read and write. So again, you know, read the, you know, you know, read a comment blog over here. It has a lot of information there. And you'd be a question, send me send me email. 394 00:54:49.620 --> 00:54:58.500 William Cheng: All right, functions in envy over here. So I guess we already, you know, sort of look at them VI Colonel FS name the see 395 00:54:58.770 --> 00:55:05.010 William Cheng: Over here. Those are the function. There are not implemented look up is not implemented during the NBA is not implemented open MBA is not implemented right 396 00:55:05.700 --> 00:55:11.820 William Cheng: The rest of it as guests CW BD over here. So, therefore, you are not, you know, don't, don't, don't look at out. Don't waste time of those things. 397 00:55:12.690 --> 00:55:24.000 William Cheng: So these other thing you have to implement to open Colonel FS open see over here. So again, there's lots of information right here. Okay, so again, you might not have to implement everything 398 00:55:24.630 --> 00:55:27.540 William Cheng: The get empty file. Did the file descriptor over here. 399 00:55:27.930 --> 00:55:39.450 William Cheng: So this is the rule for Linux or Unix system. Will you try to create a new file, you need to get a new file descriptor. You need to scan the file descriptor table, find the first one that's open. So again, this is the code that actually does that. 400 00:55:39.780 --> 00:55:42.570 William Cheng: Yeah, so this is implemented for you already. So you don't have to do anything. 401 00:55:44.580 --> 00:55:51.540 William Cheng: Oh I guess one of the things I need to mention, I guess, special file re Colonel FSB no see special 402 00:55:52.770 --> 00:55:53.820 William Cheng: We need 403 00:56:01.260 --> 00:56:05.790 William Cheng: A special for our readers over here. So it's not yet implemented over here, right. So, 404 00:56:07.020 --> 00:56:07.350 William Cheng: Let me 405 00:56:11.640 --> 00:56:26.070 William Cheng: Okay, so. Oh, yeah, yeah. Here is the vino operations right again a real function pointer over here. They are all these functions over here. So, this one says, For by device, the function read and write it and malfunction or implement it. Okay. 406 00:56:27.660 --> 00:56:29.700 William Cheng: What about for a 407 00:56:34.470 --> 00:56:40.710 William Cheng: Therefore block device over here. So as you can see that you know the are these, these are a function pointer over here they are, you know, 408 00:56:41.280 --> 00:56:45.060 William Cheng: All of these functions are not the only function that's available here is for stack. 409 00:56:45.450 --> 00:56:52.950 William Cheng: Okay, so for block device you can call stack stack on it before the character device you have a lot more functions that you can use. Okay. You can you can 410 00:56:53.340 --> 00:56:59.130 William Cheng: Read Write a map or something like that none of these things has created. Make note or something like la look up 411 00:56:59.700 --> 00:57:10.680 William Cheng: OK. So again, so I think I'm going to sort of stop right now. So next time. What we're going to do is that we're going to sort of take a look at the the referral system code. And also, you know, 412 00:57:11.820 --> 00:57:19.440 William Cheng: Take a look at these are real function there. So one last thing I want to mention over here. If you look at the ref over here. There we need to worry about reference counting 413 00:57:19.830 --> 00:57:25.770 William Cheng: reference count for the vino is incremental and documented in the ref and there's another function called be put 414 00:57:26.640 --> 00:57:34.140 William Cheng: OK. So again, you have all the functions. Over here, we put right so so the rep implement the reference count v. Put that command the reference cow. 415 00:57:34.980 --> 00:57:39.480 William Cheng: The code over here is pretty long, but I strongly recommend you to try to understand how this works. They're 416 00:57:40.260 --> 00:57:47.910 William Cheng: All right, so why important thing over here is I used to see that, you know, these function over here. They use db, db GV and rep over here. 417 00:57:48.540 --> 00:57:50.940 William Cheng: So look at your config. I am K 418 00:57:51.390 --> 00:57:59.070 William Cheng: To see if they mentioned the word VN ref in lowercase and then look at a comment there to see how you should turn it on that one. Well that's turn off. 419 00:57:59.250 --> 00:58:10.860 William Cheng: Than when whenever you call this function. They actually print out a lot of information about your vino so every time. So, so if I look for the big V and ref over here you will see that it's caught in the rough, it's calling v get 420 00:58:11.700 --> 00:58:16.380 William Cheng: So what function is this. This is also V get by the get us here we get us here. 421 00:58:16.770 --> 00:58:23.580 William Cheng: It's also calling the put over here. So if you have, you know, reference counting bug you should, you know, turn this thing on. So this way. 422 00:58:23.820 --> 00:58:31.650 William Cheng: When these talks and get I'll get caught, you will see them onto the screen. So this way you can actually figure out, you know, what will happen to be know whether it's over reference and under reference 423 00:58:32.310 --> 00:58:42.120 William Cheng: The problem with the reference counting is that, you know, everybody might do it in a different way. Some people will over reference it but as long as you over reference it and you detriment. The number of references exactly the same way as you over reference 424 00:58:42.270 --> 00:58:49.470 William Cheng: While India is going to be okay. Okay, so if you ask them, the cost Google group. What is the right reference count for this vino you're going to get different answers. 425 00:58:50.610 --> 00:58:57.540 William Cheng: Alright, so again, you're asking that question you could ask that question, but you need to understand that you know other people might have a different number. And that's perfectly okay 426 00:58:57.780 --> 00:59:05.820 William Cheng: As long as whatever you add it. You remove them at the right time in the right place. And this is really no problem. Okay, so everybody will have a different kind of, you know, 427 00:59:07.290 --> 00:59:07.530 William Cheng: All right. 428 00:59:08.550 --> 00:59:15.870 William Cheng: Okay, so that's this is you get it good. You're going with, you know, Colonel to if you have questions, as usual, please send me email. Okay. 429 00:59:17.070 --> 00:59:26.250 William Cheng: And also, you know, with the live lecture and the life discussion section or even my office are, feel free to feel free to ask me questions about, you know, Colonel to okay 430 00:59:27.990 --> 00:59:28.740 William Cheng: All right, I see it.