WEBVTT 1 00:00:01.140 --> 00:00:08.340 William Cheng: This is the second part of lecture 20 so now we're going to talk about Michael Colonel 2 00:00:10.710 --> 00:00:17.670 William Cheng: Alright. So the basic idea is to take everything out of the kernel and move into user space. So what kind of stuff you can move into the user space. 3 00:00:18.390 --> 00:00:25.530 William Cheng: For example, the networking subsystem. You can move into the user space line displaying improving the user space out. In fact, even the entire file system. 4 00:00:25.980 --> 00:00:33.120 William Cheng: You can move into the user space. So in the end, or what's left inside the Colonel. Right, so, so, so we want the candidate to be as small as possible. 5 00:00:33.480 --> 00:00:40.680 William Cheng: Because over here. It says, if you're using micro Colonel process management is still inside the Colonel, does it make sense to a process known as being the user space. 6 00:00:41.130 --> 00:00:46.230 William Cheng: You probably doesn't really make sense. Right. Will you try to create a process where he tried to terminate a process. Wait for process. 7 00:00:46.710 --> 00:00:50.850 William Cheng: This seems to make sense that they're done instead of Colonel. What about your virtual memory system. 8 00:00:51.660 --> 00:00:57.270 William Cheng: You know, again, it kind of makes sense that there actually is things that occur know so. So, you know, so there are certain certainly belong to the Colonel. 9 00:00:57.930 --> 00:01:06.780 William Cheng: Over here, it says device drivers also built into the kernel. What happens at the microphone or people that you really try really hard to move all the device driver into the user space. 10 00:01:07.320 --> 00:01:13.980 William Cheng: Okay, because again, because we're because there are bugs there and things like that. So it would be nice if we can move into the user space, but will you do that. 11 00:01:14.190 --> 00:01:20.190 William Cheng: Why is that the performance can be a very poor because instead of device drivers. Remember the device drivers other device specific stuff. 12 00:01:20.460 --> 00:01:28.470 William Cheng: Every instruction you execute these other device driver, you know, as it turns out, no, no. Most of them is going to be privilege. So therefore, you're gonna you're going to go up and down the colonel all the time. 13 00:01:29.250 --> 00:01:39.750 William Cheng: As an Indian even for micro Colonel people, they often put device driver, you know, into the kernel. Very. I mean, today there are still people experimenting by putting a divide driving to the user space and try to make it 14 00:01:40.680 --> 00:01:50.250 William Cheng: Make it fast. Yeah. And also you need something new. Inside the colonel over here. It's called message passing. So we're going to sort of briefly take a look at, you know, a message passing as is 15 00:01:50.580 --> 00:01:58.290 William Cheng: And that's, you know, one of the things that that micro kernels. So it has to introduce right. The basic idea over here is that if all these things are in the user space. 16 00:01:59.700 --> 00:02:03.600 William Cheng: Okay, so for example if you want to talk to the file system, how do you talk to the file system. 17 00:02:03.960 --> 00:02:11.160 William Cheng: Right, so your applications here the fastest and this year. The only way you can do it is by sending messages. Right. So over here, there's something called message passing 18 00:02:11.400 --> 00:02:20.850 William Cheng: For you, for your application to talk to all these traditional Colonel component and now they're in user space. So again, all these things need to be done as as efficient as possible. Okay. 19 00:02:22.710 --> 00:02:31.560 William Cheng: All right. So why do people work on micro kernels. Number one, it's cool because it's a very, very difficult problem to to to to to work on. 20 00:02:32.010 --> 00:02:36.000 William Cheng: People have tried this for many, many years as an Indian. The result has never been really good. 21 00:02:36.780 --> 00:02:45.210 William Cheng: So, so therefore you know if you're working on, it's really sort of really a cool problem to solve. Yeah, I mean, but if you can solve this problem would be really cool. Right. 22 00:02:46.110 --> 00:02:50.910 William Cheng: The other reason is that, you know, assuming that the O is coders are incompetent malicious or both. 23 00:02:51.330 --> 00:03:01.170 William Cheng: You know, sometimes you know the code inside the cardinal they crash. So again, the purpose of Michael Colonel is to remove everything that's unreliable usable. The end user space. 24 00:03:01.440 --> 00:03:15.870 William Cheng: Okay, so, so, India, you really want to book your device driver enter user space. Okay. And number three, okay, this is really the reason is extensive ability if you if you can actually make micro kernels to be successful, then the colonel NEVER HAVE TO CHANGE ever again. 25 00:03:17.130 --> 00:03:24.750 William Cheng: Guys, once you have a reliable Michael Colonel everything that you need to do if you want to experiment with file system, you're doing a user space, you want to create a new file system user user space. 26 00:03:24.930 --> 00:03:34.170 William Cheng: You want to create a new networking subsystem, you do the users, but you don't need to modify the kernel anymore. Okay, so therefore it will become very, very easy to add or modify extend you know everything. 27 00:03:36.240 --> 00:03:41.730 William Cheng: Inside your system because all your future system, there will be all done to the user space right and the user space program if 28 00:03:42.360 --> 00:03:52.110 William Cheng: They died, if you have, if you have a file system that dies. Okay, well, you cannot access data inside up houses, but you can still use other use other file system that are alive inside your system. 29 00:03:53.070 --> 00:03:58.470 William Cheng: Ok, ok. So, therefore, this is a sort of a really good way to go. So that's why people are continuing to work on it. 30 00:03:58.950 --> 00:04:10.620 William Cheng: Because one day you know maybe one day we don't care about speed anymore because the CPU will be so fast, and we have so much memory. So in that case, all we were worried about is you know how to actually make your operating system more extensible then 31 00:04:13.170 --> 00:04:25.920 William Cheng: Some of the implementation issues over here right before when we talked to the file system. How do we talk to the file system. I will open the file And will read and write, but now you know there's there's no such functionality you cannot open, you know, 32 00:04:26.970 --> 00:04:35.400 William Cheng: You can actually open the desk. So in this case, what you have to do that you actually have to figure out how to communicate the file system. Okay. What if you know you know 33 00:04:35.880 --> 00:04:46.050 William Cheng: These are the set of API's. We just talked about this them. What are these API's are not supported by all the file systems, okay, these user space program over here. They have all kinds of different way to interact with the user. 34 00:04:47.310 --> 00:04:59.370 William Cheng: Interact with the user program. So in that case, you don't you you even need to find out to say the word in my, in my program only knows how to, you know, talk to this kind of houses. Now, what are the other houses and other that can actually talk to 35 00:05:00.420 --> 00:05:06.630 William Cheng: Okay, so basically, the idea here is that, you know, the file system over here is user space where a person is your spirit and your application over here is also a user space. 36 00:05:06.900 --> 00:05:10.710 William Cheng: In order for that to talk to each other, they basically have to send messages to each other. 37 00:05:11.700 --> 00:05:13.680 William Cheng: Okay, so using the Michael current architecture. 38 00:05:14.010 --> 00:05:23.010 William Cheng: It's almost like client server computing. Right. It's as if you're sitting on a different machine. So in that case, if you want to talk to a server on a different machine all your same machine. What do you have to do. 39 00:05:23.400 --> 00:05:28.410 William Cheng: Get you have to use communication protocol if you use communication protocol which can be occasion protocol you use 40 00:05:29.970 --> 00:05:40.260 William Cheng: Well, so in that case, you know, you actually need to be able to sort of figure out, you know, what are the functions that are there. What kind of communication protocol, do they support and then your application. What kind of communication protocol to use support. 41 00:05:40.500 --> 00:05:43.740 William Cheng: And you can't find a match what they can use a particular file system. 42 00:05:44.760 --> 00:05:51.060 William Cheng: Okay, I didn't know just that. Will you try to use the, the, the web server. If you don't talk http protocol. There's no way for you to talk to those are whatsoever. 43 00:05:51.240 --> 00:05:58.140 William Cheng: And now the future of the file system is going to be like that. Right. If you want to talk to the assistant. First, you need to find out what kind of protocol that will support. 44 00:05:58.710 --> 00:06:05.010 William Cheng: So I guess on the internet. You guys have taken an elect the class, you know, there's some terminology is to say, you can actually negotiate. 45 00:06:05.400 --> 00:06:09.570 William Cheng: With a server. You know how you want to communicate with them. Now you have to do the same thing with the file system. 46 00:06:09.870 --> 00:06:18.030 William Cheng: Yeah, the operating system. You do support you know functionality to say that while you know if these are the protocol that I support, you know, find me, you know, 47 00:06:18.630 --> 00:06:24.390 William Cheng: Tell me which file system actually support these protocol. Right. So this way to find the operating system can help you to find the 48 00:06:24.990 --> 00:06:31.380 William Cheng: Find the right match. Okay, so, so, so the so the way they use the facility is going to be very, very different under, under 49 00:06:31.740 --> 00:06:39.360 William Cheng: Under Michael carnal. Yeah. So, so that that's one of the issues over here, you need to solve this problem, because you are using inter process communication. Yeah. 50 00:06:40.050 --> 00:06:47.640 William Cheng: Right, and also the second part of the problem is that when I mentioned before, how do you make things efficient. Okay. So as it turns out that that's much more difficult than 51 00:06:50.280 --> 00:07:01.290 William Cheng: A little bit history or Mark. Mark was first invented by CMU and get CMU, they don't you know they don't work on Mark anymore. The holidays. I think they they they 52 00:07:01.770 --> 00:07:08.820 William Cheng: Over the years, they, they really try to get it to work. And in the end, you know, nobody tried to pick up Mark copy this is too slow. Yeah. 53 00:07:09.330 --> 00:07:15.450 William Cheng: Now it's maintained by University of Utah. So University. I don't know if you heard of university you that if you 54 00:07:16.320 --> 00:07:26.250 William Cheng: know a little bit about the history of the internet. I went in and it got started the first the first internet that was Bill. We are four nodes on the Internet by one is a UCLA. 55 00:07:26.550 --> 00:07:30.480 William Cheng: Because there's no number one. And then there's one in Stanford writing their number two. 56 00:07:30.720 --> 00:07:39.900 William Cheng: And then there's one at UC Santa Barbara. And the last one is the University of Utah. Okay so University, Utah. They are very well known for, you know, two units and also doing the internet. Yeah. 57 00:07:40.320 --> 00:07:43.890 William Cheng: So, so now they are picking up the maintenance of the operating system. Yeah. 58 00:07:44.280 --> 00:07:51.180 William Cheng: The early version shared the same kernel with Unix. So again, they, you know, they use the sort of the, the UNIX system call interface. 59 00:07:51.480 --> 00:07:56.460 William Cheng: And this is the basis for the next operating system. Right. I don't know if you remember the next opening system. 60 00:07:56.940 --> 00:08:02.910 William Cheng: When Steve Jobs. You know, when company hopping eventually right before he come back to to Apple, the second time. 61 00:08:03.480 --> 00:08:10.800 William Cheng: You know, the last company work was called next computing when he, when he came back from and then at that time. So basically next was going out of business. 62 00:08:11.340 --> 00:08:24.330 William Cheng: So he brought you know some of the stuff from the next computing COMPANY BROUGHT SOME PEOPLE. And he also brought some software up on next computing. One is the operating system. Later on, become you know a Darwin and Mac OS X iOS. 63 00:08:24.810 --> 00:08:30.000 William Cheng: So, so, you know, so that that's why the Quran, you know, Mac OS X, the database on Unix 64 00:08:30.450 --> 00:08:37.410 William Cheng: And the other thing that he brought by was the graphical user interface because at the time the next operating system via the one with the best graphical 65 00:08:37.830 --> 00:08:45.720 William Cheng: The best book and graphical user interface. Yeah. So anyways, the do the organism, there is based on that based on Mark 66 00:08:46.290 --> 00:08:53.010 William Cheng: You know, I don't want because that's one of the reason the option. The other company went out of business because they often the system is kind of slow that 67 00:08:53.880 --> 00:09:02.550 William Cheng: The linear version. I still share the same kernel with unit one unit. The basis of OSF one so always have one is this sort of a consortium. 68 00:09:03.300 --> 00:09:12.240 William Cheng: You know of Unix vendors because around the 90s the UNIX you know system has really bad reputation that they all. They all claim that they're all units, but they're totally incompatible. 69 00:09:12.480 --> 00:09:18.480 William Cheng: So there's an effort to try to unite all the units operating system to at least make that they've made made the system call interface. 70 00:09:18.960 --> 00:09:29.550 William Cheng: Sort of compatible. So that's called OSF one. Yeah. So I said, What is also the basis of Mac OS X, Y, so by taking the next computing or SF one. So when or Mac OSS got started. 71 00:09:30.060 --> 00:09:40.050 William Cheng: They will actually doing something very similar to mark. Yeah. But in the end, you know, Apple has to compete with, you know, compete with Microsoft has to compete with Linux idea, everything goes back into the kernel. 72 00:09:40.770 --> 00:09:50.370 William Cheng: Okay. So at the beginning when when Steve Jobs went back to Apple, they really tried to get mock working at Apple, again, but the dn. You know that they they still have to put everything back and said, 73 00:09:51.450 --> 00:10:00.090 William Cheng: Alright so today i'll pretty much the only people who are still working on Mark are the two new people, the new are the Free Software Foundation people, they have a project called her project. 74 00:10:00.660 --> 00:10:10.080 William Cheng: So again, they continue to try to get mark to work guys so, so again I i'm not i don't think any you know any product they're actually using the sort of 75 00:10:10.590 --> 00:10:19.020 William Cheng: The new heard operating system or using the Mac operating system because they are just, you know, they, they really cannot compete with the other kind of operating system. 76 00:10:20.520 --> 00:10:30.330 William Cheng: All right, here's an example of how message passing work, you know, inside the inside the monsters them. So the idea here is that you have an application that need to talk to the file system. 77 00:10:30.690 --> 00:10:38.040 William Cheng: How do you talk to the file system or the way you do it is by sending messages in order for you to send message don't need to be a mailbox right before he died. You send messages. 78 00:10:38.340 --> 00:10:42.300 William Cheng: So idea is, is that inside the Colonel. There's something called the message port. 79 00:10:43.140 --> 00:10:49.680 William Cheng: Okay so message passing including these message for message for our Colonel object and they are uni directional just like a Unix pipe. 80 00:10:50.160 --> 00:10:56.910 William Cheng: Because, in a way, they're like Unix pie for my application over here to talk to the file system. What I would do is that, you know, I need to find the port. 81 00:10:57.120 --> 00:11:02.430 William Cheng: inside the kernel for talking to the spouses them. So I need to make the operating system. Hard to say, hey, you know, give me the 82 00:11:03.000 --> 00:11:09.900 William Cheng: Give me the message for that I can actually send message to I can talk to this House. Is that right, once the system return to you the port and 83 00:11:10.470 --> 00:11:15.120 William Cheng: Everything you this message for what you can do is you can write to the message port and then you talk to the file system. 84 00:11:15.690 --> 00:11:23.340 William Cheng: OK. So again, just you know so. So again, what is the message for look like a looks like a producer consumer problem. It looks like a unit type. So why don't we use the UNIX five 85 00:11:24.030 --> 00:11:31.980 William Cheng: Okay, because the UNIX pipe is typical to use between the parent and the child process. Okay, so, so, so what happened is that you create them in memory. And then you share them. 86 00:11:32.640 --> 00:11:39.480 William Cheng: So in this case, you know, if these processes. They are not parent, a child. Well, in that case, how do you find, you know, so 87 00:11:41.040 --> 00:11:42.210 William Cheng: How do you find a pipe to talk 88 00:11:43.860 --> 00:11:52.170 William Cheng: To 2000s application well as this guy we need additional stuff inside the operating system for you to help to help you so they can actually communicate using that pipe get 89 00:11:52.560 --> 00:12:01.470 William Cheng: Today I guess if you are using a Unix operating system. A typical or Linux operating system. There's something called a name pipe and A and D named pipe. 90 00:12:02.340 --> 00:12:11.820 William Cheng: Now so name pipe is a pipe that you can actually create inside the operating system. And now this pipe has a name. So later on when you should have talked when you try to use that pipe to communicate with another process. 91 00:12:12.090 --> 00:12:16.080 William Cheng: All you have to do is to name the pipe and then the opposite system will return it back to you. And now you can use 92 00:12:16.950 --> 00:12:24.630 William Cheng: That. So again, you know, so, so, so, so again, that the other. The name pipe will be here basically come from a message passing come from the mock carnal. Yeah. 93 00:12:25.140 --> 00:12:31.860 William Cheng: Alright, so, so, and also we sort of try to do the same team for the fastest the fastest in the application in order for me to talk to the 94 00:12:32.070 --> 00:12:37.470 William Cheng: Driver. Okay. It doesn't make a system called Iraqis this driver. So what do we do city will also use the same architecture. 95 00:12:37.710 --> 00:12:47.430 William Cheng: There to talk to the bus driver. There's also a request for. So for the file system to talk to the desk. It'll also asked operating system for the request portal, we here. And then what you can do. You can send a message over here. 96 00:12:47.760 --> 00:12:51.690 William Cheng: To the driver. Okay, so why did they do it this way. Well, because they wanted 97 00:12:52.380 --> 00:12:59.970 William Cheng: Because the goal here is to eventually move this driver over here into the application space. Well, in that case. Well, you find the request for you to send it to request, boy. 98 00:13:00.120 --> 00:13:08.550 William Cheng: And it doesn't really matter whether it's a user process or Colonel component that pick up the message, right. So we want them to work exactly the same way. 99 00:13:09.750 --> 00:13:20.430 William Cheng: Okay. So, therefore, you know, you know, so, so in Mark over here where you try to communicate with other words without the optimism component you will end up you're using, you know, you're 100 00:13:21.630 --> 00:13:23.400 William Cheng: Using a message board. Okay. 101 00:13:23.910 --> 00:13:35.070 William Cheng: All right, what about getting a response back. Okay, so these things are like Unix pipe so they are uni directional, you can only send data while way in order for the data to come value need another pipe, you need another you need another message for 102 00:13:35.430 --> 00:13:40.290 William Cheng: Okay, so therefore, when the file system, talk to this driver over here, what the file system has to do is it 103 00:13:40.500 --> 00:13:47.970 William Cheng: Your first has to create a response poor will create a responsible obedience army colonel there. And then what it will do is that when it talks to the device driver. 104 00:13:48.150 --> 00:13:57.810 William Cheng: It will send the information about the response pour over here to the driver. So this does have this drive to say, hey, when you finish writer to this responsible and and I will pick out the data. 105 00:13:58.350 --> 00:14:01.440 William Cheng: Okay. Similarly, when your application when you try to talk to the post them. 106 00:14:01.890 --> 00:14:12.420 William Cheng: In order for you to get a response back. You also need to create a response points out of kernel and then you pass that information into the process and so that allowed for the PA system is done, you will send that data into responsible and then you can pick up the data. 107 00:14:13.080 --> 00:14:18.840 William Cheng: There. So, therefore, you know, sending data will be looking like this. Right. And also if you include the response board over here look like this. 108 00:14:19.590 --> 00:14:28.110 William Cheng: That. So you can see right away. Why this is so slow. Okay. Because in order for this to work. You know, you know what it used to be in a, you know, 109 00:14:28.560 --> 00:14:35.280 William Cheng: You know, without using medical Colonel, you make a system called you come into the kernel you fall asleep inside the cardinal, and then when you're done you returned to the user space program. 110 00:14:35.490 --> 00:14:39.210 William Cheng: So in that case, you're going to come into the kernel once and you return on the corner was 111 00:14:39.660 --> 00:14:46.260 William Cheng: OK, so now with this architecture, how many times you have to come inside of Colonel right if you follow the arrow here. There's one arrow that points down 112 00:14:46.470 --> 00:14:55.950 William Cheng: Or up and down three arrows that points down, so therefore it's going to be three times as slow and also when you return back you also going to return back three times right here's one time to time and three times. 113 00:14:57.510 --> 00:15:00.930 William Cheng: Okay, so every time we need to make a system called now it's going to take three times as long. 114 00:15:01.290 --> 00:15:08.220 William Cheng: Guy so so again I mean we hear their stuff that happens out of Colonel here, but eventually the other component was also need to move into the user space. 115 00:15:08.490 --> 00:15:13.920 William Cheng: So in that case, it's going to get worse and worse and worse, right, the more things you put into user space, the slower, I guess. 116 00:15:14.670 --> 00:15:18.600 William Cheng: That's what this is one of the main problem with Mark is that, you know, it's too slow. 117 00:15:19.050 --> 00:15:25.530 William Cheng: And also, if you look at this particular architecture is so the looks like sort of a the client server architecture. 118 00:15:25.830 --> 00:15:29.670 William Cheng: Right over here, our application they talked through something the application space. 119 00:15:29.820 --> 00:15:39.930 William Cheng: So we're sending messages to it. So it's almost like a client server architecture right, except that what we talked about a client server architecture we can draw a line over here, this is one machine on the level. Here's another machine on the right. 120 00:15:40.560 --> 00:15:52.170 William Cheng: Okay, so in that case we talked to a server on a different machine but you know in the market situation over here, you're communicating, you know, with other user processes, you know, he inside your own chain. 121 00:15:53.190 --> 00:16:03.930 William Cheng: So in this case, you know, we sort of need to also worried about what about security. Right. Well, you go across machines. Over here we have to worry about security as over here. You know when you try to, you know, you know, 122 00:16:04.950 --> 00:16:14.370 William Cheng: When you send a message to the server, and then you send them the information about the response before and now the server will send that data back to you to the response for 123 00:16:15.030 --> 00:16:19.650 William Cheng: Okay, but remember that these response port over here. Everybody can actually request the operating system. 124 00:16:19.860 --> 00:16:29.070 William Cheng: To, to find out about response for. So if you have malicious application over here, the city and the user space. They can ask the information about this responsible. And what of this one I should send data to you. 125 00:16:29.340 --> 00:16:34.410 William Cheng: And now you're going to end up here. So basically, basically, somebody can pretend that they're actually the server and it was centered around data. 126 00:16:35.160 --> 00:16:39.150 William Cheng: Okay, so therefore the security on these kind of system. They're typically very, very different. 127 00:16:40.020 --> 00:16:47.100 William Cheng: Okay, so for the system the way that they do this is that some people refer to the Monica, you know, system has the capability basis, then 128 00:16:47.820 --> 00:16:54.330 William Cheng: So capability over here is that, you know, whenever you create a response for inside the kernel or whenever you create any kind of points out the Colonel. 129 00:16:54.960 --> 00:17:05.610 William Cheng: You know, along with the poor. It also create something called a capability, where the capability can be passed around, whoever whichever user process has the capability will be able to use this port. 130 00:17:06.060 --> 00:17:13.110 William Cheng: Okay, so this is this is using security mechanism. So when we create a response for the application over here is going to be able to receive the capability. 131 00:17:13.320 --> 00:17:20.400 William Cheng: So in order for it to make sure that only the server can can write down into the response. What it needs to pass this capability to the server. 132 00:17:21.090 --> 00:17:28.050 William Cheng: Okay, so what do we do, is that when you send the request message you're going to append your capability over here to the server. So when you reach the server will be here, the server. 133 00:17:28.950 --> 00:17:41.730 William Cheng: Eventually when the server is done. Whenever I the response back over here, what it has to do is that it will send the capability plus and respond message. This one you know the for the server to present the credential to say that I have the right to write into this report. 134 00:17:42.870 --> 00:17:53.670 William Cheng: Okay, so therefore, when you get into the, you know what, when we get into the server when you get into the operating system over here, the operating system will verify that you are the one that has writing ability. So therefore you have permission to write to the sport. 135 00:17:54.690 --> 00:18:00.360 William Cheng: Okay, are the application over here, since they don't have the capability when they try to write this for the permission will be denied. 136 00:18:00.990 --> 00:18:07.080 William Cheng: Okay, so you can see that this is a very, very different kind of permission mechanism. I'll compare to the way Unix does a user group ID. 137 00:18:07.800 --> 00:18:14.430 William Cheng: Now, he also has a problem with a permission system. So, any kind of the other offerings is also use capability. 138 00:18:14.820 --> 00:18:21.390 William Cheng: Okay. The problem with capability over here is that even though it's very convenient to specify who has access to this particular poor 139 00:18:22.020 --> 00:18:25.200 William Cheng: But he just like you know the case that where you have, you know, 140 00:18:25.710 --> 00:18:32.010 William Cheng: So you have a plumbing problem at home and then you call a plumber and then the plumbers, I can come at this time. And then you're not home right 141 00:18:32.310 --> 00:18:39.210 William Cheng: Okay, so. So having said that the comic cons and then has come back at a later time. So what you would do is that you can actually hear the plumber your key. 142 00:18:39.570 --> 00:18:42.690 William Cheng: Good probably giving the keys like capability over here. 143 00:18:43.320 --> 00:18:54.450 William Cheng: Okay, so why don't you give the key to the plumber plumber can actually make copies of the keys. Okay, so what are the server over here will actually take the capability and make a copy and send it to another server. Why would it do something like that. 144 00:18:55.020 --> 00:19:01.530 William Cheng: Okay, maybe for scalability, because this is over, over here, it's pretty busy. What it will do is that it needs to ask another server to perform work for you for 145 00:19:01.830 --> 00:19:07.770 William Cheng: What is done. They want the other server over here to be able to send you a message. So in that case, you will make a copy of the capability. 146 00:19:08.430 --> 00:19:13.080 William Cheng: Okay. So clearly, if the club plumber, you know, make a copy of your keys. Pretty soon. A lot of people are going to have keys to your house. 147 00:19:13.470 --> 00:19:21.570 William Cheng: In the. Yeah, you have to India. India, what can you do right, the only thing that you can do is to revoke the capability or rebuilt the key over here. 148 00:19:22.530 --> 00:19:31.650 William Cheng: Then, so that's going to be one of the problem with accountability system, they have a different kinds of security problem. They didn't really solve all the security problem, they just change the security problem from one time to a different time. 149 00:19:32.460 --> 00:19:41.100 William Cheng: Okay. So, therefore, you know, if you want to build a system like this inside your system. You also need a sort of a capability doesn't have a capability or capability we vocation list. 150 00:19:41.520 --> 00:19:49.980 William Cheng: So this way. Once you see that one of the capability over here has been compromised or has been illegally copied in that case you need to sort of reject it, this one out. 151 00:19:50.610 --> 00:19:54.330 William Cheng: There's a while. We'd also implement the capability is basically using AES encryption key. 152 00:19:54.780 --> 00:19:59.400 William Cheng: Right. So what you would do is that whenever you create a response for you're going to generate a bunch of encryption key. 153 00:19:59.580 --> 00:20:04.500 William Cheng: And then only the current over here has the corresponding decryption key. You can pass encryption key around 154 00:20:04.650 --> 00:20:13.350 William Cheng: When the server needs to send data into the responsible for what he would do it, it will encrypt the key and encrypted data using that key and it wouldn't get into the Colonel. The Colonel will have the 155 00:20:13.680 --> 00:20:20.970 William Cheng: Corresponding decryption key to what the crypto the message and we'll be able to sort of, you know, verify that that the server is the one actually have the access 156 00:20:21.660 --> 00:20:30.120 William Cheng: Well guys, I don't really want to get too much into this, but they are they are young, because they just want to sort of bring up the fact that they are system out there that use a different security model. Yeah. 157 00:20:32.220 --> 00:20:39.660 William Cheng: All right, so I guess that's pretty much all I want to save on Michael, Colonel. Oh, here's a successful Michael Colonel system and there are none. 158 00:20:40.650 --> 00:20:47.550 William Cheng: None of them are very successful, but people have tried guys. So for example in Windows. Windows actually tried to do I'm Michel Colonel 159 00:20:48.120 --> 00:20:55.260 William Cheng: You know, I mean, this will do a version of the colonel in Windows MP3 point why they move the entire graphic subsystem into user space. 160 00:20:55.650 --> 00:21:00.630 William Cheng: Okay, is that a good idea, you can move the graphics and saying, either as it turns out that you realize that really, really bad idea. 161 00:21:01.110 --> 00:21:16.260 William Cheng: So, so in Windows NT 4.0 they move everything back inside, Colonel. Okay, so if you're using Windows NT don't use window and teeth before 4.0 is it performances. That'd be terrible. Yeah, my macro access initially they really want to have everything based on mark right because it's cool. 162 00:21:18.000 --> 00:21:25.110 William Cheng: And then because it makes the RPM system really really extensible. Yeah. But eventually, because of performance problems and move everything back into the kernel. Yeah. 163 00:21:25.800 --> 00:21:33.750 William Cheng: The only thing left is going to hurt, but again, nobody's really using it. So I guess one of the reasons. One of the reasons they're still alive because, you know, we're hoping that the one day. 164 00:21:34.350 --> 00:21:39.990 William Cheng: Harlow will be so fast. Maybe the speed is longer issue. So maybe one day that would come we don't know yet. Okay. 165 00:21:41.490 --> 00:21:50.340 William Cheng: All right, so we're done with Michael, Colonel. The next thing we're going to move to is that so so we're done with chapter four, we, we talk about 166 00:21:50.760 --> 00:21:57.690 William Cheng: You know, virtual machine and Michael, Colonel. The next thing we're gonna do is, I'm going to do all boon to all the way to the end of chapter five and talk about scheduling. 167 00:21:58.470 --> 00:22:05.370 William Cheng: Scheduling is a very important topic because when you go on interview and your interviewer says, Oh, you're taking off. But you have taken obligations in class. 168 00:22:05.640 --> 00:22:11.700 William Cheng: Let me ask you a question about scheduling because scheduling is a very important topic. Yeah. Alright, so, so let's 169 00:22:12.540 --> 00:22:18.510 William Cheng: So I guess our weenies kernel has a really simple scheduler first first come first serve up first in first out 170 00:22:19.320 --> 00:22:24.090 William Cheng: So now we're going to take a look at some other kind of scheduling. Alright. So as it turns out. 171 00:22:24.600 --> 00:22:35.700 William Cheng: You know, for scheduler. There's really no one size fit all. So, but, by the way, for, for the colonel assignment in Kona one you you're implementing the scheduler right there's a bunch of course scheduler see well as CH e de de see 172 00:22:36.060 --> 00:22:39.180 William Cheng: That your scheduler scheduler. It's simply a collection of functions. 173 00:22:40.440 --> 00:22:49.770 William Cheng: So unfortunately, the schedule is not one size fits one size fit all. Some of the system. You know, they, they either the summer system will perform better using a different kind of schedule. 174 00:22:50.130 --> 00:22:58.170 William Cheng: Right. Alright, so the first thing I'm going to sort of take a look at is what kind of different systems are out there, and they'll can sort of talk about, you know, under on you know for for these kind of system. 175 00:22:58.380 --> 00:23:03.420 William Cheng: What kind of schedulers good and if you use another kind of scheduler. What's going to be the trade off you know cetera, okay. 176 00:23:04.200 --> 00:23:16.410 William Cheng: Yeah, here's a sample of sort of system over here. The first one over here is the IBM mainframe IBM mainframe. They are a simple batch system. So what you do is that you submit jobs into the into the operating system and the 177 00:23:16.650 --> 00:23:26.040 William Cheng: System is going to work on the job one at a time. Okay. When I finished doing that. So I guess at that time, they don't call it processes which i'm glad they call the jobs. So you submit a job and they will run a 178 00:23:26.430 --> 00:23:33.660 William Cheng: Run your program your program is done, they will print they'll actually print the result on to the printer. So, therefore, you go to the printer and then you pick up your print out 179 00:23:34.080 --> 00:23:42.960 William Cheng: Okay, so that's called a simple batch system. There's no interactive user and and then what they decided what a few hours that you know that's really kind of a, you know, 180 00:23:44.010 --> 00:23:52.800 William Cheng: It's kind of a waste of resources because, for example, if you are talking to the disk disk and the CPU their separate hardware. So you can actually give the CPU to somebody else. 181 00:23:53.190 --> 00:24:01.980 William Cheng: Okay, so therefore they come up with a multi program batches them. So in this case, again you submit jobs and know the offices of a juggle all these job to that, so they can share the CPU. 182 00:24:02.580 --> 00:24:07.830 William Cheng: Okay, so they come up with a term both had pro by me to means that you know you're sharing the CPU now. 183 00:24:08.250 --> 00:24:15.720 William Cheng: And then they come up with the time chases them to remember, you know, the term time sharing is the mean that you have interactive users. Okay, so they started 184 00:24:16.200 --> 00:24:26.400 William Cheng: Out with a single user time sharing system and then it came to him will tell us about the time sharing system. So what is the main difference between the time sharing system and a multi program batch. 185 00:24:26.880 --> 00:24:39.570 William Cheng: OK, so now you have interactive users sitting from the machine. So now you have two kinds of jobs. One is the one that people submit it. You know, sometimes a job. So a job to you and the other one is the interactive user, which you know whose job is more important. 186 00:24:40.620 --> 00:24:49.680 William Cheng: Okay, so since you have interactive user, you should make the interactive users job more important, right, because the interactive user user. They need to feel that the system is more responsive. 187 00:24:50.460 --> 00:25:00.120 William Cheng: Okay, so you can go there as well, you have, you know what, we have a simple job simple batches, that when you submit a job, you can go have a cup of coffee 15 minutes later, you go to the printer and you pick up your you pick up your work. 188 00:25:00.660 --> 00:25:10.020 William Cheng: OK. Now, when you have an interactive user to interactive user need to feel feel that it has a good response time coming from the system. So in our case, we start using party scheduling. 189 00:25:10.500 --> 00:25:19.260 William Cheng: Okay, we're going to start prioritizing our tasks. Anything that belong to the inactive user. We want to make sure that they're done first, anything that's running in the background while they can actually 190 00:25:19.740 --> 00:25:29.310 William Cheng: Run at a later time. Okay. So, therefore, at this point, the scheduler needs to be very, very different. Okay. And even with the multiple I mean badge, or can also see that there are different kinds of your schedule that we should use 191 00:25:30.180 --> 00:25:40.380 William Cheng: And and then there are other kind of, you know, system. Other like the partition server, as I mentioned, you know, just with virtual machine right if you find one part of a while and what part 192 00:25:40.830 --> 00:25:43.020 William Cheng: One part of the machine inside the cloud. 193 00:25:43.410 --> 00:25:53.010 William Cheng: Because you're doing call computing. Let's say that you have a powerful machines that have cloud you're buying one 10th of that that particular machine, you want to get one 10th of the CPU. You want to get one 10th of the memory. You want to 194 00:25:53.250 --> 00:25:58.440 William Cheng: You know, you'll get one 10th of everything. Okay, how do you make sure that you're guaranteed to get one 10th of the CPU. 195 00:25:58.740 --> 00:26:02.850 William Cheng: Okay, so in that case you need a scheduler. I can guarantee that you get what you pay for. 196 00:26:03.240 --> 00:26:13.230 William Cheng: Okay, so, so, so that those things are called partitioning server. We want to make sure that other things that are running inside the cloud don't interfere with, you know, with the operation inside car. 197 00:26:13.740 --> 00:26:21.300 William Cheng: Okay, so therefore this is as if all the server that you're running out of car, even though they use the same machine as if they are partition right they're not participating in 198 00:26:21.720 --> 00:26:28.650 William Cheng: That partnership in terms of security that one machine can access the other the other machine. They also need to be partition in the sense of performance. 199 00:26:29.070 --> 00:26:38.520 William Cheng: Okay, so that every, you know, so every virtual machine, get the same fraction of the CPU. OK. So again, in this case, when you a different kind of scheduler, to be able to make that kind of guaranteed. 200 00:26:39.270 --> 00:26:46.230 William Cheng: Yeah. We also have the general purpose operating system right like your desk, the operating system. So in that case, how do you actually characterize the general purpose albinism. 201 00:26:46.470 --> 00:26:55.350 William Cheng: What is the best scheduler for the general purpose operating system. So in that case, again, there's really no, you know, good answer. What is the best for general purpose offices and because everybody going to use their system and a little 202 00:26:55.740 --> 00:27:02.130 William Cheng: A little differently. Right. Some people, you know, you use your laptop, you know, to listen to music and watch you know video all the time. 203 00:27:02.580 --> 00:27:07.560 William Cheng: Some people you know do online gaming all the time. And some people wants to, you know, work on Colonel Simon all the time. 204 00:27:08.130 --> 00:27:14.220 William Cheng: So in that case, again, you know, how do you have a scheduler that can actually do everything there. So, so we're also going to take a look at that. 205 00:27:14.970 --> 00:27:22.470 William Cheng: The last one over here is guys and sort of more more specialized operating system is no as a real time operating system. So far, we haven't really talked about system like that. 206 00:27:22.890 --> 00:27:33.300 William Cheng: The difference between a general purpose, obviously, in a real time operating system is that the threat you know that are being scheduled in a real time, you know the real time real time operating system. 207 00:27:33.780 --> 00:27:40.260 William Cheng: They must be dealt with a deadline. Okay, so you can see that instead of throw control blog every source control blog has, you know, 208 00:27:40.710 --> 00:27:49.320 William Cheng: Has a deadline to say that you know what you know when this thread get schedule, you know, get get a schedule into the wrong Q, it must finish running before Adela 209 00:27:50.160 --> 00:27:52.740 William Cheng: Okay, if you miss a deadline, bad things going to happen. 210 00:27:53.460 --> 00:28:02.070 William Cheng: Okay, so what kind of bad things. So as it turns out, depends on how bad things are there are two kinds of real time system, what is called a heart real time since then. And the other one is called a software system. 211 00:28:02.550 --> 00:28:05.220 William Cheng: Okay, in a heart real time system. If you missed the deadline. 212 00:28:06.150 --> 00:28:11.940 William Cheng: Okay, if you missed the deadline is going to cost disaster that people is going to die. You know, you're, you're going to waste, you know, the zillion dollars. 213 00:28:12.510 --> 00:28:18.300 William Cheng: The example that are given over here in this is a textbook. So, for example, you're trying to controlling a nuclear power plant. 214 00:28:19.140 --> 00:28:23.520 William Cheng: Okay, if you are have a controller, the controller nuclear power plant, you have a harder time system and 215 00:28:23.910 --> 00:28:28.110 William Cheng: So in this case, what would your organism do right so maybe what you would do is that you actually do a bunch of readings. 216 00:28:28.260 --> 00:28:34.560 William Cheng: You're going to take temperature reading you know periodically, you're going to do moisture reading or depression reading going to do a bunch of reading over here. 217 00:28:34.950 --> 00:28:39.000 William Cheng: Every job is going to have a deadline. If you miss a deadline going to end up with a nuclear meltdown. 218 00:28:39.840 --> 00:28:51.210 William Cheng: Okay, so this case disaster is going to happen if you miss a deadline that another example over here that I've given in the textbook is lending and then also emphasize the worst softly Omar's 219 00:28:51.780 --> 00:29:01.470 William Cheng: If you have a spacecraft, you're going to land on Mars. Right. So, you know, the bars terrain is very ugly over here you have space coming down over here and you try to land softly, you know, on the surface over here. 220 00:29:01.770 --> 00:29:08.070 William Cheng: I mean, you know, you need a real time system, right, because you know what you do that again you are you're doing sensing you're trying to sort of figure out what the terrain look like 221 00:29:08.220 --> 00:29:13.050 William Cheng: And then you going to find the rockets and things like just at the right time, you know, for the right duration. 222 00:29:13.530 --> 00:29:19.260 William Cheng: Everything to be perfect because if you end up a you miss a deadline, what's gonna happen right this empire spacecraft will crash. 223 00:29:19.680 --> 00:29:24.300 William Cheng: So in this case, you know, if the spacecraft. There's nobody, you know, there's nobody on the spacecraft 224 00:29:24.570 --> 00:29:32.280 William Cheng: And nobody's going to die. But in the end, you know, if you want to send another spacecraft to to Mars, you can take years for now you can lose a lot of money your company's the golf business. 225 00:29:32.610 --> 00:29:37.800 William Cheng: So in that case it might be disastrous to your business. Okay. So, therefore, in this case, you know, the kind of 226 00:29:38.220 --> 00:29:43.560 William Cheng: The, the other the, kind of, you know, the kind of real time system that you have is a heart real time system now. 227 00:29:44.430 --> 00:29:51.840 William Cheng: So, so typically, this one will require specialized operating system with a specialized scheduler. Okay, so, so, towards the end of 228 00:29:52.710 --> 00:29:58.980 William Cheng: I guess the next lecture, we're going to sort of talk about what kind of a scheduler that they that you need for operating system like that now. 229 00:29:59.580 --> 00:30:12.930 William Cheng: The South real time system. They also, you know, every job when it comes to the rescue. They can come to the deadline. But in this case, if you miss the deadline, it's not a big deal. Okay, so, so, so, so, then why, why bother to have a deadline, because it will be nice if you miss a deadline. 230 00:30:14.520 --> 00:30:20.130 William Cheng: Sorry, it will be nice if you make the deadline. If you miss the deadline, the user experience is not gonna be very, very good. 231 00:30:20.490 --> 00:30:27.150 William Cheng: Okay, so one thing that sort of come to mind. Is that what you're playing video okay you're using YouTube and YouTube is actually playing videos. 232 00:30:27.900 --> 00:30:37.950 William Cheng: I think it's 3030 frames per second. Okay, so everyone 30s and the second there's a deadline for you to play it, play, play one frame. If you miss a deadline. So in that case. Well, however. 233 00:30:38.640 --> 00:30:44.190 William Cheng: Okay, well, we see that, you know, I guess we're all trained by, you know, YouTube video. 234 00:30:44.610 --> 00:30:55.260 William Cheng: When they cannot keep up the frame rate what he would do is you start seeing this things are spinning on the screen and you know that, oh, you know, I have to wait. Again, and eventually is going to catch up and everything's going. Go, go, go, go, go, go. Good again. 235 00:30:55.740 --> 00:31:03.720 William Cheng: Okay. So, so what you miss a deadline on a software system, you know, the quality of the user experience is going to be degraded. 236 00:31:04.200 --> 00:31:09.780 William Cheng: Okay. But again, we sort of over the, over time, we, we learn how to deal with that. So in this case, it's really not a big deal. 237 00:31:10.620 --> 00:31:16.560 William Cheng: Yeah, I mean, it was still don't like it, it will be nice, you know, if you kind of software with our system can be treated as a heart real time system. In that case, 238 00:31:16.800 --> 00:31:23.970 William Cheng: I will never miss a deadline, they'll be great. Right. But again, building a harder time system is much more expensive because you want to make sure that you'd never missed a deadline. Yeah. 239 00:31:25.050 --> 00:31:36.030 William Cheng: So for the cell phones is that even today, we can see that, you know, when you are using your laptop, you can actually watch a video. You can also use internet audio right when you make a phone call, you know, if you started you know 240 00:31:37.350 --> 00:31:47.700 William Cheng: Person on the other on the other end say something and somehow the playback was slow, you know, it didn't really meet the deadline. All you have to do is there. What did you say can you say that again. And then, then in this case will recover from there. 241 00:31:48.390 --> 00:31:57.090 William Cheng: Okay. So over time, we sort of learned to deal with us, you know, areas, instead of software time since then. And today, we can actually use a general purpose system to implement a soft real time system. 242 00:31:57.870 --> 00:32:03.210 William Cheng: Okay. So, therefore, you know, later on when we tried to talk about the schedule, we're only going to talk about the scheduler for the heart real time system. 243 00:32:03.570 --> 00:32:10.410 William Cheng: For the software does is that when we're going to use the general purpose you know scheduler, you know, for for for general purpose operating system. Okay. 244 00:32:13.020 --> 00:32:20.730 William Cheng: Okay, so you know when you have, you know, you know, we'll soon. So we're going to end up with talking about a bunch of different kind of scheduler. 245 00:32:21.300 --> 00:32:24.360 William Cheng: When you try to pick a pika scheduler. How do you actually pick a scheduler. 246 00:32:24.930 --> 00:32:31.350 William Cheng: Ok so so again we're going to answer a question with a question to say I went out to pick the scheduler. What are you trying to optimize 247 00:32:31.950 --> 00:32:36.690 William Cheng: Okay, because there's no one size fit all. There's no one scheduler that can be best under all condition. 248 00:32:37.050 --> 00:32:44.490 William Cheng: So, therefore, you got to eat. So, so each other to pick a scheduler. You gotta tell me what your goal is. Okay, do I want to, you know, minimize something optimize something 249 00:32:44.970 --> 00:32:50.940 William Cheng: So in that case, I might be able to answer your question. Okay. So over here, this sort of a list of some of the common goal. 250 00:32:51.300 --> 00:32:59.490 William Cheng: That you tried to shoot for when you try to pick a pick a scheduler. Unfortunately, some of them are in conflict with one another. 251 00:32:59.910 --> 00:33:09.030 William Cheng: Okay. That's why you don't have a scheduler that's best of all worlds, because when you pick. Yeah. We should optimize one feature. You might have to give up on the other on 252 00:33:10.230 --> 00:33:19.050 William Cheng: The other performance characteristics. Yeah. So here, just a list of some of the things that you typically might want to optimize for example, you want to maximize CPU utilization 253 00:33:19.620 --> 00:33:28.470 William Cheng: Okay, so what does CPU utilization. Right. That's the percentage of time that the CPU is busy. So you want the CPU to be 100% utilized. Why do you want CPU. Hundred percent utilized 254 00:33:28.860 --> 00:33:38.130 William Cheng: Right, because the CPU is a very expensive piece of hardware. Right. So, therefore, you want to keep it as busy as possible. So maybe one of the good metric over here is that you want to maximize the CPU utilization 255 00:33:39.030 --> 00:33:46.350 William Cheng: Okay. But again, you got to worry about Busy waiting. When you when you're doing busy lady, even though CPU really busy. You're not doing any useful work why, in that case, you know, 256 00:33:47.520 --> 00:33:59.970 William Cheng: Might not be good, so. So anyways, and also the CPU ization is just one number right between zero percent of 100%, you know. So just because you are very, very high. It doesn't really mean that. Yo yo yo opposite is performed really well. 257 00:34:00.450 --> 00:34:11.190 William Cheng: Okay, because it's a very, very simple number. And there's another thing that you can optimize for example you can optimize the SU put together to put over here the, you know, we are super 258 00:34:12.210 --> 00:34:19.110 William Cheng: Follow the the textbook. The, you know, super is jobs per second. Right, good job is using the Google IBM days where you submit a job over here. 259 00:34:19.470 --> 00:34:28.770 William Cheng: In modern days. What is the job. OK, so the textbook. Actually, if you find a job in a very specific way. So for the rest of the semester over here, what we talked about the job. We're going to use the textbooks definition. 260 00:34:29.160 --> 00:34:32.790 William Cheng: OK, so the idea over here is that when you get on the wrong. Q You are a new job. 261 00:34:33.390 --> 00:34:41.040 William Cheng: Okay, so, so, so, you know, so. So let's say you, you have a sweater. We don't want to throw it is we know what the processes. But exactly what a job. So, you know, you'll see that 262 00:34:41.370 --> 00:34:47.460 William Cheng: You know, can go sleep in IoT, you can go sleep in the enemy attacks you, but eventually when they're ready to run. They get added into a room to 263 00:34:47.790 --> 00:34:53.610 William Cheng: Get when they get into the reviews over here is a picture of the show you at the time you get onto the wrong cute you are a new job. 264 00:34:54.390 --> 00:35:04.140 William Cheng: Okay, and then you get a running out of CPU, but something where you get running out of CPU, you're going to get preempted by interrupt service routine. When you get printed by the new web services. He way you go back into the wrong. Q. 265 00:35:04.710 --> 00:35:08.580 William Cheng: OK, and then later on, you're going to start running again. So in that case, you're still the same job. 266 00:35:09.300 --> 00:35:12.870 William Cheng: Okay. You can also, you know, if you're running some kind of a time slice scheduler. 267 00:35:13.470 --> 00:35:25.740 William Cheng: So, you know, you start running, you start running out of CPU going to wind up o'clock when the timer expire in that case, we're going to get another we're going to run another series data CPU. So in that case, you will get put back on the run, cute, but you're still the same job. 268 00:35:27.120 --> 00:35:32.580 William Cheng: Okay, you're only a different job when you eventually give up the CPU voluntarily. So why would you give out to see if you voluntarily. 269 00:35:33.030 --> 00:35:43.530 William Cheng: While you want to go wait on the I O que when I went on mute. I choose. So in this case over here. So at some point you know you get on the monkey over here you get on the CPU, get on the CPU on and obviously view eventually you're going to go call 270 00:35:43.830 --> 00:35:55.740 William Cheng: You know, you're going to go away for either way for me to ask you give up the CPU voluntarily and now he goes, you go into the waiting state. Okay, you going to sleep in a queue. When you wake up, you're going to get put back into the wrong here. And now you're a different job. 271 00:35:57.660 --> 00:36:07.470 William Cheng: Okay, so that's the definition of a job. Okay, so only when you give up the CPU voluntarily and now you're gonna come back as a different job and then we can actually measure the number of jobs per second that are served 272 00:36:08.250 --> 00:36:17.100 William Cheng: By that by the scheduler. Do we want this number to be big or small, why I mean, clearly, we wanted to hire the number of jobs or second, the better because it looks like we're doing a lot of work. 273 00:36:18.390 --> 00:36:26.250 William Cheng: OK. So again, over here. That's one of the the performance mentioned, we're going to look for is that we want to maximize the number of jobs for second in our schedule. 274 00:36:26.910 --> 00:36:32.100 William Cheng: Okay, so, so the higher the number of jobs are super per second, the better our schedulers doing that. 275 00:36:32.850 --> 00:36:42.660 William Cheng: Now, some people say well you know we're not really sure. So again, this is just a performance metric. Okay, it's not a perfect metric, as we're going to see you later example why this is not a perfect metric. Yeah. 276 00:36:43.800 --> 00:36:50.400 William Cheng: Oh, there's a comment over here. Is that a thriller sometimes can be classified incorrectly as either CPU bound or IO bound 277 00:36:50.760 --> 00:36:59.100 William Cheng: Okay. So, so what is the CPU bound job okay CPU bound job is out when it get on the wrong key. What is are running out of CPU. It wants to run inside the CPU for very, very long time. 278 00:36:59.520 --> 00:37:04.920 William Cheng: Okay, that would be a CPU bound job guys so, so these are the you know the service or I call them. 279 00:37:05.340 --> 00:37:13.710 William Cheng: Basically, like a memory hog, you know, once you're running out of CPU. You don't want to give out the CPU, you want to hold on to the CPU, as long as you want and or this is called CPU hog, not a memory hog. 280 00:37:14.490 --> 00:37:20.970 William Cheng: So, so, so, these, these are the CPU bound. Yeah, right. So what kind of job. What kind of job CPU bound 281 00:37:22.080 --> 00:37:28.500 William Cheng: If you have a simulation right if you're running your simulation and if you don't do any iOS by reading or writing out to the devices or two. 282 00:37:29.010 --> 00:37:35.490 William Cheng: To storage. So in that case, you will be a CPU bound job. Okay. So, for example, some people, you know, some W people they're running the 283 00:37:35.850 --> 00:37:42.510 William Cheng: Simulation or something like that. Well, in that case, you know, you are going to be a CPU bound job. Yeah. The other kind of CPU bound job is that you were doing. 284 00:37:42.960 --> 00:37:53.310 William Cheng: Even if you're doing a crypto crypto you're doing number crunching or in this case, when you're doing number crunching you're doing a lot of number crunching for very long time. In that case, again, you don't want to give up the CPU. Yeah. 285 00:37:54.030 --> 00:38:03.030 William Cheng: Well, they also IO bound job I about job, basically, to say that, you know, whenever you run inside a CPU, you're going to give out the CPU very quickly because you want to do it. Oh. 286 00:38:04.140 --> 00:38:10.050 William Cheng: Okay, so, so, so, so, so if you think about your warm up. Number one, you know, no 111 you know 287 00:38:11.040 --> 00:38:17.730 William Cheng: Online it's single threaded. Right. So let me draw a picture like this one, my mobile number one over here. So horizontal axis over here is time. 288 00:38:18.090 --> 00:38:25.830 William Cheng: The vertical axis is going to be whether your CPU bound job or a job right. So we hear your CPU bound at the top of your, your I O box at the bottom over here. 289 00:38:26.250 --> 00:38:36.450 William Cheng: Okay, at the beginning of your warm up. What do you do that you start reading data from a file, right. So, in that case, you know, you want to go to the fall all the time. Every time you run inside the CPU. What do you do 290 00:38:37.020 --> 00:38:41.520 William Cheng: Well, is that the CPU either a parcel alone you work on the file and then you're going to create a 291 00:38:42.300 --> 00:38:46.110 William Cheng: You're gonna create a transaction out there. Are you going to add it to the list and then you go back to read the next slide. 292 00:38:46.890 --> 00:38:53.910 William Cheng: Okay, so therefore you know what we try to parse ly, even though you write a lot of code India when he started. He started CPU. This can be done very, very quickly. 293 00:38:54.270 --> 00:39:03.060 William Cheng: Okay, so most of the time, will you run inside of CPU you run for a very short period of time and then you've got called we call call get line or whatever function that you call and you go away for a while. 294 00:39:03.660 --> 00:39:09.540 William Cheng: Okay, so therefore, at the beginning, when you try to read. You know, we try to find funding profile you r IO bound job. 295 00:39:10.380 --> 00:39:18.360 William Cheng: Okay. And when you finish you know processing all the input and now the second phase you try to store, you're going to call bubbles or something like that we call bubble sort, do you use IO. 296 00:39:19.140 --> 00:39:23.820 William Cheng: Okay, you don't like to the desk. You don't, you know, talk to the user. So in that case, it become IO bound job over here. 297 00:39:23.970 --> 00:39:32.040 William Cheng: So if you read it 1 million record. Why, in that case, you're going to become a CPU bound job, you need to solve for very long time. Right, especially if you're using bubbles or you will take you a long time. 298 00:39:32.250 --> 00:39:33.810 William Cheng: A dimension and when you're done, what do you do 299 00:39:34.110 --> 00:39:42.840 William Cheng: Right, you, you have a link this whole we hear their sorta and then you go to the limiters over here. You take every object and then you format a printout over here, you're going to run inside of CPU for a brief. 300 00:39:43.080 --> 00:39:47.730 William Cheng: Period of time and then you got to write it to the desk. That's a nut case, you also become over here. 301 00:39:49.230 --> 00:39:52.920 William Cheng: So if we look at a more detailed picture over here where, you know, where are the job boundaries. 302 00:39:53.160 --> 00:40:03.150 William Cheng: Okay, so in the, in the beginning, over here, every time when you get on to the CPU, you're going to give us the CPU right away and you go to try to read it. This. So at the beginning, over here, you're actually are many, many, many, many jobs over here. 303 00:40:04.260 --> 00:40:15.690 William Cheng: Okay. And when you go to the second phase when you try to sort of data over here you are running as one long job because as soon as you get on the wrong key over here. You don't give up the CPU until you're completely finished already before you do another I operation. 304 00:40:16.890 --> 00:40:22.110 William Cheng: Okay, so, so all we hear your time size is going to keep expiring because you want to hold on to the CPU for very long time. 305 00:40:22.230 --> 00:40:29.220 William Cheng: So you're one long job over here. And then when you're done over here, you start writing to the data. So in this case, every time when you get this going to CPU. 306 00:40:29.370 --> 00:40:40.800 William Cheng: You're going to format that that transaction, you're going to print and then again you go to sleep on IQ. So, towards the end over here you also many, many, many, many tiny jobs over here when you try to provide I operation. 307 00:40:42.810 --> 00:40:50.550 William Cheng: OK. So again, you know, over here, said it's incorrect it's incorrect account caused by a thread as a CPU bound or I'll bounce through that. 308 00:40:50.730 --> 00:41:03.690 William Cheng: Because our thread over here right and one moment, you don't have one, so that at the beginning. Over here you are, you know, the your threat because many, many IO bound job and then it become one CPU bound job and towards the Adobe already become many, many albums job. 309 00:41:04.530 --> 00:41:06.060 William Cheng: Okay, so when we try to come, you know, 310 00:41:07.140 --> 00:41:15.690 William Cheng: Jobs per second. Over here, we need to be very careful because these are separate jobs over here and the one in the middle. Over here is one long job and then followed by a bunch of small jobs again. 311 00:41:16.590 --> 00:41:27.930 William Cheng: Alright, so, so, so also this one sort of point out that it's more appropriate to classify jobs as CPU bound IO IO bound. It's really you know incorrect sort of think about whether it's a CPU bound while back. Yeah. 312 00:41:29.520 --> 00:41:38.640 William Cheng: All right, so, so that's one thing that you can do. And I'm going to see this over and over again that we try to maximize the the the super into your schedule. 313 00:41:38.940 --> 00:41:51.510 William Cheng: Yeah, why don't we give me a good because, again, if it has high jobs for a second. The case whenever you know a job. Go away instead of IQ or way instead of meat. I see you. We're going to give the CPU to another. So, so this way it looks. I were doing a lot of work. Okay. 314 00:41:53.100 --> 00:41:59.430 William Cheng: All right. The other thing that you can do is you can actually minimize waiting time. So again, we're gonna go with the definition of waiting time inside the textbook. 315 00:41:59.970 --> 00:42:07.860 William Cheng: Okay, so what is waiting time right according to the textbook over here. When you start running when you start getting yourself into the monkey. We're going to start a clock. 316 00:42:08.160 --> 00:42:14.160 William Cheng: Okay, at some point you're going to give up the CPU voluntarily. We're going to stop the clock, the time interval is called the waiting time 317 00:42:15.390 --> 00:42:22.680 William Cheng: Okay, so that's the amount of time. Once you start getting on a run queue until the time you finish that will be the waiting time. Right. So during this time, you might get preempted. 318 00:42:23.160 --> 00:42:30.360 William Cheng: Okay, you might get plenty. You got to put it back to the run queue. And we're going to run other job but those kind of time is going to be accounted for as part of your waiting time 319 00:42:30.810 --> 00:42:37.950 William Cheng: So guys, while you're waiting for other sweat, as we are waiting for other job to run inside of CPU, that, that, that also count as you're waiting. Hi. 320 00:42:38.820 --> 00:42:48.510 William Cheng: Guys, it's kind of, you know, like when you go to a supermarket checkout the supermarket checkout. What is going to be you're waiting time. Right. It's the time when you get on to the get on to the other two. 321 00:42:49.230 --> 00:42:59.730 William Cheng: To the checkout. Q You have a bunch of people waiting. Waiting in front of you. You still have to wait for all them to finish and eventually when you're done, then, then that will be the end of your waiting on 322 00:43:00.720 --> 00:43:02.190 William Cheng: Okay. Similarly, when you go to a bank. 323 00:43:02.550 --> 00:43:09.090 William Cheng: You know, we get advisor, usually people in front of you. You have to wait for everybody in front of you to finish and eventually the bank teller. What I do something 324 00:43:09.300 --> 00:43:14.190 William Cheng: And then as it turns out that you'll maybe you forgot to do something, the bank teller will tell it to go somewhere else and then 325 00:43:14.400 --> 00:43:24.810 William Cheng: Eventually, you can come back and then you will be going to finish what you're doing. So again, once you start getting into the run queue for the first time we're going to start the clock. And when you completed your done we you know when you leave the bank. That's when you 326 00:43:26.160 --> 00:43:31.200 William Cheng: That's when you stop the clock and that will be waiting time. All right, do we want to wait and have to be long or short 327 00:43:32.040 --> 00:43:37.440 William Cheng: There. So, of course, it will be nice if the waiting time is short. So therefore, another goal over here will be to minimize the waiting time 328 00:43:37.860 --> 00:43:50.070 William Cheng: The time until the job voluntarily give up the CPU. Okay. So your job called piece of new tax law or Ego. Ego with iOS. So in that case it will be end of the waiting time. Right. So if you look at this picture over here. How do you minimize the waiting time 329 00:43:51.630 --> 00:43:57.630 William Cheng: That, well, you know. So one thing is that you need to wait. You need to minimize the time that you're waiting for other jobs. 330 00:43:58.470 --> 00:44:09.240 William Cheng: Okay, so in that case that will be sort of a good way to to as well for the waiting time because once you get on the donkey over here. When you get on the run queue, the amount of time that you spent execute inside and CPU pretty much is fixed. 331 00:44:10.170 --> 00:44:14.190 William Cheng: Okay, so if you think about your warm up one right every time, will you run inside the CPU guy. 332 00:44:14.550 --> 00:44:21.180 William Cheng: Depends on the state of your program right at some point, you start running out of CPU you return for reading for iOS. So at this time you read that that particular record. 333 00:44:21.390 --> 00:44:29.880 William Cheng: The amount of the ICU depends on the data inside the hierarchy. But if you know what's inside of the record, the amount of time that you're executing that the CPU, that part is face. 334 00:44:30.600 --> 00:44:38.490 William Cheng: Okay, so therefore the waiting time part of the waiting time is fake. So therefore, in order for you to minimize waiting time you need to you need to minimize all the other part of the 335 00:44:39.480 --> 00:44:47.910 William Cheng: Of the waiting time right which is most of the time is waiting for other jobs running out of CPU. Okay. So later on we're gonna sort of see how you know what kind of schedule, you can actually pick to minimize 336 00:44:50.460 --> 00:44:55.890 William Cheng: Some people also wanted to minimize the response time. But we've got to be very careful with the word response time. So what is response time 337 00:44:56.730 --> 00:45:04.440 William Cheng: Okay. So as it turns out, different people actually sort of, you know, defined response time differently because you know the word response time sort of 338 00:45:05.160 --> 00:45:07.920 William Cheng: When people have a response I they talk about the user response time 339 00:45:08.610 --> 00:45:14.190 William Cheng: Okay. The user is doing something on a machine. And at some point, they say, Oh, something's going on. So now they feel that the system is responsive. 340 00:45:14.670 --> 00:45:20.070 William Cheng: Okay, so basically, there's some psychology going on. So, therefore, typical in this class we shouldn't be talking about response time 341 00:45:20.430 --> 00:45:25.380 William Cheng: Okay, it's more useful to talk about things like you know waiting time and throughput and the side of stuff, then 342 00:45:25.950 --> 00:45:35.760 William Cheng: Yeah. So what for interactive real time out issue. So for example, if you have a desktop right and and and and you double click on something on the desktop. Okay. When do you feel that the system has responded 343 00:45:36.780 --> 00:45:46.950 William Cheng: Okay, some people started seeing graphics and say, oh, you know, this is a nice respond that right somebody watching. Want to see the entire application start running and you see that our user interface and they say, okay, now this system has finally responded 344 00:45:47.340 --> 00:45:52.470 William Cheng: OK. So again, different people have different way to dismiss defy response time. So we got to be very careful with each other. 345 00:45:53.490 --> 00:46:04.140 William Cheng: We also to define response time. Yeah. And typically this is done, you know, for interactive user will you feel that the system has responded or then then you can actually measure your response that yes okay very difficult to define. 346 00:46:05.580 --> 00:46:10.410 William Cheng: The last one over here is called fairness fairness can all as it turns off fitness. You know, it's actually 347 00:46:10.650 --> 00:46:18.780 William Cheng: A very, very difficult concept because if you ask people what their definition of fairness, are they actually give a different definition they so just like response time or sometimes difficult 348 00:46:19.470 --> 00:46:31.260 William Cheng: To the divine, but we're going to sort of try to sort of to define fairness because India when tried it when people try to, you know, choose your operating system, which I'm choosing the scheduler. They tried to sort of 349 00:46:32.010 --> 00:46:45.330 William Cheng: Pick a schedule. That's fair. Okay, so you got to have some sort of a measurement of fairness. One of the ways that over here. So think about is that, you know, maybe I'm running a multi threaded you know operating system, maybe every so I should get exactly the same amount of CPU time 350 00:46:46.530 --> 00:46:55.650 William Cheng: Where does that seem fair. Okay, every day. So if you're running 10s 10 slides over here. Every student will get one 10th of the CPU that. Does that sound fair 351 00:46:56.520 --> 00:47:07.140 William Cheng: Well, I mean, it might not be actually fear because what else would it be on nine of these threads over here. Our CPU bound by they're actually acting a CPU bound job at this time, while the tensor over here is actually IO bound job. 352 00:47:07.830 --> 00:47:17.220 William Cheng: Okay, so in that case if you give one 10th of the CPU to the IO bound job. Well, in that case, it's totally wasted because our end up on jobs going to go away into IQ. It's not going to use the CPU cycle. 353 00:47:17.850 --> 00:47:27.150 William Cheng: Okay, the CPU is actually a precious resource. You want to keep the CPU as busy as possible. So, therefore, if you try to be fair, this way you're going to end up whale Ii Ii 354 00:47:27.570 --> 00:47:29.850 William Cheng: II, you're going to end up wasting CPU cycles. 355 00:47:30.720 --> 00:47:35.550 William Cheng: Okay, so therefore, just, you know, just because you think something's fair, you know, other people say, hey, that's really not fair. 356 00:47:35.730 --> 00:47:44.250 William Cheng: Because you know that you know the that's that is actually sleeping. I'll cue. So, therefore, you better not give any CPU cycles to somebody who's not a CPU who's not a drunk, you 357 00:47:44.610 --> 00:47:52.470 William Cheng: Know, which kind of makes sense, right, if they're not in the run Q why you shouldn't give the CPU to them. Yeah. Alright, so they're also going to talk about you know how 358 00:47:53.190 --> 00:48:04.950 William Cheng: To design a system does have a ton of scheduler for fairness then scheduling is very, very important because the effects and how well you achieve all these goals can be felt by the user. 359 00:48:06.000 --> 00:48:13.740 William Cheng: Guide. So India when the user actually use the operating system, you know, the application on TV for the actual user if they feel that the system is kind of sluggish. 360 00:48:14.340 --> 00:48:21.120 William Cheng: Okay, those are those are the water system doesn't respond very well. So if I go to a different system, it actually does better. Well, in that case, nobody wants to use your operating system. 361 00:48:21.540 --> 00:48:29.550 William Cheng: Okay, because the poor performance of your scheduler can actually be felt by the user, right. So that's why you know when you go interview people want to ask you a question about scheduler. 362 00:48:29.670 --> 00:48:38.100 William Cheng: Because user need to understand that the scheduler can actually make a big difference. If you use the wrong kind of scheduler the entire system will feel like they're actually not very responsive, then 363 00:48:38.880 --> 00:48:43.080 William Cheng: Alright, so again, all these goals over here please feel peace. Remember that some of them are 364 00:48:43.290 --> 00:48:54.540 William Cheng: Going to be in conflict with each other, especially when you talk about fairness, right, if you want to be fair, some of the other performance measures over here has to go right. For example, you know, maybe it's not a good idea to maximize CPU utilization 365 00:48:54.930 --> 00:49:00.120 William Cheng: When you worry about fairness there. Alright, so this is actually a good time to break. So next time we're going to see 366 00:49:01.200 --> 00:49:11.850 William Cheng: Them sort of briefly introduce the next slide over here. We're going to sort of talk about the scheduling algorithm, you know, we're going to sort of go, you know, start describing, you know the details of, you know, 10 different scheduling algorithm. Okay.