WEBVTT 1 00:00:56.850 --> 00:00:59.730 William Cheng: Welcome to the live lecture seven 2 00:01:15.090 --> 00:01:15.360 Good. 3 00:01:16.560 --> 00:01:18.750 William Cheng: Morning. Another question. 4 00:01:18.990 --> 00:01:23.220 Hardik Mahipal Surana: With respect to handling of rocks. So you're 5 00:01:25.050 --> 00:01:27.060 William Cheng: interrupting me highway interrupt. Yes. 6 00:01:28.230 --> 00:01:28.590 William Cheng: Okay. 7 00:01:29.100 --> 00:01:40.440 Hardik Mahipal Surana: So Michael, my question is that you mentioned that when we are handling a hardware interrupt. We need to decide which Colonel stack, we need to store data into a 8 00:01:42.030 --> 00:01:46.050 Hardik Mahipal Surana: sighting in in in lecture seven slide number 19 nine 9 00:01:47.160 --> 00:01:52.650 Hardik Mahipal Surana: You give an example of when we get an interest from a user thread, how we handle it. 10 00:01:54.420 --> 00:01:55.740 William Cheng: Then let me get there. 11 00:01:59.940 --> 00:02:05.280 Hardik Mahipal Surana: I think we might be a little earlier, the heading says interrupting will use it right 12 00:02:08.010 --> 00:02:08.700 William Cheng: Okay. 13 00:02:11.070 --> 00:02:11.850 William Cheng: Right, this part. 14 00:02:13.290 --> 00:02:19.590 Hardik Mahipal Surana: Yes. So here in point number three. You mentioned that we need to decide which kernels Tigray 15 00:02:19.950 --> 00:02:25.260 Hardik Mahipal Surana: Right. So, earlier you had explained two approaches for different architectures. 16 00:02:26.040 --> 00:02:28.620 William Cheng: Yeah, so let me get that's right here, right here, this one. 17 00:02:32.640 --> 00:02:34.830 William Cheng: There are three different choices. You can allocate 18 00:02:35.550 --> 00:02:35.880 William Cheng: Yes. 19 00:02:35.940 --> 00:02:45.390 Hardik Mahipal Surana: So here in the third one, it says borrow the current slide from the trade. It is interrupting and earlier you had mentioned two different approaches which an operating system might take a 20 00:02:46.560 --> 00:02:57.600 Hardik Mahipal Surana: User thread might get its own Colonel stack that you'd like it will get its own user stack anchor mistake. And you also mentioned that there might, there is one kernel slack, which is shared amongst all the facts. 21 00:02:58.770 --> 00:03:06.390 William Cheng: Right, so that's that's right, so, so, so again, long time ago. There are some older operating system. They do things in different ways. Yeah. 22 00:03:07.020 --> 00:03:21.030 Hardik Mahipal Surana: So my question is, if the, if we are using an operating system where the current site is shared amongst all of the user threads. When an interrupt happens, technically, we don't need to decide which connects back to use it because there is only one goodness 23 00:03:21.720 --> 00:03:33.150 William Cheng: Exactly, yeah. There's only one kernel stack. So so long time ago when things are much simpler when you know computer doesn't have to do too many things. So they have the simplistic solution. Yes. 24 00:03:34.350 --> 00:03:35.280 Hardik Mahipal Surana: Okay, so 25 00:03:37.020 --> 00:03:40.410 William Cheng: But, but, you know, for for these days, three is the only one that we have to worry about. 26 00:03:41.550 --> 00:03:43.470 Hardik Mahipal Surana: Okay and this assumes that each 27 00:03:44.490 --> 00:03:50.670 Hardik Mahipal Surana: Trade has its or has a different user stack and a different currency and each state has different goodness text. 28 00:03:50.700 --> 00:03:59.130 William Cheng: Right. So in chapter five. We're going to talk about these details right so so remember one thing that I said that is that for this class, most of the time when 29 00:03:59.520 --> 00:04:05.400 William Cheng: You know when a user thread make a system called is still the same threat, it still belong to the same process. Okay. 30 00:04:06.030 --> 00:04:18.570 William Cheng: They are operating system out there that's not true. Okay. But most of the time, you know, as far as this introductory class is concerned, we're going to assume that that's always going to be the case unless we explicitly say that that's not the case. 31 00:04:20.640 --> 00:04:21.030 Hardik Mahipal Surana: Okay. 32 00:04:21.720 --> 00:04:27.150 William Cheng: So, so, so, so in that case, you know, you have a thread that go from a user threat to the colonel threat and that's the same thread. 33 00:04:27.450 --> 00:04:31.020 William Cheng: Then you have to have to stack one in the user space and one in the kernel space. 34 00:04:32.040 --> 00:04:40.470 Hardik Mahipal Surana: Okay, yeah, I think if dude stacks for Eastern then it becomes simple to understand which is the interesting thread and which is the corresponding career site for that. 35 00:04:41.040 --> 00:04:45.750 William Cheng: Right. So for this class we pretty much always assume that's the case. Okay. 36 00:04:46.830 --> 00:04:56.310 Hardik Mahipal Surana: And another question is that you mentioned that the current stat. Is it just to clarify, is it stored inside the threat control block. 37 00:04:58.050 --> 00:05:01.920 William Cheng: A the colonel step is reachable from the threat control block. 38 00:05:02.970 --> 00:05:11.040 William Cheng: Okay, because West pointers, you know, you can use to point. Yeah, I can just point your finger point, your opponent opponent. It doesn't really matter how many levels of indirection that you have 39 00:05:11.370 --> 00:05:13.830 William Cheng: As long as you have a way to find the colonel stack. 40 00:05:14.940 --> 00:05:22.740 Hardik Mahipal Surana: Okay, so technically the current site is a part of the extended it space and the thread control block has a pointer to the top of the Colonel. 41 00:05:24.690 --> 00:05:33.000 William Cheng: Um, I don't really know if that people will consider that part of the extended I just basically extended address space is something that the colonel is doing for you. 42 00:05:33.570 --> 00:05:45.540 William Cheng: Reza, for example, you open a file right the Colonel. Remember that you have open the file for you. So that's kinda like the extended address space if you use the colonel data structure to, you know, to, to implement the Colonel. 43 00:05:46.830 --> 00:05:56.880 William Cheng: You know i i don't think it's correct to color the extended address but extended address based something that you have access to that you have access to indirectly right like a file that you have open 44 00:05:58.470 --> 00:06:03.630 William Cheng: But you don't really have the at, you know, so for your program. You can say, oh, I want to use the colonel stack. 45 00:06:03.900 --> 00:06:17.370 William Cheng: That's really not allowed right but but when you make a system call you become a colonel so that you are using the you know you are using the the the colonel stack. So would you call the Colonel's diabetes send that address space, you know, I probably wouldn't 46 00:06:19.980 --> 00:06:29.190 Hardik Mahipal Surana: So how do we actually distinguish between what exists in the external narrative space and what exists in these control blocks, whether it's the third control broke or the process control. 47 00:06:29.190 --> 00:06:30.600 William Cheng: Themselves, maybe. Exactly. 48 00:06:32.040 --> 00:06:32.940 Hardik Mahipal Surana: The VC firm. 49 00:06:34.560 --> 00:06:39.600 William Cheng: Well, so I think these kind of stuff, you know, you asked it in person, they will have a different opinion. So, you know, 50 00:06:41.310 --> 00:06:55.680 William Cheng: So, you know, so, I mean, the idea here is that is that you have an address space right the address space has addressable memory location. Okay, so what is the extended address space the extended address space, it will be something that you you can refer to 51 00:06:57.240 --> 00:07:07.680 William Cheng: You know, and so in this case is, you know, someone inside a file system, the operating system to keep track for you. I don't really see that that that you have to define these terms precisely right 52 00:07:08.940 --> 00:07:21.720 William Cheng: Well, we just saw that, you know, well I guess in chatting lecture seven that you can you can switch threat. The threat is an abstraction. So, so if you want to say exactly what is the threat. Howdy, I should be fine. 53 00:07:22.980 --> 00:07:30.120 William Cheng: I mean, it also. So sometimes, you know, someday. It's okay not to have a precise definition for for some of these terms. 54 00:07:32.760 --> 00:07:42.840 William Cheng: And it's that's that. That is my view. I think if you if you define stuff so rigidly or India and you're gonna, you know, I'm going to get into trouble because you know i mean 55 00:07:43.320 --> 00:07:57.330 William Cheng: If you, if you want to define a threat very rigidly then it will be impossible to be in two threads at exactly the same time or it will be impossible to be in between different threads or something like that, you know, so you're going to get into trouble if you try to be really rigid 56 00:07:59.460 --> 00:08:11.280 William Cheng: Okay, so, so a lot of time studying computer science. So they talk about these these updated these concepts. Sometimes we sort of were waving our hands a little bit I because because, you know, they're just so it's just an abstraction. 57 00:08:12.660 --> 00:08:20.190 William Cheng: Well guys, when we say extended address space, you know. Is that, is that an abstract concept. But, yeah, yeah. It's kind of like an abstract concept right 58 00:08:21.810 --> 00:08:25.230 Hardik Mahipal Surana: All of the definitions would be dependent upon a particular 59 00:08:27.660 --> 00:08:34.860 William Cheng: Well, I'm just saying that if you if you ask a different person. You know that's teaching an operating system class, they probably give you a slightly different definition. 60 00:08:37.500 --> 00:08:48.030 William Cheng: So, so you need to understand the basic concept. Right. You know, so it was when we talk about extended address space. What you know what an address spaces. Right, that's, you know, to, to the 32 memory locations. Right. 61 00:08:48.360 --> 00:08:53.730 William Cheng: So extended address space is anything that's accessible outside of your address space. 62 00:08:56.220 --> 00:08:56.520 Okay. 63 00:08:58.530 --> 00:09:07.740 William Cheng: Right. And then, then you use the social what so so you know what we tried to do that, which I sort of get a feel for it to see exactly what what do people mean when they say extended extended address space, right. 64 00:09:07.920 --> 00:09:12.750 William Cheng: It's just anything that's reachable that's not in your address spaces in this in the extended address space. 65 00:09:13.770 --> 00:09:21.750 William Cheng: Right. But then, then it can argue whether you can reach the colonel stack or. Now you said why if I make a system call there might become a kernel thread, then I can use the colonel stack. 66 00:09:22.770 --> 00:09:36.120 William Cheng: But you can't really use it you know directly right so so that looks like a particular file. Once you open the file. You can tell it opens and say I want to retain bites on that file, you can say, I want to retain buys one kernel stack right so 67 00:09:38.760 --> 00:09:47.760 William Cheng: So there's a difference. Okay, thank you. Okay, yeah. Sorry, let me sometime computer science is just, you know, people are being a little loose now. 68 00:10:02.460 --> 00:10:03.330 William Cheng: Any other question. 69 00:10:10.470 --> 00:10:10.920 Wookyum Kim: Oh, yes. 70 00:10:14.340 --> 00:10:16.530 Wookyum Kim: Is questions about the homework, actually. 71 00:10:16.950 --> 00:10:17.250 Okay. 72 00:10:18.300 --> 00:10:20.670 Wookyum Kim: Um, so in 73 00:10:23.940 --> 00:10:26.760 Wookyum Kim: So for the reading that TS file. 74 00:10:27.090 --> 00:10:34.560 Wookyum Kim: Hmm. And then if there is an adder, then it should, we should like terminate our programs. Right. 75 00:10:35.370 --> 00:10:40.830 William Cheng: Yeah, whenever you're counting error, you must printer error message immediately and quit your program immediately. 76 00:10:40.980 --> 00:10:45.900 Wookyum Kim: Yeah. And then I mean, but because I'm reading 77 00:10:47.760 --> 00:11:01.320 Wookyum Kim: It my program is readings, the files in the trial district. I mean, I mean the different functions from the main functions. I mean, yeah, it's from the package generator. So 78 00:11:02.670 --> 00:11:11.130 Wookyum Kim: So if then I'm wondering is that if I just call exit in that strength is valid. 79 00:11:12.480 --> 00:11:15.660 William Cheng: Well, the, the, the spec give you permission to do that. 80 00:11:16.410 --> 00:11:16.920 Wookyum Kim: Oh really, 81 00:11:17.370 --> 00:11:24.750 William Cheng: Well, the smoke says you have to print a message and quit your program. It doesn't, you know, so, so, so you you you print an error message or you say exit. That's it. 82 00:11:25.080 --> 00:11:36.810 Wookyum Kim: I mean the, I mean, during the lectures like in the, I mean we should avoid that call exit in the trance thread for like some problems. 83 00:11:37.530 --> 00:11:44.550 William Cheng: No, no, no, the lecture, give you a very, very specific example to say that if you do this, this will happen if we do that that will happen right 84 00:11:44.820 --> 00:11:53.490 William Cheng: Yeah, yeah. Before our warm up assignment you know the spec says, Whenever you encounter an error, you have to print an error message. And you have to create your program right there. 85 00:11:54.240 --> 00:11:56.850 Wookyum Kim: Oh, so we can call the accident there. 86 00:11:56.940 --> 00:12:05.850 William Cheng: Yeah, I'm just like the example in the in chapter one, right, what doesn't. When, when there's an error when there's an arrow was a p error in a meeting for the exit. 87 00:12:06.300 --> 00:12:18.540 Wookyum Kim: Yeah, I know that I understand that part, but I'm just wondering if I can like just called the exit in that others thread. I mean, you saw I mean other than the main functions. 88 00:12:18.870 --> 00:12:24.330 William Cheng: Yeah, you can call exit in any threat right because of because all it does is that it's a system called you coming out of Colonel 89 00:12:24.870 --> 00:12:27.090 William Cheng: Colonel will make sure that your program is that 90 00:12:27.570 --> 00:12:29.820 Wookyum Kim: Are that are destroyed will just that. 91 00:12:30.840 --> 00:12:34.650 William Cheng: Also, once you make a system call you come inside of Colonel and to exit system call 92 00:12:34.800 --> 00:12:38.010 William Cheng: Yes. So what is the Colonel supposed to their supposed to kill your program. 93 00:12:38.370 --> 00:12:41.760 William Cheng: Yeah, we have to trust the colonel to do the right things. 94 00:12:44.220 --> 00:12:52.140 William Cheng: Right, so, so, so, so, so let's say you're running six different threats or they're all running in six different CPU. One of the thread called exit. What's going to happen. 95 00:12:52.560 --> 00:12:57.510 William Cheng: Okay, so, so that's where it's going to come in and out of CPU and you're supposed to kill the kill the program. 96 00:12:57.750 --> 00:13:08.370 William Cheng: So in this case, the operating system has to make sure that all the other five CPU, they start executing code for your threat right because if they're if they're executing code, whether he can really kill your program yet, right. 97 00:13:08.880 --> 00:13:13.620 William Cheng: So you have to wait until all the other CPU, they all go run, they all go do something else. 98 00:13:13.830 --> 00:13:15.930 William Cheng: And then you know that all these six threat. They're all 99 00:13:17.490 --> 00:13:28.770 William Cheng: They're all not doing anything. And now you can say that you want to make sure all these threats never execute again. So at that point, you will, you know, you, you, you can actually self, self destruct. 100 00:13:32.370 --> 00:13:38.550 Wookyum Kim: So good. In general, there can be a problem if I called you sit in the charges. Right, right. 101 00:13:38.910 --> 00:13:46.650 William Cheng: Well, it depends on the depends on the spec right if the spec to say that, you know, whenever you encounter an error, you have to recover from the era, whether you recover from the air. 102 00:13:46.830 --> 00:13:59.580 William Cheng: If the specs, as you have to have a graceful shutdown where you went when when input as an error. Well, then in that case you haven't to a graceful shutdown being our specs see explicitly say that you supposed to immediately. Immediately quick 103 00:14:00.090 --> 00:14:01.140 Wookyum Kim: Yeah yeah 104 00:14:01.200 --> 00:14:05.580 William Cheng: So, so for our warm up to, we only do graceful shutdown when you have control seat. 105 00:14:06.540 --> 00:14:07.140 Wookyum Kim: Oh, 106 00:14:07.620 --> 00:14:12.900 William Cheng: Right, all the other cases because the input is not supposed to have error. Right. So if the input is not supposed to Eric, what do you do when 107 00:14:13.530 --> 00:14:21.810 William Cheng: You get an error, while you quit your program right away, and it doesn't really matter if you have simulated for five days. Yeah, the requirement is that you have to quit your program. 108 00:14:24.270 --> 00:14:27.000 William Cheng: Right, because there's no requirement to graceful shutdown at that point. 109 00:14:27.600 --> 00:14:35.880 Wookyum Kim: Yeah yeah i mean i i'm just like confuse that with that previous lectures about that exceeded piece read exits stops. 110 00:14:36.600 --> 00:14:39.900 William Cheng: Right, so, so when you called Pisa exit only your threat dies. Right. 111 00:14:39.930 --> 00:14:40.710 Wookyum Kim: Yeah yeah 112 00:14:40.800 --> 00:14:45.840 William Cheng: So, so, so, so, so then it depends on which thread copies that exit that will be the only thread that dies. 113 00:14:46.440 --> 00:14:47.820 William Cheng: But when you call exit. 114 00:14:48.000 --> 00:14:50.430 William Cheng: By anything bad then, then the process is dead. 115 00:14:51.540 --> 00:14:58.980 William Cheng: Okay, and also when you call. So that means that you don't really care what's going on with all the other threads, because otherwise you shouldn't call exit. 116 00:14:59.790 --> 00:15:00.960 Wookyum Kim: Oh, yeah. 117 00:15:01.230 --> 00:15:05.520 William Cheng: Right, the ordinances and give you all these tools to give you a choice. They even called Pisa that so you can exit. 118 00:15:05.760 --> 00:15:09.090 William Cheng: Us a programmer. You get to choose. Yeah. 119 00:15:09.120 --> 00:15:12.570 William Cheng: Yeah, if you choose exit. That means that you don't care about the other threat. 120 00:15:12.960 --> 00:15:13.920 Wookyum Kim: Yeah, I got it. 121 00:15:14.010 --> 00:15:15.180 Wookyum Kim: Yeah, thank you. 122 00:15:15.240 --> 00:15:21.840 Wookyum Kim: Yeah. And another one is that I was I'm kind of make sure about that. 123 00:15:23.280 --> 00:15:25.830 Wookyum Kim: Interviewer internal rubber times 124 00:15:26.100 --> 00:15:31.980 Wookyum Kim: Okay, yeah. So, oh, based on my understanding, understand 125 00:15:34.860 --> 00:15:39.600 Wookyum Kim: Oh, I think it's like, so I have to, like, make 126 00:15:41.460 --> 00:15:52.080 Wookyum Kim: Time in the extra hour time difference between that the each tokens or each packets as 127 00:15:53.220 --> 00:15:53.760 Wookyum Kim: I mean, 128 00:15:56.730 --> 00:15:58.530 Wookyum Kim: As possible, as I can. Right. 129 00:15:58.980 --> 00:16:03.630 William Cheng: Well, so yeah, so, so, so the way this is done right. So let's say that you're doing the token threat right 130 00:16:03.720 --> 00:16:07.620 William Cheng: Yeah, yeah. So here is a token to arrive at this time. Right. 131 00:16:07.680 --> 00:16:08.400 Wookyum Kim: Yeah yeah yeah 132 00:16:08.580 --> 00:16:13.770 William Cheng: Okay, so, so at that time when you print in line on the screen to say token to arrive at this time. 133 00:16:14.130 --> 00:16:17.520 William Cheng: Yeah, right. So that will be the right of arrival time for token to one. 134 00:16:17.820 --> 00:16:18.570 Wookyum Kim: Yeah yeah 135 00:16:18.810 --> 00:16:23.490 William Cheng: And then once token to you on a ride, then you know when token T to is supposed to arrive. 136 00:16:23.790 --> 00:16:28.140 William Cheng: Yeah, right, because it's so, so, so if token to arrive at equal to x, right. 137 00:16:28.260 --> 00:16:34.140 William Cheng: Yeah, and the interval type of token is equal to one over our so therefore at. So this is one over art right so 138 00:16:34.920 --> 00:16:40.410 William Cheng: X x plus plus one over our. This is where T to supposed to arrive. 139 00:16:40.950 --> 00:16:47.400 William Cheng: Yeah, okay. So, therefore, when you are ready to go to sleep in a token threat. You should read the clock right at the clock right now is why 140 00:16:47.790 --> 00:16:55.230 William Cheng: Yeah. And how long do you have to sleep well you need to sleep x plus one over x minus y, right, because that will be this amount of time that you have to sleep. 141 00:16:55.620 --> 00:16:57.960 Wookyum Kim: Okay. Okay, got it. Yeah, okay. 142 00:16:58.320 --> 00:17:04.440 William Cheng: And then the other thing you need to understand is that when you wake up. You're going to wake up at a later time, then you know x plus one over here. 143 00:17:04.860 --> 00:17:14.880 William Cheng: Right. So that will be the time the actual token T to arrive. So again, this will be the new X and then you add one hour or two, and this will be the time where T three supposed to arrive. 144 00:17:16.080 --> 00:17:21.300 Wookyum Kim: Okay, so we can we can so we can ignore that these 145 00:17:22.380 --> 00:17:29.610 Wookyum Kim: Small time difference of extra, extra or key to and that supposed to teach to write year right 146 00:17:29.640 --> 00:17:32.010 William Cheng: Well, yeah, so, so, so this, this time right here. Right. 147 00:17:32.220 --> 00:17:33.270 William Cheng: This time over here. 148 00:17:33.360 --> 00:17:36.000 William Cheng: It could be one millisecond, it could be 10 seconds. 149 00:17:36.210 --> 00:17:37.350 Wookyum Kim: Yeah yeah yeah yeah yeah 150 00:17:37.410 --> 00:17:43.500 William Cheng: But yeah, if your CPU is really, really busy or something. Well, then in that case. Yeah, it will take a long time. Right. 151 00:17:43.770 --> 00:17:44.340 Wookyum Kim: Yeah yeah 152 00:17:44.400 --> 00:17:50.700 William Cheng: So, so, so, so, so, again, the idea here is that the token is not supposed to arrive everyone over our second 153 00:17:50.940 --> 00:17:56.460 William Cheng: Yeah, okay. So it was a once a token right then you know that the next token is supposed to arrive, one over our second later. 154 00:17:56.730 --> 00:17:59.340 Wookyum Kim: Yeah, yeah, yeah, yeah. Okay. Okay. Got it. 155 00:17:59.640 --> 00:18:01.920 William Cheng: Okay. Yeah. Thank you. Welcome. 156 00:18:14.340 --> 00:18:16.470 William Cheng: Any other questions. 157 00:18:19.980 --> 00:18:22.560 Hardik Mahipal Surana: Regarding are handling controls in the warm up. 158 00:18:23.310 --> 00:18:34.380 Hardik Mahipal Surana: Okay, so my question is, once we find block. Once we use cigarette in our controls in catching thread and in the situation where 159 00:18:35.160 --> 00:18:48.300 Hardik Mahipal Surana: We don't press Control. See, in that case, once we joined from the other four threads. In the meantime, can we call like pizza kill or pizza cancel to stop the controls in catching thread as well. 160 00:18:48.990 --> 00:18:58.440 William Cheng: Right. That will work because you know subway is a cancellation point. So if you call pizza Castle for the control see handling threat. It should die and stick. Wait. 161 00:19:00.540 --> 00:19:06.420 William Cheng: And then, then you can join with it. Right. As soon as you you Castle and the you join with it. So in that case it will be fine. 162 00:19:06.870 --> 00:19:13.950 William Cheng: But, you know, of course, at the time where you try to cancel it. If the user just happened to be pressing Control see at exactly the same time. 163 00:19:14.640 --> 00:19:20.760 William Cheng: then then then then there to possibility. Right. One is that the third which is act on cancel in subway and then it would die. 164 00:19:21.390 --> 00:19:27.360 William Cheng: The other possibility is that the user prayer control see actually before right you know at the instance of pattern right before you cancel it. 165 00:19:27.780 --> 00:19:30.330 William Cheng: Right. So, in that case what you would do is it will return on subway. 166 00:19:30.810 --> 00:19:45.960 William Cheng: Okay, and then you cancel a while. But then, and then in that case you will continue to execute. It's Co. You will lock them in tax do all that kind of stuff. But then, and so at that time cancellation is going to become pending and eventually you know that said was, so that was sort of self. 167 00:19:47.400 --> 00:19:55.470 William Cheng: Will. Will Self terminate. And in that case, that's also perfectly fine, right, because if you cancel that. And you join with that pretty soon it will return 168 00:19:56.430 --> 00:19:59.700 Hardik Mahipal Surana: But do we really need to join with the control. So you can say 169 00:20:00.390 --> 00:20:05.250 William Cheng: Well, why do you need to cancel that. And if you're not going to join with it and don't can't. There's no need to cancel it. 170 00:20:06.030 --> 00:20:11.820 Hardik Mahipal Surana: Because if we join on the on the cancer rate, but we never call control see 171 00:20:13.080 --> 00:20:19.110 Hardik Mahipal Surana: Then in that case, our main thread will be waiting for controls you to die, but the rest of the program would be over a 172 00:20:19.470 --> 00:20:24.060 William Cheng: Right yeah if you join with it. But if you don't want to join with that, then there's no need to cancel it. 173 00:20:27.630 --> 00:20:31.440 Hardik Mahipal Surana: Okay, but if we don't join it. And if we 174 00:20:32.520 --> 00:20:44.850 Hardik Mahipal Surana: Don't call control. See, then the main program. Okay. Okay. So I think in that case, the main program main function would end and that will end with the entire process. 175 00:20:45.060 --> 00:20:46.110 William Cheng: That will call exit by 176 00:20:47.430 --> 00:20:49.830 William Cheng: When you return from the main function call. Exit 177 00:20:50.910 --> 00:20:56.670 Hardik Mahipal Surana: Okay, so if we don't join. We don't need to call Pete said cancel. But if we are joining we can call either cancel. 178 00:20:57.120 --> 00:21:10.830 William Cheng: If what if you are joining it you make you need to make sure that you copies of the Council before I yeah because otherwise if Control C is now press and he just joined with it, then they are going to get blocked wherever God. Thank you. Okay. Yeah. 179 00:21:17.640 --> 00:21:20.160 Lalit Gupta: Yes, I have a question regarding switching third 180 00:21:20.730 --> 00:21:22.050 William Cheng: So, which will say, 181 00:21:23.310 --> 00:21:27.420 Lalit Gupta: In in the in the lecture seven, you talked about switching threads. 182 00:21:27.600 --> 00:21:28.980 William Cheng: Of switches that. Okay, sure. 183 00:21:29.700 --> 00:21:39.720 Lalit Gupta: Yeah, so, so in the intellectual we are storing the stack pointer. But you said we get, we have to also store the other additional also 184 00:21:40.080 --> 00:21:41.190 William Cheng: Yes, so 185 00:21:41.220 --> 00:21:53.340 Lalit Gupta: Are we are restoring this other additional in the in the TCP or in are we pushing this disclosure onto the stack, so that we can pop off it and it will be recovered. 186 00:21:53.490 --> 00:21:59.850 William Cheng: Yeah, so like if you look at this slide right over here, instead of their control blah, there's an area called saved context. 187 00:22:01.020 --> 00:22:07.680 William Cheng: Right. So one of the register over here is the stack pointer. So you can sort of imagine that all the other register also say right right there. 188 00:22:08.880 --> 00:22:24.780 Lalit Gupta: Okay, but we don't think you can also do is we can when we are in the in the assembly code of this switch program, we can push all the registers and then it has time to return it will pop the resistors and we will get all the things back 189 00:22:25.530 --> 00:22:36.660 William Cheng: That that will be correct. Yes. Yeah. So, you know, the, the idea here is, again, we just talked about sort of the high level concept exactly how you do it. You know, some of the, you know, some of us have it depends on the CPU. 190 00:22:37.710 --> 00:22:41.130 William Cheng: You know, like I mentioned before, the spark CPU has over 100 register. 191 00:22:41.760 --> 00:22:47.790 William Cheng: And so in that case, I'm not. Yeah. So how do you actually say it is right. So, so again this is, you know, maybe CPU dependent right 192 00:22:48.450 --> 00:22:59.700 William Cheng: But every CPU has a stack pointers over here. What sort of talk about the stack puncher right ABC DS or has has instruction pointer has a stack pointer. They also have like a frame pointer. So you can access function argument local variable. 193 00:23:01.440 --> 00:23:04.110 William Cheng: Okay, so we sort of focus on those three registers. 194 00:23:05.940 --> 00:23:16.920 Lalit Gupta: And since we have to store all the solicitor and since you're saying we can have like hundreds of registers. It seems like switching the threats is maybe time consuming. 195 00:23:18.180 --> 00:23:30.540 William Cheng: Yeah, if you have a seat. If you have a simple CPU, then it's less time consuming. If you have a complicated CPU, like the spark CPU. I actually, I don't really know exactly what the spark CPU does when they have 100 something registers. 196 00:23:31.680 --> 00:23:41.880 William Cheng: So, you know, again, this is, you know, the, the, what we come down to writing real code. And these are the horror abstraction layer co right because they are CPU dependent. So those people have to worry about it. 197 00:23:42.810 --> 00:23:48.060 William Cheng: Okay, right. So since we're talking about introductory operating system clause. We're going to say that yeah you know these things will be saved. 198 00:23:50.310 --> 00:23:55.920 Lalit Gupta: The bottom line is we have to save it or we save it, it doesn't matter for right now. 199 00:23:57.180 --> 00:23:58.650 William Cheng: Yeah, you have to deal with it. 200 00:23:58.860 --> 00:23:59.880 William Cheng: Yeah, so 201 00:24:00.000 --> 00:24:09.990 William Cheng: Definitely right so we're, we're not talking about all the details right because a detailed might belong to a different class, not in this class. Okay, thank you. Okay. Yeah. 202 00:24:15.840 --> 00:24:21.300 William Cheng: Whereas over here basically talk about this operating system concept. How do you switch on one side to the other. You know, you call like this. 203 00:24:21.750 --> 00:24:25.950 William Cheng: So later on in chapter five, we're going to see more detailed code for the Switch function. 204 00:24:26.880 --> 00:24:37.560 William Cheng: Okay, and then eventually, when you do your kernel assignment, the Colonel's me, you actually have to switch threads. So, therefore, you can actually look at the, you know, look at the Brown University implementation of how you, how do you actually switch right 205 00:24:48.900 --> 00:24:50.490 William Cheng: Any other questions. 206 00:25:02.250 --> 00:25:06.540 William Cheng: If there are no questions. Is it okay if I stop the recording. 207 00:25:15.720 --> 00:25:26.550 William Cheng: Okay, since there are no or somebody still trying to, you know, look for a question to ask if you're if you're still doing that, please let me know, because otherwise I will, you know, I will stop the recording. 208 00:25:32.010 --> 00:25:36.780 William Cheng: Alright, so I'm going to stop the recording right now. So you'll feel free to talk to each other. Okay.