WEBVTT 1 00:00:01.620 --> 00:00:12.389 William Cheng: Okay, this is the third part of the lecture nine. So in part two we talk about this important concept of mapping a file into your address space. 2 00:00:12.929 --> 00:00:17.789 William Cheng: There share mapping. You can use that on the tech segment. And then there's private mapping you use that 3 00:00:18.570 --> 00:00:31.140 William Cheng: On your all your heat segment and also you use on your data segment. Also you that the steps that men and the way to implement the private segment is to use copy. All right. Okay. So every time you see the word private mapping 4 00:00:31.830 --> 00:00:37.980 William Cheng: Sorry, it's not private segments private mapping and and how you see the word private mapping. That means that we're using copy on. Right. Okay. 5 00:00:39.990 --> 00:00:48.660 William Cheng: All right, so, so let's continue. So, so, so using this memory mapping, you can actually share a file with another process. 6 00:00:49.080 --> 00:00:54.120 William Cheng: So in this case, you know, you've you've met before into both into the address space of two processes. 7 00:00:54.600 --> 00:00:59.820 William Cheng: So in that case, when both process when they tried to modify memory, memory location, it will be the same thing as 8 00:01:00.450 --> 00:01:07.500 William Cheng: As modifying the file. So therefore, in that case, you can also share a file that way. Okay, so, so this mapping. Again, it's a very powerful concept. 9 00:01:08.160 --> 00:01:14.100 William Cheng: You know they they can do that. You can also share things read only. So once you share things. Read Only if you try to write to her. There'll be an error. 10 00:01:14.370 --> 00:01:20.460 William Cheng: Then in that case, you were trapped into the operating system and the system will kill your program. Right. So typically, if you want to share a file. 11 00:01:20.970 --> 00:01:27.270 William Cheng: You gotta, you gotta decide whether you want to share for reading read only or you want to shut up a rewrite, will you if you share it for rewrite 12 00:01:27.870 --> 00:01:39.960 William Cheng: If you modify your address space. It's the same thing as modifying the file. So therefore, the other process shouldn't be surprised if they all of a sudden see that, you know, part of the address space got change because you're sharing a file that way. Yeah. 13 00:01:41.820 --> 00:01:46.590 William Cheng: Alright, so here's a summary of different ways to to to to to perform memory mapping 14 00:01:46.830 --> 00:01:51.570 William Cheng: So again, there are major two kinds of mapping, what is called a phone mapping the other ones that anonymous mapping 15 00:01:51.750 --> 00:02:01.500 William Cheng: And again, the difference over here is a profile mapping your mapping of thought into your address space well anonymous mapping. There's no file system path, so therefore it's anonymous. It has no name. Okay. 16 00:02:02.070 --> 00:02:07.860 William Cheng: So let's take a look at the, you know, so. So yeah, if you just want to share a file for reading this is never any problem. 17 00:02:08.070 --> 00:02:16.020 William Cheng: So the only cause problem when you try to write to the top right. So over here, the summary. Most of the the comparison were sort of comparing the case when you write what will 18 00:02:17.100 --> 00:02:22.200 William Cheng: What will you read into memory locations over here. We're going to see why to the firewall to the anonymous memory. 19 00:02:22.500 --> 00:02:32.850 William Cheng: Now. Alright, so first let's take a look at the mapping against there are two different, two kinds of our mapping want to share mapping and the other one is private mapping. So when you do share mapping, you can share for rewrite 20 00:02:33.240 --> 00:02:36.690 William Cheng: Okay, so that's the, that's the slide that we just saw. Right. So in this case, 21 00:02:37.110 --> 00:02:50.310 William Cheng: You know when you change your what once you map this file for rewriting to you. I just based changing the address space will be changing a file and then if the other process also looking at the same file or in that case the data inside if I will also change that. 22 00:02:51.870 --> 00:02:59.520 William Cheng: Again, when it's read only. Well, and, you know, for different cases when you read only. And if you try to write to it, then in that case, you're going to tap into the operating system. 23 00:02:59.940 --> 00:03:05.490 William Cheng: So, the opposite is going to kill your program. There is a read only is actually pretty straightforward. Okay, so we're going to sort of focus on the revised case. 24 00:03:06.090 --> 00:03:11.100 William Cheng: If you have kept private mappings, or as soon as we see the private IP. We're going to see that we are using copy on write 25 00:03:11.430 --> 00:03:15.270 William Cheng: That. So in this case, if you have a file mapping and you using private mapping 26 00:03:15.480 --> 00:03:25.500 William Cheng: And if you right to the share memory segment. And in this case, when that case we're doing copyrights. We're going to make a copy. I'm going to write into the copy. So the actual modification never go into the real file. 27 00:03:25.860 --> 00:03:32.910 William Cheng: Okay, so this way you know when you try to modify your address space every process will see their own version of the modification that 28 00:03:33.480 --> 00:03:38.100 William Cheng: For. So again, that's because you're using private mapping. On the other hand, if you use anonymous mapping 29 00:03:38.580 --> 00:03:42.570 William Cheng: If you're using sure not anonymous happy. How do you actually share a memory segment. 30 00:03:42.840 --> 00:03:51.150 William Cheng: That that's anonymous right in order for you to share memories that you have to name them memory. Memory segment. If this memory seven has no name. Well, in that case, there's really no way to share it. 31 00:03:51.870 --> 00:03:56.970 William Cheng: Okay, so in that case, the only case that you can actually share anonymous mapping is between the parent and child. 32 00:03:57.180 --> 00:04:07.440 William Cheng: Right, because you because you know, you start with a parent you for coffee child process. And now the child process gets a copy of the address space and if it turns out there, sharing when this case, you know, they can actually share memory segment that way. 33 00:04:07.980 --> 00:04:15.930 William Cheng: That. So again, if you're performing a rewrite as. Sure, I'm happy. And then you're doing that rewrite that in that case, when one process right to the 34 00:04:18.000 --> 00:04:27.450 William Cheng: Right to the address space that the map. The map for anonymous memory that in that case the other process that also have the same mapping will see all the changes. 35 00:04:27.990 --> 00:04:36.210 William Cheng: Okay, so again, you know, share mapping, you gotta do very, very carefully, because otherwise you'll process will be surprised when the other process modify of the sort of locations that memory. 36 00:04:36.510 --> 00:04:44.400 William Cheng: Yeah. And finally, if it's not, none of the memory and you can do private mapping, just like the the data segment just like the heap segment just like the stack segment. 37 00:04:44.670 --> 00:04:58.740 William Cheng: So in that case, when you perform you know right operation to these memories segment you going to do copy on write. So again, every process have their own copy of the data. So in this case, you know, again, again, it's perfect for the data segment with VSS admin for the heat map for the stack. 38 00:05:00.360 --> 00:05:05.010 William Cheng: So you can do this inside the Colonel. As it turns out, you can also do this in the user space program. 39 00:05:05.370 --> 00:05:13.920 William Cheng: There was a system called called em map system call guys. So if you if you take a look at the man pages of the map system call it will show you how to do all these four different kinds of mapping 40 00:05:14.280 --> 00:05:20.520 William Cheng: OK. So the, the, the, the man pages. For me, it's actually pretty long, so you can actually read a lot of details about 41 00:05:22.950 --> 00:05:32.730 William Cheng: About all these four kinds of mapping. You can do this in the user space program. Right. So typically we don't really do we don't really call them map in the user space program. I don't know if you have ever written a piece of code. 42 00:05:33.150 --> 00:05:34.830 William Cheng: That will use the emphasis on call. 43 00:05:35.250 --> 00:05:43.620 William Cheng: Okay, but if you allow to map a file into your address space and modifying the address space is empty. Let's modify the file, then in that case you are also doing file I O 44 00:05:43.830 --> 00:05:51.000 William Cheng: Rafa Iowa's file input output. So if you can map into address space you can be from it. You can write from it. So that will be another style of doing 45 00:05:52.560 --> 00:05:58.560 William Cheng: Another style of doing doing follow that. So they are kind of to their due to different kinds of 46 00:05:58.860 --> 00:06:06.300 William Cheng: Follow one is that, you know, if you map entire file into your space, well then you're doing the Iowa, block, block up data at a time. 47 00:06:06.660 --> 00:06:14.070 William Cheng: Okay, so they have what is called a block I O right the normal way that we do IO is that we sort of read the data sequentially. We open the file and then we read 48 00:06:14.370 --> 00:06:26.970 William Cheng: We read 100 bytes. And the next time that we read another 100 bytes. We're going to read from where we left off. So therefore, we're doing our regional data sequentially. Okay, so when you are using open and followed by read and write and stuff like that you are doing sequential I O 49 00:06:28.290 --> 00:06:39.510 William Cheng: OK, so, so, so, so, so, so, you know, so, so, under what condition. Would you do a block I O. Right. So even though you probably never have written a, you know, CO like that before. But if you have taken the database class. 50 00:06:40.170 --> 00:06:50.760 William Cheng: Typically the database is really, really big, right, if you have a one gigabyte file, you know, which is your database. How do you access your database, right. So one way is to open it sequentially. You have to read the entire you know Gigabyte, you know, 51 00:06:51.870 --> 00:06:56.910 William Cheng: One gigabytes of database. You can read a one gigabyte is fun. It is into memory and then you got to build your data structure. 52 00:06:57.240 --> 00:07:04.680 William Cheng: That seems to be a really slow way to go. So one thing that you can do is that you can map the entire file or even map a portion of the file into your address space. 53 00:07:04.890 --> 00:07:10.680 William Cheng: You can modify data inside your address space. And when you close the file all the data will go back and we'll go back onto the desk. 54 00:07:11.670 --> 00:07:20.490 William Cheng: Okay, so, so you can think about a database application, you know, actually using a block I O is a really good way to do that. So also, if you can imagine that if you tried to, you know, 55 00:07:21.930 --> 00:07:31.590 William Cheng: write code for computer graphics right it will be nice. We can actually map. Some of the graphics memory into your address space. So again, in this case, modifying your address space. It's the same thing as modifying 56 00:07:33.450 --> 00:07:38.730 William Cheng: Modifying sort of the graphics device. So in that case, it's also going to make a programming very, very simple. 57 00:07:39.150 --> 00:07:46.020 William Cheng: There. Alright, so, so even though, typically we see sequential I O once in a while, you know, block I O is also very suitable that 58 00:07:46.920 --> 00:07:51.990 William Cheng: So, so, yeah. So, so when again that I guess I sort of talked about, you know, I'm, you know, 59 00:07:52.590 --> 00:08:03.210 William Cheng: Doing computer graphic as an example. So in that case, the computer graphics is actually a device resident. So, so not only you can map a file into your space. You can also map a device into outer space. 60 00:08:03.930 --> 00:08:15.360 William Cheng: Okay, so, so, so, and then, you know, to the block I O is available for file is available for devices. Similarly with sequential I O right when you try to refund the keyboard. Should you use sequential I O. So you block I O 61 00:08:15.780 --> 00:08:30.360 William Cheng: Well, when you try to refund the keyboard, you're reading one character at a time you read in one line at a time. So, so therefore it's more suitable to use different a sequential I O or so, again, different devices, you know, sort of support different kinds of, you know, so I operation stocks. 62 00:08:31.920 --> 00:08:41.310 William Cheng: Alright. So when we talk about a few just a system called right so again for the file system called there's open. There's read right and then just close 63 00:08:41.640 --> 00:08:51.810 William Cheng: So now we also see one more, which is the memory map, guys. So typically we see the file system, the sort of the, the operating system call. They are usually a small set of function called that you use to to ask 64 00:08:52.380 --> 00:09:01.170 William Cheng: For help. Okay, so when you try to design your operating system. One of the most important thing you need to design is that what are the system called because that's the interface. So the operating system. 65 00:09:01.500 --> 00:09:08.010 William Cheng: Okay. And also, once you finish design that you know it will be nice that you never have to change because every time, will you need to change your options. I mean to face. 66 00:09:08.280 --> 00:09:12.690 William Cheng: The application programmer is going to get very upset because they have to learn a new way to talk to the operating system. 67 00:09:13.140 --> 00:09:23.850 William Cheng: That. So, therefore, you know, for those for the system point API is very, very important to have backwards compatibility. Because when you design your optimism. You got to make sure that when I designed the operating system. This 68 00:09:24.420 --> 00:09:29.880 William Cheng: You know this this sort of system call is good for the current operating system. It's also good for the future operating system. 69 00:09:30.750 --> 00:09:35.970 William Cheng: Okay, so you can sort of imagine that's a really, really difficult tasks, right, because you know this because howdy howdy really predict the future. 70 00:09:36.330 --> 00:09:44.940 William Cheng: So as we see in so sort of historically only a few operating systems survive. And these are the one that has a very, very good design for the criticism API. 71 00:09:45.540 --> 00:09:54.960 William Cheng: Okay, so this way you know 10 years later with somebody come up with a new device. We can still use the same operating system to talk to that device. Yeah. So again, so, so, so 72 00:09:56.610 --> 00:10:04.530 William Cheng: So the idea here is that your application should talk to the hardware using exactly the same same operating system API, even when the operators. 73 00:10:05.250 --> 00:10:13.530 William Cheng: Even when the hardware devices are changing over time that. Similarly, we also want the operating system to be independent of the hardware and we mentioned before. 74 00:10:13.950 --> 00:10:22.710 William Cheng: You know, built between the offices, having the hardware. We're going to also going to use another layer called a hardware abstraction layer. So this way, our operating system can be independent of what 75 00:10:23.520 --> 00:10:28.080 William Cheng: Okay. So in this case, we're not talking about device independent because we we mentioned before, the way you the 76 00:10:29.040 --> 00:10:34.410 William Cheng: Way you do device independence is that you have the hardware manufacturer, they are the one that implemented device driver. 77 00:10:34.980 --> 00:10:39.690 William Cheng: Okay. So in this case, what are you really independent. All right, because you also want to be independent of the CPU. 78 00:10:40.590 --> 00:10:46.020 William Cheng: Okay, so in order to make the offices that may depend on CPU going to use a hardware abstraction layer. So this way you know 79 00:10:46.320 --> 00:10:59.580 William Cheng: Five years from now somebody come up with a new CPU and the ideal situation is that you don't have to change a single line of your operating system. All you have to do is come up with a new hardware abstraction layer and you can plug it into your organism, everything will work. 80 00:11:00.660 --> 00:11:10.230 William Cheng: That right so so you want your operating system to be independent of the CPU and also you know the the same CPU has different configuration. Right. So for example, you want to buy Intel CPU. Which one do you buy 81 00:11:10.620 --> 00:11:14.970 William Cheng: Okay, so. So in terms of x86 architecture. And then there's the sad. Sorry. 82 00:11:15.450 --> 00:11:20.370 William Cheng: x86 64 architecture right, they have a 32 bit architecture. They have a 64 bit architecture. 83 00:11:20.610 --> 00:11:27.840 William Cheng: But, you know, for every architecture. There are a lot of variety. Some of the CPU. I should have physical either smaller they have small they have smaller number of features. 84 00:11:27.990 --> 00:11:35.490 William Cheng: And there are some some CPU that actually bigger has a lot of features, right. So again, you want your operating system kernel to be independent of all of these 85 00:11:35.670 --> 00:11:38.760 William Cheng: Different kinds of CPU, even though they're the same architecture. 86 00:11:38.940 --> 00:11:48.180 William Cheng: And also, you know, some of these CPUs. How are configured differently. They have more hardware inside they have less hallway inside. So again, all these things are abstracted away inside of our abstraction layer. 87 00:11:48.600 --> 00:11:54.600 William Cheng: Guys, okay, in order for you to have a good holiday obsession. They are you also need to very, very carefully designed to how objection. They are API. 88 00:11:54.930 --> 00:12:02.370 William Cheng: And as we mentioned before that this is really outside of the scope of this class guy. So if you take a sort of a hardware class and there was a real talk about more 89 00:12:02.880 --> 00:12:13.200 William Cheng: More things like that. Yeah, right. So again, it's important to make the operating system, independent of the CPU and also different configuration of the same type of CPU. Right. And that's why we have the hardware abstraction layer. 90 00:12:14.550 --> 00:12:18.840 William Cheng: Okay, what else is there. So the next thing that we're going to talk about in chapter four. 91 00:12:19.050 --> 00:12:25.890 William Cheng: Is a framework for devices. So, you know, so. So we mentioned before, right, the way you talk to devices is that you need to, you know, sort of, 92 00:12:26.010 --> 00:12:36.690 William Cheng: Talk to the device driver and the device driver is going to be the one that talks to the devices and the device drivers are written by the hardware manufacturer. Okay, so the question over here is that if you have a bunch of device driver. Which one should you use 93 00:12:37.770 --> 00:12:42.930 William Cheng: Okay. So as it turns out, you know, we sort of need to have a framework of talking to all these devices. Yeah. Alright. 94 00:12:43.320 --> 00:12:46.350 William Cheng: So here's an example of a device. And this is a computer terminal. 95 00:12:46.620 --> 00:12:56.790 William Cheng: So if you blow this one up right here you will see that on the left hand side over here. It's a digital equipment court. They are the ones that invented the mini computer. And this is one of the most popular terminal that they built there. 96 00:12:57.030 --> 00:13:08.610 William Cheng: On the right hand side over here. It says, so this terminal type is VT 100 when you log into a one to, you know, 60.04, you can use the command a your terminology echo dollar term. 97 00:13:10.200 --> 00:13:12.150 William Cheng: Okay, so what it will do is it will print 98 00:13:13.410 --> 00:13:17.790 William Cheng: It will print. What kind of terminal that the Ubuntu 16.04 things that they're connected to 99 00:13:18.240 --> 00:13:26.070 William Cheng: OK. So again, this is a this is a physical terminal. I mean, today we have terminal emulation right so so when you type this command. Want to see the bio for 100 00:13:26.250 --> 00:13:34.020 William Cheng: You are no longer sitting in front of a terminal. You're sitting for a laptop and the lockout can emulate a lot of terminals. Okay. So when you say Ecuador term. It's going to sort of 101 00:13:34.920 --> 00:13:43.560 William Cheng: Going to print. What kind of terminal that he thinks that's connected to. Okay, so these days. I think when you do that, you're going to see, you know, it will print something called x term. 102 00:13:44.040 --> 00:13:59.520 William Cheng: Dash color 256. Okay, so x term is another company. So this is a company called X terminal. They're also very famous building all these terminal and they have a color terminal that has 256 colors. So that's why. Yeah. So, so, you know, what will you run the Ubuntu terminal. 103 00:14:00.060 --> 00:14:04.380 William Cheng: To terminal is emulating you know this other type of terminal. Okay, so I don't know what 104 00:14:05.490 --> 00:14:10.680 William Cheng: I mean, you've probably never seen a real terminal before I want to see a picture. So what does it mean to to connect to a terminal. 105 00:14:11.070 --> 00:14:23.310 William Cheng: Okay, so when you're sitting in front of a terminal to Terminal over here is a character based device. And I mentioned before 80 characters across 24 lines, right. It's not a. It's not a graphical display. It's a character display that 106 00:14:23.700 --> 00:14:34.740 William Cheng: Every key press over here, January a hardware interrupt. Okay, so how does it generally how we interrupt. Right. So the idea here is that at the back of his computer. There's a serial cable that's connected to the computer physically 107 00:14:35.190 --> 00:14:41.040 William Cheng: Okay, so when you're sitting in front of a terminal. That means that you're physically connect to a computer. So at the back of the computer over here. There's a serial port. 108 00:14:41.310 --> 00:14:44.760 William Cheng: Guys are computed the terminology here physically plugin 04 109 00:14:44.940 --> 00:14:51.600 William Cheng: And that's why every key that you press over here is going to generate interest. So again, there's a keyboard controller that sitting over here that's sitting on the bus. 110 00:14:51.720 --> 00:14:57.300 William Cheng: So every key that you present to generate interest on the best you're going to interrupt the CPU and then again you know the the 111 00:14:57.690 --> 00:15:06.960 William Cheng: Inside interrupt service routine is going to find out what key that you have press. Yeah. And also, when the operating system tried to put a character onto the screen. It also does this one character at a time. 112 00:15:07.320 --> 00:15:16.290 William Cheng: Because this is a very slow device, it will put one character on the screen over here way for an interrupt interrupt interrupt service routine, they will put the next character onto the screen and they will do this one character at a time. 113 00:15:16.890 --> 00:15:26.790 William Cheng: Okay, so when you are using the terminal. That's the kind of devices, you're connected to that. And also, since you're physically connected this machine. If you have the right privilege to use this machine, you can actually shut down the machine. 114 00:15:27.540 --> 00:15:35.670 William Cheng: That I just want to mention that this kind of connection is very, very different. And we use your web browser and you have a connection to Google. COM. Can you shut down Google com 115 00:15:36.000 --> 00:15:44.580 William Cheng: Well, there's no way for you to do that. So again, it's a very, very different kinds of connection right this is the physical connection. And then when you connect to Google com or CNN com that's a logical connection. 116 00:15:45.060 --> 00:15:49.950 William Cheng: Okay. Alright, so, so, so, so now you know. So what it means to be sitting, sitting in front of in front of a terminal. 117 00:15:51.150 --> 00:15:55.920 William Cheng: In the good old days before the days of the terminal. There's something called a TTY so once in a while you're going to see the 118 00:15:56.310 --> 00:16:04.590 William Cheng: The word TTY especially in our carnal assignment so TTY stands for teletype. So in this case, you know, there's the they're actually no screen. 119 00:16:05.160 --> 00:16:12.240 William Cheng: The actually everything that you tab over here. We'll get we'll. It's like a typewriter your shows up on a piece of paper then and also when the 120 00:16:12.630 --> 00:16:23.550 William Cheng: When the computer to print things out to you. They will also put it on a piece of paper, you can see that this paper over here, you know, what does it go to right so so once you start printing one at a time. This paper start disappearing at the back of this 121 00:16:24.630 --> 00:16:32.310 William Cheng: Pack of this teletype right so if you forget what you have seen what you have to do is that you have go to you have to go pick up the paper and then you have to scroll it 122 00:16:32.790 --> 00:16:41.640 William Cheng: Okay, so that's where the term scrolling come from well guys have these days where we have a computer screen. We need to scroll up right so in the good old days over here, you actually have to pick up a paper and then scroll 123 00:16:42.120 --> 00:16:51.120 William Cheng: Okay, so when you're dealing with a TTY over here. You know, you know, unless you guys sort of physical the score the paper you only going to see 24 rows and columns. 124 00:16:51.810 --> 00:17:00.030 William Cheng: Okay, so, so, so later on you'll kernels. I'm going to be dealing with to TTY and you will find out that in the real TTY there's no way for you to scroll the screen that 125 00:17:00.810 --> 00:17:01.440 William Cheng: Alright, so 126 00:17:02.280 --> 00:17:08.400 William Cheng: I want to talk about devices. I will mention a couple of things already device independence device discovery. When we mentioned that in the in 127 00:17:08.490 --> 00:17:14.340 William Cheng: What we talked about booty right when you tried to pooja ordinances that is I'm fighting to discover all the devices and it can be a really 128 00:17:14.520 --> 00:17:23.760 William Cheng: slow process and later on we have dynamic Lincoln and loading. So therefore, we can actually cut out a lot of times when we try to put our operating system now. Alright, so, so we mentioned already in booty. 129 00:17:24.480 --> 00:17:34.950 William Cheng: Also, when we tried to name the device. How do you actually name all these devices. Okay, there are two different approaches. One is to have the you have an independent namespace. Okay. Every device is his name, independently of all the other devices. 130 00:17:35.340 --> 00:17:39.450 William Cheng: Okay, this is going to be making it very, very difficult for you to write your options to send because when you try to 131 00:17:39.630 --> 00:17:46.020 William Cheng: Churches and write your audiences and you have to say that I want to use the device. I want to use one name and one of us another device. I need to come up with a complete different name. 132 00:17:46.830 --> 00:17:49.860 William Cheng: Okay. So typically we will see this anymore unless you are sort of, you know, 133 00:17:50.130 --> 00:17:58.380 William Cheng: Sort of implementing a very specialized operating system, you only have one or two devices. Why, in that case, you can explicitly name these devices, but for Linux and Unix system. 134 00:17:58.590 --> 00:18:07.830 William Cheng: Typically what they are doing what we hear that devices are named as files. Okay. I mentioned before, right, you know, sort of the file system is the only way for UNIX system. 135 00:18:08.220 --> 00:18:12.240 William Cheng: To go outside of the address space. So in this case, where you need to talk to the desk. 136 00:18:12.510 --> 00:18:17.520 William Cheng: While you're gonna use the file says that we need to talk to you a keyboard. You also need to process them. Well, you need to talk to the display. 137 00:18:17.730 --> 00:18:21.810 William Cheng: You're gonna you're gonna use the fastest demo, you need to talk to the internet, you will also have use the file system. 138 00:18:22.110 --> 00:18:30.570 William Cheng: Okay, so in this guys if you want to talk to any kind of devices that device will have a file system path name. And if you open that putting the file you will be talking to the device. 139 00:18:31.110 --> 00:18:41.880 William Cheng: Okay, so that's the UNIX abstraction. As it turns out, this was a really convenient, a very useful abstraction. And that's why I sort of Unix you know survive throughout all the years. Okay, so, so, so 140 00:18:42.780 --> 00:18:53.100 William Cheng: So so so the the the way we sort of connected device driver, you know, to a file system path name is that, you know, for all the files in a UNIX system and a Linux system. 141 00:18:53.580 --> 00:19:02.250 William Cheng: There's a director com slash dead or so. I mean, meaning that it's a device directory. So inside this directory over here. We're going to have a lot of file every file represented device. 142 00:19:03.300 --> 00:19:06.630 William Cheng: Okay, so if you go to the slash Deb directory, you're going to see all your devices. 143 00:19:07.170 --> 00:19:18.570 William Cheng: Okay, so if you do a minus, minus, minus l inside that directory, you will see that every file. You can see the information about every file every fall. What do we do something will show you two numbers. These two numbers represent a file. 144 00:19:19.530 --> 00:19:26.580 William Cheng: Okay, so you know way you know Unix. The other devices are the representation or device is very, very simple every device is simply to numbers. 145 00:19:26.790 --> 00:19:33.090 William Cheng: The first number is known as the major device number and the second number is known as the minor device number every number is a 16 bit number 146 00:19:33.900 --> 00:19:41.550 William Cheng: Okay, so who represented device. All you need is a 32 bit integer, then the major device number tell you which device drivers to use 147 00:19:42.150 --> 00:19:50.010 William Cheng: Okay, so, so, so, so the major device number over here, identify the device driver. So by opening the right device over here, you end up talking to the right device driver. 148 00:19:50.940 --> 00:19:55.770 William Cheng: Right. So again, the solutions are very, very simple, right, if you if you have a file system path. And then the system path. 149 00:19:56.130 --> 00:20:01.530 William Cheng: You know it's coming in them a device and the device has to be major the first integer is used to to to to to 150 00:20:01.890 --> 00:20:09.360 William Cheng: To give the other device driver and then some of the right driver can actually control multiple devices, right, for example, at this controller. 151 00:20:09.570 --> 00:20:17.160 William Cheng: This controller can count some of this control. I can control two days some of that this control and control for this. So if you have a disk controller that control for this. 152 00:20:17.430 --> 00:20:24.900 William Cheng: If you use a major device number they will only give you one device driver and now you know if you want to use for this we need to specify which this you want to talk to you. 153 00:20:25.380 --> 00:20:33.960 William Cheng: Then. So in this case you will use the minor device that number. So you can use 0123 to say I want to talk to this number 01 or two or three, you know, for this particular device driver. 154 00:20:34.530 --> 00:20:40.680 William Cheng: Okay, so this way you can actually be able to specify a particular to finally go down to the actual device level, then 155 00:20:42.000 --> 00:20:50.820 William Cheng: So, so, so this is actually how it's done right. So if you do an ls minus out in slide deck and you will see that this one has two number. The first number is six, and the second line number is one 156 00:20:50.940 --> 00:20:59.310 William Cheng: So that means that the major device. Number six, and a minor device number is one, right. So again, this guy's maybe this disc over here they are, you know, for you know the the 157 00:20:59.640 --> 00:21:05.100 William Cheng: The disk controller control for days and their number 0123 or 1234 or whatever the number is. 158 00:21:05.610 --> 00:21:13.950 William Cheng: So the idea here is that this number six over here is simply as an array index, guys. So inside the Colonel, they have a data structure called the seat def switch 159 00:21:14.400 --> 00:21:20.190 William Cheng: Okay, so in this case is going to be an array of a function pointer, each one of them will point to a device driver. 160 00:21:20.520 --> 00:21:32.970 William Cheng: Okay, so if the major device number is equal to six over here, you come to this data structure 0123456 use you use the major device number as a re index and this one will give you a function pointer and the punchy part over here. It's going to point to 161 00:21:34.650 --> 00:21:41.460 William Cheng: Give you a pointer and the partner points to the interface for that device. And again, the interface face without device is simply a function project. 162 00:21:41.850 --> 00:21:53.940 William Cheng: Now, so for this device or what are the function over here, we saw before the function is is like to read entry point the right entry point and we saw before. The third entry point is the inner of entry point. But now we also know about memory map. 163 00:21:54.450 --> 00:22:01.470 William Cheng: Okay, so you can actually map a disk, you know, a part of it. This into your address space. In this case, you know, maybe one of the function over here is going to be memory map. 164 00:22:01.980 --> 00:22:09.660 William Cheng: Because, again, is there a way a function pointer over here, right. So, so again, they will point to the specific implementation and we saw before. In chapter three. 165 00:22:10.440 --> 00:22:21.360 William Cheng: Chapter three, right, we talked about how that mapping is done. Now you can have the western digital device driver and the Seagate device driver by going through one level in direction, you can actually call up any of these device drivers. 166 00:22:21.930 --> 00:22:29.370 William Cheng: Or guys. But again, the major device number over here will point to a device as a pointer device driver. So in this case, you know, again, every device. 167 00:22:29.790 --> 00:22:38.430 William Cheng: On your mobile device. So when you make the function call via for the reader, right, you need to specify which this, I want to, I want to reframe and which this, I want to write to 168 00:22:38.790 --> 00:22:41.700 William Cheng: That. So one of the arguments over here for the reader and arrived function. 169 00:22:41.970 --> 00:22:46.530 William Cheng: And that function call is going to be the miter device number. So what you would do that you will take the matter device number 170 00:22:46.740 --> 00:22:56.430 William Cheng: Pass it as a function arguments. So this way you will we find the right desk and you can also, you know, sort of, right to the correct desk. Oh, that's all good and four units and let it this is super simple. 171 00:22:57.780 --> 00:23:02.070 William Cheng: Device discovery over here again we mentioned that in boot already. So we're going to go skip all that 172 00:23:02.550 --> 00:23:10.710 William Cheng: One thing I just want to mention over here is a modern days we use USB devices. Right. So what is USB right so USPS actually a hardware protocol. 173 00:23:11.130 --> 00:23:17.460 William Cheng: Okay, so therefore your computer over here. We're going to have a device called a USB device and the USP is a bus architecture. 174 00:23:17.670 --> 00:23:30.990 William Cheng: On the USB bus. Right. So here is the USB bus over here. Okay. It goes out. So you have every bought a USB hub right the USB hub over here is kind of like a bus architecture, you can plug in a bunch of USB devices plugs into the USB bus. 175 00:23:31.740 --> 00:23:42.120 William Cheng: Okay, so what happens is that when you put your operating system. So now all you are required to have a very, very few number of device driver. So what kind of device driver. Do you need what you need a keyboard driver, you need a display driver. 176 00:23:42.660 --> 00:23:50.400 William Cheng: You need at this driver. Right. So in that case, that's, you know, maybe you need us. Yeah. So maybe, maybe that's all you need. And also you need a USB device driver. 177 00:23:50.940 --> 00:24:00.720 William Cheng: Okay. So Robin is out where you put your organism, you're going to load the minimum number of device driver. Once you load the USB drive device driver at the USB device level actually talk over the USP 178 00:24:01.380 --> 00:24:06.060 William Cheng: Talk over the USB bus and talk to all these hardware using the USB protocol. 179 00:24:06.840 --> 00:24:09.330 William Cheng: So in that case, you're operating system is no longer, you know, 180 00:24:09.660 --> 00:24:21.210 William Cheng: There is no longer involved. This piece of hardware over here will actually talk to all the other piece of hardware. Find out who they are, they would download their drivers device driver over here and they were installed into a running Colonel using dynamic Lincoln and loading. 181 00:24:22.440 --> 00:24:25.050 William Cheng: Okay, so once you start doing this. So what is the major advantage of 182 00:24:25.230 --> 00:24:29.220 William Cheng: This particular approach, right, is it now your boot off. We are criticism is going to be very, very sure. 183 00:24:29.370 --> 00:24:40.050 William Cheng: Because at the time for your boo, you only require a minimum number of device driver and one of them is going to be the USB device driver at that can actually discover all the other device driver and download them and then install them into a running Colonel 184 00:24:40.680 --> 00:24:47.160 William Cheng: Okay, so that's why today we love USB so much because it really cuts down on the boot time for your operating system and 185 00:24:48.480 --> 00:24:58.470 William Cheng: All right, so let's continue over here. So, so the next part of hearing the textbook as you talk about, you know, sort of that device driver design issue. 186 00:24:58.920 --> 00:25:08.670 William Cheng: We're going to skip that. The reason for that is that, you know, again, when we look at our current assignment. The Colonel seven from Brown University. There are five assignment. We're doing one, three and five. We're skipping two and four. 187 00:25:09.390 --> 00:25:15.000 William Cheng: You know, the Simon number two. It was called drivers. So for Brown University. They're actually implementing the device driver. 188 00:25:15.570 --> 00:25:27.180 William Cheng: Okay. For us, we got the solution in binary form from Brown University, and we just going to use them. We're going to assume that they're perfect. Okay. So, therefore, we're going to talk about device driver, a little later when we finished chapter seven. 189 00:25:27.810 --> 00:25:35.640 William Cheng: Now, so now I'm going to skip that and we're going to talk about processes and threats and this is more related to your kernel one assignment. Okay, so I'm going to give you a background. 190 00:25:36.030 --> 00:25:45.090 William Cheng: For kind of one assignment. Yeah. Alright. So again, what is the process a process host an address space, a whole bunch of swear to provide execution context, again, we talked about this several times. 191 00:25:45.450 --> 00:25:54.120 William Cheng: Because this is a very, very important for you to understand that and also to interact with process where a bunch of API's. We talked about, you know, fork exact weight and exit all these API's. Yeah. 192 00:25:54.720 --> 00:26:03.450 William Cheng: Alright, so let's take a look at more detail of the process implementation. So again, we talked about the process inside the Colonel, the implementation, we started out with the process control, blah. 193 00:26:03.930 --> 00:26:14.640 William Cheng: Okay, the process comes over again PCB over here is data structure. We already seeing some of the stuff that goes into a process control blah blah day right. Number one is the process ID and go also store the 194 00:26:15.390 --> 00:26:23.670 William Cheng: The the the exit code for your process in case of process went into a zombie state, yeah. What else, going to the address space that we also see that, you know, 195 00:26:24.450 --> 00:26:36.960 William Cheng: You also need to represent your address space. So therefore inside the process control blah, we need to have some kind of a data structure that represent your address space. Okay. As it turns out, this is closely related to your memory map. So therefore, your address. 196 00:26:37.200 --> 00:26:40.590 William Cheng: Description. So later on we're going to see that evolved into the virtual memory map. 197 00:26:41.040 --> 00:26:47.580 William Cheng: Okay. So using that data structure, you can actually represent the address space for your program. Right. So again, all that stuff going to be chapter seven. 198 00:26:47.970 --> 00:26:53.670 William Cheng: Other stuff inside their process control bra. As we mentioned also in chapter one every process has their own 199 00:26:54.090 --> 00:26:56.730 William Cheng: file descriptor table right so the file discovery table. 200 00:26:56.910 --> 00:27:06.600 William Cheng: Typically is part of the process control block. So again, it's easier. So again, you can also be outside right as long as you use a pointer using one level indirection. You can have a point to another, another data structure. 201 00:27:06.930 --> 00:27:19.170 William Cheng: Right, so whether they actually live inside the process control blog or one hop away from classical Java. That doesn't really matter that I mean some people is going to say, oh, there's a performance issue but again following one point, it doesn't really cost you very much. Yeah. 202 00:27:20.250 --> 00:27:23.460 William Cheng: He said process control, but they're also a list of threats, right, because the process. 203 00:27:24.270 --> 00:27:36.900 William Cheng: Needs to maintain a list. There's a thread. And the last part over here. It's going to be the current state we mentioned already one state of your process your process can be in the zombie state was one of the threads inside your process, make the system call 204 00:27:37.320 --> 00:27:47.310 William Cheng: Okay, so later on I'm going to see what other stage will process can be in. OK. So again, the state of the process is stored inside the process control blah right there are other studies out the process control, blah. 205 00:27:47.790 --> 00:27:54.030 William Cheng: Now you have the kernel source code, you can actually look at the kernel source code to see what other stuff going to the passage central blah, right. So that's the semester move forward. 206 00:27:54.330 --> 00:28:01.200 William Cheng: Eventually, we'll talk about more stuff inside process central blah. OK. So now again. It's very, very high level description because we're in chapter four. 207 00:28:02.550 --> 00:28:15.210 William Cheng: And what about a second robot. Right. Is that a third canto blog. We have the three identifier. We have the fair return, Mexico, we have the signal masks. Right. Well, we also have a threat specific data, you know, 208 00:28:16.320 --> 00:28:21.330 William Cheng: We were so we were sort of talking a bunch of stuff that that the inside of your control, blah. 209 00:28:21.780 --> 00:28:27.870 William Cheng: One of the the the thing we're talking about is that there's a contact area where you're threatening to go to sleep. We need to save all the register value. 210 00:28:28.110 --> 00:28:39.870 William Cheng: One of them is most important is the stat pointer that standpoint, it will point to, you know, where the stack is punt on top of that. So if your threat is sleeping. This that point it will point it exactly weren't at the top of the 211 00:28:40.230 --> 00:28:50.970 William Cheng: Stack. So when you go sleep now. So again, if your thread and executing inside of CPU than this point over here will point to the wrong place, because you know when we execute our threat. We don't keep updating our control, blah. 212 00:28:51.540 --> 00:28:59.760 William Cheng: OK. So again, the third are running out of CPU this. Yeah, this information will be our data before the thread there are sleeping. This is the exact state where your third went to sleep. 213 00:29:00.240 --> 00:29:03.900 William Cheng: Guys, so you need to keep the standpoint, are you also need to keep track of all the other register. 214 00:29:04.350 --> 00:29:10.950 William Cheng: Again, we need to save the contacts over here instead of their control blah and later on we also need to run again we're going to restore the contacts now. 215 00:29:11.490 --> 00:29:18.450 William Cheng: The third also have, you know, have a state variable we here to represent different states and later on we're going to see for Linux system. What kind of state a second half. 216 00:29:19.260 --> 00:29:26.190 William Cheng: But again, there's more stuff inside of sequential blog, you know, feel free to check out the data structure, you know, inside your kernel assignment that 217 00:29:27.330 --> 00:29:35.910 William Cheng: All right, so. So anyway, and all these things. I wrote them to your kernel one. All right. Although for the Colonel. Why, I just want to keep stressing this because people are still, you know, always want to change things. 218 00:29:36.360 --> 00:29:44.550 William Cheng: We're doing one separate process, right, which means that MTP MTP over here, equal to zero inside configure AMP. A please don't change that. 219 00:29:45.030 --> 00:29:57.900 William Cheng: Okay. So in this case, that means that every process that exactly one. So in this case, you know, over here we have a list of threat. So what does it mean every process can help only one threat. Okay. That means that the list of floods over here is going to be a list of one thread. 220 00:29:59.100 --> 00:30:03.240 William Cheng: Okay. Some people actually go to the header file over here changes want to point to a slight don't do that. 221 00:30:04.020 --> 00:30:11.430 William Cheng: Okay, so again, the way we do this is that it's going to be a list of threats and this list is always have only one slide in it. OK. So again, we're gonna keep the same data structure. 222 00:30:11.760 --> 00:30:20.850 William Cheng: Because, you know, current assignment. You are not allowed to modify the header files. Okay, if you if you modify the header file or delete your header files that are replaceable. Oh, so again, don't do that, then 223 00:30:22.980 --> 00:30:32.370 William Cheng: All right, so let's take a look at the life cycle of a process. The process. As it turns out, is very, very important can only be in two states. One is the zombie state and the other state is known as the run steak. 224 00:30:32.700 --> 00:30:37.410 William Cheng: Okay. Over here says the process stuff in the, in the run say. So how does the process start 225 00:30:37.740 --> 00:30:48.720 William Cheng: Whereas, remember the when the process star is started out by the pound process forking a child process. So when the child classes get created what status in well it's in the middle of doing a fork, so therefore it's running already 226 00:30:49.620 --> 00:30:53.340 William Cheng: Okay, so therefore, when a process. Get started running already so therefore it's interesting, right. 227 00:30:53.430 --> 00:31:01.320 William Cheng: And also the child process later. Are you still running over here, you can actually wipe out the address space and replace it with a different program. But again, it's still the same process. 228 00:31:01.590 --> 00:31:11.400 William Cheng: Again, it's still still stay inside around say around state okay once one of the threads inside of process. Make the exorcism call in that case you will going to the zombie state. Once this is a zombie stay 229 00:31:11.640 --> 00:31:14.820 William Cheng: None of the thread in this process will ever execute a single line of code. 230 00:31:15.720 --> 00:31:23.790 William Cheng: Okay, so that's what it means to be in the zombies day. And again, the reason for going to the zombies day is that the parent needs to get the return Mexico from this particular child process then 231 00:31:24.630 --> 00:31:33.000 William Cheng: All right, what's important about the process is that for the Unix and Linux system. The process has to form a strict hierarchy. Okay, so what's a strict hierarchy. 232 00:31:33.570 --> 00:31:39.690 William Cheng: Hierarchy is a tree hierarchy where there's only one root and the root of the tree hierarchy is going to be the entire process. 233 00:31:40.200 --> 00:31:45.120 William Cheng: OK. So again, what does the unit process right in a process is the process with with the process it equal to one. 234 00:31:45.750 --> 00:31:53.430 William Cheng: When we talk about booting right you know for the Linux is that there's a funny process called process zero which is actually the sort of the parent process of the entire process. 235 00:31:53.970 --> 00:31:59.340 William Cheng: But the process zero doesn't really count because it's creating a positive zero is created in a weird way. 236 00:32:00.150 --> 00:32:05.670 William Cheng: Okay, because it's created from no context and all of a sudden, you end up with a process zero again. That's not using assembly code. 237 00:32:05.850 --> 00:32:16.020 William Cheng: And the only other the first process that get created in a normal way is a process right now process, the one with kitty and he's the ancestor of all the, the user space processes. 238 00:32:16.290 --> 00:32:20.550 William Cheng: That. So, and this guy's again is going to be the ancestor of all the processes over here that you're running 239 00:32:20.880 --> 00:32:29.520 William Cheng: That already exists, then you can actually use the command PS tree and you will actually show you this hierarchy. Okay, you will see that the root of the hierarchy is going to be the entire process. 240 00:32:30.180 --> 00:32:39.480 William Cheng: Now, so, so, so, since it's a strict hierarchy or the other meaning of the hierarchy is that every year, every process over here has to have exactly one parent process. 241 00:32:39.960 --> 00:32:42.810 William Cheng: Okay, if you don't have a strict hierarchy in that case you can I have two parents 242 00:32:43.230 --> 00:32:52.200 William Cheng: So in the Unix and Linux system every process required to have exactly one per. The only exception is the entire process very enterprise, it doesn't really have a parent, even though there's a hidden parent 243 00:32:52.440 --> 00:33:00.810 William Cheng: Household the IPO process, but the way we sort of think about is that image is the root of the hierarchy. So it doesn't have any prior all the other processes have exactly one parent 244 00:33:01.350 --> 00:33:08.010 William Cheng: Okay, then the, the obvious question is that what if what if a process dies. Right. So the login screen over here. What is this process that 245 00:33:08.430 --> 00:33:19.530 William Cheng: You guys. So again, this example is like these are the login demon over here. If one of them died over here, the child processes has to have a parent process. So in this case, we have to re, re parent and the child processes. 246 00:33:19.800 --> 00:33:25.620 William Cheng: Okay, so the chances are they will become the child process of the interview process because they're required to have parents 247 00:33:26.010 --> 00:33:31.920 William Cheng: That. So therefore if log in three days over here. The picture will change this, because every process required to have a parent. 248 00:33:32.700 --> 00:33:42.060 William Cheng: But what about when this process diet. When this process that over here if you make, you know, the child classes over here. If you make the parent that you know the other sort of the grandparent. 249 00:33:42.480 --> 00:33:49.770 William Cheng: In that case is really not allowed. Okay. Because unique process tree over here is not like the sort of the human society, the human society. 250 00:33:50.100 --> 00:33:57.630 William Cheng: Grandparents actually know who the grandchildren are getting the UNIX passes over here in the process tree, the grandparent process doesn't know where the grandchild are 251 00:33:58.170 --> 00:34:07.770 William Cheng: Okay, well why is that because when the parents do when the grandparents over here. When a call fork is going to create the parent process. So, we will receive the process ID of the parent process. 252 00:34:08.040 --> 00:34:13.650 William Cheng: But when the parent process create the grandchildren process. This process ID is not returned to the parent 253 00:34:13.950 --> 00:34:27.840 William Cheng: Okay, so if you make, you know, the grandchild over here, become the chart of a parent or grandparent process when the grandparent call or the way system called is going to return. Oh, with the process ID and it says I've no idea who these are who these grandchildren are 254 00:34:28.950 --> 00:34:40.620 William Cheng: Okay, so definitely in that case when command and the other one. This process that over here. When you repair and you know these grandchildren process. You have to prepare them to be the type of the new parent being the inner process. 255 00:34:41.340 --> 00:34:51.480 William Cheng: Okay, so therefore the audio visual of like this that so when you perform we parenting all the orphan children needs to have a new parent and the parent has to be the entire process. 256 00:34:52.620 --> 00:34:54.300 William Cheng: Okay, so what is the process do we get 257 00:34:54.690 --> 00:35:05.580 William Cheng: The entire process where I will do is that in the beginning of your career, a bunch of processes over here. Once they finish creating all these process what he would do is that it was sitting in the infinite loop and it keeps calling way way way way. Wait. 258 00:35:06.150 --> 00:35:15.720 William Cheng: Okay, so this way you know when they will one of these grandchildren, a process that over here. What it will do is it will actually you don't get the return Mexico and it will do nothing to the recent actually Cody was simply 259 00:35:15.990 --> 00:35:17.550 William Cheng: You know, make sure that these processes are dead. 260 00:35:17.970 --> 00:35:23.730 William Cheng: Okay, when all the processes are dead right when all the procedure, guys. So eventually, everybody become a child of the inner process. 261 00:35:23.940 --> 00:35:30.900 William Cheng: When they're all dead. Then they process would know that there's no process running. And then what he would do is that will call exit comes out of kernel and it will turn off the gene. 262 00:35:31.680 --> 00:35:40.560 William Cheng: That alright so this is the life cycle, you know, for your entire machine, right. You start out with a new process and then you wait for everything to die. And then in the end. Everything dies. Yeah. 263 00:35:41.130 --> 00:35:46.380 William Cheng: Oh, there's one more issue with process. You'll be here where you you know make a phone system call 264 00:35:46.710 --> 00:35:53.850 William Cheng: Okay, so let's say you do multi threading in this process over here. Again, we're not talking about weeks programming assignments. So this guy's one project can have multiple threads. 265 00:35:54.330 --> 00:36:02.010 William Cheng: If this person has to start over here and then you make the fork system call in the channel process. Do you have one threat or do you have to threats. 266 00:36:02.850 --> 00:36:10.410 William Cheng: Okay. As it turns out, this is actually a design decision that's made by the opportunities and designer, you can choose to implement this way. Okay. He chooses to implement the other. The second way. 267 00:36:10.650 --> 00:36:14.820 William Cheng: Okay, why would it make sense that the child process only has one as only have one threat. 268 00:36:15.750 --> 00:36:26.160 William Cheng: Okay, this sounds kind of weird, right, because it was when we talk about fork. I was actually being very, very careful. I said well you for you. Come inside our finances and we make a copy of your address space. 269 00:36:26.430 --> 00:36:28.230 William Cheng: Did I say that you're going to make a copy of your threat. 270 00:36:29.040 --> 00:36:39.690 William Cheng: No, I didn't say that. Right. So you make a copy of the outer space. What about threats. Right. So in this case, you know, Robin is where you make a fork system call is because one of the threats, make the forces and call. It's not that the process. Make a phone. 271 00:36:39.990 --> 00:36:51.630 William Cheng: Call that so therefore that's a fair number to over here. Make the forces in college and companies that have colonel. So in this case, when you create a new child process, the child process will only have three. Number two, because it doesn't nice or number one. 272 00:36:52.500 --> 00:37:02.610 William Cheng: Okay Linux and Windows are like that. Okay, so it is, it's a Unix operating system. So, what it will do is it is a typically large companies that they have fancier feature. They're usually around a little faster. 273 00:37:03.150 --> 00:37:10.500 William Cheng: So why because I, in this case, when once we get over here and make the forces and call it comes out the Colonel, so he's not a colonel, you will make copies of all the threats. 274 00:37:11.010 --> 00:37:21.240 William Cheng: Okay, but how do you actually do that. Okay, how do you copy another sir. So let's say that third one over here is actually simultaneously running and another CPU, if that's it is running out of CPU or how do you copy that states. 275 00:37:21.510 --> 00:37:28.740 William Cheng: Or there's no way for you to do that because if a third running the other CPU. There's no way for you to find out what is that doing so, therefore, there's no way for you to copy that threat. 276 00:37:29.610 --> 00:37:41.100 William Cheng: That. So when you have to do is that, will you make the for system called inside of Colonel, you have to wait for all the other CPU to give up all the threat that are inside your process when they all go to sleep, once they go to sleep, you can actually copy the state of a threat. 277 00:37:42.300 --> 00:37:52.740 William Cheng: Right, if you just want to say it goes to sleep. Right, we're going to remember the state of that thread inside the circle bar. So, in that case, you can copy the second or the third still running. If you copy the second toolbar. You're going to copy the wrong data. 278 00:37:53.820 --> 00:38:00.090 William Cheng: Okay. So, therefore, you know, it's actually more difficult to implement a second approach as hilarious. Turns out they implement a second approach. Yeah. 279 00:38:02.010 --> 00:38:07.470 William Cheng: Alright, the next thing we're going to do is to look at the threat lifecycle. Okay, so, so for the Linux system. 280 00:38:07.710 --> 00:38:12.210 William Cheng: The threat only has four states right we already see one of the state over here. It's called a terminus day 281 00:38:12.420 --> 00:38:22.470 William Cheng: The terminal instead over here is a zombie state, right. So when the thread called piece that I said in this case it will go into the zombie state and he will no longer execute any code, right. So over here, we call it the terminated state that 282 00:38:23.100 --> 00:38:30.120 William Cheng: THERE'S THERE'S ONE STATE OF YOUR CALL THE RUNNING state when you're running out of CPU, you're, you're in the running state. So, therefore, if you only have one CPU. 283 00:38:30.600 --> 00:38:37.920 William Cheng: If you have only one CPU in your machine, then in that case, only one that can be in the running say all the other threat they must be in some other states. 284 00:38:39.240 --> 00:38:48.870 William Cheng: So, so there's there's a ready state. And there's also the waiting say the waiting is that, meaning that your third is waiting for something. So what is there still waiting for it. Right. Well, if you call a piece of your time slot you're waiting for 285 00:38:49.140 --> 00:38:55.560 William Cheng: New tax if you call pizza condition where you're waiting for a condition you're waiting for notification if you, you know, if you call you sleep. 286 00:38:55.830 --> 00:39:05.310 William Cheng: You're waiting for time to pass. If you are, you know, activating an iOS device, you want to wait for a device to be done in that case you're waiting for the iOS device to interrupt the CPU and then they will wake wake you up. 287 00:39:05.760 --> 00:39:13.410 William Cheng: Right. So in that case, you're going to go into the waiting say. So there are different name for the ratings that it could be know also as a sleeping state is also known as the blocking state right 288 00:39:13.530 --> 00:39:18.000 William Cheng: Well, you brought that means that you give up a CPU and you go sleep somewhere and later on somebody's going to wake you up. 289 00:39:18.360 --> 00:39:29.400 William Cheng: Then finally, the last thing over here is called irritable stay so when you are not waiting for a taxi or not waiting for a you know, a sort of notification, you are waiting for iOS device. So in that case, are you ready to 290 00:39:29.820 --> 00:39:38.970 William Cheng: Are you going to run inside of CPU. What if you have only one CPU. In that case, you could only run once the inside the CPU. So all the other things that are ready to run, they are in the rubble state. 291 00:39:39.480 --> 00:39:50.910 William Cheng: Okay, so they're actually they're all sitting inside a data structure over here the intercession know has the wrong to you whether there's something go to run queue that so instead of rank, you are a bunch of threats. They are waiting for the CPU to become available. 292 00:39:52.260 --> 00:40:00.780 William Cheng: Okay. So, naturally, they're not waiting for IO. They're not waiting for me tax but they're waiting for the CPU are available. So they're all in the runabout stay there ready to run, except they don't have a CPU. 293 00:40:01.830 --> 00:40:11.430 William Cheng: Okay, so in this case when the thread running out of CPU and the things that is if you give out the CPU. In that case, you will pick up the first threat from the wrong queue. And then what what do you do with that. 294 00:40:11.700 --> 00:40:22.470 William Cheng: You call switch on it. Right. So remember the switch function has one argument that's a swear. How do you find it there you go to the run queue and you DQ the first graph on the run queue. And that's how you how you're not calling the switch function. 295 00:40:23.070 --> 00:40:27.570 William Cheng: Yeah all right over here. Is that a threat starts in a run of our state. Why is that 296 00:40:28.050 --> 00:40:37.650 William Cheng: Okay, well, you create a. So how do you create a section called Pisa. Create what you call piece of Korea. So let's say he is creating threat be right. So in this case, he is running out of CPU is in the running state. 297 00:40:37.890 --> 00:40:42.270 William Cheng: Right, so they have a week with a bit, so be can can throw up and be in the running state. 298 00:40:42.750 --> 00:40:50.970 William Cheng: One. No, it cannot be running say so when the thrill is created, it must be an irritable stay because it's now waiting for new tags now waiting for I O is simply waiting for the for the CPU. 299 00:40:51.660 --> 00:41:01.830 William Cheng: Then, so therefore I want to target creator. It's an unreasonable state and asleep in the rescue. So over here we say is sleeping that are wrong here. So it's not really sleeping and in the sense that's waiting for iOS device or waiting for new tasks. 300 00:41:02.040 --> 00:41:06.960 William Cheng: But we also call a sleeping because it's not running as sitting inside of you know, sitting inside acute. 301 00:41:07.350 --> 00:41:14.130 William Cheng: Well guess what, again, what is it you a cue is my for two lists right there's i o que there's new tax you know all these kind of cute. There's a condition verbal cue. 302 00:41:14.700 --> 00:41:27.600 William Cheng: So, so in this case, you know your your threat. If it's not, what is that a CPU is must be sleeping in some kind of cute. Okay, so we can sleep in the wrong cable. We can also sleep in iOS device you can sleep in a new text you can subpoena CB Q, etc. Then 303 00:41:29.310 --> 00:41:35.640 William Cheng: Alright, so we're going to take a look at some of the transition over here. So the arrows that are shown over here are the only possible transition 304 00:41:35.910 --> 00:41:43.650 William Cheng: Okay, so this tell you that if you're in the waiting stay. Can you all of a sudden go into the zombies day this transition is not allowed. 305 00:41:44.190 --> 00:41:51.570 William Cheng: Okay, if you're in the rubble state, can you go into the zombies day again this transition is not only the only allowed transition over here are shown this table. 306 00:41:52.320 --> 00:41:58.860 William Cheng: Guys are showing this figure. Yeah. So let's take a look at some of the transition over here. How do you go from the runabout state to the running state. 307 00:41:59.100 --> 00:42:04.920 William Cheng: Okay, so it says the schedulers switches effects day from running off and run about to running. All right. What does the scheduler. 308 00:42:05.580 --> 00:42:11.460 William Cheng: Okay, just like the memory alligator I the memory allocation is a collection of function, the scheduler is also a question of options. 309 00:42:11.760 --> 00:42:13.500 William Cheng: Okay, so which function is that a scheduler. 310 00:42:13.800 --> 00:42:21.840 William Cheng: The switch function is inside the scheduler. Right. So the switch machine. What do we do is that, you know, when you when you know when the third running out of CPU when they call switch 311 00:42:22.020 --> 00:42:31.260 William Cheng: What it will do is that it will go to the wrong Q, pick up the first slide over here. And then, you know, moving sort of CPU and he will change the state of that. So from runabout to running 312 00:42:32.160 --> 00:42:42.780 William Cheng: Okay, so therefore the terminology that we say inside the operating system is that, you know, the scheduler because the scheduler. The switch is the function is that a scheduler. So therefore, the scheduler is the one that switches a sweat stay from one level to writing 313 00:42:43.470 --> 00:42:51.780 William Cheng: OK. So again, a scheduler is not a threat. It's not a process is simply a collection of functions. And one of the function is the switch function that you have seen before that. 314 00:42:52.410 --> 00:42:58.410 William Cheng: So this transition is made by the by the scheduler. How do you go from the running state to the waiting say 315 00:42:58.890 --> 00:43:09.390 William Cheng: Well, I sort of got for you know when you started when you call piece of new time slot. If the text is now available in this case your throw will add yourself to the new tech skew and then you will cost switch to give up the CPU. 316 00:43:10.110 --> 00:43:16.260 William Cheng: Okay, so then what we'll do, we'll do is that you will add yourself to so so this guy's you know there's a new tax Q Right, here's a new tax you will be admitted to 317 00:43:16.470 --> 00:43:24.060 William Cheng: Your add yourself to the new tax you so you add your control button and it has to be here and there, you call the switch function over here to give the CPU to somebody else. 318 00:43:24.930 --> 00:43:31.350 William Cheng: So therefore, when you go to sleep inside of me tax you your three I will also change the state from the running state to the waiting say 319 00:43:32.880 --> 00:43:37.980 William Cheng: Okay, so therefore this pretty much transition is done by the by the action of the thread itself. 320 00:43:38.310 --> 00:43:45.780 William Cheng: Okay, so a thread goes from the running state to the way to say when a blocking call is made by the thread itself. So again, and what's blocking call I 321 00:43:45.990 --> 00:43:52.980 William Cheng: Will you make a block and call it is possible that you don't block it. All right, for example, where you copy the text luck either the text available. You don't go to sleep. 322 00:43:53.460 --> 00:44:00.600 William Cheng: Okay, but when the media is not available, then in this case it's a block in part because there's there's a chance that this function called your blog and your thread will go to sleep. 323 00:44:01.500 --> 00:44:10.140 William Cheng: Okay, so again every time when you go to sleep, you have to go to sleep in a queue. So in this example over here. When you call piece of meat AX luck, you're going to go sleep inside of your tasks here. Okay. 324 00:44:10.320 --> 00:44:14.310 William Cheng: Will you call Peter condition where you go sleep in a condition variable. Q. When you go 325 00:44:16.050 --> 00:44:26.460 William Cheng: When you start using iOS device. So in that case, you will sleep on Io cute. Okay, so again every time we used to. I go to sleep when they make a blocking call he will go to see inside the queue somewhere that 326 00:44:27.270 --> 00:44:36.390 William Cheng: Right, so please understand that this particular transition, the scheduler is not involved. You first. You make the transition and then you invoke the scheduler to give the CPU to somebody else that 327 00:44:37.500 --> 00:44:47.220 William Cheng: I have on the running state to run of our state, right. So, you know, again, if you're you know if your thread is a CPU hog use the CPU and doesn't give up at some point the time slice scheduler. 328 00:44:47.970 --> 00:44:52.140 William Cheng: You know, again, the times I said earlier, the way it works is that why should I start running out of CPU. 329 00:44:52.320 --> 00:45:02.070 William Cheng: The organisms going to wind up a timer. In case you don't give up the CPU at the time we will go off when the time ago. I'm going to get a hallway interrupt inside of horror interrupt it will force you to give up the CPU. 330 00:45:02.370 --> 00:45:09.000 William Cheng: OK, so the way this is done is that he will invoke a function inside the scheduler to switch your threat from the running state that one of those day 331 00:45:09.210 --> 00:45:14.250 William Cheng: Okay. And also, what do we do, is that it will go to the rescue. Take the first side over here and then changing the running state. 332 00:45:15.090 --> 00:45:21.240 William Cheng: Okay, so therefore this transition can be made by the scheduler guy. And also there's another way. There's a Cpl. So 333 00:45:21.750 --> 00:45:28.920 William Cheng: If your third try to be nice to the other thread over here when it has nothing to do, it will not keep running out of CPU, we actually give out the CPU voluntarily. 334 00:45:29.100 --> 00:45:34.890 William Cheng: Wanting to do it is called sleep. Right. And also, you just want to give up the CPU. There's another function call, you can make is called yield. 335 00:45:35.400 --> 00:45:45.210 William Cheng: OK, you are simply giving him to see if he has a how to yield the CPU. So what you do is that you add yourself to the run queue and then you call the switch function to give out the CPU to an X ray inside around you. 336 00:45:46.110 --> 00:45:52.620 William Cheng: Okay, so in that case, you know, this particular operation over here is also done by the schedule because in the end, going to end up using schedule a function inside 337 00:45:52.950 --> 00:46:06.330 William Cheng: You know, you're going to use a function inside a scheduler to add yourself to the wrong you guys, how do you add yourself to run you you have to invoke the scheduler. To do that, guys. So therefore, again, this is done, you know, by but by using the schedule that. All right. 338 00:46:07.650 --> 00:46:14.700 William Cheng: The last transition over here. Now the lessons of you from the way the into the running state over here is how to go from the waiting state to the rug will say, 339 00:46:15.030 --> 00:46:21.030 William Cheng: Well, so please remember that the only time that you can run code is when you're in the running state, right, because you're ready, say you're running out of CPU. 340 00:46:21.240 --> 00:46:26.400 William Cheng: If you're saying make a transition from the way to say to run the ball state over here, it doesn't really execute inside the CPU. 341 00:46:27.000 --> 00:46:41.700 William Cheng: Okay. So, therefore, this is the, you know, this operations must be done by another thread that's executing inside of CPU. Okay. So I said, gets on brought by the action of another sweat or by, you know, by interrupt service routine over here. Okay, so if you're waiting for iOS. 342 00:46:42.780 --> 00:46:47.940 William Cheng: If you're waiting for iOS device to finish. Why not case, you know, when the iOS device finish is going to generate interrupt. 343 00:46:48.150 --> 00:46:52.830 William Cheng: Inside you know observers routine. Right. So again, what is doing that interrupt service routine right there's two things. 344 00:46:53.160 --> 00:47:03.600 William Cheng: On blocker kernels that and it also started. Next I have operation operation when I'm blocking Colonel threat, it will move this from the Q. That's that slipping off and then moving into the rescue. 345 00:47:05.220 --> 00:47:12.690 William Cheng: Okay, so that's what I'm blocking is right. I'm blocking, meaning that you're going to move a threat from the threat of on the queue that it was sleeping and move into. Thank you. 346 00:47:13.560 --> 00:47:20.580 William Cheng: Okay. So clearly you cannot move into real estate because another thing is running inside another threat or another interrupt service routine is actually running out of CPU. 347 00:47:21.330 --> 00:47:29.070 William Cheng: Now the other possibility is that, you know, this can be done by another threat, right, for example, once that's running out of CPU core piece to a new test unlock 348 00:47:29.670 --> 00:47:37.200 William Cheng: Okay we copies of these online. You can unblock us that. That's why the sleepy in the new tax skew it wasn't me tax you over here. So what do you do, again, you pick up a slide in the 349 00:47:37.320 --> 00:47:43.830 William Cheng: Deck to over here and then you move it into the wrong queue because you cannot move it into the CPU because another thing is running out of CPU. 350 00:47:44.670 --> 00:47:54.930 William Cheng: Okay. So then again I'm blocking me that you move throughout from the queue that CPR and then moving inside recruit. OK. So again, this transition over here, the scheduler is not involved when 351 00:47:56.490 --> 00:48:04.830 William Cheng: The final transition over here again when you call, he said. Exit. Right. So you said you know again your third has to be in the running state in order for you to execute the pizza access 352 00:48:05.070 --> 00:48:15.150 William Cheng: And then he will go to the terminated state will go into zombies day. And once you're in a zombie state. There's no way out. Okay. So, therefore, there's no way for you to go back into the running state ever again. Right. 353 00:48:17.550 --> 00:48:23.550 William Cheng: Okay, so over here. So, to ask a few questions over here on this piece at exit delete the threat that cause it 354 00:48:24.120 --> 00:48:27.450 William Cheng: Okay, so here you know so if you have to sell a calling pizza and exit my 355 00:48:28.110 --> 00:48:38.250 William Cheng: lovely wife with what are you with us again we mentioned before, when you called Pisa. That's it right then the transition is like over here, you're simply going to the Terminator stage. So your flight control blog is still left around 356 00:48:38.760 --> 00:48:43.650 William Cheng: Okay, because you want to keep that the ethical. So this way, another second join with 357 00:48:44.100 --> 00:48:49.620 William Cheng: That. So in this case, you know, you have a sentimental value over here. Can you start free up data structure inside your federal law. 358 00:48:49.830 --> 00:49:00.180 William Cheng: And the answer will be yes. Right. Because if your thread goes into a zombie. State your third will never execute code as you recall ever again some of the some of the data structure inside the threat control block can be cleaned up. 359 00:49:00.630 --> 00:49:10.320 William Cheng: Okay, but, you know, of course, the thing that you are not allowed to do the you're not allowed to delete the three identify you know a lot of deleted say exit code. Also, you are not allowed to delete the stack for your threat. 360 00:49:10.740 --> 00:49:21.780 William Cheng: Right. Why are you not allowed to the stack of your threat right because when you're executing Pisa say it's a safe assumption and see function needs a stack execute you hit delete your own stack. What are you going to be in big trouble. 361 00:49:22.500 --> 00:49:29.550 William Cheng: Okay. So, therefore, you know, here's as question how can affect the lease on stock. They are if this was executing sequel. There's no way for this to be done. 362 00:49:30.600 --> 00:49:38.820 William Cheng: Okay. So, therefore, you know, you know, what will you try to free up the data structure increase their access, you cannot free up your own staff, right, because you still need to execute code. 363 00:49:39.150 --> 00:49:42.600 William Cheng: That are we here as a question we switch that are we talking about anyways. 364 00:49:42.930 --> 00:49:53.250 William Cheng: So your number, your throat has to start wanting the user space and one inside of Colonel right so if the third control blog over here is a colonel data structure. And once you're inside the Colonel, can you delete the user space stack. 365 00:49:54.060 --> 00:49:57.030 William Cheng: Get the answer will be yes. Right, so remember your address days every 366 00:49:57.810 --> 00:50:02.730 William Cheng: Every say it gets your own stack space and the statutes can be pretty big can be like a megabytes or something like that. 367 00:50:02.820 --> 00:50:12.930 William Cheng: So in that case you want to free up your address space as much as possible. So therefore, in that case, you can actually free up your users that but since you are doing the cleanup inside of Colonel, you are not allowed to free up the colonel stack. 368 00:50:13.410 --> 00:50:20.280 William Cheng: Right. So one of the coolest I couldn't get freed up there. The Colonel Dr. Stein is going to get freed up when another thread going with your threat. 369 00:50:21.150 --> 00:50:28.350 William Cheng: Guy when the other day job. We are said they fetch, they're going to get your return to Mexico. So, at that time, they can actually free up your data structure. Yeah. 370 00:50:29.160 --> 00:50:40.050 William Cheng: All right, so, so, so, so nutcase. You know, let me said that three is actually not detached. If a third is actually detect we saw, we saw the API in Pisa Pisa detach right well you copies of the touch. 371 00:50:40.260 --> 00:50:44.970 William Cheng: That means that, you know, nobody's going to join with my threat. So in that case, when do I free up the third control, blah. 372 00:50:45.480 --> 00:50:51.090 William Cheng: Okay, there are two different approaches over here. One is to use the extra sweat inside your process know as a Reaper threat. 373 00:50:51.270 --> 00:50:57.000 William Cheng: So basically refer to what you would do is that, you know, when you said died what it'll do is they will do exactly the same thing as a piece of I joined 374 00:50:57.210 --> 00:51:01.590 William Cheng: It will look for the said there are dead, and then they also detach and they will clean up the data structure. 375 00:51:02.100 --> 00:51:06.570 William Cheng: Yeah, but in that case is going to be a little weird because inside you sell your address space you're gonna end up with the extra threat. 376 00:51:07.080 --> 00:51:11.010 William Cheng: So typically, you know, some people really don't like this approach right so if you don't want an extra three 377 00:51:11.340 --> 00:51:17.460 William Cheng: In that case, what you can do is, I will you make other piece of a function called over here, you can actually use that to check whether there are death threats lying around. 378 00:51:17.640 --> 00:51:25.110 William Cheng: If their deaths are there are lying around, and they are detached. So in that case, you can actually use, use the other piece of that function to clean up the data structure there to free up the data structure. 379 00:51:25.650 --> 00:51:29.490 William Cheng: OK. So again, typically we're going to see lots of system will implement, you know, 380 00:51:30.240 --> 00:51:39.960 William Cheng: The joining of the detached were using this particular mechanism. Right. But again, this is not really a joy. It's something that's very, very similar to join because during joint you connect your free up the second job yeah 381 00:51:42.180 --> 00:51:45.030 William Cheng: Alright, so I want to sort of briefly talk about, you know, 382 00:51:46.110 --> 00:51:52.470 William Cheng: About what's related to the current one. Right, so, so, so the part of your corner one assignment is to implement the life cycle process in 383 00:51:53.010 --> 00:51:57.810 William Cheng: Which are the one that we just talked about. Okay, so that include process creation process termination. 384 00:51:58.020 --> 00:52:07.410 William Cheng: Process waiting and all these kind of stuff and also include a third cancellation as and this is what I'm talking about the colonel thing because legit. It's a little different from the user say cancellation. 385 00:52:07.800 --> 00:52:16.770 William Cheng: Okay, so, but again, it's a good thing that you have done that you warm up to so you understand how users like isolation work. So when you come inside the Colonel, you have to implement kernels that cancellation that 386 00:52:17.160 --> 00:52:19.920 William Cheng: You also have the employee or, you know, like process waiting all these kind of stuff. 387 00:52:20.610 --> 00:52:24.540 William Cheng: Right. So again, at the beginning, it's very difficult to actually figure out what 388 00:52:24.810 --> 00:52:30.360 William Cheng: You know what you're supposed to encouraging Colonel one. So again, you need to read some of the code inside the Colonel, you need to ask a bunch of questions. 389 00:52:30.540 --> 00:52:42.900 William Cheng: And then you need to sort of figure out what you have to do so in the end like a big puzzle. You have to solve that, unlike warm up to over here in the colonel assignment. The first procedure of almost all Colonel threads have been written for you already. 390 00:52:44.430 --> 00:52:48.660 William Cheng: Okay. So your job is not to write the first procedure of any of the colonel flat. 391 00:52:49.800 --> 00:52:55.470 William Cheng: Okay, so it's kind of this is also what are you doing over here, right. So, so, you know, the thriller code over here. The first procedures. 392 00:52:55.680 --> 00:53:08.430 William Cheng: That are already implemented for you, they're going to make a bunch of function call and some of these function calls are not yet implemented. Okay. So your job is to implement all these function that hasn't been implemented yet so that these kernels were can run perfectly 393 00:53:09.600 --> 00:53:13.620 William Cheng: Okay, so what you would do that. You start with the first procedure or a bunch of Colonel threads. So you can actually look at 394 00:53:14.550 --> 00:53:20.490 William Cheng: The first procedure of these kernels that and then nobody's nobody's currency, I can execute because all these functions are not implemented. 395 00:53:20.910 --> 00:53:28.920 William Cheng: Okay, so therefore, your job is to implement all those function and now those kernels that will actually they will run perfectly okay that's going to be your job. Yeah. 396 00:53:29.640 --> 00:53:35.520 William Cheng: So the way we sort of figured out that this is to read the code and kernel proc there's a file called a favorite 397 00:53:36.420 --> 00:53:47.430 William Cheng: Test. I see. So inside that that fall over here. There. Tons of the colonel threads, man. All the corner over there. They're written for you already. You are not allowed to modify single line of code over here because 398 00:53:47.760 --> 00:53:56.100 William Cheng: The requirement over here is I want to make sure that all the threads that run perfectly okay. The purpose of those to head over there is simply to test your current one implementation. 399 00:53:57.090 --> 00:53:59.040 William Cheng: Okay. So, therefore, if you look at this 400 00:53:59.460 --> 00:54:09.420 William Cheng: Look at the code over there. So again, it's about 500 lines of code over there. If it cause a function that you're supposed to implement. Well, then basically one is trying to do this is trying to tell you what it's expecting 401 00:54:09.840 --> 00:54:16.980 William Cheng: You know, as far as the return value is concerned, or if a function has multiple return value. It's actually checking all these return value. It was sort of shows you 402 00:54:17.100 --> 00:54:25.020 William Cheng: Under what condition with an air conditioner. What's going to use a good condition. Right. So if you actually see those if say man. So you've got to make sure that you always return you know the 403 00:54:25.230 --> 00:54:31.740 William Cheng: Other return value for for, you know, for for your cursor over here always return the current value, right, because otherwise going to create some error messages and stuff like that. 404 00:54:32.100 --> 00:54:43.530 William Cheng: Man. So again, the secret over here. So read this thought in order for you to know what you know what a what a good kernels, they're supposed to do when they make when when the good Carl said call the function that you're supposed to implement 405 00:54:45.060 --> 00:54:52.740 William Cheng: Right, so then it's important to be able to understand what every line of code is doing their insight favorite test. I see. Again, you don't even you don't understand what do you do 406 00:54:53.310 --> 00:54:58.770 William Cheng: You start a discussion is that of course we will grow, you can do you know the live lecture you ask me questions and all these kind of stuff. 407 00:54:59.100 --> 00:55:05.640 William Cheng: There are you the past every test there again see the wedding gown. If all the requirements over here. You're not. You're not allowed to change any the code there. 408 00:55:06.120 --> 00:55:16.980 William Cheng: If you do something. So as it turns out, I get these are the code are given to you as part of your assignment. So if you want to use coke. You want a copy go from there. Go, you know, feel free to do that. 409 00:55:17.520 --> 00:55:25.950 William Cheng: Okay, you don't have to say that because I know exactly what a couple of those code look like. Okay. So, if you will, if you need to do something very, very similar to, to, to the code inside the 410 00:55:26.460 --> 00:55:38.460 William Cheng: Inside the style or inside any module, you should feel free to copy it. Okay, so that's why we provide some the code for you already. So that so that you can actually make copies of them. If you need right if you don't need them. Don't. Don't force it to the copy it. 411 00:55:40.020 --> 00:55:48.030 William Cheng: Alright, so now I'm done with you know this part of chapter four. So I'm going to sort of briefly go over to show you where I am. 412 00:55:54.630 --> 00:56:04.110 William Cheng: Okay, so for Chapter four over here as you can see the Chopra phobia. We have four sets of slide over here we have finished the first set of slide over here. It's called a simple system right here. Okay. 413 00:56:04.560 --> 00:56:09.750 William Cheng: The other three. The next one over here is for device driver will go over this first after we're done with chapter five. 414 00:56:09.990 --> 00:56:17.280 William Cheng: And then the other two over here we're going to cover. Then after chapter seven. So we are done with less than nine over here. Next lecture, we're going to start going to chapter five. 415 00:56:17.520 --> 00:56:23.040 William Cheng: We're going to see how we implement that. And also how you implement that the interrupt service routine, they 416 00:56:23.430 --> 00:56:27.810 William Cheng: Are as over here to the next one we're going to see the third implementation for the way I look at a 30 minute strategy. 417 00:56:27.990 --> 00:56:36.060 William Cheng: And then we're going to sort of look at how do you implement new tax. We talked about new types already right now we're going to see how they implement it inside the kernel and also inside a user space program. 418 00:56:36.330 --> 00:56:48.390 William Cheng: And then we're gonna, you know, a talk a little bit about interrupts. So by the end of next lecture, you're going to have everything that you need to know for you to implement your colonel colonel one. Okay. All right. See you on the next section.