WEBVTT 1 00:00:02.909 --> 00:00:15.570 William Cheng: Okay. Welcome to Week five discussion section. So last time we were talking about the overview of Colonel assignment. So I'm just going to finish that first and then talk about Colonel one 2 00:00:16.800 --> 00:00:25.530 William Cheng: So I guess last time we'll start talking about grading. So again, grading for the colonel assignment. It's very, very different from the warm up grading. 3 00:00:26.100 --> 00:00:38.100 William Cheng: So make sure you look through the grading guidelines and also guess the the spec. There's also a lot of instruction. So I'm going to sort of mention a few strange you know items in the in integrating online today. 4 00:00:38.640 --> 00:00:48.090 William Cheng: So again, it's important that you read them and anytime you're confused or you're not sure about something please make sure you asked me, don't assume that you know that doing some things. Okay. 5 00:00:48.720 --> 00:00:58.200 William Cheng: So if there's anything that's that that's confusing. A please make sure you ask me that, or so. So as I've already mentioned some of the important stuff that you have to pay attention to. 6 00:00:58.980 --> 00:01:09.360 William Cheng: That we also start talking about, you know, one of the new requiring the kernel source code is that the greater is going to start reading your kernel source code and the warm up assignment. It doesn't really matter what you do. 7 00:01:10.200 --> 00:01:23.820 William Cheng: You know, most of the time we don't read your source code on, you know, unless the grading gun I specifically said that with that, we're going to check your check your source code. Yeah. So now for the Colonel, Simon. One of the most important requirement is that the colonel is very, you know, 8 00:01:25.170 --> 00:01:33.930 William Cheng: It's very, very delicate is very important. So one of the requirement over here is that you know you need to make sure that you don't leave any useless code inside the kernel. 9 00:01:34.380 --> 00:01:40.290 William Cheng: Okay, if you end up leaving any code that inside the kernel that are useless. We're going to deduct points from your assignment. 10 00:01:41.130 --> 00:01:45.120 William Cheng: Okay, so some people like to write a lot of code and then turns out another call is very useful. 11 00:01:45.600 --> 00:01:52.530 William Cheng: So in that case, you're going to be very careful when you try to write some code, you got to either clean it up or make sure that every line of code that you write are useful. 12 00:01:53.040 --> 00:01:59.910 William Cheng: Okay, so, so, so, so, you know, so this is referred to as a self check requirement, your kernel source. 13 00:02:00.330 --> 00:02:05.280 William Cheng: We give 10 points for self checks. Okay, so if you if you want to leave a lot of jumping. So your current or at 14 00:02:05.670 --> 00:02:10.350 William Cheng: Least. Let's go. These are you heard of as perfectly fine if you're out. We will feel willing to lose 10 points. 15 00:02:10.680 --> 00:02:17.160 William Cheng: Okay, if you want to make sure that you don't lose those 10 points, then you have to clean up your kernel source code. Okay. 16 00:02:17.850 --> 00:02:25.140 William Cheng: Alright, so let's talk about what that look like. So what is the useless color. For example, you know, if you have a cold look like they say if condition and then you have a 17 00:02:25.560 --> 00:02:31.710 William Cheng: So over here is called a coast sequence or so of course sequence is simply lines of C code. Okay, that doesn't have, you know, 18 00:02:32.250 --> 00:02:35.760 William Cheng: Again, if this if there's any embedded IV and if then else anything 19 00:02:36.240 --> 00:02:42.030 William Cheng: Else, then, then we're going to end up with a co sequence instead of course sequencing, because it's that whole sequence. Right. It's gonna be very, very corrosive 20 00:02:42.240 --> 00:02:49.500 William Cheng: So let's take a look at the city. The simplest example over here, which we just have a sequence of CO each one of them is one my you make make a function call, but you always return 21 00:02:50.640 --> 00:02:55.530 William Cheng: Okay, so if you make a function call. You don't return, then it's time to go to. So in that case is really part of the code sequence. 22 00:02:55.680 --> 00:03:02.460 William Cheng: So I'm going to sort of take a look at a few very, very simple stem and maybe as subtract may function or something like that. So here will be a sequence of code. 23 00:03:03.180 --> 00:03:10.470 William Cheng: Okay, if the condition over here is never true. It can never be true, even though is that, you know, for example, some people allocate memory. They want to check in. 24 00:03:11.820 --> 00:03:18.960 William Cheng: memory allocation is fail. What if memory allocation can never fail. Well, then in that case this coast sequence is useless coat 25 00:03:19.890 --> 00:03:29.460 William Cheng: Okay, so if condition can never be true, then the CO sequence over here is going to be active declared to be useless. Okay, so if you call if you leave this kind of coincide your current or 26 00:03:29.640 --> 00:03:33.810 William Cheng: If it turns out the CO, CO sequence over here is useless. Then we're going to need that points for you. 27 00:03:34.950 --> 00:03:43.110 William Cheng: Alright. So so the so so the trick. Over here is not to to to have called like that. Right. So one thing that you can do is that you know if this condition over. You can never happen. 28 00:03:43.320 --> 00:03:50.550 William Cheng: What you can do is that you can actually replace this with the assertion to say that assert as as the RT not condition. 29 00:03:51.480 --> 00:03:58.080 William Cheng: Yeah. So when you say a certain condition, that means that you're declaring that this condition will always be false, right, because false. Excellent. 30 00:03:58.650 --> 00:04:07.770 William Cheng: Exclamation mark false that's equal to two. So you basically asserting something that's always true or so if you do something like that, then you know the sequence of courses is gone. 31 00:04:08.850 --> 00:04:21.000 William Cheng: Okay, so what I want you to do is that if the CO sequence over here can never be executed, you should replace this code with an assertion statement right instead of Colonel, there are plenty of examples of how do you how to make a kernel assertion. So again, 32 00:04:22.530 --> 00:04:24.570 William Cheng: You should you you you should use called like that. 33 00:04:24.930 --> 00:04:37.410 William Cheng: Right. Otherwise, so if you don't do that, right, then that means that this code sequence is useless. So this consequences useful. So you have to tell the greater how you know what has to run to execute this because he was 34 00:04:37.890 --> 00:04:47.400 William Cheng: There. So to demonstrate that co sequel is useful, you must tell the greater which test to run to reach the end of the CO sequence. I hope he has a co sequence like this. 35 00:04:48.060 --> 00:04:56.130 William Cheng: One of your program die, you know, what if a girl died in the middle of your then you'd never reached the end of, you know, what then in the end it so so so the last few seconds over here is again, they are useless. 36 00:04:56.490 --> 00:05:07.530 William Cheng: Yeah. So in order to do to demonstrate to the greater that that every line of code over here instead of course sequences useful, you have to demonstrate that you have to tell the greater how to reach the end of this post request. 37 00:05:08.370 --> 00:05:10.800 William Cheng: Reservation, the beginning is no garage in the middle of nowhere. 38 00:05:11.010 --> 00:05:14.610 William Cheng: You have to cover the grid, how to reach there. So the way we're going to do this is that 39 00:05:14.730 --> 00:05:25.590 William Cheng: You must add something called a conforming DVD call again if you read the spec. There's plenty of places, talking about conforming Davies, you call because people always get confused by it. So that's why I came up here, you have to explain it over and over and over again. 40 00:05:25.920 --> 00:05:39.600 William Cheng: Okay, so you're required to add a conforming DPC call at the end of the CO sequence. Right. So therefore, the co sequences here, you have to enter conforming DVD called right after the end. Okay, so therefore your coat have to look like this. 41 00:05:40.890 --> 00:05:49.470 William Cheng: Okay, so, so if you're declaring that this coast sequence is useful, you have to add a conforming DVDs. You guys are conforming to you because you got them is that it has to be in this format. 42 00:05:49.740 --> 00:05:56.910 William Cheng: If it's not in this format that you can end up losing points, right, so, so, so, so what does this one I read this one has to be, you know, a function called dvd 43 00:05:57.180 --> 00:06:07.170 William Cheng: The next one over here, this has to be a big print some people use some other stuff. I don't understand why because the specs is very, very clear to say you have to use DVD print. Otherwise, you're not going to get any credit 44 00:06:08.220 --> 00:06:15.690 William Cheng: Okay. So, therefore, you have to be vigilant over here and then follow it. There's a single stream over and there's nothing afterwards. So even though this function can look like a printer. 45 00:06:15.900 --> 00:06:21.570 William Cheng: You can have a bunch of stuff afterwards. But you are not allowed to do that because otherwise it will not be a conforming DVD call 46 00:06:22.080 --> 00:06:31.500 William Cheng: Right. And then what you do is that you put you put a double call on and then you put a pair of parentheses, followed by a backslash and inside the parentheses. The first few character has to be grading. 47 00:06:32.190 --> 00:06:35.940 William Cheng: Raza this one because this is this is for self grading. So you right to the streets, a gradient 48 00:06:36.360 --> 00:06:42.720 William Cheng: And then followed by four different things. The first one over here is the pound sign over here the pound sign needs to be the assignment number 49 00:06:43.110 --> 00:06:48.210 William Cheng: Okay, so we have currently one two and three is over here, this pasa, you have to say, you know, don't put a pound sign there. 50 00:06:48.480 --> 00:06:53.640 William Cheng: Okay, you have to say one, two or three right so this one will be reading my grading one waiting to upgrading three 51 00:06:53.880 --> 00:07:00.990 William Cheng: The sob here is going to be a section number in the grading guidelines. So you're telling the greater which test to run from the grading guidelines. 52 00:07:01.560 --> 00:07:06.990 William Cheng: OK. So the message over here is that to get to this line of coal. The or greater please run this test. 53 00:07:07.770 --> 00:07:10.170 William Cheng: Okay and this will be the section number in the grading and I'm over here. 54 00:07:10.620 --> 00:07:16.830 William Cheng: So this is typically going to be B C D or so again you have to read the grading guidelines to know exactly what you put down here. 55 00:07:17.190 --> 00:07:28.140 William Cheng: Okay, and some testing the grading Ghana has a sub task and sub sub test has as an item number. So in this case, so the other two x and y over here are optional. Okay, if you know so so so 56 00:07:28.590 --> 00:07:43.650 William Cheng: So, so, so, so the exception be over here, we have to stop test one and two guys in order for you to tell the grid and say runs you run a test be run sub test one in Section B, then you will put over here be followed by space, followed by one 57 00:07:44.760 --> 00:07:55.830 William Cheng: That if it turns out that section P has no sub tasks or there's no way to run the sub tasks individually, then all you have to do pro over here is to reboot before the section number and the x one x out wide over here, you know, 58 00:07:56.550 --> 00:08:05.100 William Cheng: You should not write anything on it. OK. So again, for detailed look at the grading guidelines scroll all the way to the bottom, it will tell you what are the possible string that you can put there. 59 00:08:05.700 --> 00:08:15.480 William Cheng: Now, alright, so here the section number if applicable. If a if a test doesn't have a sub test or if there's no way for you to run individual sub test separately. Well, then, in this case, they will not be as 60 00:08:15.810 --> 00:08:25.680 William Cheng: Applicable so then they have to leave it up and leave it up if the sub has over here also have an item number. Why, in that case, you have to also specify the item number and if the item number can be individually. 61 00:08:26.940 --> 00:08:37.290 William Cheng: That tasks can be individually run. OK. So again, it has Hope I make it very, very clear that you're required to start something like this, otherwise you're going to end up losing up to 10 points. 62 00:08:38.400 --> 00:08:49.920 William Cheng: All right, so. So again, if you have any code that you don't visit the best thing is to take is changing into assertions day, man. So this way you can get rid of all these codes. But if you end up you know you you have a coat sequence, what then you have to follow these rules. 63 00:08:51.030 --> 00:08:54.300 William Cheng: Right. So if you're confused about this. Make sure you send me email. Yeah. 64 00:08:55.980 --> 00:08:59.760 William Cheng: Alright, so let's talk a little bit more about the grading guidelines at the beginning as usual. 65 00:09:00.180 --> 00:09:05.640 William Cheng: Is divided into two sections. One is called the plus point section that the other ones called the you know the minus point section. 66 00:09:06.090 --> 00:09:13.110 William Cheng: So the plus one section over here. Section A is special. Okay, so it's actually a is no as the mandatory K asserts 67 00:09:13.440 --> 00:09:18.240 William Cheng: Okay, so basically what I'm doing over here is that I'm going to try to help you write a few lines of code is that the Colonel. 68 00:09:18.810 --> 00:09:23.580 William Cheng: By telling you what lines to put inside certain functions. So I actually giving you cheap points to earn 69 00:09:24.570 --> 00:09:33.360 William Cheng: Okay, so, so make sure you take advantage of it. So organizations that the section over here, there's you know in the in the green. Again, it tells you exactly what line to put inside which function. 70 00:09:33.840 --> 00:09:39.690 William Cheng: Okay, will also tell you that you should put this function near the beginning, the middle or near the bottom so so so again. 71 00:09:39.960 --> 00:09:46.230 William Cheng: The, the beginning, the middle of the bottom. Those are all suggestion. We don't have to put it exactly the beginning. Oh, exactly at just somewhere around there. 72 00:09:47.010 --> 00:09:53.370 William Cheng: OK. So again, read the. Yes. So these are called chaos Thursday, man. They are inside the colonel you assert that some condition is true. 73 00:09:54.420 --> 00:10:01.320 William Cheng: Okay, so again I'm trying to help you to write some code there and give you some free points. Okay, so make sure you, you, you, you. 74 00:10:01.890 --> 00:10:09.000 William Cheng: You take advantage of that. Yeah. So, so these things are the assertions that matter I the example that I wrote before. So why did you say kiss or something over here. 75 00:10:09.180 --> 00:10:16.890 William Cheng: You are. You're asserting that a certain condition is true. Yeah. So in order for us to make sure that this particular tests actually get it get executed. 76 00:10:17.160 --> 00:10:22.830 William Cheng: What you have to what you have to do is that also immediately after these care. So you also need to add a component DVD call 77 00:10:23.370 --> 00:10:30.990 William Cheng: So gather component division called we will look like this. Right. And if this you know if this one is for cancer for section, you know, a, you know, 78 00:10:31.470 --> 00:10:46.050 William Cheng: You know, a subsection five an item be over here that is a.five.be a five be over here, then in that case the conformity big call you have to make is that a over here will be at the intersection of you will be a and then this one will be fine. And this one will be will be be 79 00:10:47.250 --> 00:10:53.970 William Cheng: OK. So again, read the spark read the grading guy and find out exactly what you have to put their guys on anyways, I'm not going to get into too much into it. 80 00:10:54.240 --> 00:11:02.700 William Cheng: Then just mentioned that these cancer must be immediately followed by a compliment DVD DVD call. So that will be one place that you will need to conform to give you a call. 81 00:11:02.880 --> 00:11:08.760 William Cheng: Is for the mandatory cancer and that correspond to Section eight of every, every one of your current assignment. 82 00:11:09.540 --> 00:11:11.760 William Cheng: That and the other place that you will use 83 00:11:12.120 --> 00:11:24.330 William Cheng: Your company TVs, you call is simply for self check. So again, read the grading guidelines, one of the section is no self check and again that's that's assigned 10 points and then you are required to use conforming DVD call at the places that I just mentioned before. 84 00:11:25.590 --> 00:11:28.440 William Cheng: OK. So again, if this is confusing, you know, send me email. Yeah. 85 00:11:29.880 --> 00:11:42.060 William Cheng: All right, so yeah. Please read the grading is very, very carefully. When in doubt, you have to ask the instructor, so, so I think it's best that you don't ask the TA. Okay. Someone I wrote up all these rules over here, it's best that you clarify that with me. 86 00:11:43.770 --> 00:11:53.070 William Cheng: All right. Alright, so, so, so in the plus one is over here I. The first one is called cancer. The manager care, sir. The last one is called self check all the other one is good. No as pre contest. 87 00:11:53.550 --> 00:12:02.910 William Cheng: Okay, so these are the tasks that you have to the most of the tests are written for you already. So all you have to do is to implement or you have to implement so you pass all the tests. 88 00:12:03.420 --> 00:12:10.350 William Cheng: OK. So again, the pre cancers over here are sort of Colonel assignment dependent. So again, you have to read the instruction very, very carefully. Yeah. 89 00:12:12.390 --> 00:12:19.290 William Cheng: Alright so conforming DVD called we already talked about it, right. So, therefore I'm going to skip it again. When in doubt, as an instructor 90 00:12:20.190 --> 00:12:26.970 William Cheng: Alright so here is your sort one day we will comment just an example from the spec right to show you that if you have cold and look like this. 91 00:12:27.150 --> 00:12:37.260 William Cheng: Here's co sequence number one here. It's costly was number two here costumers number three and CO sequence number four. How do you demonstrate to the to the greater that co sequence 1234 they are all useful. 92 00:12:38.640 --> 00:12:47.670 William Cheng: Okay, so, so over here that these on the right hand side over here show you what the requirements are. You have to put a conforming DVD called at the end of every call sequence, right, so we're 93 00:12:47.880 --> 00:12:56.910 William Cheng: Follow the sequence one or two over here, you have to put a component DVD call a sequence number three. Do you have a good compliment DVD called here. What about sequence number one over here. 94 00:12:57.930 --> 00:13:07.590 William Cheng: Well, so in a way you know i mean signals that one over here. You don't have to put a compliment DVDs, you go at the end because once you pass sequence number one over here, you have to execute either sequence number two or three 95 00:13:08.490 --> 00:13:15.510 William Cheng: Right. So, therefore, if the greatest sees either confirm and DVD call over here get printed onto the screen or, you know, this conforming DVD called 96 00:13:15.750 --> 00:13:23.220 William Cheng: Dragon put onto the screen there for the grid. The greater would know that you must have passed sequence number one, so therefore sequence number one is not useless call 97 00:13:24.540 --> 00:13:29.760 William Cheng: Okay, so if you call it look like this. You have to put a compliment. If you go right here and comedy right here. What about sequence. 98 00:13:31.110 --> 00:13:38.460 William Cheng: The sequence number four over here, right. So the requirement because at the end of sequence number four over here. You also have to add a compliment GVHD call 99 00:13:39.840 --> 00:13:48.030 William Cheng: Okay, so, so again. So, so if you have code that look exactly like this, then you are, you are required to put on put in three conforming jeebies you call 100 00:13:48.390 --> 00:13:56.010 William Cheng: Okay, so every DB every conformity vehicle, you're going to tell the greater to run this to run one test to reach that particular a particular line of code. 101 00:13:56.970 --> 00:14:01.440 William Cheng: Okay. What if there are multiple ways to go to the same line of code wine. That's great. You don't have to tell to tell the greater that 102 00:14:01.620 --> 00:14:09.270 William Cheng: This code is not useless. So definitely just have to tell the greater one way to reach this line, you don't have a ton of great at all possible ways to resupply 103 00:14:10.530 --> 00:14:16.500 William Cheng: OK. So again, go back to their the, the original reason why we are conforming DVD call is the only to demonstrate 104 00:14:16.680 --> 00:14:26.520 William Cheng: That this code is you useful so you don't have to demonstrate to the greater all possible way to execute this do this because he was just one of the ways, right. You get to choose which way now. 105 00:14:27.840 --> 00:14:36.480 William Cheng: All right. And also, or is it sort of important part over here when you perform this analysis in order for you to determine, you know where to 106 00:14:37.050 --> 00:14:43.710 William Cheng: Complement DVD call you must use static analysis and not a dynamic analysis where I was dynamic analysis dynamic 107 00:14:44.100 --> 00:14:53.130 William Cheng: Analysis is actually execute a coach you know exactly where your code is going to run to okay static analysis. It's just look at the structure of the code and decide where do you have to 108 00:14:53.310 --> 00:14:59.460 William Cheng: Conform individual. So what I have been doing over here to say that these are require and that's because I'm doing static analysis. 109 00:15:00.450 --> 00:15:06.840 William Cheng: Okay, if you're doing dynamic analysis, then you know which condition will always get executed before condition might will never get executed. 110 00:15:07.140 --> 00:15:13.230 William Cheng: Okay, so, so again, don't do analysis like that. Always do static analysis based on the structure of your code. 111 00:15:14.070 --> 00:15:27.720 William Cheng: OK, so again this is requirement. Read the spec. I think the spec or the current status of point to a web page that explains all about these, you know, CO sequences and then come home and DVD call so again read all the details. Okay. I don't want you to lose you know 10 points right 112 00:15:29.940 --> 00:15:38.670 William Cheng: All right, some other important thing is about their the colonel Simon, you know you you have to have a plan to backup your coat, right, because you know so so once in a while. 113 00:15:39.180 --> 00:15:42.900 William Cheng: You know, Virtual Box is just the Virtual Box is actually going to crash. 114 00:15:43.260 --> 00:15:52.860 William Cheng: Now hopefully you will never experienced that. But I have plenty of horror story. You know, people telling me that everything is fine. One day I start running my Virtual Box and Virtual Box refused to boot. 115 00:15:53.490 --> 00:15:56.940 William Cheng: Okay. They asked me, What can I do for them. There's nothing I can do. 116 00:15:57.750 --> 00:16:04.950 William Cheng: There's, there's no way no way for me to rescue your virtual box because what your Virtual Box refuse to boo. There's nothing in your Virtual Box is going to be accessible. 117 00:16:05.640 --> 00:16:13.710 William Cheng: Okay, so hopefully that whenever. So, so how can that happen, right. So my guess is that, you know, some people let their battery runs out when the battery runs out. If you're still running. Virtual Box. 118 00:16:13.950 --> 00:16:25.080 William Cheng: Maybe some bad things can happen. Okay. It's not supposed to happen, but still bad things can happen. Okay, or some people also, you know, I don't know they're charging their laptop. Unplug the power cord or they, you know, 119 00:16:26.550 --> 00:16:29.670 William Cheng: They shut shut off their machine when their Virtual Box is still running. 120 00:16:30.540 --> 00:16:38.280 William Cheng: So in that case, you know, bad things can happen guys so, so if you're using a laptop. What I would recommend you that whenever you whenever you want to. 121 00:16:38.550 --> 00:16:47.040 William Cheng: You know, some sort of, you know, go away. You want to shut up your laptop, there's actually no requirement to shut your laptop. I'll just close the lid. And then the last part will go to sleep. 122 00:16:47.700 --> 00:16:53.370 William Cheng: Okay, so if you do something like that. Chances are your virtual machine will never, you know, Coke go back 123 00:16:53.730 --> 00:17:02.400 William Cheng: Okay, but if you kill your organism, you turn our power or something like that. Those things are very, very drastic and sometimes bad things will happen to your virtual machine. Okay, so you got to have a backup plan. 124 00:17:03.210 --> 00:17:05.250 William Cheng: Okay, you can use your host machine is backup. 125 00:17:06.000 --> 00:17:10.560 William Cheng: backup software. So if your host machine is running Dropbox. I called Microsoft cloud or something like that. 126 00:17:10.770 --> 00:17:17.640 William Cheng: All you have to do is say, you have to take all your kernel source code copy to your hostess them and you use your host systems Pegasus them to back them all up. 127 00:17:18.150 --> 00:17:25.620 William Cheng: Okay. Some people will put all their source code inside the shared folder and then you know on the host machine. Also, you know, a pet. 128 00:17:26.340 --> 00:17:31.260 William Cheng: Back out the entire shared folder. You can also do that okay but you gotta, you gotta sort of pay attention because you know 129 00:17:31.950 --> 00:17:38.850 William Cheng: If you want your winnings co from a, from a shared folder, sometimes there may be problems. So again, look at their, their current FAQ 130 00:17:39.120 --> 00:17:43.260 William Cheng: And it will tell you that if you get into this kind of stuff, this kind of problem. This is how we actually get resolve it. 131 00:17:43.770 --> 00:17:51.450 William Cheng: OK. So again, you also want you be very, very careful when you do something like that because the weenies kernel is really not supposed to run from a shared folder. 132 00:17:51.870 --> 00:18:03.270 William Cheng: Okay, but if you want to do that just because it's easier to to to to to to to to to backup your code that's fine but you gotta, you gotta watch out for stuff that are mentioned, you mentioned in the colonel FAQ that 133 00:18:04.770 --> 00:18:14.190 William Cheng: So well, simple ways to backup your, your work is that you can you can create a submission file and then you can remain your submission file by putting a date into that he needs an iPhone in 134 00:18:14.370 --> 00:18:20.880 William Cheng: And this way you can copy this file into your shared folder and now you can easily back of your shareholder. So this way, they will always be backed up. 135 00:18:21.360 --> 00:18:30.840 William Cheng: Okay, so this will be the easiest way so I will recommend you to do this at least once a day. Okay. If your group is Matty. Also you 14 is, you know, making changes. 136 00:18:31.170 --> 00:18:39.810 William Cheng: Several times a day. Well, in that case, maybe you have to do this more than once. So in that case, you know, not, not only putting the date inside your phone and you can also put into current time is how you'll find a 137 00:18:40.050 --> 00:18:48.990 William Cheng: So this way you have multiple version, you know, for the same day guys over here you do the actual find it will be in approx and then followed by the day, followed by time or something like that. Yeah. 138 00:18:51.840 --> 00:19:03.900 William Cheng: You can also use, you know, get to do the backup, right. So again, don't use GitHub com there's big buck. So if you're using Bitbucket Bitbucket also use get. So in this case, you can also pass it back to the seventh. 139 00:19:05.370 --> 00:19:14.370 William Cheng: Into Bitbucket data. I think it's called big bucket bucket or something like that. So again, if you do something like that, it would be really nice because your, your, your Colonel team. 140 00:19:14.730 --> 00:19:22.710 William Cheng: You can actually synchronize you know to synchronize in the cloud and also they do version control. So this way you can actually go back to a previous version. 141 00:19:23.100 --> 00:19:29.010 William Cheng: To the next version. So if you want to do that. You really have to learn. Get right so there's the free book inside the 142 00:19:29.700 --> 00:19:40.110 William Cheng: The course description you know web page. So this one is online plugins free to learn it these days. Learning kid is really, really important thing because you know you know like 143 00:19:40.470 --> 00:19:48.330 William Cheng: A lot of companies are using free software so free software is maintained by get. And the reason for that is that good is written by Linus Torvalds 144 00:19:48.750 --> 00:19:55.320 William Cheng: The sort of the, the inventor of Linux. So lots of people are using it and it's a it's a super neat piece of software. 145 00:19:55.860 --> 00:20:06.420 William Cheng: So if you if you learn how to use it, you can put on your resume though actually look really good guys. So again, I strongly recommend you to use bitbucket.org and never use you use GitHub com 146 00:20:07.980 --> 00:20:08.580 William Cheng: And 147 00:20:09.720 --> 00:20:22.890 William Cheng: Get right and then if he has Bitbucket aka doesn't you know.org I make sure you repositories private so that nobody else can actually copy your copy your code. Okay, only authorized user will be able to share your code and which should be your teammates. 148 00:20:25.650 --> 00:20:32.580 William Cheng: So, you know, so again, you know, for when you try to try to sort of coordinate using a, you know, using things like Bitbucket 149 00:20:32.940 --> 00:20:40.890 William Cheng: You know, or you got to be careful because once in a while, they tried to sort of merge changes when two people are accessing exactly the same place inside of file, then it gets a little messy. 150 00:20:41.160 --> 00:20:50.760 William Cheng: Okay, so, so, so my recommendation is not, you know, not have two people working on exactly the same spot inside your source code. Okay. Because otherwise, you know, sometimes we have stuff can happen. 151 00:20:51.900 --> 00:21:01.830 William Cheng: Alright, the late policy, you know, for Colonel one and two. They for the colonel seven, they're pretty much the same as before, except that there's one extra late policy. Yeah. 152 00:21:02.460 --> 00:21:14.700 William Cheng: If you, if it turns out that Colonel one, especially if you're doing it by yourself, you can really finish corner one on time. If you turn in Colonel one by the colonel to deadline, you can still get 50% 50 50% credit for Colonel one 153 00:21:15.060 --> 00:21:25.380 William Cheng: Okay. Similarly, if you cannot finish Colonel to buy the original Colonel to della but you if you can finish that by the colonel three deadline. You also get a 50% deduction for Colonel two 154 00:21:26.250 --> 00:21:37.890 William Cheng: Okay, so instead of getting, you know, zero percent I going to get this picture is that Colonel three, you know, that will be the end of the semester so so there'll be no more extension. So therefore, Colonel three always have a regular submission deadline that 155 00:21:40.590 --> 00:21:48.030 William Cheng: Extra Credit I mentioned is the lecture wind. So again, you know, well for the colonel assignment, if you help other students in the class Google group. 156 00:21:48.480 --> 00:21:53.580 William Cheng: Okay, that you're eligible for extra credit. So again, you know, don't assume that you're going to get extra credit 157 00:21:54.030 --> 00:22:01.980 William Cheng: You only get extra credit if you are, you know, if you're posting the class Google goal is to help out another students post and you know you 158 00:22:02.250 --> 00:22:12.660 William Cheng: And your posting is timely, which means that it's within 24 hour 24 hours of the original post and also it needs to be good and useful and I get to decide whether it's good or useful. 159 00:22:12.960 --> 00:22:20.340 William Cheng: Okay, if you're going to say something that somebody said already live and clearly you're trying to be helpful, but it's not very useful because somebody said it already. 160 00:22:21.180 --> 00:22:30.570 William Cheng: Okay, so therefore, in that case, you know, whenever you're if you want to be eligible for extra credit, you need to say something different from what other people are saying that 161 00:22:32.760 --> 00:22:37.530 William Cheng: Alright, so, so how do you start, you start by reading a lot of code and 162 00:22:37.920 --> 00:22:48.750 William Cheng: You know, so, so, so, so again the colonel assignments is very, very difficult. It's maybe it's very difficult. Conceptually, right. I mentioned before, Colonel. One is about only 500 lines of code. 163 00:22:49.080 --> 00:22:57.210 William Cheng: Okay, so you have two weeks to write. There's plenty of time to write. So basically what you should do that. You spend a lot of time thinking and all of a sudden you realize what you need to do. And then you go write a bunch of code. 164 00:22:58.140 --> 00:23:06.540 William Cheng: OK. So again, preferably over here, you're going to be working together with your teammates and you work on this together and then you think thing thing thing thing and then you write some code. 165 00:23:06.900 --> 00:23:12.000 William Cheng: Okay, and then you test your code you and then you make sure you don't eat junk. And he said, your kernel or these kinds of stuff. 166 00:23:12.330 --> 00:23:20.250 William Cheng: Today, so, so, so, so writing the kernel code. It's kind of a different kind of experience. It's very different from your warm Elko won't go. You just hack it until it works. 167 00:23:20.940 --> 00:23:26.700 William Cheng: Currently going to be very, very careful because if you start hacking it nothing will work inside your kernel because your kernel is going to crash left and right. 168 00:23:27.750 --> 00:23:30.060 William Cheng: Okay, so therefore, again, I'll put a lot of thought into your 169 00:23:31.380 --> 00:23:35.700 William Cheng: Into your code and then eventually, you know, write a few lines of code, you know, test things out there. 170 00:23:36.150 --> 00:23:48.390 William Cheng: So over here is, as you know, learning to write operating system is almost like you know Zen. I don't know if you have familiar with the concept of Zen. So, you know, so these then, you know, monks, they, they sit there, you know, four days. I try to think about some 171 00:23:49.650 --> 00:24:03.300 William Cheng: Philosophical philosophical issue, and all of a sudden they would jump out and say, I got it. Okay, so so writing albinism, sometimes it has to, you know, you have to do something like that, okay. Don't just write a bunch of code thing thing thing and then write your code, right. All right. 172 00:24:06.240 --> 00:24:14.670 William Cheng: All right, so, so if you have questions about the carnival Simon, you know, of course you should read the documentation is a weenies documentation, you know, which is, you know, coming from Brown University. 173 00:24:15.000 --> 00:24:20.040 William Cheng: And also you can read the textbook. Read the lecture slides, you know, read more code, you know, we all kinds of stuff. 174 00:24:20.490 --> 00:24:26.550 William Cheng: Okay, so please understand that, you know, starting with a corner assignment neither me nor the TA can tell you what Coach right 175 00:24:26.850 --> 00:24:36.690 William Cheng: Okay, so hopefully we will point you to the right direction without telling you what Coach. Right. Okay. So you're going to ask us, should I put a number two or three is that this data structure, we cannot tell you that 176 00:24:37.230 --> 00:24:43.020 William Cheng: Okay, but feel free to discuss that in the class, boo, boo, boo, because your classmates, they, they want extra credit 177 00:24:43.470 --> 00:24:53.850 William Cheng: Okay, so if you ask the question, they can ask for us. Again, if they post Cotto pseudo code, then you know that's considered cheating that but if you only asked for one, you know, you said this data start, you should I put two or three in it. 178 00:24:54.630 --> 00:24:58.860 William Cheng: Why that is is one line of code. Why not a code doesn't violate our cheating policy. 179 00:24:59.370 --> 00:25:05.310 William Cheng: Okay, so therefore, in that case, if you ask question like that that's that's always. Okay. But if you ask people, Do I pseudo code or that's gonna 180 00:25:06.060 --> 00:25:17.520 William Cheng: That's not gonna be okay. Okay, so when you try to help other students by posting stuff into the cost will read your post very, very carefully before you press send, because if you end up sending too many lines. 181 00:25:17.970 --> 00:25:24.300 William Cheng: Yeah, one or two lines of code. Okay. But if it's more than one or two lines of code or pseudo code that will be considered cheating. 182 00:25:25.440 --> 00:25:28.770 William Cheng: Okay, so again, be very careful about what you post to the classical group. 183 00:25:29.130 --> 00:25:39.210 William Cheng: That and some people also want to show us other people's GDP session. Well, don't do that. If the GDP session is showing you a curl. Well, then you're telling other people will, you know, showing other people your code. And that's cheating. 184 00:25:40.320 --> 00:25:49.410 William Cheng: Okay, so again, talk about what you're seeing are we here when you try to you know show people your GDP session, but don't show people your code because that will be considered cheating. 185 00:25:50.190 --> 00:25:57.270 William Cheng: Okay, so if you're not sure, send me email. Okay, well I don't don't post directly to the hospital because once you do that, it's too late. 186 00:25:57.600 --> 00:26:05.820 William Cheng: Right. So if you're not sure about something, you know, send me email that I can, I can look at what you're posting over here and then again when I reply if whatever you're saying is appropriate. 187 00:26:06.000 --> 00:26:17.400 William Cheng: I will, you know, I, I will keep that he might replace that entire class. But if they're not appropriate. I'm going to delete them, I would say, you know, coat the leader. You see, I've done that in some of them. Some of my posts already 188 00:26:17.880 --> 00:26:22.710 William Cheng: You know, in the classical group. Okay, so therefore that's what that's what that's what I will continue to do. Okay. 189 00:26:24.540 --> 00:26:25.050 William Cheng: All right. 190 00:26:26.520 --> 00:26:37.830 William Cheng: You know pitfall. Do they are your team needs to be often so again we have zoom you know we're doing social distancing. So again, you know, you should meet as often as possible, talk to each other, you know, over zoom 191 00:26:38.400 --> 00:26:46.590 William Cheng: So, so, so, so, so, so this way you know what each other's doing and also you know that nobody's cheating your group. Nobody has, you know, CO from the previous semester. 192 00:26:47.010 --> 00:26:55.350 William Cheng: Because if you know that you know some one of your teammates a coven previous measure, you have to ask them to delete as soon as possible that all right. 193 00:26:57.690 --> 00:27:06.300 William Cheng: Okay, so, so that's the sort of the introduction to all the Colonel's on. So now I'm going to sort of go to a little bit of Colonel one specific you know material there. 194 00:27:06.810 --> 00:27:14.160 William Cheng: So now you're doing kind of once again kind of was completely inside a kernel and there's no user space code that kind of wanting to is completely inside of carnal. Yeah. 195 00:27:15.030 --> 00:27:16.470 William Cheng: Alright, so one thing they will 196 00:27:16.710 --> 00:27:26.250 William Cheng: Ask you to do is that, you know, the first thing is do is to put the pristine kernel source rather pristine Kurosawa is the one that you got from me. If you have a team. So our way through, you know, all the other teams can only keep one copy 197 00:27:26.430 --> 00:27:33.420 William Cheng: And that will be the thing that you run. So the first thing that you want to, you want to do is that before you run the weeds come at first start a transcript. 198 00:27:34.260 --> 00:27:35.220 William Cheng: Okay, so you 199 00:27:35.700 --> 00:27:47.340 William Cheng: Read part of yours is what you have to type. So you type script and he will start a transcript, but he will see script started a file is TypeScript. So what he will do is that everything that you do over here. From this point out will be recorded in a file called TypeScript. 200 00:27:47.850 --> 00:27:51.840 William Cheng: OK, and then Robin is I, you know, when you start running you say dot slash readings minus 201 00:27:52.290 --> 00:27:56.460 William Cheng: Everything that you see on the screen because they're going to scroll by really, really fast and you won't be able to see anything. 202 00:27:56.760 --> 00:27:59.490 William Cheng: Right, so that's why it's good to record them inside a transcript. 203 00:27:59.730 --> 00:28:09.540 William Cheng: That. So when you're done over here. So since this is pristine Colonel, you're supposed to get these error messages over here. So, by the way, you know, these lines are too long. So what I do is I put a backslash at the end of the line. 204 00:28:09.810 --> 00:28:21.480 William Cheng: That's one way for people who talk about Unix and Linux. When they say that this line is too long. What they would do is that a backslash backslash character at the end all be here to set up the next line is actually a continuation in the current life. 205 00:28:22.530 --> 00:28:29.010 William Cheng: Okay, so when you read a printer like that. So you should see that this law actually appear at the end of the previous slide. And this slide actually if you had the previous slide. 206 00:28:29.910 --> 00:28:34.950 William Cheng: So in the end, you know, you're going to get a kernel panic and everything is that a hall. So when you 207 00:28:35.250 --> 00:28:39.300 William Cheng: When you see the Colonel Halt the message over here. You're supposed to press Control see 208 00:28:39.600 --> 00:28:50.970 William Cheng: Okay, so when you press Control, see what you're killing over here is the Q em you a software qu is the x86 emulator. Right. So that's the one that in that pretend that you actually have a 209 00:28:51.930 --> 00:28:56.730 William Cheng: Have a machine that you are that you have a machine that you're running the Windows operating system all 210 00:28:57.150 --> 00:29:09.450 William Cheng: Okay, so when you first come to see over here. YOU'RE GOING TO KILL, KILL EM you he and he understands what the emulator. So this one is an emulator for the x86 CPU. Yeah. So now when you cannot over here, you're going to get your regular, you know, 211 00:29:10.320 --> 00:29:16.140 William Cheng: You'll see shall promo bash Brom and then at this point you're going to type exit to get out of the script command. 212 00:29:17.010 --> 00:29:29.250 William Cheng: Guys. Oh, so will you type squared, you're gonna start a transcript and then next time you type exit. Then in this case, he will close the transcript. So it was a script on the file is transcript and now you can open up the transcript and look at all the thing that flew by. 213 00:29:30.480 --> 00:29:35.340 William Cheng: Okay. So anytime you have anything I flew a fly by. And if you want to look at them, you know, so again, yo. 214 00:29:36.480 --> 00:29:38.940 William Cheng: Yo run a transcript and look at the transcript now. 215 00:29:40.230 --> 00:29:48.300 William Cheng: Alright, so if you look at a transcript over here. Look at the TypeScript file over here, you're going to see that at the beginning, it will tell you where is the current you know that the colonel has a tech stack, man. 216 00:29:48.510 --> 00:30:01.590 William Cheng: And the tech savvy. And so I started as I mentioned before in class. The Colonel start at 0000000 so what it is, it will show you something like this 0000 dash 00038000 217 00:30:01.950 --> 00:30:12.930 William Cheng: Okay, so when you see that. So in the Linux ism and also you know carnal assign this was sort of show you an interval, it has, it has a beginning, that has the end the way without we're going to display the 218 00:30:14.280 --> 00:30:21.540 William Cheng: Integral is that we're going to use, use a square bracket on the left hand side and then we're going to use the user right parentheses will be on the right hand side. 219 00:30:22.110 --> 00:30:24.420 William Cheng: Okay, so this means that this particular in 220 00:30:24.900 --> 00:30:34.980 William Cheng: This particular interval on the left hand side is closed on the right hand side is open. So when it's closed. That means that include this address when it's open. That means that it doesn't include this address 221 00:30:35.520 --> 00:30:51.720 William Cheng: Okay, so when you run a notation like this. So, wait. So what does the universe, right, the universe start with this address and the last address is going to be zero XE 0037 F, F, F, that will be the last address and does not include 38000 okay because the integral over here is open. 222 00:30:53.100 --> 00:31:02.760 William Cheng: Okay, so, so the reason is I sort of, I know that this one is open on the last location is that because if you look at the types good over here. The next slide will say that the data segment started this address 223 00:31:03.210 --> 00:31:07.020 William Cheng: Okay. So clearly this address cannot be in both the tech segment annual data segment. 224 00:31:07.410 --> 00:31:10.980 William Cheng: Okay, so do I showed that the data. Secondly is going to be this one and then the BSS seconds. 225 00:31:11.250 --> 00:31:19.890 William Cheng: Here, this one is going to show you a lot of stuff. OK. So again, you just briefly take a look at it, don't spend too much time looking at it. Don't try to understand everything because it's impossible to understand everything 226 00:31:20.640 --> 00:31:24.180 William Cheng: Guys are just sort of get an idea of, oh, you know, actually have a colonel touch that man. 227 00:31:24.360 --> 00:31:35.130 William Cheng: And again, all these things are what we talked about in lectures to say that, you know, the colonel address starts at 00. So now you know that at the beginning of the texts like Matt followed by the data segment all about VSS admin and 228 00:31:35.820 --> 00:31:46.410 William Cheng: As it turns out, what's underneath there is actually you know this is going to be something like the page table for the colonel and all that kind of software again when we go to Colonel three you know all this stuff will make more sense. Yeah. 229 00:31:47.520 --> 00:31:57.600 William Cheng: So again, you don't need to understand everything right. Okay, so, so in order for you to find out what function, you have to implement. So in the pristine kernel source code. He can he can 230 00:31:58.140 --> 00:32:03.300 William Cheng: Make and why I'm and why, since we're not yet implemented, you're going to get a printout I look like this. 231 00:32:04.290 --> 00:32:15.000 William Cheng: Okay. So on the right hand side over here, this will tell you what the assignment number is the assignment is the first assignment is the proxy, you know, assignment right over here on the last column over here is prompt and then over here, they would tell you which fall 232 00:32:15.570 --> 00:32:26.640 William Cheng: Which line number are the are the are the functions that are not yet implemented. Okay, so over here says inside proc a new text. I'll see online 36 inside this function called me came you tax in there. 233 00:32:27.180 --> 00:32:36.300 William Cheng: There is a nice implement a function. And that's the, that's one of the functioning of the implant there, and also online for the day. There's this once you have in place again they're, they're all these things you have to implement 234 00:32:36.810 --> 00:32:43.020 William Cheng: That. So, and this goes, how many files are there 123456 there are six five. You have to have that function, you have the implement 235 00:32:43.530 --> 00:32:48.270 William Cheng: So again, we're going to sort of briefly go over you know the the audio. The assumption. 236 00:32:49.020 --> 00:32:57.120 William Cheng: That all right so in that case that I see over here. So these are the colonel threat creation cancellation and destruction functions. Right. 237 00:32:57.360 --> 00:33:03.240 William Cheng: K threat create what does it sound like it sounds like P3 create. So now you're creating a kernels, where he said, instead of a 238 00:33:03.720 --> 00:33:13.110 William Cheng: User threat K through a castle. It sounds like pizza account. So, so this is how you can sell another Colonel thread. Okay. So it sounds like pizza at x. So, this is how your threat. 239 00:33:13.560 --> 00:33:18.210 William Cheng: You know, self terminated. So whenever you're flooding determinate it needs to call K through an exit that 240 00:33:19.110 --> 00:33:30.270 William Cheng: Right, so please keep in mind that MTP equal to zero in conflict, I am K and will only implement a single separate process. So, therefore, when your throat. Okay, so Dr. What happened to your process. 241 00:33:31.140 --> 00:33:37.770 William Cheng: Well you know where you're like, Okay, so actually you are the only 32nd process. So therefore, the process also needs to go into a zombie state. 242 00:33:38.970 --> 00:33:45.030 William Cheng: Graduate again, you know, so make all these connection, you know, between what we learned in class and also what you're seeing inside Colonel that 243 00:33:45.900 --> 00:33:51.330 William Cheng: The next one over here is that there are these functions at a scheduler. So again, the scheduler is simply a collection of functions. 244 00:33:51.510 --> 00:34:03.000 William Cheng: right inside scheduled. I see over here. There are four function, what is called scheduler cancel level sleep out right. So this means that you're going to sleep on a queue. So when your thread need to give out the CPU. He needs to go sleep on a cute. 245 00:34:03.660 --> 00:34:09.390 William Cheng: Okay. As it turns out, there are two kinds of sleep, what is called a castle castle level asleep, and the other one is called it 246 00:34:09.750 --> 00:34:18.210 William Cheng: On castle asleep so so this one is called castle about this one because it will see the one that I'm Castle, the ball is no as scheduler cancel asleep. 247 00:34:18.960 --> 00:34:26.730 William Cheng: Okay, so when you when you try to see by the q your kernel throw has two choices. One to call this one and the other one called this way. So what is the difference 248 00:34:27.270 --> 00:34:34.410 William Cheng: Okay, if you call scheduler, a castle of asleep on that means that you wanted to be able to be castle. When you're sleeping on the skew. 249 00:34:35.580 --> 00:34:38.820 William Cheng: Man, so that means that this function is a cancellation point 250 00:34:39.660 --> 00:34:47.880 William Cheng: OK. So again, this is a cancellation points that will you call cassava sleep all that's the cancellation pie. So if you fall asleep, your threat can get cancer when you when you make a castle. Why then, 251 00:34:48.720 --> 00:34:54.150 William Cheng: You get moving to the run queue and next time we're running out of CPU is going to self terminate by calling case right exit. 252 00:34:55.170 --> 00:35:00.840 William Cheng: Okay, so that's what's supposed to happen. But again, all these things, doesn't really happen in this function. So he's out this function. You just need to 253 00:35:01.110 --> 00:35:11.850 William Cheng: Make sure that when somebody cancel your thread, you're going to return. And as I when somebody cancel your throughout your thread get picked up moving to the run queue. And when this function return you better you know behave accordingly. 254 00:35:12.390 --> 00:35:18.570 William Cheng: So guys, but again, you're going to read some kernel source code to sort of find out what does it mean to behave accordingly. So again, by reading a bunch of Colonel 255 00:35:19.170 --> 00:35:24.000 William Cheng: The Colonel source code, you should be able to figure that out there. What if you call schedule asleep on 256 00:35:24.330 --> 00:35:32.430 William Cheng: Schedule asleep on is not a cancellation point. So he so so so what you call script, you're asleep. Off you go. Sleeping out of Q when another thing. So you are then 257 00:35:33.330 --> 00:35:36.420 William Cheng: Then cancellation become pending and nothing really happens to you. 258 00:35:37.410 --> 00:35:43.020 William Cheng: OK. So again, that's the major difference between these two functions over here. Why is the cancellation point. The other one is that there 259 00:35:43.350 --> 00:35:53.070 William Cheng: Is a Schedule A castle over here is that you swear he wants to cancel thread be so he will call this function and the argument over here is going to be thread be. And again, this function is not blocking call it returns right away. 260 00:35:53.370 --> 00:36:03.930 William Cheng: So GPS constellation is going to become Penny because you only have one side runnings that one CPU. So, therefore, you know, you can really execute code for the other for the other thread. So therefore, the other friends has legit become pending. 261 00:36:04.830 --> 00:36:09.930 William Cheng: Their schedule a switch. This is our stress which function that we just finished talking about inside 262 00:36:10.440 --> 00:36:20.730 William Cheng: In a lecture 10 mass over here. This is going to be the switch function. And again, you need to look at the code on the legislature and then convert them into a nice girl and upper right there, then 263 00:36:21.690 --> 00:36:28.890 William Cheng: Over here, it says make rubber over here. So how do you make a third run about by adding the threat to the run queue. And that's how you make it readable. 264 00:36:29.190 --> 00:36:37.800 William Cheng: There and then we talked about sleep on over here. And then over here is your schedule a wake up on what is, wake up, wake up all these p three conditions signal. 265 00:36:38.370 --> 00:36:48.840 William Cheng: Okay, so in this case you will be the kernel version of Peter conniption fit signal and they're scheduled broadcast on that will be the kernel version of peace or condition broadcasts. Right. The difference over here is that you can 266 00:36:49.290 --> 00:36:56.280 William Cheng: You can you can signal a thread and then again wake it up and moving to run to you, no matter where the sweat is sleeping up 267 00:36:56.640 --> 00:37:07.980 William Cheng: So it doesn't really have to be a condition variable. Q. You will notice that our Colonel does not have a condition variable cute. Okay, so, so, so this is where the condition verbal cue every Q is a condition variable. Q. 268 00:37:09.480 --> 00:37:16.710 William Cheng: Let me set for the new tax you read all the other kids over here, potentially, they can all act as a condition BBQ because India. What is the condition verbal cue. 269 00:37:16.980 --> 00:37:25.050 William Cheng: The condition variable Q is just a regular Q Right, we mentioned before, you know, condition over here can be implemented using my for two lists. So just a few 270 00:37:26.340 --> 00:37:32.070 William Cheng: That again. So this is a piece of religion cigar. This was the third question broadcast there. 271 00:37:32.880 --> 00:37:39.090 William Cheng: Is a proxy is where you implement processes is over here. There's procreate. So what does not create 272 00:37:39.690 --> 00:37:47.610 William Cheng: Well, it's not the same thing as fork, right, because when you make a fork system called the forces employee as a user space, will you call for it simple. You know companies that have Colonel 273 00:37:47.850 --> 00:38:00.690 William Cheng: When you get inside a colonel. What you need to do is that you need to also create a colonel process and that will be the child process of the parents. Okay. So inside the colonel in the wind is kind of, we need to create a new process you call procreate. 274 00:38:01.800 --> 00:38:10.410 William Cheng: Because again, if you want to create a thing called case or creative want to create a colonel process over here, you need to call procreate and and and what else is here pro clean up. 275 00:38:10.950 --> 00:38:18.240 William Cheng: What your process is ready to die, you need to clear out all the data structure was okay, you know, you can call, probably not, but we so so 276 00:38:18.780 --> 00:38:20.010 William Cheng: So if you look at the source code. 277 00:38:20.340 --> 00:38:24.540 William Cheng: Above every one of these functions. There's a detailed description of what you have to do is that assumption. 278 00:38:24.690 --> 00:38:32.070 William Cheng: So I'm sort of going over that very, very quickly because you're supposed to look at the, you know, look at a comment right above these funky and they will tell you what has to be done. 279 00:38:32.490 --> 00:38:41.790 William Cheng: Okay, and also in the corresponding header file. Right. So there's a product. I see. There's also a file called practice. Ah, so the prophet, he is actually inside Colonel include 280 00:38:42.510 --> 00:38:49.170 William Cheng: Subject code include right and then the rest of over here is the same product over here, followed by proc dot h 281 00:38:49.740 --> 00:38:59.400 William Cheng: Okay, so that would be the corresponding Colonel include file so that includes all we are sometimes there will be additional comment you should read so that they will tell you what you have to do to implement all these files. 282 00:39:00.300 --> 00:39:03.960 William Cheng: Now, so again it's very, very important to look at all those comments now. 283 00:39:04.560 --> 00:39:14.430 William Cheng: Alright so clear over here again read the comment of us know what to do proper care over here, as he tried to kill a threat. How do you kill us. Right. You can't really kill us. That's all you're doing over here is to cancel a threat. 284 00:39:15.240 --> 00:39:18.420 William Cheng: OK. So again, please understand that there's no way for you to kill a thread. 285 00:39:18.720 --> 00:39:28.560 William Cheng: Unless the third is yourself. What if you kill a threat. You know, you saw the patient call case the exit right otherwise what you're trying to kill another threat. Basically, you're asking, you know, you're, you're basically capturing that threat. 286 00:39:28.980 --> 00:39:37.410 William Cheng: That there's there's a proxy. Oh. So again, just going to cut a bunch of threat. So again, read the spike or we here to find out exactly why you have to kill that 287 00:39:37.920 --> 00:39:49.830 William Cheng: Proxy excellent over here. So, this one says the thread inside a process has Exodus, right. So it means that the thread has called pizza at exit. So therefore, at that point, you should call this function. So this one more point here, we'll do some cleanup. 288 00:39:50.430 --> 00:39:58.140 William Cheng: So I think this clean up what we hear is going to be inside the process control blog over years, so maybe there's some data short, you have to clean up. So, okay, read a comment upon exactly what you have to do. 289 00:39:58.950 --> 00:40:05.160 William Cheng: That the next function over here is called do way P ID. So this one is the way system call 290 00:40:05.670 --> 00:40:12.390 William Cheng: Okay, so remember the racism classism, the user space where you can start a kernel. There's the kernel version of the way system call and this is it. 291 00:40:13.380 --> 00:40:22.710 William Cheng: Okay, so do AP ID is the kernel version of racism called and this one is pretty complicated read a comment and find out exactly how you're supposed to do to to to wait for another process to die. 292 00:40:23.010 --> 00:40:28.710 William Cheng: Okay, so in the kernel. When you wait for processes that who can you wait for you can wait for a child process today. 293 00:40:29.070 --> 00:40:33.240 William Cheng: Okay, so this one is different from the kernel version of the way that we talked about before. 294 00:40:33.600 --> 00:40:40.470 William Cheng: Because this why they're there extra function argument. So you can actually say, I want to wait for a specific colonel colonel process to die. 295 00:40:40.890 --> 00:40:49.050 William Cheng: Okay if I say threat of a mistake over here. So yeah, these are about processes. If you want to wait for a specific Colonel process to die, you can actually call to AP ID. 296 00:40:49.410 --> 00:40:55.800 William Cheng: Yeah, but you got to make sure that that process is going to be a child process of the parent process, right, because otherwise you can't really wait for it to that that 297 00:40:56.340 --> 00:41:03.810 William Cheng: Alright, the next version over here is called do exit exit over here. Again, this is the kernel version of the exorcism call right so in the user space program will you 298 00:41:03.990 --> 00:41:11.610 William Cheng: Will you will your process is going to self terminate. You're gonna call so you come inside a kernel and this will be the kernel version of the system Hall. 299 00:41:11.940 --> 00:41:19.140 William Cheng: That. So therefore, when when a third. Right. So again what doing a one thread per Colonel process. If the third call to exit over here. Laughing 300 00:41:19.890 --> 00:41:24.150 William Cheng: Right, so they'll say dies over here and also the process going through the zombies day again you need to see 301 00:41:24.720 --> 00:41:37.410 William Cheng: You need to say the return, Mexico, so when he caught to access five will be here five has to be the return Mexico for this process and they don't know when the parent process called do way P ID it better get the number five. 302 00:41:38.730 --> 00:41:49.050 William Cheng: Or so, then these two functions over here. Our work should work together when he called to exit with an argument over here that argument must be the exit return call you know when the parent tried to fetch the Charles X return go 303 00:41:49.590 --> 00:42:00.240 William Cheng: Okay, so you so it's your responsibility to make sure that this information is passed on to the parent correctly. There are lots of people make that mistake and not losing a lot of points that 304 00:42:01.350 --> 00:42:10.350 William Cheng: You take. So we're here, right, there's a new text. I'll see there's, you know, new text in there. You have to initialize the mute. So again, what's inside of you tax, right. So you started your tax. There's a new tech skewed. There's also 305 00:42:10.530 --> 00:42:16.590 William Cheng: Whether the new tax law or not. So again, look at the corresponding header file to find out how you know what you need to initialize so you have to implement that. 306 00:42:16.800 --> 00:42:26.460 William Cheng: And then you have implemented, you know me tax law. Can you touch on law and now there's also a cave new tax luck has level. So in this case, this new tax law is a cancellation point 307 00:42:27.420 --> 00:42:39.240 William Cheng: OK. So again, you should read the kernel source code to find out what other function over here is using this function and read the code, very, very carefully. This way you can figure out how you must implement this particular function. 308 00:42:40.410 --> 00:42:49.080 William Cheng: OK. So again, by looking at these functions, specifically those are the contract, you have to fulfill okay by reading the comment by reading other function is that a corner or using 309 00:42:49.560 --> 00:42:58.470 William Cheng: Your code your implementation all the songs you they have to satisfy the contract guys again don't change other code, you have to make sure that your code works. Yeah. 310 00:42:59.340 --> 00:43:04.830 William Cheng: I finally is the Colonel startup costs. So the main function over here. The Colonel is going to start in the bootstrap on G. 311 00:43:05.040 --> 00:43:10.590 William Cheng: Is that a boost. If I'm seeing you are in a weird contacts. We're going to contact you in a while, maybe you're in a bootstrap contacts. 312 00:43:10.950 --> 00:43:20.550 William Cheng: Okay, so what what is it boosts your contacts, while we said with there's only three contacts is only iraq contest. So where is the pool shark on that. Well, you haven't really start running your carnal. Yeah. So there's the other weird contacts. 313 00:43:21.180 --> 00:43:29.010 William Cheng: In first that so therefore inside Bootstrap, but we are, what are you supposed to. You're supposed to have to create a process zero in a weird way. 314 00:43:29.910 --> 00:43:37.530 William Cheng: OK. So again, read the comment and booster shot over here and try to sort of figure out what kind of code that you have you create process zero over here. And the first procedure or process. 315 00:43:38.010 --> 00:43:45.450 William Cheng: Has been written for you already. And that one is called ICO proc Ron ID LTE proc the idol problem here is going to be the first procedure. 316 00:43:45.960 --> 00:43:50.310 William Cheng: You know, for, you know, for the idol process. So the first procedure is known as either proper 317 00:43:50.610 --> 00:43:55.110 William Cheng: That Cole has written be a for you for it for Colonel one don't change a single line of code right there. 318 00:43:55.350 --> 00:44:03.300 William Cheng: Okay, so all you have to do over here is that create a process and that is that a process career thread, but you can create them in a funny way because you already the blue stripe contacts. 319 00:44:03.450 --> 00:44:13.380 William Cheng: Right. And then what you do that, you need to give give the CPUs to process number zero give a CPU to the threading process zero and now this function issue start executing in the threat context. 320 00:44:15.030 --> 00:44:21.570 William Cheng: Okay, so in the bootstrap function you and the booster contacts. But once you start going to either proc run now you are in the right context. 321 00:44:22.050 --> 00:44:30.780 William Cheng: Okay, so maybe you're still halfway in there because in the beginning, over here, the kernel is not completely initialized. So if you read the code over here for either proper they're going to initialize the rest of the Colonel. 322 00:44:30.960 --> 00:44:35.130 William Cheng: At some point it's ready to to create process number one in the normal way. 323 00:44:35.880 --> 00:44:43.200 William Cheng: Okay, so how to create a process in a normal way read the code inside of progress on over here to find out how you create a process in a normal way. Yeah. 324 00:44:43.980 --> 00:44:46.140 William Cheng: Alright so what were those that have a call a function called idle. 325 00:44:46.800 --> 00:44:58.200 William Cheng: Idle proc create a site in the appropriate so in improv create is the normal way that you create. You create a you kind of process. So in this case you will create a new process. The process is the one with process ID number one. 326 00:44:58.380 --> 00:45:06.150 William Cheng: So again, the either process POS ID number zero it will create personas. Number one, so that should be. Oh, that sounds from all okay so in this case it will create I don't 327 00:45:06.420 --> 00:45:10.290 William Cheng: Create any process which is process ID number one in a normal way. 328 00:45:10.650 --> 00:45:21.570 William Cheng: Okay, so, so, so again the normal way. That means that the parent process is in the threat contacts and then you go there you go to create a process, you're going to create a third in it. So that will be the normal way to create a process. 329 00:45:23.100 --> 00:45:32.070 William Cheng: And then the first procedure of the idea in a process is not written for you that right now. It only has one line that says now you implement it and then also we generally 330 00:45:32.820 --> 00:45:43.410 William Cheng: Just return. Okay. So in this case, why because I when you first try to get this to work. You don't have to modify the entire program because they knew proper is not supposed to do anything your intake process doesn't really have anything to do 331 00:45:44.460 --> 00:45:55.560 William Cheng: That case, all I have to do is that we have to self terminate so so so in the process will return and then in that case, he will wake up the patent process which the idol process and the IPO process is going to turn off the machine. 332 00:45:56.520 --> 00:45:59.820 William Cheng: Okay, so that's why you have to implement at the beginning. Yeah. 333 00:46:02.340 --> 00:46:11.040 William Cheng: So, so again, please read all the comment brought us graph to find out you know what other parts of the colonel are using these function again when you see those functions we either, you know, read the code. 334 00:46:11.250 --> 00:46:19.980 William Cheng: Read the comment blog and then try to understand the code there, guys. So if you don't want to send the call started discussion of the class, we will send me email asked me questions that 335 00:46:21.240 --> 00:46:30.270 William Cheng: All right. Okay. So, so over here. There's a little comment over here. When a third give out the CPU is okay, how do you give up a CPU right you add yourself to a queue and then you call threat switch 336 00:46:30.480 --> 00:46:38.760 William Cheng: You got to make sure that right before you do that, you got to make sure that all the global grab all the data structure inside of Colonel, they're all in a consistent state. 337 00:46:39.240 --> 00:46:47.130 William Cheng: Okay, so when you're ready to hand you're, you know, you're, you're ready to hand your CPU off to another threat. You got to make sure that all the links that you have 338 00:46:47.520 --> 00:46:56.550 William Cheng: That you have touch. They're all in good shape, right, because otherwise, when you get the CPU to another one of the other first are using this link plans. Well, then in that case, you end up crashing the Colonel. 339 00:46:58.020 --> 00:47:05.130 William Cheng: Okay, so therefore it's very, very important that when you are ready to give up the CPU to somebody else. You got to make sure that all the colonel data structure or in the shape 340 00:47:05.310 --> 00:47:09.720 William Cheng: How do you make sure that while you're going to make sure that all the phones you have implemented or implemented correctly. 341 00:47:10.500 --> 00:47:14.280 William Cheng: Okay, that sounds really scary. That means that a lot of CO has to work over here. So again, 342 00:47:14.820 --> 00:47:20.520 William Cheng: As it turns out, that was true at the beginning, you got it. Yeah, you actually have to get a lot of code to work in order for you to get into a good state. 343 00:47:21.450 --> 00:47:28.200 William Cheng: That I saw the saw here is going to be by my recommendation, how do you actually start your kernel. Okay, you're going to divide them into two phases over here. 344 00:47:28.380 --> 00:47:35.460 William Cheng: In phase one over here. You simply get the colonel to simply start started quit. And again, keep drivers equal to zero. 345 00:47:35.940 --> 00:47:38.310 William Cheng: So guys, how do you get the colonel to start in quit right 346 00:47:38.490 --> 00:47:51.300 William Cheng: In bootstrap. You need to start up process number zero and in process number zero, you have the first procedure as it execute. What do you do, they will start our process. Number one process. Number one doesn't do anything. It was self terminate, and you wake up process. 347 00:47:51.570 --> 00:47:53.070 William Cheng: And processor is going to turn off the machine. 348 00:47:54.720 --> 00:48:02.280 William Cheng: OK. So again, this is what what phase was supposed to do to do to be your inner process doesn't do anything other than self terminate. 349 00:48:02.760 --> 00:48:13.020 William Cheng: There. So the head over here is that you need to look at the code inside favorite test because favorite Test, test the code there is trying to test your kernel. So it will show you what a legitimate Colonel would do. 350 00:48:14.070 --> 00:48:18.690 William Cheng: Okay. So inside favorites letters over here. You're going to create a lot of threads. And then it's going to create you 351 00:48:18.810 --> 00:48:25.860 William Cheng: Can create a lot of processes and he every project that will run a threat, and then they will show you how these processes, how they were supposed to interact with each other. 352 00:48:26.760 --> 00:48:30.210 William Cheng: Okay. So use that as an example as legitimate Colonel Flacco 353 00:48:30.960 --> 00:48:40.500 William Cheng: Okay, and then you use it in for you know all these functions that I just showed you before. How do you have to, what do you have to implement to make sure that all the code inside favorites that has runs perfectly 354 00:48:41.040 --> 00:48:51.660 William Cheng: OK. So again, please remember that you are not allowed to modify single line of code inside for a birthright test. So it's your job to make sure that you know all the coding stuff it with a test, they all run perfectly 355 00:48:52.800 --> 00:48:53.070 But 356 00:48:54.330 --> 00:49:02.100 William Cheng: So, so, so, so this is, you know, Phase one there. So over here. Here's a list of the function that I think that will be involved. 357 00:49:02.520 --> 00:49:11.400 William Cheng: Okay, I don't know whether I missed the function or not, right. So this is my list over here, you have to implement all these functions if it turns out that there's a function I miss me email me to add to the list. 358 00:49:11.730 --> 00:49:18.930 William Cheng: Okay. Nobody ever did that you did it. So I'm going to assume that this is all you need to get working, you know, in order for you to pass phase one. 359 00:49:20.070 --> 00:49:36.810 William Cheng: Okay, so you can see the hundred questions you have right 1-234-567-8910 1112 13. Okay, so that's a lot of code to get to work in phase one. So, again, not every one of these function has to be perfect, but you have to implement something to get past phase one. 360 00:49:38.250 --> 00:49:49.320 William Cheng: Life. So once you pass phase one day, you got to face to right. So is that phase two over here for a new program over here in the proper in phase one doesn't do anything. So now what you need to do is that you need to test your kernel. 361 00:49:50.100 --> 00:49:59.850 William Cheng: Okay, so and so is that a problem. So that would be the first procedure of your where your in your process which is process. Number one, all you need to do is to call favorite that has 362 00:50:00.270 --> 00:50:08.250 William Cheng: Okay, so I've got some favorites. So if you look at five 450 lines of code there lots of tests over here. So you don't really want to pass all the testing one shot. 363 00:50:09.030 --> 00:50:19.890 William Cheng: Okay, you want to pass the test, a little bit of time. So what you would do is that you were CEO, CFO to test over here, equal to wine country guy. Okay, so this way you only test. The first set of has over here. If you can pass all 364 00:50:20.520 --> 00:50:24.780 William Cheng: The first set of tests over here. Oh yeah, it's going to be very, very difficult in the beginning to pass all those tests. 365 00:50:25.410 --> 00:50:33.600 William Cheng: Okay. And the reason is that because you don't really know how the colonel works. So you're going to use that opportunity to learn the colonel to understand how these functions supposed to work. So again, you know, set, you know, 366 00:50:34.590 --> 00:50:44.820 William Cheng: Puzzles task. Once you can pass it there. You can test, you know, set a CFO to test will be able to to and again we compile your kernel and then make it up, you pass the first to set of tasks. 367 00:50:45.060 --> 00:50:49.830 William Cheng: And after you process that it to three and then pass Teresa, have you do that surpassed the 45678 368 00:50:50.400 --> 00:50:55.980 William Cheng: Okay, you can you can do this all the way until eight you can pass all the way today. And now you're in Phase three 369 00:50:56.550 --> 00:51:02.070 William Cheng: Guys in phase one or two also you need to make sure that whenever you shut down your Colonel the colonel always housecleaning 370 00:51:02.460 --> 00:51:09.810 William Cheng: Okay, so during Phase two over here if you call favorites that has if you pass the test, what do you do that it will return for favorite through a test and now your 371 00:51:10.260 --> 00:51:17.310 William Cheng: Your, your idea in a threat or self Terminator, and it was going to wake up the the idols that and the answer was shut off the machine. 372 00:51:18.480 --> 00:51:28.410 William Cheng: Okay, so during phase one, phase two every time when you run everything successfully and yeah your current issues, you should shutdown shutdown normally and you will see a message on the screen to say the colonel hearts cleanly. 373 00:51:29.070 --> 00:51:41.160 William Cheng: OK. So again, you should grow up using the ground commands. Look for the street to see who's printing on that machine that message and there's this way. You know I would. You see this message. How far have you gone inside a carnal man. 374 00:51:42.210 --> 00:51:48.000 William Cheng: So if you pass phase one and phase two, then you already do phase three and phase three, you gonna say drivers include the one 375 00:51:48.150 --> 00:51:57.240 William Cheng: Inside in the program right now. You have to run Keisha and then you don't you don't give her your code that call favorite protests. Okay. And instead, you gotta 376 00:51:57.540 --> 00:52:02.970 William Cheng: You gotta replace it with the code or UNK Asia. So it's only a few lines of code look at the colonel FAQ to find out which 377 00:52:03.330 --> 00:52:10.980 William Cheng: You know, which few lines of code that you had that you have to add as soon as you do that, your case you should be working. So the Keisha is just like you'll, you'll want to shout. 378 00:52:11.610 --> 00:52:15.450 William Cheng: Okay, so, so, you know, like, like, like your best show like a TC shall over year. 379 00:52:15.900 --> 00:52:21.180 William Cheng: Except that the only has three commands that are available to you. One of them is called help the other ones called echo the other ones called exit. 380 00:52:21.690 --> 00:52:32.460 William Cheng: Okay, so if you call. So then in that case you will execute a shell which will also exit intent pop Ron, will you actually didn't proper, are you in a process with die, you will wake up the idol process either possible turn off machine. 381 00:52:33.750 --> 00:52:36.240 William Cheng: That has okay you should make sure that that process work. 382 00:52:36.450 --> 00:52:46.710 William Cheng: And what's that process work over here. You're going to create three K shell command again read the colonel one FAQ to find out how you create a shell command in every case, I'll come out, you're going to run a test instead of waiting, guys. 383 00:52:46.980 --> 00:52:57.300 William Cheng: Okay, so he's waiting on there will be three tests, you have to run while is called the favorite test, which is the one that you're running before and another one is called saw tears, and there's another one's called Assad della test. 384 00:52:57.630 --> 00:53:04.830 William Cheng: Okay, so therefore you need to create three k shall come on each one case I can I run one of these three tests over here. And then in this case, will your 385 00:53:05.340 --> 00:53:12.690 William Cheng: Will your run Acacia you can type any of these three commands over here. So, so you should be able to run the favorite test what we hear over and over and over again. 386 00:53:13.080 --> 00:53:20.520 William Cheng: Okay, you should also be able to run the test over and over and over again. So the sound has basically is testing your threat together, working with new tax. 387 00:53:20.880 --> 00:53:27.690 William Cheng: That's a nut case if it works over here. That's great. Yeah. And then the deadlock has over here whenever you run their life has over here that you're currently della 388 00:53:28.380 --> 00:53:31.500 William Cheng: Okay, so that would be the only case you're allowed to allow is where you run a 389 00:53:31.830 --> 00:53:39.390 William Cheng: Test. Right, so we'd rather than our test over here. Everything is going to freeze up but you will notice that when you pass a key on your keyboard your key watch your show up onto the screen. 390 00:53:39.840 --> 00:53:48.720 William Cheng: Okay, so that's called echoing whenever you type of key on your keyboard. The key that you type or get echo onto the screen. Okay. So even though nothing is running to interrupt service routine is still 391 00:53:49.380 --> 00:53:54.390 William Cheng: Is still running. Is that all you do is just that all your kernel said they're all they're locked together. 392 00:53:55.320 --> 00:54:02.430 William Cheng: OK, so the delta is going to create a bunch of threat. They're going to tell out together over here, but the interrupt service routine should continue to work. Okay. 393 00:54:02.850 --> 00:54:11.640 William Cheng: But if you press enter one nothing's gonna happen because none of your threads running. Okay. They should all be together. So at that point, the only thing you can do is the press Control see to curl, curl. Yeah. 394 00:54:13.920 --> 00:54:19.440 William Cheng: All right, you know, so, so again, please remember that we can I tell you what code right and then 395 00:54:19.680 --> 00:54:23.490 William Cheng: So, so, you know, the stuff that that's appropriate to talk inside the class Google group again. 396 00:54:23.700 --> 00:54:35.580 William Cheng: You are not supposed to talk about your code or the pseudo code of the code that you're going to write that you can talk about the spec and hug for the for the colonel FAQ. So again, the spec. The current FAQ their code there you can talk about those code. 397 00:54:36.330 --> 00:54:43.410 William Cheng: Okay, the grading guidelines over here. They also have some coke and sort of discuss so coast. Again, you just not allowed to discuss the code that you are writing there. 398 00:54:44.070 --> 00:54:52.350 William Cheng: Is a favorite test. There's 500 lines of code. There's 400 lines of code here. So, so again, feel free to talk about those codes. If you copy those go and post it into your question. 399 00:54:52.560 --> 00:55:03.780 William Cheng: That's perfectly legit because those are codes that are given to you as part of the, you know, as part of this course. So therefore, feel free to talk about that. Okay. Just don't talk about the code that you are going to write. Yeah. 400 00:55:04.650 --> 00:55:07.560 William Cheng: All right, and you got a question over here. You can also feel free to send them to me. 401 00:55:08.700 --> 00:55:13.740 William Cheng: There are lots of hints, you know, everywhere. So again, you know. So again, you should you should read all the stuff 402 00:55:14.310 --> 00:55:25.110 William Cheng: So yeah the the specs as a bunch of stuff. Right. The Colonel is very powerful. So therefore, the colonel must not have any bugs if there's any bug inside the Colonel, it must be because of the bug that you put inside the Colonel. 403 00:55:26.100 --> 00:55:33.030 William Cheng: Okay, why is that because we must assume that the rest of the colonel is perfect. Well guys that whenever you see a kernel bug. It's your bug. 404 00:55:33.540 --> 00:55:45.930 William Cheng: Or so keep that in mind. Okay, so, so again. So how do you look for look for both inside your code. Don't try. So even though you know you're going to crash your car know the code is going to crash in some kernel memory alligator. You say hello. The kernel memory. 405 00:55:47.040 --> 00:55:52.950 William Cheng: Is bad. No, it's because your body kill the Colonel. Okay, maybe I'm memory corruption, we have memory. 406 00:55:53.250 --> 00:56:01.860 William Cheng: Corruption, you're going to mess up the memory allocation chain inside the Colonel, you gotta mess out of the buddy system, you're going to mess up the slab alligator. That's why the colonel stop working because of your code. 407 00:56:02.880 --> 00:56:08.100 William Cheng: OK. So again, don't waste your time looking for bugs inside the pristine kernel source code because they're all perfect 408 00:56:08.730 --> 00:56:15.570 William Cheng: That I'd be running this you know programming assignment for many, many years. So trust me that the colonel action has no books now. 409 00:56:16.080 --> 00:56:26.670 William Cheng: And again, please remember that the Venus Colonel is non preemptive so in lecture 10 I mentioned the exactly what you know what it means. And also, you know, keep MTP equal to zero, but 410 00:56:27.750 --> 00:56:39.450 William Cheng: Oh, so I think, you know, um, yeah. So, so, so, so is that came in. I see over here. There's a bunch of function over here. So again, at the beginning of these functions are very, very difficult to, to, to understand 411 00:56:39.780 --> 00:56:46.020 William Cheng: Okay, so again, what you should do is that you should go over there. So right now, I've been sort of quickly go over them. So again, if you have more questions, feel free to 412 00:56:46.470 --> 00:56:52.320 William Cheng: To do some email that I'll be here incoming there's a function called complex setup. 413 00:56:52.530 --> 00:57:04.830 William Cheng: What is trying to do. It's a setup the bootstrap contest. I mentioned that there's a bootstrap contacts so this function over here is an example to show you how to set up the bootstrap contacts again. So later on if you need to set up another contacts. 414 00:57:05.040 --> 00:57:08.670 William Cheng: Maybe you have to do the same thing, or maybe have to do something very, very similar. 415 00:57:08.910 --> 00:57:16.560 William Cheng: There. So once you set up the booster conference again when we talked about the contracts, where is the context. The context is a data structure, right. So even though we did we save data. 416 00:57:16.950 --> 00:57:22.650 William Cheng: Construct all over the place. Okay. Inside the third control bar. There are actually some data structure noise contacts. 417 00:57:23.730 --> 00:57:28.260 William Cheng: Or is over here, you know, we can actually make a contracts active right so of years as many contacts as 418 00:57:28.590 --> 00:57:36.870 William Cheng: We're making the booster I've contacted by making this function call. So later on when you want to make a threat contacts. ACTUALLY, WHAT DO YOU DO WHAT again you do something very similar 419 00:57:37.770 --> 00:57:46.500 William Cheng: OK, so again by reading the code like this over here you also you also figure out, oh, maybe I need to do something very, very similar, not exactly the same, but something very similar 420 00:57:47.130 --> 00:57:51.750 William Cheng: OK. So again, think about what you have to do that. And then there's a call of the article called panic. 421 00:57:51.990 --> 00:58:01.860 William Cheng: Every time when you call panic, you will crash the colonel intentionally right so whenever you see a line of code. Is that a pristine cornrows sources, Penny. That means that you should never get to this line of code. 422 00:58:02.340 --> 00:58:08.130 William Cheng: Okay. Otherwise when you go to this line of code, you're going to see a message to put out onto the screen and then your car will crash. 423 00:58:08.580 --> 00:58:12.180 William Cheng: Well guys, that again you know he's trying to give you a hand to say that you should never get here. 424 00:58:13.050 --> 00:58:25.080 William Cheng: That inside bootstrap over here. We're going to see Nadia implement. So again, whenever you see something like this over here. You're supposed to comment on this lie, we can delete this line and replace it with your co in place right here. 425 00:58:26.400 --> 00:58:34.140 William Cheng: Okay, don't put it anywhere else. Okay. I mean, some people like to make a rational function. So in this case you will make a function called a call another funny. That's also perfectly fine. 426 00:58:34.860 --> 00:58:44.700 William Cheng: Okay, but also you need to remember that when you replace and now you implement a call with your car that all the code that you have written there are subject to this, the rule of self check 427 00:58:46.590 --> 00:58:56.610 William Cheng: OK. So again, the code that you put there to replace the functionality of now you implement so you're employing a function over here, whatever the code that you write, they're all subject to the rule of self checks, guys. Yeah. 428 00:58:57.000 --> 00:59:02.340 William Cheng: You know, every course sequence, you need to put up a conforming DVD call at the end of every co sequence now. 429 00:59:02.940 --> 00:59:11.400 William Cheng: All right over here at the end of booster over here it says pending so so once you are in bootstrap and then in this case, you're going to switch contacts to the the contents of threat of the 430 00:59:12.690 --> 00:59:20.160 William Cheng: Process number zero, so you'll be in the right context. So over here, it says you should never come back to the bootstrap contacts. Okay, so that's why there's a panic right here. 431 00:59:21.030 --> 00:59:27.360 William Cheng: Yeah, so is idle proper on over here. They call this function to create what is a career. If you look at the function over here, it was 432 00:59:27.960 --> 00:59:30.330 William Cheng: It created a third you create the control bar. 433 00:59:30.900 --> 00:59:36.870 William Cheng: Okay, so this function over the actual return flight control, blah. So therefore, we're gonna use a pointer to the 300 blog over here. The point where 434 00:59:37.110 --> 00:59:42.330 William Cheng: And then it causes a function called in a call. So this function will initialize the rest of the Colonel. 435 00:59:43.230 --> 00:59:52.230 William Cheng: Well, so therefore, again, this function is run inside the context of a process number zero so process number zero you are really not completely in the threat contact over here. 436 00:59:52.350 --> 00:59:57.420 William Cheng: Even though technically units right contacts, but you know the rest of the colonel is not really finished initializing yet. 437 00:59:58.230 --> 01:00:06.930 William Cheng: Okay, so therefore we're going to call it in a call over here to try to initialize the rest of the kernel. And now we are ready to go into the second time. So how do we re came through contacts. 438 01:00:07.290 --> 01:00:17.670 William Cheng: Right, we're going to enable in a Rob right here. So I am to enable VR is going to enable you know once you enable interrupt and now your IP level is going to be equal to zero. And now you're in the threat contacts. 439 01:00:18.180 --> 01:00:24.270 William Cheng: Okay, so yeah process zero is funny because at the beginning of the first procedure of the threat is that process. 440 01:00:24.540 --> 01:00:31.830 William Cheng: At the beginning, you're in a funny contacts you are not really in the thread contacts you went to three contacts will you turn on the interrupt, but can we enable universe. 441 01:00:32.670 --> 01:00:37.980 William Cheng: Okay, so why don't you I never hear about here. We're going to call this function costs a scheduler made runabout 442 01:00:38.430 --> 01:00:43.080 William Cheng: Okay, so over here. Here is a threat. So in this case, we're gonna we're gonna make this thread rateable 443 01:00:43.680 --> 01:00:52.560 William Cheng: We, how do we make this to around about by adding it to the wrong key. That's how we make it run about I run about meaning that you listen to run queue. So over here, you know, so so inside in a park real we hear 444 01:00:52.800 --> 01:01:05.670 William Cheng: This will be a function, you have to implement that will create the in a process which is positive, a positive ID number one and also inside that process, we need to create a third in it. Okay, this one is running right. Why is it not running because I know processes running 445 01:01:06.900 --> 01:01:17.910 William Cheng: Guys, by the way, I used to work process and three interchangeably, because we're doing single step or process. So, you know, process. Instead, they mean the same thing that is over here, you know, we're gonna create it. 446 01:01:19.050 --> 01:01:26.100 William Cheng: In a process and it's going to return the point over here. And then we're going to make the initial by adding it to the to the wrong shoe. And then we call 447 01:01:26.580 --> 01:01:35.400 William Cheng: Way P ID. Right. So again, what are we doing over here. We're going to go away for the child process to die over here. So in this case, we're going to end up sleeping so the Colonel. 448 01:01:35.820 --> 01:01:40.800 William Cheng: Right, because in order for you to wait for the child to die. You got to give up the CPU will you give her the CPU. Who do you give the CPU to 449 01:01:41.880 --> 01:01:45.360 William Cheng: While you give the CPU to whoever they just happened to be in the wrong key. 450 01:01:46.770 --> 01:01:48.840 William Cheng: Okay, so that's how you go to sleep. I went 451 01:01:49.530 --> 01:01:58.230 William Cheng: To AP ID, you're going to add yourself to a queue and then you call first word, and now you give them CPU or to another threat. Right. So again, the way that you should think about is that your corner. Oh, Simon is that 452 01:01:58.470 --> 01:02:08.100 William Cheng: Every threat, you know, eventually they all have to give up the CPU because they're not. They don't give out CPU. Nobody else gets to run. So you're going to find out all kinds of way to give up the CPU. 453 01:02:08.580 --> 01:02:16.950 William Cheng: Okay so clearly when you go through a few ideas. This one is a blocking call. So whenever you call it blocking call. Well, that means that there's a chance that you will go. Go to sleep. 454 01:02:17.700 --> 01:02:25.260 William Cheng: Okay. There's also a chance that you will you will not go to sleep because when you go call to AP ID. What if the deposit you're waiting for is already dead. 455 01:02:25.740 --> 01:02:30.600 William Cheng: While your necklace. You don't go to sleep, you actually return right away. Okay, so that's what a blocking call is 456 01:02:31.260 --> 01:02:39.930 William Cheng: Okay. Sometimes you might go to sleep. Something you might not go to sleep. So again, the important part is if you go to sleep. That's how you give out the CPU and then in that case other federal run 457 01:02:40.560 --> 01:02:48.060 William Cheng: There. Oh, I finally over here, inappropriate over here. So this one, create a problem when you never create a new prospect, you know, create a thread in there. 458 01:02:48.270 --> 01:02:52.230 William Cheng: Now, the Fed is not running over here. So, so this function only create the process and the threat. 459 01:02:52.650 --> 01:03:05.040 William Cheng: That the new program over here in the beginning, it doesn't do anything when you go into phase two, you need to replace this line with calling or the favorite test and then when you go to phase three, you gotta get rid of your favorite 460 01:03:06.240 --> 01:03:20.070 William Cheng: Test, you need to replace it, you know, with the new replaces with running the shop. OK, so again. So in this case, when you're writing Acacia Acacia is not a separate process you Acacia is actually run as the entire process. 461 01:03:21.150 --> 01:03:27.330 William Cheng: Okay, so your threat. Your Keisha is actually run it. Is that a threat contacts of process ID number one. 462 01:03:28.890 --> 01:03:32.430 William Cheng: Okay, so you're Keisha is actually part of a process ID number one there. 463 01:03:33.690 --> 01:03:35.700 William Cheng: Alright, so this is actually a good place to start. 464 01:03:37.680 --> 01:03:44.700 William Cheng: Well, well, I'm going to sort of walk you through, you know, the first few lines of code inside favor threat tests. OK. So again, 465 01:03:45.870 --> 01:03:52.830 William Cheng: If you start working on favorites that has. And if you have a question on what those lines do feel free to send me email and I'll answer them. Okay, and 466 01:03:53.550 --> 01:04:03.870 William Cheng: Otherwise, I think what I'm going to do is that the next discussion section I'm gonna release the video for as soon as possible. So this way you can actually, you know, a CC how I explain what I 467 01:04:06.540 --> 01:04:18.480 William Cheng: Actually read the code inside favorite test, guys. Okay. The most important thing for you to do right now is to read the favorites. Let us go and try to understand what they're doing. Once you understand what they're doing, then you will know what you have to implement 468 01:04:19.680 --> 01:04:21.300 William Cheng: That. Alright, see you next time.