WEBVTT 1 00:00:01.979 --> 00:00:16.289 William Cheng: Okay, this is a part three of lecture seven. So we saw the other three types of context switching and now we're going to talk about the fourth one. So again, when we talk about interrupt. We're talking about hardware interrupts. OK. 2 00:00:18.690 --> 00:00:28.830 William Cheng: So again, we shouldn't confuse interrupt with signals. So even though the terminologies are very, very similar signals are generated by the Colonel, they are delivered to the user process. 3 00:00:29.100 --> 00:00:31.980 William Cheng: And again signal. It does not equal to software interrupt then 4 00:00:32.490 --> 00:00:39.300 William Cheng: When we whenever we talk about interrupt without saying the word software in front of it. We're talking about Harvey and Rob, so they are generated by the hardware. 5 00:00:39.720 --> 00:00:46.410 William Cheng: They are delivered to the kernel. And now we know about the hardware abstraction layer right so in this case the you know the interrupt. 6 00:00:47.100 --> 00:00:54.900 William Cheng: Interrupt but generated by the hardware that deliver to the how abstraction layer and how abstraction layer with deliver into the into the carnal. Yeah. 7 00:00:55.440 --> 00:01:05.910 William Cheng: And what so so when the hallway drop happen. The processor is going to put aside, whatever they're doing before we need to save the context somewhere. And again, we're going to talk about how to save the contacts. 8 00:01:06.330 --> 00:01:09.900 William Cheng: We're going to switch to the internal contacts, but we're handling interrupt. Yeah. 9 00:01:10.470 --> 00:01:19.260 William Cheng: The current contacts so so what could be the current contact or the current contacts could be a threat contacts and if it's a threat context, it can be a user through a context, it can be a kernel for contacts. 10 00:01:19.740 --> 00:01:23.580 William Cheng: The Colonel conduct the current context and also be instead of enroll contacts. 11 00:01:23.940 --> 00:01:29.550 William Cheng: Okay, so for example if you have an interest that you're servicing, as it turns in Rob is actually a low priority in Europe. 12 00:01:29.760 --> 00:01:35.820 William Cheng: Which means that it's not really that urgent to service this particular interrupt and all of a sudden a higher party interrupt happen. 13 00:01:36.000 --> 00:01:44.370 William Cheng: So, in that case what happens that again we need to suspend what we're doing before, which is servicing interrupt and we're going to go go go go go go to to serve a more urgent interrupt. 14 00:01:44.730 --> 00:01:54.540 William Cheng: Whereas it again. What we still have to do is that we need to save the context of the interrupt service routine and go to a go. Go switch the context of a more urgent interrupt interrupt service routine now. 15 00:01:55.290 --> 00:02:04.950 William Cheng: Right. So in this case, we also need to be able to mask and block individual interrupts. Okay. So we mentioned before their signal. I'm asking. They also 16 00:02:06.720 --> 00:02:15.750 William Cheng: So, so for interrupt, we only talk about interrupt enable and disable and that's done by one of the registry instead of CPU. So when you to say well you know Rob you disable all interrupt. 17 00:02:16.230 --> 00:02:23.070 William Cheng: Okay. So as it turns out, you know, just like signal can be individually mass interrupt can also be individually mast. 18 00:02:23.520 --> 00:02:32.070 William Cheng: Okay, so we're going to sort of take a look at that over here. So again, this is separate from enabling and disabling interrupt right enabling disabling Europe is you enable all interact with disable all interrupt. 19 00:02:32.340 --> 00:02:45.000 William Cheng: Once interrupts enable you can still individually block, you know, put a block harbor interrupt just like you can block individual signals. Okay, so we're going to select all going to talk about the typically how the CPU does it 20 00:02:45.660 --> 00:02:48.300 William Cheng: So right now we're sort of assume that you can do something like that. Yeah. 21 00:02:48.900 --> 00:02:57.090 William Cheng: And and whether you are hello finishes it needs to go back to whatever he was doing before. So it was executing a colonel swag before you need to go back to the colonel threat. 22 00:02:57.300 --> 00:03:07.800 William Cheng: It was execute a user thread before you need to go back to the actual user threat if you were handling interrupt before he's the go back to handle a the previous interrupt. OK. So again, saving contacts and restoring context. Yeah. 23 00:03:09.690 --> 00:03:19.860 William Cheng: Alright, so I'll be here. We're going to take a look at the three things you can enter our first is a user threat. Okay, so when you interrupt the user threat. You can see that this slide is very similar to make an assistant call 24 00:03:20.580 --> 00:03:27.750 William Cheng: Right because making the system call you are, you know, again, make a system called phone for Intel. It's the same thing as a software interrupt right so now 25 00:03:28.320 --> 00:03:33.990 William Cheng: You know. So in this case, you're doing yourself interrupt and now when you get a highway interrupt, but basically exactly the same thing is going to happen. 26 00:03:34.830 --> 00:03:35.790 William Cheng: Okay, so therefore again. 27 00:03:36.090 --> 00:03:47.100 William Cheng: If you're executing in the user through a program over here. And now we get a hardware interrupt, what will happen while ago. First you needed to say well you know route and you said the CPU mode to privilege Mo, because now you need to execute interrupt service routine. 28 00:03:47.550 --> 00:03:54.990 William Cheng: Yeah. And then again, he said, How abstraction layer over here. What it will do is it will save the context of the current threat which is going to be a user threat. 29 00:03:55.710 --> 00:04:01.350 William Cheng: Right over here. What interrupt your users. So I'm going to say the use of their contacts into a temporary location inside 30 00:04:01.620 --> 00:04:11.220 William Cheng: The temporary memory location or temporary data structure inside the Colonel. So again, this data structure is shared by all all interrupt service routine right that's what we have to disable to interrupt. 31 00:04:11.550 --> 00:04:17.280 William Cheng: Now, so again, the whole abstraction layer is going to save all these register into some temporary location is that the kernel space. 32 00:04:17.760 --> 00:04:23.190 William Cheng: By the way, I think I forgot to mention that before so so over here. This is for example, right, you'd use, for example. 33 00:04:23.730 --> 00:04:32.460 William Cheng: So some, you know, so, so again if you search the internet where they would. There's that there was there was say that that the user threat contacts is safe, instead of interrupt stack. 34 00:04:33.240 --> 00:04:47.100 William Cheng: So that's not the only approach. Okay, we can just have some kernel data structure to store, you know, to do this. The store the store the user three contacts, again, you know, since since the standard charges. Sure. We need to copy it out, you know, 35 00:04:48.930 --> 00:04:56.850 William Cheng: Copy out. So therefore, we can enable enable a drop again right if you don't copy it up. Next time you get a higher interest. We're going to wipe out all the data. 36 00:04:57.510 --> 00:05:07.170 William Cheng: Guy. So get it doesn't have to be an interrupt stack, but on some hardware, they will use it will use the interrupt stack to implement this guy's okay just just just as one possible implementation. Okay. 37 00:05:07.590 --> 00:05:14.100 William Cheng: All right, so all the register are being saved, and the hollow abstraction layer is hardware dependent and it's also the scope of this class. 38 00:05:14.400 --> 00:05:22.320 William Cheng: And then what the how abstraction layer in this case will do is that it will need to find the colonel stack that are designated to to to head to 39 00:05:24.000 --> 00:05:32.910 William Cheng: Head with the syndrome. Well, why do we need to find a colonel stack, right, because again this this narrow view is very, very similar. When you make a system call where you come inside the Colonel. 40 00:05:33.240 --> 00:05:40.080 William Cheng: You know, you, you, you know, of service routine. It's written in sequel. So in order for you to execute the interrupt service routine, you need a stack. 41 00:05:40.830 --> 00:05:48.660 William Cheng: Well, so in this case we need to somehow, you know, find the appropriate kernels that you know the first X is equal, right. So right now, we're still in the horror abstraction layer. 42 00:05:48.810 --> 00:05:57.120 William Cheng: We're going into the sequel. Yeah, so right before going to seek. Oh, we need to be able to, we need to be able to identify a stack. And then, and then 43 00:05:57.690 --> 00:06:01.170 William Cheng: I never have a colonel stack for your interrupt service routine to execute 44 00:06:01.740 --> 00:06:05.760 William Cheng: That. So over here I mean I add an extra common over here which Colonel stack. 45 00:06:06.090 --> 00:06:14.190 William Cheng: Guys, as it turns out that's not an issue for the operating system. When you get a hurry interrupt you know there's tons of kernels that you that you can use. Which one should you use 46 00:06:14.490 --> 00:06:23.250 William Cheng: Guys, we're going to talk about that a little later. So that's one of the difference between this one and a feeling when the system call when you're in the system call you are a user threat. Well, then we know 47 00:06:23.730 --> 00:06:29.580 William Cheng: What what Colonel threats that as well. I couldn't stop, you're going to use because you use it becomes a colonel. So that is still the same threat. 48 00:06:29.940 --> 00:06:34.740 William Cheng: Right. So, therefore, all you need to do is to find other the colonel stack for that. 49 00:06:35.520 --> 00:06:40.740 William Cheng: Okay, but now you're getting a highway interrupt, then it's not really clear you know which kind of sector you borrow from 50 00:06:41.430 --> 00:06:45.780 William Cheng: Okay, so we're going to talk about that a little later that alright so what. So what will 51 00:06:46.560 --> 00:06:53.790 William Cheng: Once you identify which start to use what you will do that he needs to say the user three contacts at the bottom of the colonel stack. Just like when you make a system call 52 00:06:53.970 --> 00:07:03.990 William Cheng: Right, we also need to say the IP to point to the you know up social team for this particular particularly interrupt. And again, the web servers will be over here is written in C. That's why we need a colonel staff. 53 00:07:04.830 --> 00:07:10.830 William Cheng: That. So once we, you know, sort of hide all the user threat contacts over here into the bottom of the Colonel's tag and now 54 00:07:11.130 --> 00:07:17.460 William Cheng: You know the these temporary location can be reused for additional you know absorbs it. So at this point, we're going to enable interrupt. 55 00:07:18.450 --> 00:07:24.330 William Cheng: That as overhearing. This guy is going to be enabling we're going to end up. And again, here's one difference between 56 00:07:24.630 --> 00:07:31.230 William Cheng: You know, dealing with a highway interrupt compared to assistant call okay when you re enable interrupt it is possible. Some of the inner 57 00:07:31.620 --> 00:07:35.280 William Cheng: Certainly some of the highway interrupt will be blocked and they will be masked 58 00:07:36.000 --> 00:07:47.730 William Cheng: Okay, while you while you are going inside the when we make a system call, will you go from the user thread contact into the kernel three contacts we are inside the Colonel's to our contacts know interrupt will be blocked. 59 00:07:48.480 --> 00:07:51.810 William Cheng: Okay, well you're servicing a highway interrupt. Well, then you know what you would do is that 60 00:07:52.260 --> 00:07:59.970 William Cheng: You know, anything that's more urgent than the the interrupt that you're servicing, they will be unblock while all the other less important interrupt, they will be law. 61 00:08:00.510 --> 00:08:04.830 William Cheng: Right, because we don't really want to sort of unless important you know how how interrupt. 62 00:08:05.490 --> 00:08:11.850 William Cheng: Interrupt what you're doing right. The only thing that can happen is if you get a more urgent, you know how we interact. Then in that case. Yeah, that you need to service. 63 00:08:12.810 --> 00:08:19.350 William Cheng: Okay, so therefore, again, this will be one difference over here and the other things is that you will still stay inside enroll contacts. 64 00:08:19.950 --> 00:08:29.010 William Cheng: Okay, so when you go from the user context of the colonel three contacts eventually be you have a Colonel said if you become a colonel through that. So you will be in the threat contacts. 65 00:08:29.790 --> 00:08:40.890 William Cheng: That. So after you enable interrupt. If you're making the system call you will be in the kernel select contacts. But if you if you're dealing with a highway interrupt after you run re enable interrupt, you're still in Iraq contacts. 66 00:08:41.730 --> 00:08:52.980 William Cheng: That. So, and eventually going to go serve as your, you know, Rob. When you finish in a role, where should you go back to you should go back to the previous context. So in this example, the previous content is a user three contacts. So again, you do exactly the same. 67 00:08:53.430 --> 00:09:02.550 William Cheng: Everything backwards. And then at the end, you can execute I return if you on x86 CPU and you go back into the user contacts or so in that in that says that that's exactly the same. 68 00:09:03.090 --> 00:09:08.430 William Cheng: As when you make him a system call. And then when you're done with the system call you're going to reach them back into the user so complex. Yeah. 69 00:09:09.540 --> 00:09:22.470 William Cheng: So, so again, this slide look very, very similar to the system costs lie so to highlight the difference over here. I'm going to sort of say that, you know, the main difference between this and the system color is number one, we need to find a 70 00:09:23.520 --> 00:09:34.650 William Cheng: Way we need to find the right kernels to use. Okay, before he was very clear which goes back to us. But now we're not we're not sure right number to over here is that not all interrupt will be blocked. 71 00:09:35.160 --> 00:09:46.140 William Cheng: Okay, so therefore, when we start servicing, you know, maybe somebody to run will be blocked and be sent me to OB on block. And finally we stay inside enroll contacts. Right. Otherwise, you know, this part and the other part. There are exactly the same. Yeah. 72 00:09:48.420 --> 00:09:49.680 William Cheng: Alright, so 73 00:09:51.090 --> 00:10:00.960 William Cheng: So, so I guess so, so, so there's this question of, you know, where does the colonel come from. So as it turns out that this is a sort of a design decision that 74 00:10:01.710 --> 00:10:09.390 William Cheng: Historically there have been three different approaches. Number one is to, you know, so, so, so, so what we're talking about this particular Colonel segue here that 75 00:10:09.870 --> 00:10:18.450 William Cheng: So where do you get a kernel.com One possibility is that every time you get a highway interrupt you create a new you create a new kernels that 76 00:10:18.990 --> 00:10:28.950 William Cheng: You guys are in that case you need to run memory allocation. As it turns out, memory allocation is actually really, really slow. So even though this is a possibility. Nobody really implement this okay because it's just too slow. 77 00:10:29.580 --> 00:10:34.530 William Cheng: Right. The second one is that you have one stag that's shared by all the interrupt handler over here. 78 00:10:35.130 --> 00:10:38.280 William Cheng: So this might be what other people talking about this is called the interrupt stack. 79 00:10:38.730 --> 00:10:45.780 William Cheng: OK. So again, this is not really commonly used, but it's a possibility. This is not often done, but there are, you know, sort of some sort of 80 00:10:46.170 --> 00:10:49.710 William Cheng: Sort of hardware architecture, they require you to do things this way. 81 00:10:50.310 --> 00:10:58.800 William Cheng: Okay, but today, you know, most of them general purpose, you know, sort of a CPU. And then, together with the organism, the way they service interrupt. They use approach number three over here. 82 00:10:59.070 --> 00:11:08.610 William Cheng: Okay so approach number three says the interrupt handler over here will borrow the colonel stack from the thread that's interrupting. Okay, so which thread is interrupting. 83 00:11:09.720 --> 00:11:16.380 William Cheng: That so so this guy's again, the way we sort of talked about it is that inside the Colonel. There's a global variable called current threat. 84 00:11:17.100 --> 00:11:26.220 William Cheng: Okay. So currently, you know, basically point to the correct answer control blah insider threat control bar. There's a kernel side. So we're going to just comment also. So this guy will happen is that we can just follow that one. 85 00:11:26.880 --> 00:11:32.730 William Cheng: Okay, so we're going to follow the colonel stock from the thread that's interrupting interrupting over here is the current threat. 86 00:11:33.780 --> 00:11:35.640 William Cheng: Okay, so this is the most common approach. 87 00:11:36.570 --> 00:11:44.460 William Cheng: Okay. So, in the previous example over here we have a user story right that's running when the user. So that's running, we know who is the corresponding Colonel thread, because it's the same so that 88 00:11:44.880 --> 00:11:52.950 William Cheng: And so therefore we know what the cursor control blog is the thread control blog is pointed to buy current software. So inside that data structure. There's a kernel stacks are you going to follow that kernels that 89 00:11:53.340 --> 00:12:04.440 William Cheng: OK. So, again, in this case, this kernel stock will be exactly the same as the system call when we make a system call you go to borrow that Colonel stack. Okay. So, therefore, again, this part over here is basically exactly the same as before. Yeah. 90 00:12:06.060 --> 00:12:13.590 William Cheng: Alright, so that's typically the answer. Getting the picture look like this. You know when you try to interrupt the user thread the picture exactly the same as what we saw before. 91 00:12:13.650 --> 00:12:17.730 William Cheng: Right, we're going to start it off, we run into user space program at the colonel sag is empty. 92 00:12:17.880 --> 00:12:23.280 William Cheng: And now we get a highway interrupt. We're going to save the user through our contacts over here at the bottom of the colonel start over here. 93 00:12:23.430 --> 00:12:29.520 William Cheng: And then we're going to build a stack frame and then when to transfer control to it with interrupt disable and now we're going to start executing interrupt service routine. 94 00:12:29.670 --> 00:12:35.910 William Cheng: Where you go excellent interrupt service routine. The top of the stack go up and down, up and now because you're making a lot of function call inside the Colonel. Yeah. 95 00:12:37.230 --> 00:12:47.880 William Cheng: Alright, so again this is very, very similar. There's almost exactly the same as the system call except you stay in the internal contact with some interrupt mask or a boss. Okay. Otherwise, you know, look exactly the same. Yeah. 96 00:12:48.900 --> 00:12:55.650 William Cheng: Right. What about the case where you interrupt a colonel threat right so when you grow up a colonel says what what does that mean to interrupt, Colonel. 97 00:12:56.310 --> 00:13:01.170 William Cheng: The colonel. So the way we sort of think about is that is that the kernels that come from the user threat. 98 00:13:01.740 --> 00:13:06.390 William Cheng: Right, you're executing the user threat contacts and you make a system called and now that's how you become a kernel threat. 99 00:13:06.930 --> 00:13:14.910 William Cheng: Okay. So, therefore, what is the, the, the user stack and the Colonel style look like if you're executing. Sorry, Colonel. Well, then this is the picture I 100 00:13:15.330 --> 00:13:25.320 William Cheng: Get the user has been suspended already because users for the system call with him in the system call us a threat contacts to save at the bottom. The Colonel stuck over here and now we're executing the Colonel. 101 00:13:25.980 --> 00:13:32.160 William Cheng: The Colonel psychotic episode go up, go up and down like crazy and all of a sudden you get a hardware interrupt because what do you do 102 00:13:32.670 --> 00:13:42.390 William Cheng: Okay, so yeah, the rule over here is that you've got. You're going to follow the stack from the current that for for for the current and going to use that stack to service the euro. 103 00:13:43.260 --> 00:13:51.600 William Cheng: Okay. So in this case, you know, what happened is that we are in the kernel for that contact. We need to say the concept of the corners where, where do we save the contents of the current right because we need to borrow the stack. 104 00:13:52.620 --> 00:13:57.060 William Cheng: So, so therefore the solution over here is that we're going to save the kernel for context right here. 105 00:13:57.720 --> 00:14:04.710 William Cheng: Right here, over here, right. And now we're going to build a start praying for the interrupt service routine and then are the web server sitting over here. Oh, sorry, executing like that. 106 00:14:05.190 --> 00:14:08.610 William Cheng: Okay, so therefore the picture will be liking this. Right. So, so now 107 00:14:08.850 --> 00:14:17.520 William Cheng: Yeah, so, so, so we started out with, with the colonel stack looking like this. Right, we're going to save the colonel thread contacts right here. Okay. And then we're going to start building the stack rank. 108 00:14:18.000 --> 00:14:27.750 William Cheng: To to run the sequel for handling air up there. So again, the top of the stack over here going to go crazy. What we, you know, execute those seacom then alright so this is, you know, 109 00:14:30.300 --> 00:14:35.430 William Cheng: Now you're inside of your account. You know of contacts and now you can get a more urgent interrupt. 110 00:14:36.000 --> 00:14:46.110 William Cheng: OK. So again, this is going to be the state that we're going to start with. And now, a lot of it is that you're gonna you're gonna interrupt another interrupt service routine. Right. So the current stock of the Colonel's its gonna look like this. 111 00:14:46.980 --> 00:14:54.720 William Cheng: Yeah, I mean, of course. Another possibility is that close that. Why should look like this. Right. The to start with. And now you get a highway interrupt. OK, so the we only draw one picture over here. 112 00:14:55.140 --> 00:15:02.340 William Cheng: Which is the one that you already, you start with the colonel thread get interrupted by a low priority, you know, observers routine and now you're going to get a more 113 00:15:02.580 --> 00:15:13.560 William Cheng: Urgent interrupt service routine, which is higher priority. So what do you do, again, you follow the same rule, you're going to borrow the threat. You're going to follow the stack from the current through that and the current that you know this is sort of stuck with the current threat. 114 00:15:14.970 --> 00:15:18.840 William Cheng: Right, because we're still in the internal contacts. Right. So that means that the current that hasn't changed yet. 115 00:15:19.170 --> 00:15:29.550 William Cheng: Okay, so therefore this is still the current that we're going to borrow this that so so so so right now we're executing interrupt service routine. Right. So what do we say the contents of interrupt service routine. I laid it all can resume it 116 00:15:29.940 --> 00:15:34.500 William Cheng: So again, we're going to interrupt does interrupt service routine and we're going to serve the context right here. 117 00:15:34.950 --> 00:15:39.090 William Cheng: Right. And then we're going to build another stock frame to handle the more urgent interrupt service routine. 118 00:15:39.600 --> 00:15:47.250 William Cheng: Okay, so therefore the picture look like this right to interrupt. So this is, you know, handling number one. So we're going to save the contacts right on top of the stack room over here. 119 00:15:47.490 --> 00:15:55.320 William Cheng: To the stockroom to handle the more urgent interrupt. And again, I'm going to make the call and now the top of the sex middle crazy for a while as would make function call. 120 00:15:57.210 --> 00:16:07.710 William Cheng: Alright, so, so, so this one's going to look like. And eventually you know up servers with the number two is going to finish. And then in this case we're going to take the the the interrupt service routine number one August will take the contacts. 121 00:16:07.920 --> 00:16:15.210 William Cheng: Put it back into the CPU and now we start running, then the CPU will be servicing interruption in the roster servers with the number one, right. 122 00:16:15.630 --> 00:16:18.300 William Cheng: Eventually when, you know, obviously, the number one is finished. 123 00:16:18.750 --> 00:16:26.850 William Cheng: In this case, the stock room over here is going to get pop and then we're going to take the Colonel's to my contacts, put it back into the CPU and now we're going to return back into the kernel three contacts. 124 00:16:27.060 --> 00:16:36.330 William Cheng: And eventually, when the colonel says done the stockroom will be he'll be empty. Then we're going to take the user three contracts over here. We're going to execute I returned and returned back into the back into the users that 125 00:16:37.470 --> 00:16:37.830 William Cheng: Okay. 126 00:16:39.870 --> 00:16:51.900 William Cheng: All right, so, you know, using this particular approach we're using one a designated Colonel stack over here to service that you know up. Okay, so please understand is that at this point, there's no way for you to suspend it interrupted the 127 00:16:52.230 --> 00:16:55.860 William Cheng: Suspended interrupt service routine and go back to another interrupt service routine. 128 00:16:56.700 --> 00:17:08.790 William Cheng: Okay, if you look at this picture over here, right, that if we are to execute you know episodes of Regina. Number two, can we suspect interrupt service routine. Number two, and then go back to servicing interrupt interrupt service routine number one. 129 00:17:09.660 --> 00:17:18.780 William Cheng: Well, there's no way for us to do that, right, because if we do that, we're going to start making function call again those in this case, you know, all these data will be wiped out. So therefore, there's no way for us to go back into the internal contacts. 130 00:17:19.230 --> 00:17:21.690 William Cheng: Okay, what about if we go back to any threat contacts. 131 00:17:22.500 --> 00:17:25.980 William Cheng: That so so once we start executing interrupt service routine number two or 132 00:17:26.250 --> 00:17:33.810 William Cheng: Number one over here. There's no way for us to go back to the threat contacts in order for us to go back to the right, contacts, where do we need to go to what we need to go to the current 133 00:17:34.290 --> 00:17:44.970 William Cheng: The current state is the one that the smart contract to say right here. If we restore that to my contacts. Then we're going to execute code over here by making see function call and we're going to wipe out the entire stack. 134 00:17:45.810 --> 00:17:55.260 William Cheng: Okay, because we don't. We can't really predict what our see function is going to do. So we're going to end up wiping out the say contacts. But, you know, absolutely. Number one, or even the same context for interrupt service routine number two. 135 00:17:56.070 --> 00:18:02.760 William Cheng: Okay, so, so once we start servicing you know Rob over here, when we're not allowed to return back to the right contacts. What about other threats. 136 00:18:03.750 --> 00:18:17.100 William Cheng: Okay, so can we, you know, keep up the CPU over here and then execute another threat. So, so other side is going to use different different stack. But how do we get there in order for us to switch to another swear we have to tell the current. So, at the give the CPU to another threat. 137 00:18:18.270 --> 00:18:24.210 William Cheng: Okay. So since we're not allowed to return back to the current. There's also no way for us to give the CPU to another threat. 138 00:18:25.590 --> 00:18:37.770 William Cheng: Alright, so this is really a big deal. Okay, so what what we're sitting over here is that once you are in the interrupt service routine. Once you're in the interrupt contacts you don't get out of the interrupt contacts until you finish servicing all your interrupts 139 00:18:38.670 --> 00:18:42.240 William Cheng: There so we here in this example over here, right, once that going to interrupt service. 140 00:18:42.990 --> 00:18:46.230 William Cheng: Throughout your headline or number one, even though this is a low priority, you know, 141 00:18:46.470 --> 00:18:56.700 William Cheng: I will not return to any threat contacts until it finishes servicing interrupt number one right in the middle of servicing drop number one over here. I got a higher priority interrupt one again. I need to continue to serve as interim 142 00:18:56.910 --> 00:19:01.860 William Cheng: Until all interrupt service routine are done. I will not return you know to two or three contacts. 143 00:19:02.910 --> 00:19:13.650 William Cheng: Okay, so therefore it's very, very important that all interrupt service routine needs to be a small as possible because otherwise, if you spend too much time he said even web servers routine one then in this case your threat might even start. 144 00:19:14.550 --> 00:19:28.110 William Cheng: Okay, so, so, so you know that the main reason for us to have an operating system is to run user space program, right, the user space program, it needs to, you know, make system call to as operating system for help. So, so, running the threat code is actually the most important thing 145 00:19:29.220 --> 00:19:35.010 William Cheng: Okay, so, so therefore we should you know anything there instead of you know of service routine if they are not important. We should do it at a later time. 146 00:19:35.160 --> 00:19:49.170 William Cheng: We want to give the CPU back to the right context because the threat contacts is when we execute threat CO and those are our customer that we have to service. Okay, so therefore we need to stay inside interrupt service routine, as you know, for for a short period of time as possible. Yeah. 147 00:19:50.940 --> 00:19:58.170 William Cheng: Alright, so how do we do that right. What are the some of the interrupt service routine. You have a lot of work to do. Right. So in that case, you know, in chapter five. We're going to talk about something called the for work. 148 00:19:58.560 --> 00:20:06.060 William Cheng: We're going to sort of take the word that you have to do it inside of web servers with to divide into two categories. One is the stuff that you have to do them now. 149 00:20:06.300 --> 00:20:13.050 William Cheng: Okay, and then all the other stuff. We can do them at a later time. Right, so the software at a later time going to talk about in chapter five. What are the stuff that you have to do right now. 150 00:20:13.470 --> 00:20:19.650 William Cheng: Right, so I think I mentioned this before, there are two things that you have to do is that enough service today. And those are the most urgent thing. 151 00:20:19.920 --> 00:20:24.870 William Cheng: Number one is that, you know, since that you know up services is IO completion you to rob some kernel. 152 00:20:25.140 --> 00:20:31.560 William Cheng: Started an IO operation over here and that Colonel says waiting for the operation to finish. So, therefore, you have to wake up the kernels of that. 153 00:20:31.860 --> 00:20:39.090 William Cheng: OK. So number one is to unblock a colonel swear that sleeping on the corresponding IO queue waiting for the IO operation to finish and again when you get 154 00:20:39.270 --> 00:20:46.320 William Cheng: A little complacent, you know, that means I just finished my operation that this tool has asked me to do so, therefore, I need to wake up. Wake up. 155 00:20:46.710 --> 00:20:54.180 William Cheng: Okay, number two is that you need to start with next IO operation as early as possible and the earliest possible time is inside interrupt service routine because 156 00:20:54.510 --> 00:20:59.970 William Cheng: The interrupt service routine. You just finished servicing interrupt and now that you know that that piece of hardware is idling 157 00:21:00.780 --> 00:21:01.620 William Cheng: Okay, and some of the 158 00:21:01.860 --> 00:21:11.790 William Cheng: Hallways. Very, very expensive you spent a lot of money on it. So you want to keep highway as easy as possible and the earliest time, you can do that is inside interrupt service routine. Right. So even though you are servers or d 159 00:21:11.970 --> 00:21:18.990 William Cheng: You have more work for the iOS device to do is just start them as soon as possible. All right, because otherwise you know it's going to feel are your opportunities and performance. 160 00:21:20.430 --> 00:21:27.780 William Cheng: Is not very good. Okay, so therefore it's very important to start the next I operation in parallel with your CPU as early as possible. Okay. 161 00:21:29.700 --> 00:21:40.740 William Cheng: So let's talk about the mask interruption. So again, the idea here is like signal masking over here. Okay, so, so, so, so, so, so, so, so, so, so again, you know, instead I 162 00:21:41.190 --> 00:21:46.020 William Cheng: Want to make a clear distinction between disable enabling interrupt right inside the CPU. 163 00:21:46.440 --> 00:21:59.790 William Cheng: There's a interrupt enable bit right. I call it the iPad over here for interrupting naval i equals the one that means that interrupts enable i equal to zero, that means the interrupters disable interrupts disable you generated interrupt interrupt. 164 00:22:00.120 --> 00:22:04.980 William Cheng: Interrupt is going to become pending right so until you know I was enabled in that case will be delivered there. 165 00:22:05.430 --> 00:22:12.720 William Cheng: But also, you know, when interest is being unable individual email can also be masked okay just like signals. 166 00:22:12.930 --> 00:22:21.570 William Cheng: That. So in that case, you know, when you get a highway interrupt. First, you need to check whether you know I was unable or not interrupt enable you still need to check if that particular interrupt is 167 00:22:22.020 --> 00:22:27.840 William Cheng: is blocked or not. Now, if it's brockworth Miss mass, why not. Okay. It's still the interval become penny. 168 00:22:28.020 --> 00:22:37.590 William Cheng: And eventually went to interrupt become unmask or unblock why they, in that case, you know, the interval get delivered right when you know i'll get deliver, then the interrupt service routine will get executed. 169 00:22:38.220 --> 00:22:49.260 William Cheng: Yeah. So again, the terminology over here are exactly the same as before, and now he just seems to have finer control of you know when when to interrupt can count. Okay, now can can be mask mask. 170 00:22:50.370 --> 00:22:56.310 William Cheng: So masking interrupt this needs to be done at the hardware level. So there are two different approaches over here. 171 00:22:56.760 --> 00:23:08.700 William Cheng: One is used to how a registered to implement a bit vector, just like the signal mask. Right. You remember what the signal message guy is a mass of 32 bits over here, right, each one of them, corresponding to one one particular signal. 172 00:23:09.180 --> 00:23:17.010 William Cheng: Okay, so instead of CPU and they can also use a holler register over here. So every bit represent whether a particular highway interrupt is blah, blah, blah. 173 00:23:17.670 --> 00:23:25.530 William Cheng: Okay. So I think in the good old days, Intel, they have 32 bit you know they have, they have a 32 bit factor so they fit into 174 00:23:26.190 --> 00:23:31.860 William Cheng: The four bytes later all into actually the some hardware architecture is very, very sort of convoluted. 175 00:23:32.250 --> 00:23:42.120 William Cheng: They can actually go up to 128 bits over here. So again, instead of CPU, there's this big registered that you can actually manipulate to determine which interrupt his mask and which, you know, has a mask. 176 00:23:42.960 --> 00:23:54.960 William Cheng: There. So this is that instead of hardware. So that is actually give the application, the operators and program or a big headache. When you are servicing why interrupt which other interrupts you you brought and would you, you know, 177 00:23:56.430 --> 00:24:06.390 William Cheng: Which are the interruption to john blah, okay, because there are other 127 choices. So every time when you get to interrupt you need to decide, you know, which I interrupted, blah, blah. 178 00:24:07.560 --> 00:24:13.470 William Cheng: Okay, so therefore there's a second approach is no as hierarchical, you know, interrupt level. And that one is much easier to deal with. 179 00:24:14.130 --> 00:24:21.840 William Cheng: You know, for for for operating system programmer. So in this case, every job has an enormous privilege level or IPL ok so the idea here is that 180 00:24:22.260 --> 00:24:32.550 William Cheng: The system so that your IP out your IP is equal to 11 okay if you said IP or equal to 11 then all the inner level from zero all the way to 11 they're all blocked. 181 00:24:33.780 --> 00:24:42.480 William Cheng: Okay. So, anything above 11 there on blah. Okay. So, therefore, in this case, all you have to figure out, you know, if I have one, two, and 28 interrupt all I have to do it to sort them. 182 00:24:42.960 --> 00:24:45.930 William Cheng: Okay, make sure that I saw them based on what is more important. What is more 183 00:24:46.410 --> 00:24:52.620 William Cheng: Urgent than the other way. So this case, you know, like I can. What I can do is I can assign the IPL level based on their party. 184 00:24:53.010 --> 00:25:03.120 William Cheng: Because that's what this is called into a party level that so if yo party level 11 you know up happen all the higher priority interrupt will get unblocked and all the low party interrupted. They'll get blah. 185 00:25:03.990 --> 00:25:07.830 William Cheng: Okay, so this become a very, very easy, you know, sort of model, model to deal with. 186 00:25:08.190 --> 00:25:19.740 William Cheng: For the opposite program. So most of the system out there, even though the hardware support the bid factor, they probably will feel something inside hardware abstraction layer to make it look like they're supporting interrupt party level. 187 00:25:20.340 --> 00:25:24.960 William Cheng: Okay, so this way for the appliances, the programmer, there'll be a lot easier to deal with that when they need to set it, they 188 00:25:25.530 --> 00:25:33.420 William Cheng: Also have to sort of thing much about that. So for example, if you have a discussion or up right so this IP address or IP or equal to sell them for a disc interrupt. 189 00:25:33.870 --> 00:25:39.660 William Cheng: Okay, so when you servicing this interrupt. But when you're servicing do you out. You're servicing interrupt party level seven 190 00:25:39.930 --> 00:25:49.050 William Cheng: That means that all the integral from zero to seven their block, right. So in this case you will also not be able to get another this interrupt. If you get a second visit around also get the second does interrupt. 191 00:25:50.160 --> 00:25:55.650 William Cheng: It says, no problem. Here's block all the way to level seven. The second designer will become pending. 192 00:25:56.100 --> 00:26:05.910 William Cheng: Okay, well you finish service that you know over here. You're going to go back to the previous in Rob level if the previous era level or typically it's going to be lower. Why not case you do deliver that this gonna rob 193 00:26:06.420 --> 00:26:18.660 William Cheng: Rob is a level seven now. So using the IPL over here is going to make things a lot easier to talk about that. So, therefore, for the rest of the semester. We're going to assume that when we deal with interrupt. We're always going to deal with IPL 194 00:26:19.260 --> 00:26:29.250 William Cheng: Okay, so by setting IPL to a particular level you're blocking or interrupt you know from zero all the way to that level. Right. And also you unblocking all the other higher priority interrupts. Okay. 195 00:26:31.230 --> 00:26:35.670 William Cheng: Alright, so go see a lot example that alright so so we're done with context switching 196 00:26:36.750 --> 00:26:45.480 William Cheng: The next part over here. We're going to talk about input output architecture. So again, input output over here. We'll talk about devices right again with device hardware into three different category. 197 00:26:45.750 --> 00:26:54.630 William Cheng: There's a CPU. There's a memory everything else. We call them devices guys are going to talk about how you know how to deal with devices. So again, how do you deal with CPU. 198 00:26:54.960 --> 00:27:02.220 William Cheng: While you run a thread is that a CPU or how to deal with memory you use an address space, all this kind of stuff. Right. So, so the rest of it is dealing with IoT devices. Okay. 199 00:27:03.840 --> 00:27:19.260 William Cheng: All right, so, you know, so what does the computer look like. So this is sort of inside of a computer noise LSA 11 LSA 11 is the processor for PDP 11 and so other than the processor, they're also the IoT devices over here. So this is just 200 00:27:21.690 --> 00:27:30.780 William Cheng: This guy's. This is the CPU. This is also a bunch of device controller that's what the device controller device controller. We saw the picture before I will have a boss, we have the CPU. 201 00:27:31.050 --> 00:27:36.510 William Cheng: Memory over here and there were a bunch of device controller divided control or the one that connected devices. 202 00:27:36.900 --> 00:27:42.420 William Cheng: Okay, so, so, so, so inside the CPU over here, we don't really have the devices devices actually external 203 00:27:42.660 --> 00:27:50.280 William Cheng: There. So in this example, we are, we see a bunch of boards over here every board over here you could take them out and sort of look like the picture on the right on the right over here. 204 00:27:50.820 --> 00:27:56.310 William Cheng: So at the bottom. Over here, there are these metal fingers, the metal fingers over here, they are the one that made electrical contact 205 00:27:56.880 --> 00:28:02.010 William Cheng: So at the bottom over here. There's a bunch of connector that that will make contact with these middle finger. 206 00:28:02.430 --> 00:28:11.070 William Cheng: So let's call these the our little pins over here, though this middle fingers call them pins. Here's pin one has been to his pin three and all the way to pin. I don't know. You know 100 or something like that. 207 00:28:11.400 --> 00:28:19.080 William Cheng: Okay, so how does that. What will you put a signal on pin one that all the boards over here. All the boards, they're paying while we'll see exactly the same signal. 208 00:28:19.740 --> 00:28:25.860 William Cheng: Okay, if you put a signal on pin seven over here then for all the boards, a pin seven they will see exactly the same signal. 209 00:28:26.220 --> 00:28:33.510 William Cheng: Okay, so therefore everything that we're putting on the bus. The bottom over here. The bottom of the bottom part of this computer is known as the bus. 210 00:28:34.080 --> 00:28:43.560 William Cheng: ride the bus over here is all the signals over here, they're all connected across each other right so this way when one of the board over here I put a signal you know into in the in 211 00:28:44.220 --> 00:28:50.100 William Cheng: The sort of put a 01 on a particular signal all the other boards will see exactly the same signal. 212 00:28:50.670 --> 00:28:56.070 William Cheng: OK, so the bottom part over here, we call them the bag plane bus and these days. We'll just call it a bus. 213 00:28:56.370 --> 00:29:03.000 William Cheng: Okay and this is called the both boss architecture, you have all these words plug into the bus and then that's how they can communicate with each other. 214 00:29:03.810 --> 00:29:14.970 William Cheng: So what are these boys over here. So one of the boards over here. Maybe CPU. Right. So if you have an Intel CPU. One of them will be an X86 CPR sitting over there, another board might be a memory board. They're full of memory chips. Yeah. 215 00:29:15.510 --> 00:29:18.930 William Cheng: And then all the other boards. They are iOS device controllers. 216 00:29:19.560 --> 00:29:29.460 William Cheng: That. So for example, if this one is that this controller. Okay, this one is that this controller at the bottom part again is plugged into the bus on the top over here, there's going to be a cable that's connected to the desk. 217 00:29:30.330 --> 00:29:33.810 William Cheng: Okay, if this board over here is going to be the graphics control abort. 218 00:29:34.200 --> 00:29:44.160 William Cheng: So again, the bottom power is plugged into the bus. The top over here is going to have a cable that connect to your screen. I mean, these day we use HDMI is there's going to be HDMI cable that comes out of it. This is the graphic controller card. 219 00:29:44.400 --> 00:29:50.130 William Cheng: Okay it. This is a networking car again there are two different kinds of networking car. One is the wired in the other ones, the wireless internet 220 00:29:50.280 --> 00:30:00.390 William Cheng: So if this one is a wired internet right again the bottom part of your connect to the bus. The top part over here is going to have an Eastern a jack where you can actually plug in the connector into it if it turns out to be a wireless 221 00:30:00.870 --> 00:30:08.940 William Cheng: You know network interface card again the bottom part over here, plug into the bus and the top bar over here is gonna be antenna sticking out, and that he can actually, you can receive all the wireless signals. 222 00:30:09.420 --> 00:30:15.810 William Cheng: Okay. There's also the keyboard controller. There's a mouse controller or these kind of stuff. So lots of these card over here will plug into the bus. 223 00:30:16.770 --> 00:30:23.310 William Cheng: Okay, so again, there are many different kinds of bus standard right so that will determine, you know, how many, how many metal fingers that you have 224 00:30:23.460 --> 00:30:28.710 William Cheng: And what's the name of all the signals or, you know, which one is really which one is right. Which ones data which one's the address on the kind of stuff. 225 00:30:29.010 --> 00:30:35.220 William Cheng: There. So yeah, if you really want to know the detail, you have to take a W class over here we're going to draw the simple picture to represent that. 226 00:30:35.400 --> 00:30:43.230 William Cheng: Again to just be going to be a boss and then we have all these controller that you use it to, to, to talk to the devices. Right. 227 00:30:43.440 --> 00:30:52.680 William Cheng: Here's the here's the desk and here's this controller. Here's a display. And here's the graph is controller, the keyboard. The keyboard Control that typically memory doesn't have a controller. 228 00:30:53.490 --> 00:31:03.840 William Cheng: That I'm joining control over here, just in case, because some of the more sophisticated system. There are multiple ways to access memory. One of them is from this boss. Maybe there's another bus over here. They can also 229 00:31:04.320 --> 00:31:08.880 William Cheng: Connect a memory, right. So this guy is if you have two buses, try to access memory at the same time. 230 00:31:09.120 --> 00:31:16.440 William Cheng: While you're really not allowed to do that. So in this case I will put another controller in front of me and this way, only one bus can be accessing memory at the same time. 231 00:31:17.220 --> 00:31:21.330 William Cheng: Because that was a long as i mutual exclusion. Right. But this is done at the hardware level that 232 00:31:21.990 --> 00:31:32.370 William Cheng: The CPU board over here the CPU is not a controller as over here. I'm going to draw my CPU over here again CPU sitting on a board over here. And then, you know, most of the time the CPU is going to be driving the bus, where I put in the address. 233 00:31:32.880 --> 00:31:36.690 William Cheng: The address and the return resting on under, under the bus. Yeah. 234 00:31:37.860 --> 00:31:44.700 William Cheng: So the way that we talked to all these devices controller over here is that we're going to use something called the memory map I Oh, guys. What is memory now by all. 235 00:31:44.940 --> 00:31:56.010 William Cheng: Means that we're going to talk about it says okay, over here, how do you talk to memory right by putting a memory address on the bus, and that's how we talk to memory. Okay, we're going to talk to all the iOS devices as if they are memory locations. 236 00:31:57.240 --> 00:32:05.640 William Cheng: Guys, so if you want to talk to the bus over here we're going to use a memory access. We're going to use a memory reader memory, right, to talk to the keyboard Control all the control over here. 237 00:32:06.090 --> 00:32:16.950 William Cheng: That. So that's why this is called memory map out right in order for us to use the IoT devices. We're going to use memory operations. Right. And what I memory operation refund the bus and right to the bus. 238 00:32:17.610 --> 00:32:22.230 William Cheng: Okay, and that's how we talk to our devices. Okay. By reading and writing memory locations. Now, 239 00:32:23.820 --> 00:32:29.070 William Cheng: Alright, so there are two categories of IOT devices. A one is called program I oh 240 00:32:29.460 --> 00:32:37.650 William Cheng: Girl pii over here. So these are usually for slow devices over here are so out of these devices over here the keyboard controller is a small device. 241 00:32:37.920 --> 00:32:43.290 William Cheng: Okay, so when you press the key onto the keyboard. How does your program FIGURE OUT WHAT HE WAS PRESSED 242 00:32:44.160 --> 00:32:49.470 William Cheng: That. So this key is sitting, you know, the key of your way, press the key. This key is going to go inside a cubic 243 00:32:49.680 --> 00:32:57.060 William Cheng: Going out of people controller. So in order for you to find out what the key was you need to get the data from the, you know, for, for, for the keyboard Control it 244 00:32:57.420 --> 00:33:06.060 William Cheng: Okay, so, so how do you do that that so what you do is that you need to execute machine structure inside of CPU to read data from the controller. Right. So in this case, when you do that. 245 00:33:06.300 --> 00:33:09.360 William Cheng: You're going to read the data into the CPU or whether it's not good. It's not very, very useful. 246 00:33:09.990 --> 00:33:16.800 William Cheng: Okay, because India is your application that want the key that's get press on the keyboard. Now guys, remember what we have to do is that we need to 247 00:33:17.220 --> 00:33:22.770 William Cheng: Take this third hour we need to write it into memory and then we're going to use our address space to access that data in memory. 248 00:33:23.730 --> 00:33:33.030 William Cheng: Okay, so, so, so again, there's no way for us to tell the keyboard children say hey, why don't you copy that directly into memory and this guy's we have to go through the CPU and this is the call a programmed IO. 249 00:33:33.570 --> 00:33:38.490 William Cheng: Right, so we're going to read the data from the controller into the CPU and then we're going to write a data into memory. 250 00:33:39.360 --> 00:33:44.220 William Cheng: Okay, and then we're going to map the memory location over here into address space. And now we know which keywords press 251 00:33:45.000 --> 00:33:51.690 William Cheng: That. Similarly, if we do if he if we if we try to give the keyboard commands. So, for example, what kind of come out would you give to a keyboard. 252 00:33:51.960 --> 00:34:00.060 William Cheng: Maybe you can actually we map. Some of the keys over here on the keyboard. Right. So in this case, we need to send the keyboard controller, a code to tell the keyboard to go to a different mode. 253 00:34:00.480 --> 00:34:02.610 William Cheng: Okay, so in this case we're without that code compile 254 00:34:02.940 --> 00:34:11.160 William Cheng: The code that doesnt sit inside of CPU, the code. It is sittings or your program over here in memory. So in that case, what we need to do that, you need to go to memory over here. We inside your address space. 255 00:34:11.400 --> 00:34:18.000 William Cheng: Find out what code that is we didn't set to CPU and then you got to perform a memory map I operation to write it into the bus. 256 00:34:18.750 --> 00:34:24.090 William Cheng: Okay, so again, the first operation over here is that you're reading for memory location using, you know, using memory address 257 00:34:24.270 --> 00:34:33.270 William Cheng: And then you're going to use a memory address to talk to IoT device by writing that into the controller port over here. And then in this case, you know the the keyboard over here will change mode. 258 00:34:34.470 --> 00:34:41.610 William Cheng: Okay, so, so actually I accidentally use a phrase over here is that we're going to write into the controller port. So what does the controller port where the 259 00:34:42.030 --> 00:34:55.140 William Cheng: controller port it just, it just a memory address right this memory address if we put this memory address onto the bus that only the keyboard controller will look at a member says, oh, this is for me. So therefore you will take the command over here and then right into controller. 260 00:34:56.430 --> 00:35:07.410 William Cheng: Right. But the way the way you sort of think about is that you know there's controller poor and then there's memory pours Oh so you know what, when you write that down to the bus. You can direct it to go to the controller or go to a Go go go to memory. Yeah. 261 00:35:08.430 --> 00:35:13.890 William Cheng: So that's one kind of IOT devices and typically these are the slow wines, or you can take your time to read from it and copying the memory. 262 00:35:14.310 --> 00:35:26.700 William Cheng: The second category of IOT devices know as a DMA you know the devices over here DMA sense what direct memory access. Okay, so these are for the fancy controller. These controller. Basically, they have a CPU on board. 263 00:35:27.360 --> 00:35:40.320 William Cheng: Okay. I mean, those of you who are familiar with GPU rise over here the traffic controller boil here this controller warm. I have a GPU sitting on it, which is running them faster than the CPU. Right. So clearly this GPU knows how to talk to memory. 264 00:35:41.190 --> 00:35:50.820 William Cheng: Okay, so that we know case when when this up these talk to memory. He just didn't know where to write into memory, right. So in this case, you know the the CPU has to give an instruction to say, hey, later on when you transfer data into memory. 265 00:35:51.090 --> 00:35:54.960 William Cheng: Here is the star memory location, you need to copy and here's the number of bytes, the appetizer. 266 00:35:55.380 --> 00:36:05.730 William Cheng: Now, so in that case, in order for you to talk to these devices over here. The first the CPU has to do is to program this devices to get them ready for direct memory access to get them ready for DMA 267 00:36:06.060 --> 00:36:14.460 William Cheng: Right. So what do we do that he will perform sort of program I operation, again using memory map I owe to set our memory location and devices over here in the controller. 268 00:36:15.000 --> 00:36:19.950 William Cheng: Okay. And then what do we do that with what it will do is that it will have the control to say, go ahead and execute that command. 269 00:36:20.310 --> 00:36:31.800 William Cheng: Good. So when it does that, over here, another control over here, since they are a PMA devices. Right. Well, they are, what they're capable of doing, is that they will capable of driving the bus by themselves by copying data directly into memory. 270 00:36:32.610 --> 00:36:43.230 William Cheng: Okay, so why do we need to do that, right, because if you don't do that, then the CPU has to read one part of it. We four bytes of data on the desk right for buys into memory read it for buys from the desert. Right. That would be really slow. 271 00:36:43.920 --> 00:36:53.670 William Cheng: Okay, so in order for us to perform to to achieve good performers, we have these DMA devices that are capable translate a lot of data in a very short amount of time now. 272 00:36:54.690 --> 00:37:04.440 William Cheng: So this guy's gonna have to get this controller or the graphics or transfer a lot of data into memory or transfer a lot of data from memory. So when they're done, they need to interrupt the CPU to say I'm done. 273 00:37:04.740 --> 00:37:12.810 William Cheng: Right, so therefore India when they're done with the operation over here, they're going to pull the interrupt signal onto the bus and tell the CPU to say I'm done. Again, this is the IO completion interrupt. 274 00:37:13.290 --> 00:37:19.110 William Cheng: Okay, so he said you know observers or d the inside the CPU is going to tell these controllers, they do the next operation right 275 00:37:20.940 --> 00:37:31.230 William Cheng: Okay, so this is actually a good point to break. So, so, so, so, so the next time, I'm going to sort of continue to to to finish the DTI architecture. And we're also going to 276 00:37:32.070 --> 00:37:42.030 William Cheng: Try to go pretty fast on the in chapter three. Because the goal here is to go to chapter four and go to chapter five. So you can do your kernel assignment that 277 00:37:44.220 --> 00:37:44.580 William Cheng: All right.