WEBVTT 1 00:00:01.829 --> 00:00:11.429 William Cheng: Hi. Welcome to lecture two. So, usually at the beginning of every lecture, I will have a few of these housekeeping slides. 2 00:00:12.240 --> 00:00:21.120 William Cheng: So the purpose of the housekeeping slides is to remind you of the deadlines and also I use them to remind people not to cheat. 3 00:00:21.840 --> 00:00:27.930 William Cheng: The reason I have to do that. Is that because you know in the past semester. Some people you know say that they don't know that they're not supposed to cheat. 4 00:00:28.560 --> 00:00:34.470 William Cheng: So therefore, pretty much every lecture, I have to remind people not to cheat. Okay. And also, I need to remind people that 5 00:00:34.890 --> 00:00:39.600 William Cheng: You know, when they make a submission, they should verify their submission, they should read the ticket. 6 00:00:39.930 --> 00:00:46.290 William Cheng: I'm sorry I have to remind people, you know, in every lecture because you know some people would argue that they didn't know about this kind of stuff. 7 00:00:46.830 --> 00:00:57.420 William Cheng: So therefore, I have to keep doing this over and over again. Yeah. Alright so warm up. One is due on Tuesday, June 2 so you have about a week to finish. 8 00:00:58.230 --> 00:01:09.240 William Cheng: So as I mentioned before, if you have co from previous semester, please don't look at them. Don't copy them up. So just get rid of it. Because even running their code. It's considered cheating in this class. 9 00:01:09.840 --> 00:01:19.560 William Cheng: You should also start warm up one soon I sent you the email over the weekend as you to, you know, to spend a lot of time and warm up one over the past weekend. I hope you have done that. 10 00:01:19.890 --> 00:01:35.580 William Cheng: You know, because you sort of need to stay ahead of the class. Yeah. So if you're stuck I make sure you you know you you you come to see me during the live office hour and also we have a live lecture section. If you have question, you know. 11 00:01:37.440 --> 00:01:43.110 William Cheng: The question doesn't really have to be about the lecture you have questioned by your program in the summer, you know, feel. Also, feel free to ask me. 12 00:01:43.620 --> 00:01:51.090 William Cheng: You know, during the live lecture section. Okay. I should also feel free to send me email post message to the class Google group, etc. OK. 13 00:01:51.810 --> 00:01:58.200 William Cheng: For warm up one. Are you also need to read the code in list test our see you, especially if you are not really good at. 14 00:01:58.650 --> 00:02:05.940 William Cheng: You know C programming or programming in general. So we should do that. You should read the CO and try to sort of figure out what's going on. Okay. Do you have question about them. 15 00:02:06.390 --> 00:02:17.100 William Cheng: Feel free to send me email. So again, you know, the first lecture I keep reminding me I sort of keep you sending you the message to say that you know you should you should sent you should ask me a question he asked me a question he asked me a question. Okay. 16 00:02:18.300 --> 00:02:29.970 William Cheng: All right, and hopefully you have seen my post in the cost Google Group I. Some people ask me a question I try my best to explain you know everything you know that in the school. Okay, so, so, so don't feel shy by ask me question. 17 00:02:30.930 --> 00:02:38.070 William Cheng: The tentative timeline for warm up one in the first discussion section I mentioned that you should be done with Part A of the grading guidelines by the end of today. 18 00:02:38.340 --> 00:02:43.800 William Cheng: And part A is only about 100 lines typically less than that. Okay, so you should definitely get it done by the end of today. 19 00:02:44.070 --> 00:02:51.510 William Cheng: And the goal is to finish. One more, one or any of the programming assignments before the 10% extra credit, which means that is by the end of this Saturday. 20 00:02:52.110 --> 00:03:00.150 William Cheng: Okay so got the schedule is pretty aggressive but again if you start early. You should be able to meet all the earliest admission schedule. Yeah. Older only submission deadline. 21 00:03:01.980 --> 00:03:13.020 William Cheng: Alright, so again, very important to understand that the grading gala is the only way we'll grey and we can only grade on the greatest 32 bit will burn to 16.04 system which you do not have access to 22 00:03:13.590 --> 00:03:19.650 William Cheng: Okay. So, so what it means is that you should make sure that your program will work under any 32 bit Ubuntu 16.04 23 00:03:20.040 --> 00:03:24.120 William Cheng: Okay, so my recommendation is that when you install Ubuntu 16 point or four 24 00:03:24.420 --> 00:03:32.250 William Cheng: Don't do anything else. Just, just hold installation instructions and then you start just the right, the right kind of software and not to try to install anything else. 25 00:03:32.460 --> 00:03:39.180 William Cheng: Okay, because if you install anything else and your code depends on that one, then the greater than have those kind of software, the greater will end up giving you a big zero 26 00:03:40.080 --> 00:03:50.370 William Cheng: Okay, so, so, so if you want to play around with Uber to that's fine. Install multiple virtual machines. One of them just for testing to make sure that, you know, to, to make sure that your code. It's going to wake 27 00:03:53.070 --> 00:04:01.710 William Cheng: Is going to work inside the graters account. Okay. All right. So, you will get no partial credit if your co run perfectly on any other system. 28 00:04:02.070 --> 00:04:12.810 William Cheng: There's only one place, the greater can grade. Again, this is due to our fitness policy. Okay, whatever. I offered to one student have offered to the entire class. So if I can not offer to the entire class I can offer that to you. Okay. 29 00:04:13.410 --> 00:04:20.820 William Cheng: Please. Again, remember that I'm a stickler to all the written code. And also I'm bound by my own rules. So therefore, there's no way for me to make exceptions. Okay. 30 00:04:21.120 --> 00:04:24.930 William Cheng: And please understand that the grading guidelines as part of the spec right so so 31 00:04:25.200 --> 00:04:32.940 William Cheng: You know, so you make sure you need to run through the test in the grading guidelines, because the greater the only way that grader can Grey is to run through the grading, guys. 32 00:04:33.210 --> 00:04:38.160 William Cheng: Okay, if you ask the greater to go. Great. Any other different way to greater will have to say no. Yeah. 33 00:04:38.910 --> 00:04:45.270 William Cheng: If it turns out. Have you finished your meta submission, make sure that you know you shouldn't read everything on your screen. 34 00:04:45.600 --> 00:04:50.400 William Cheng: Okay, so when you make a submission and everything was successful, you will be presented with something called a ticket. 35 00:04:50.700 --> 00:04:56.850 William Cheng: Okay, and then the webpage will tell us why you should pay attention to make sure that everything you have submitted is everything you want us to great 36 00:04:57.690 --> 00:05:09.630 William Cheng: Okay. And, you know, so, so that's web page. You can also save a copy of the webpage in PDF file so that web page. So, so the ticket is proof that your submission has made has made it into my server. 37 00:05:10.410 --> 00:05:18.420 William Cheng: Okay, you don't really need to have an email The email I bit might be sent to you but you know the way in an email works is that when an email was sent you can get to you in many, many days later. 38 00:05:18.690 --> 00:05:24.090 William Cheng: Okay, and that's perfectly okay okay but you know if you really want to prove all you have to do is to keep a copy of the ticket. 39 00:05:24.450 --> 00:05:35.040 William Cheng: Okay, that's the most important part. If you end up getting an email, whether you can actually keep that email if you don't get an email, you should print out the, the, the other the ticket on the screen and then save as a PDF file. 40 00:05:36.030 --> 00:05:40.530 William Cheng: And then the other thing that you have to do is that you have to verify your submission. Right. So again, take your submission 41 00:05:40.770 --> 00:05:48.990 William Cheng: Follow the instructions there to to sort of figure out how to verify your submission. So this way you can make sure that everything that you have submitted to us is everything you want us to great 42 00:05:49.260 --> 00:05:59.220 William Cheng: Okay, because after the deadline, there's really nothing I can do. Yeah. All right. And as I mentioned, the last lecture. If you want a good grade. It's important that you keep up with the lecture. 43 00:05:59.790 --> 00:06:04.800 William Cheng: You know, especially starting with today's lecture. So last lecture, I sort of starting to talk about chapter why right so so now we're sort of 44 00:06:05.220 --> 00:06:13.920 William Cheng: You know, going into the textbook and we're going to go and a pretty fast pace, right, because everything is recorded. If you want to reviews, you can, you know, rewind the recording and go back 45 00:06:14.580 --> 00:06:25.650 William Cheng: Go, go, go back and review stuff. And there's anything that you don't understand you just send me email right away. Don't wait a week later, don't wait two weeks later, as soon as you find out that you're confused about something, send me email. Okay. 46 00:06:28.110 --> 00:06:37.140 William Cheng: All right, so you know so. So I guess the problem with the office, our policies or I heard from the TA to say that, you know, 47 00:06:38.070 --> 00:06:47.100 William Cheng: The waiting room doesn't really quite work. So, so, so the way I'm going to do my office hour is basically everybody will be able to come in. So 48 00:06:47.700 --> 00:06:54.330 William Cheng: You know, since I want to make sure that other people do not see your co you shouldn't show me your code inside the office hour 49 00:06:54.930 --> 00:07:02.970 William Cheng: Okay, because if you do that other people will copy and then I'll people submit. So in that case, you'll be in trouble, too, because you're not supposed to show your code anybody else. Okay. 50 00:07:03.360 --> 00:07:09.660 William Cheng: So I think the zoom office are there's a feature to let you go into a Tu, Tu, Tu, Tu, Tu habits go into a private session. 51 00:07:09.900 --> 00:07:19.560 William Cheng: When we go into a private session. That means nobody else is around. Well, in that case, if you have code that you want to show me. You can show Show. Show. Show me a call. But again, typically, you know, I don't really want to debug code for other people. 52 00:07:19.890 --> 00:07:29.580 William Cheng: Okay, so if you show me your code. You asked me for your bugs are. I have no idea. Okay, I'm not gonna tell you what, even if I see a amalgam tell you where your bugs are because you know the bug in your code is your responsibility. 53 00:07:30.180 --> 00:07:34.950 William Cheng: Right, so, so, so, so what you should do they use you as a higher level question or you can sort of, you know, 54 00:07:36.570 --> 00:07:46.440 William Cheng: You know, maybe if you want to. Show me, show me some some some code. Well, you're not compiling and you have a compiler error. So in that case, you can forward that to me. But you don't have to do that during office hours. 55 00:07:47.130 --> 00:07:55.320 William Cheng: Okay, when you get a compiler error, you can just copy and paste what you see and then send it to me in an email. So this way I have plenty of time to look at it. I don't have to do it and doing an office hour 56 00:07:56.520 --> 00:08:05.250 William Cheng: Or so officer IF THERE'S SOME PEOPLE ARE WAITING, I NEED TO GO REALLY FAST. And, you know, every student is limit up to 15 minutes. And if you have, you know, one hour. Then for students will take up the entire time. 57 00:08:05.790 --> 00:08:10.260 William Cheng: So again, there's no guarantee that you will get your chance to to to talk about anything private 58 00:08:10.650 --> 00:08:20.970 William Cheng: OK, so the best the actually the best way to go is again or to send me email. Okay. Because, because we send me a private email you get 100% of my attention and then I will have to respond to you. 59 00:08:21.720 --> 00:08:29.460 William Cheng: Okay, so I think that's you know that they're usually a lot better than the office. Right. Some people are used to talking about how in the office hours. So, so in that case, you're welcome to talk to me. 60 00:08:29.880 --> 00:08:35.970 William Cheng: The episode. But again, when you try to show your code. You got to make sure that nobody else is looking at your code. Yeah. 61 00:08:37.530 --> 00:08:40.260 William Cheng: Alright, so I guess it sort of mentioned that all that right here. 62 00:08:40.680 --> 00:08:43.890 William Cheng: So if you have not seen a post in the class Google group. 63 00:08:44.100 --> 00:08:55.050 William Cheng: It probably mean that you are not a member of the cost Google group. So in that case, again, you're required to be a member of the customer group, you should go to the class web page, click on the Google group, you know, there's a link that give you instructions. 64 00:08:55.500 --> 00:09:02.700 William Cheng: So again, either follow the instructions there and make a request. Okay. If you have any question you know, send me email and also if you set your 65 00:09:03.060 --> 00:09:10.980 William Cheng: Class will go email delivery method to no email. What you are required to get email from me. Okay. So, therefore, if you set it to know, you know, I have to send it to all email. 66 00:09:11.640 --> 00:09:20.430 William Cheng: Okay, so if you really don't want to see any of my email messages over here, you can set it up, you can set up on your end, set up a filter. So how all the email go back into the go 67 00:09:20.790 --> 00:09:29.010 William Cheng: Go go go into a special mailbox. So later on, can actually search all these emails. Okay, so that will be my recommendation, so you can easily set up a filter now. 68 00:09:29.820 --> 00:09:40.650 William Cheng: You should start looking for partners for kernels diamond will work with your potential Colonel partners in warm up one and two. So again, working means working at a high level, and not copying co from each other. 69 00:09:40.950 --> 00:09:49.410 William Cheng: And if you are looking for. Colonel partners. If you go to the project web page, there's a place to say how you're going to find kernel partners, enter your information there or you can also contact people there. 70 00:09:49.860 --> 00:10:01.470 William Cheng: Okay, so please understand that I cannot get involved in you choosing your kernel partners. Okay. Some people says, oh, could you hear me out with somebody. I absolutely cannot do that. Okay, it's completely on your okay 71 00:10:03.630 --> 00:10:11.850 William Cheng: All right, you must install 32 bit Ubuntu 16.4 as I mentioned in the last discussion section. You were supposed to be installing then last during the last weekend. 72 00:10:12.150 --> 00:10:14.520 William Cheng: So if you haven't gotten that you do as soon as possible. 73 00:10:14.850 --> 00:10:24.390 William Cheng: You start using it for warm up one and learn how to use the debugger GDP, right, so I've been posting the class grow, grow. So to give you an example, how to do that. So again, whenever I posted something because we will grow. 74 00:10:24.690 --> 00:10:28.110 William Cheng: If you don't understand what I'm doing, just follow what I'm doing and try to sort of 75 00:10:29.190 --> 00:10:34.620 William Cheng: Just follow what I'm doing and try to learn when I'm doing okay. And again, if you have question, you know, send me email now. 76 00:10:35.070 --> 00:10:45.150 William Cheng: One of the great things about, you know, one, two, is that they have a tool called Val grind. So if you go to the project web page, scroll all the way to the bottom or to a string search look for the word Val grind. 77 00:10:45.690 --> 00:10:50.160 William Cheng: You will find out that there is a tool for memory debugging. Okay, so I'm going to use the term. 78 00:10:50.760 --> 00:10:55.860 William Cheng: memory corruption, a lot of the very, very difficult to debug bugs are known as memory corruption bug. 79 00:10:56.280 --> 00:11:03.540 William Cheng: Okay, so what is memory corruption. Right. So all it means is that you right into your address space where you are not supposed to, or you didn't expect to 80 00:11:03.930 --> 00:11:09.330 William Cheng: See, in that case, you're gonna mess up your, you know, program you're going to mess up your data structure and later on your program is going to crash. 81 00:11:10.140 --> 00:11:12.960 William Cheng: Okay, so these are the bugs that are very, very difficult to find. 82 00:11:13.260 --> 00:11:21.120 William Cheng: So hopefully, if you use a tool like Val grind it might be able to help you to find bugs. Okay, so again, there's no guarantee that it will find bugs for you. 83 00:11:21.390 --> 00:11:31.500 William Cheng: But, you know, sometimes if you're really, really puzzled, you should run this program to see if I can find any bugs. OK. So again, read the class web page with the website and find out how to use it. Okay, so hopefully 84 00:11:32.190 --> 00:11:38.130 William Cheng: Hopefully can sort of help you once in a while to find one or two bucks. OK. So again, don't expect that it will find all the bugs. 85 00:11:38.580 --> 00:11:44.070 William Cheng: Bugs for you. You need to be able to learn how to find bugs for yourself. Yeah. All right. Alright. 86 00:11:45.060 --> 00:11:59.190 William Cheng: So you need to learn Unix, Linux, lots of commands you need to try them on. And you need to also get familiar with the class website. Okay. Alright, so, so, so today's. The first time I sort of show you these housekeeping slides from today on things going to go a lot sort of 87 00:12:00.270 --> 00:12:04.920 William Cheng: A lot faster because I put my say, you know, remind you the same thing over and over again. Okay. 88 00:12:05.970 --> 00:12:09.540 William Cheng: Alright, so let's go back to chapter one last time we will give you an 89 00:12:10.140 --> 00:12:15.720 William Cheng: Introduction and sort of a very, very high level introduction of what's going to be covering chapter five, six and seven. 90 00:12:15.960 --> 00:12:28.080 William Cheng: I mean, clearly you won't be able to understand it because we haven't really talked about any of the details. Okay. Right, so, so, so the way the textbook is structure in chapter one and two, we sort of give you a high level introduction of, you know, 91 00:12:29.340 --> 00:12:42.810 William Cheng: Basically, you know what, what the at the application program, you know, how does application program interact with the at the operating system. Okay. And then in chapter five, six and seven we show you how to implement the operating system. 92 00:12:43.920 --> 00:12:50.190 William Cheng: Alright so here in chapter one and two was sort of showing you the interface to the operating system. Alright. So today we'll talk about some of the interface. 93 00:12:50.400 --> 00:12:59.880 William Cheng: Or in chapter five, six and seven, we talked about how to implement the actual operating system. Okay and chapter three or four somewhere in between that you need to start going into talking about how to implement the kernel. 94 00:13:00.180 --> 00:13:06.540 William Cheng: Of God. So how to how to implement the operating system. All right. Okay. So again, that's just the way that the textbook is organized 95 00:13:07.080 --> 00:13:12.330 William Cheng: So unfortunately, you will not be able to sort of, you know, learn exactly what are you know threats are right away. 96 00:13:12.810 --> 00:13:21.960 William Cheng: So you actually learn, learn about exactly what the threats are probably you know almost halfway through the semester. And then at that point you will totally understand what is a threat. 97 00:13:22.980 --> 00:13:30.990 William Cheng: Okay, so, so things like threads and address space. They are pretty abstract concept, right. So we're sort of going to sort of introduce these abstraction to you. 98 00:13:31.470 --> 00:13:43.740 William Cheng: But only although we're, we're in the middle of the semester, then you will start learning exactly what they are. Okay, so, so obviously some is pretty abstract. So you sir. So, so this is the way. So this is also the way that we're going to go now. 99 00:13:45.870 --> 00:13:50.610 William Cheng: Alright, so I'm going to continue with the textbook as sort of talk about, you know, what are the 100 00:13:51.060 --> 00:14:00.090 William Cheng: 1960s operating system design issues, right. So they just gave you a very high level, you know, Introduction operating system was invented in around 1950s, 1960s. 101 00:14:00.660 --> 00:14:12.210 William Cheng: So what do people worry about 1950s and 1960s. Okay, so over here. So in 1959 60 there's only one computer company that's the company that invented a computer and that's IBM right International Business machine. 102 00:14:12.930 --> 00:14:17.310 William Cheng: So in 1960s, they will try to sort of figure out, you know how to write an operating system. 103 00:14:17.700 --> 00:14:27.720 William Cheng: So the kind of stuff that they worry about is what it's called multi programming. So IBM invented all these terms. Some of them are pretty fancy would only really, you know, I mean, sometimes still use them. Sometimes we don't use them anymore. 104 00:14:28.170 --> 00:14:36.900 William Cheng: So multi program is what is multi programming right we saw in the previous pictures over here. It's basically it is to create the parents that you're running multiple things in parallel. 105 00:14:37.290 --> 00:14:47.310 William Cheng: Okay, even though they might have only one one CPU. So again, in this class. We don't distinguish between powerless em and concurrency. Okay, being the globe as they just it just known as multi programming. 106 00:14:47.820 --> 00:14:53.580 William Cheng: OK. So again, we have one CPU with juggling all these threads only one CPU. So that's called multi programming. Okay. 107 00:14:54.120 --> 00:15:02.460 William Cheng: The other thing they're worried about something called time sharing. So again, this is a really, really old term today. All it means is that there is an interactive users sitting in front of the machine. 108 00:15:02.940 --> 00:15:10.020 William Cheng: Okay, so now you know you have this big computer that's, you know, IBM computer, they'll call mainframes they fill up the entire floor. They're really, really big. 109 00:15:10.590 --> 00:15:15.000 William Cheng: So they run a bunch of, you know, sort of background job. And there's one user sitting in front of it. 110 00:15:15.780 --> 00:15:20.160 William Cheng: Okay, so, so, so the goal in this case will be that while you know if the user is sitting in front of a computer. 111 00:15:20.310 --> 00:15:31.020 William Cheng: We need to make this user as happy as possible. So what they're trying to sort of figure out is that, how did they actually design the operating system to make the users, very, very happy with all the other jobs that can be run at a later time. 112 00:15:31.560 --> 00:15:38.820 William Cheng: Okay. So in this case, you know, the, you know, the sort of the work that you need to perform inside operating system. Some of them are more important. Some of them are less important. 113 00:15:39.210 --> 00:15:43.050 William Cheng: Okay, so in 9668 that's what is to try to sort of figure out what to do. Okay. 114 00:15:43.800 --> 00:15:52.260 William Cheng: All right. And also, once you start, you know, giving the application programmer interface to use the opportunities and the application program will say, well, this is great, can we have more 115 00:15:52.530 --> 00:15:58.080 William Cheng: OK, so the application program is going to ask for more and more feature and this way, they can write more and more complicated program. 116 00:15:58.560 --> 00:16:07.770 William Cheng: Okay, so in 1960 when they try to sort of figure, is that how do you actually manage the complexity of software to provide the right kind of interface where the opportunities are for the application to us. 117 00:16:08.100 --> 00:16:12.630 William Cheng: So this way, the application programmer can be happy. They can also be productive, they can write great software. 118 00:16:13.350 --> 00:16:20.010 William Cheng: So that's what they worry about. And last thing over here is security. I mean, in 1960s. There's really no no security problem. So again, 119 00:16:20.280 --> 00:16:31.110 William Cheng: In this class, whenever we talk about security, we're thinking about isolation. Okay, how do you isolate the application from each other. How do you isolate the operating system from the application program now. 120 00:16:32.550 --> 00:16:36.270 William Cheng: All right, 50 years later we worry about exactly the same thing. 121 00:16:36.840 --> 00:16:48.240 William Cheng: So so so you today and they're still, you know, very, very active opportunities and research. And if you go to these research conferences or look at their paper, they still worried about the same thing. Okay, except that they're at a different scale. 122 00:16:48.630 --> 00:16:56.640 William Cheng: For multiple by me, they're still running. Many things in parallel. Okay, and make it look like you know that that that that the the the actually switching very, very fast. 123 00:16:57.030 --> 00:17:05.670 William Cheng: So in this case, the scale is going to change. We're going to be running one part of your program on one machine. The other part of your program, you know, on a different machine across the continent, you know, 124 00:17:05.970 --> 00:17:17.940 William Cheng: Somewhere else and they they are considered part of the program. OK, so the multi programming the skills completely fine. But the basic idea. The basic idea over here is still very similar their time sharing or you're 125 00:17:20.010 --> 00:17:28.800 William Cheng: When you're using the desktop, you are the interactive user. But now the user interactive user wants to a lot of things right. You want to be able to do come compile your code, the same time. 126 00:17:29.070 --> 00:17:37.920 William Cheng: At the same time that you are surfing the web or maybe you're watching the movie. Maybe you are chatting with your friends, you're doing all these things simultaneously and you want to make sure that the user is happy. 127 00:17:38.610 --> 00:17:46.800 William Cheng: OK. So again, it's still the same problem. Right. But now the skills a little different. Okay, the software complexity. It's a much bigger problem that could be imagined 1968 128 00:17:47.100 --> 00:17:53.370 William Cheng: And computer science. They sort of evolved into a new field called software engineering, just to manage the complexity of software. 129 00:17:54.060 --> 00:17:58.800 William Cheng: OK. So again, the thing goes up those basically exploded into a completely different field. 130 00:17:59.370 --> 00:18:03.480 William Cheng: Similarly with security right today, security is much, much different than 131 00:18:03.870 --> 00:18:11.700 William Cheng: 50 years ago, IBM, you know, 50 years ago they cannot imagine you know what could be a Drive by download that people actually take over your machine and do all these kinds of stuff. 132 00:18:12.240 --> 00:18:21.690 William Cheng: OK. So again, we're not going to sort of focus on that kind of the aspect of security because we have security classes at USC. So if you're interested in security should take these other classes. Yeah. 133 00:18:22.440 --> 00:18:30.060 William Cheng: Right again for software complexity to take software engineering and you know those kinds of jobs require pretty much everybody has to know things about software engineer. 134 00:18:31.800 --> 00:18:43.020 William Cheng: All right, so, so, so that that's, you know, very high level talking about sort of introduction operating system in Section 1.2 we're going to talk about the brief history of the operating system. So, 135 00:18:43.560 --> 00:18:51.540 William Cheng: You know, well I'm going to skip the entire section 1.2 but sort of give you some sort of just as a couple of summary slides. Okay. Alright. 136 00:18:52.470 --> 00:18:59.370 William Cheng: So, you know, in this class we sort of talked about most of how we're going to spend our time talking about the Unix operating system or the Linux operating system. 137 00:18:59.910 --> 00:19:08.550 William Cheng: You probably heard some people will comment said, Well, you know, why do you want, why do you worry about Unix and Linux. You know UNIX is a dinosaur. Nobody cares about it. 138 00:19:09.060 --> 00:19:15.930 William Cheng: So hopefully I can convince you that you know UNIX is still not irrelevant today. Okay, there's a good reason we're learning Unix today that 139 00:19:16.350 --> 00:19:23.580 William Cheng: All right, so, so again in this class will sort of focus on the the sort of the popular, you know, desktop operating system. 140 00:19:24.030 --> 00:19:33.420 William Cheng: So I guess there are three of them. There are a very popular one is Linux and Unix and the other ones, Microsoft, and the other one is apple. Okay, so first let's talk about a little bit about the history of Unix 141 00:19:34.050 --> 00:19:37.830 William Cheng: Long time ago. There's an operating system. I think was developed at MIT. 142 00:19:38.430 --> 00:19:48.090 William Cheng: Or maybe, you know, in collaboration with people in England. It's called motifs operating system after motifs Bell at&t Bell Labs, they create an operating system called Unix 143 00:19:48.630 --> 00:19:56.070 William Cheng: There are three major difference of your different version of Unix. One is called at AMP T Unix that's also known as the commercial Unix 144 00:19:56.550 --> 00:20:05.730 William Cheng: So if you want to buy a software license. When the Unix operating system you can pay at AMP T some licensing fee and they will give you the source code of Unix guy. So that's one version of Unix 145 00:20:06.210 --> 00:20:10.890 William Cheng: The other ones copy st unit. So that one is a very famous one is the beast. That's what Berkeley. 146 00:20:11.250 --> 00:20:19.410 William Cheng: So UC Berkeley. They basically re implement the entire unit since then and then they also they give our licenses for, you know, people want to use it. 147 00:20:19.680 --> 00:20:26.880 William Cheng: They sort of the day. So you don't have to pay for a very small amount of money you can get the source code that the Berkeley people implement it. 148 00:20:27.420 --> 00:20:38.430 William Cheng: So as it turns out that lots of university lots of research lab or they all pay license for it. Okay, so this spurs up all kinds of your operating system research, they're all based on the other BSD Unix then 149 00:20:39.060 --> 00:20:50.130 William Cheng: The other one is called minutes so so I don't know if you've ever heard of this very famous professor, his name is Andrew Tenenbaum Andrew bomb. He wrote a textbook for our businesses. And so if 150 00:20:50.550 --> 00:20:53.760 William Cheng: The opposite the opposite of the textbook is very, very similar to our textbook. 151 00:20:54.150 --> 00:20:59.970 William Cheng: The audiences and also come with a bunch of programming assignments and the programming assignments, kind of going to be like our programming assignments. 152 00:21:00.360 --> 00:21:11.670 William Cheng: Except that he called his operating system for the programming assignments. It's called minutes okay so minutes is a toy awkwardnesses them so that his students can use to experiment with operating system ideas there. 153 00:21:12.300 --> 00:21:19.020 William Cheng: Then Linus Torvalds, you know, the founder of Linux. I mean, he took one Andrew Tenenbaums class and then from minutes 154 00:21:19.260 --> 00:21:27.660 William Cheng: You know he he he modified minutes he come up with the operating system called Linux and the rest is the and then and then the rest of Linux is history. 155 00:21:28.080 --> 00:21:32.280 William Cheng: Right, so we know that 1990s, the Linux has been released, and then you know today. 156 00:21:32.730 --> 00:21:38.310 William Cheng: If you're running the Android operating system. The Android operating system run on top of Linux operating system. 157 00:21:38.670 --> 00:21:45.720 William Cheng: Okay. So, therefore, if you're using the Android, you are using you're using Android you're using the Linux operating system now. 158 00:21:46.380 --> 00:21:56.100 William Cheng: All right, on the other side over here we have Microsoft. Microsoft has two lines of development. One is called MS DOS or Windows 3.0. Those are really not. 159 00:21:56.760 --> 00:22:02.760 William Cheng: Those are not real operating system. Okay. So, therefore, you know, also the rest in peace. Over here is hopefully we'll never see them again. 160 00:22:03.060 --> 00:22:09.540 William Cheng: On the other end, they have two opportunities that one. It's called us to and the other one is called BMS none of them belong to Microsoft. 161 00:22:09.900 --> 00:22:15.720 William Cheng: Okay, so always to is actually IBM operating system as what happened is that long time ago. IBM come up with the IBM PC. 162 00:22:16.080 --> 00:22:22.170 William Cheng: And they try to look for an operating system IBM PC. So they went to a company that nobody has heard of is called Microsoft 163 00:22:22.440 --> 00:22:28.980 William Cheng: They signed a contract with them to ask them to implement an operating system for the IBM PC. Right, so that one's got MS dos. Okay. 164 00:22:29.160 --> 00:22:38.790 William Cheng: So Microsoft implemented that. So, at that time, IBM sign a contract with Microsoft to say that, you know, to say that, well, if you if you guys make any modification to Ms DOS IBM will get the software for free. 165 00:22:39.390 --> 00:22:49.890 William Cheng: Okay, so at that time. Bill Gates was pretty smart. He also says, well, okay, so that's no problem. We also want the reverse to be true whenever you modify your version or MS dos. We also get a free copy of it. 166 00:22:50.550 --> 00:23:00.090 William Cheng: Yeah. So later on IBM right the IBM actually come up with a real operating system called us to and then Microsoft say give that source code to, to, to us, you know. Thank you very much, because we signed this contract. 167 00:23:00.990 --> 00:23:04.770 William Cheng: Okay, so, so, so, IBM, you know, so I wrote the software, but they have to give it to Microsoft. 168 00:23:05.520 --> 00:23:12.360 William Cheng: The other one is obvious called VM. So there's a company called Digital Equipment Corp, they are the one that invented what's called the mini computer 169 00:23:12.780 --> 00:23:19.290 William Cheng: Okay. So at the beginning. There's the mainframe computer and then there's the era for mini computers were many companies are very become very, very popular. 170 00:23:19.680 --> 00:23:24.210 William Cheng: Digital Equipment Corp is the one that actually made a lot of money building mini computers then 171 00:23:24.630 --> 00:23:36.990 William Cheng: They also the right audiences them the right to different audiences that one is the dominance of them called BMS and the other operating system is that they they they licensed Unix. They also sell Unix on their own system. 172 00:23:37.890 --> 00:23:45.750 William Cheng: Okay, so, so, so these two are criticism. They're actually very, very similar. There's even one version of VM. So look exactly the same as Unix 173 00:23:46.080 --> 00:23:52.950 William Cheng: Okay, so you can sort of think about a DNS as a little cousin of Unix because they're very similar now. So for Microsoft 174 00:23:53.370 --> 00:24:00.660 William Cheng: I guess Robin is our digital equipment costs at some point they went out of business because they cannot compete against IBM PC. Right. So in the beginning. 175 00:24:00.840 --> 00:24:08.760 William Cheng: It was the mainframe era. And then the mini computer era. And then there's the IBM PC era. So when the IBM PC era took over everybody so went out of business. 176 00:24:09.030 --> 00:24:14.670 William Cheng: Then so on. So a lot of the researchers at Digital Equipment Corp, they went and they joined Microsoft Research 177 00:24:15.240 --> 00:24:22.830 William Cheng: Okay, so what they did what it is that they take their operating system called BMS and they start working on the continue to work on opportunities and research. 178 00:24:23.430 --> 00:24:35.490 William Cheng: At Microsoft, so together, combining VM as an OS to Microsoft come up with Windows NT their windows NT then become a Windows Vista and it becomes, you know, Windows seven, eight and 10 179 00:24:36.060 --> 00:24:42.930 William Cheng: So today, if you're running. If you're running Windows, you are running an operating system based on the little cousin of Unix 180 00:24:43.560 --> 00:24:48.300 William Cheng: Okay, so even though, you know, if you ask Microsoft is what operating system is completely different from from 181 00:24:48.750 --> 00:24:55.740 William Cheng: For Unix, but the basic idea of the the opposite design. They are they are they have a very similar to Unix 182 00:24:56.310 --> 00:25:03.060 William Cheng: Now, so one of the problem with Microsoft Windows is that there are proprietary operating system. So we don't really know exactly what goes on in Windows 183 00:25:03.450 --> 00:25:06.840 William Cheng: So most of the time, we're not going to talk too much about Windows. Okay. 184 00:25:07.560 --> 00:25:17.520 William Cheng: All right. The third company, of course, everybody loves them is Apple. Apple also have two lines of development one line is called Mackintosh. I don't know if you ever use one is the mechanism, Lisa. 185 00:25:18.120 --> 00:25:31.710 William Cheng: So, so I guess you know Steve Jobs created these operating system. At least I was actually a real operating system. Okay, so as it as it turns out, at the time, they can't really compete against Microsoft. So Steve Jobs got fire. He went company a 186 00:25:32.790 --> 00:25:39.900 William Cheng: Company happy at that time, you know, for Apple, you know this this line of hardware. They did. They did. They basically died. Okay. 187 00:25:40.470 --> 00:25:48.180 William Cheng: So seek out whether a company hobby right before he come back and join and rejoin Apple again. He was actually working for a company that does Unix 188 00:25:48.570 --> 00:25:59.910 William Cheng: The name of the company is called next computer. Okay, next computer. They're very, very famous for the graphical user interface. Out of all the UNIX company that may graphic user interface, they are the one that's the previous okay 189 00:26:00.270 --> 00:26:08.310 William Cheng: So I'm gonna sell when Steve Jobs come back to Apple, he brought two things from that company, I guess, at that time, you know next computing. They also they're going out of business. 190 00:26:08.670 --> 00:26:11.220 William Cheng: Because guess what they cannot compete against windows, either. 191 00:26:11.700 --> 00:26:15.210 William Cheng: So Steve Jobs brought the technology from the company into apple 192 00:26:15.390 --> 00:26:21.960 William Cheng: The two things that he brought back. Number one is Unix. There's also the obviously units and also he brought back the graphical user interface. 193 00:26:22.110 --> 00:26:32.460 William Cheng: Then, so once you come back to gratitude to Apple he made the the sort of the new Unix graphical you know face look like the old Macintosh graphical user interface. Yeah. 194 00:26:33.030 --> 00:26:42.780 William Cheng: So the UNIX that they have in next computing are based on these two options. Is there one is called Mark So Mark, you know, again, they're very similar to Unix later, I'm going to talk a little bit about Mark 195 00:26:43.230 --> 00:26:51.660 William Cheng: The other one. It's called free BSD so free BSD is based on BBC and BBC is based on Unix so free beer is basically running a Unix operating system. 196 00:26:52.470 --> 00:27:00.660 William Cheng: That. And again, Marcus units freebie AC unit. So the whole thing is Unix together you know Apple create a Darwin operating system and now 197 00:27:01.020 --> 00:27:16.500 William Cheng: Later on the darwinopterus is a split into two to two different development one because the Mac OS X and the other ones. The other ones iOS. Okay, so today if you're running a Mac. So today, if you're running a Mac OS, you are actually running Unix 198 00:27:17.730 --> 00:27:24.000 William Cheng: Okay, so even though if you asked, you know, you know, apple, what kind of up in the system. They're running. They're going to tell you they're running iOS and there's 199 00:27:24.810 --> 00:27:31.020 William Cheng: They're running Mac OS. So they will not admit that they're running Unix. There's actually one way you can actually find out that Max is actually running Unix 200 00:27:31.440 --> 00:27:40.890 William Cheng: You need to, you know, if you have a Mac, you try to look with the software called terminal. So if you have installed one to 60.04 you know that you you're running this program called terminal get a Mac. 201 00:27:41.310 --> 00:27:47.310 William Cheng: OS X. There's also programs that you can run called terminal when you run terminal, you're going to get a Unix interface. 202 00:27:48.030 --> 00:27:56.100 William Cheng: Okay, so therefore you know Apple, you know, today is actually running Unix yeah alright so hopefully I've convinced you that you know even Unix today is very 203 00:27:56.940 --> 00:28:06.180 William Cheng: Very, very relevant. So our class is basically a focus on Unix operating system right again. The reason for that is that we don't have the source code for Microsoft Windows yet. 204 00:28:07.860 --> 00:28:11.550 William Cheng: All right, what about see right so in this case we're going to completely programming see 205 00:28:11.910 --> 00:28:21.900 William Cheng: So a little bit of history of see in 1960 or there's a programming language called a combined programming language. They would develop at Cambridge University and University of London in England. 206 00:28:22.650 --> 00:28:27.960 William Cheng: So later on. There were people who are interested in writing operating system using a high level programming language. 207 00:28:28.170 --> 00:28:36.540 William Cheng: Okay, so they pick up this language called CPL combined programming language. And then they try to sort of simplify it or they come up with something called the basic CPL a PCP out 208 00:28:36.870 --> 00:28:46.230 William Cheng: Okay, and they start doing system problem is they start running operating system for as it turns out it was still too complicated. So they even simplify a little more. And they called us language be 209 00:28:46.800 --> 00:28:55.980 William Cheng: OK, the next generation sort of the next version of be is called see. So ever since then operating system, a Unix operating system or written see okay 210 00:28:57.000 --> 00:29:06.060 William Cheng: All right, so, so there's sort of a quick so the introduction to see so so so you know after people have see you know other people come with c++ and and then create a big mess. 211 00:29:06.660 --> 00:29:12.420 William Cheng: So C is a very, very simple programming language because it was it was designed to write operating systems. 212 00:29:13.020 --> 00:29:22.920 William Cheng: Okay, so hopefully by the end of the semester. You will also appreciate you know what a nice language CS even though some people can tell you all kinds of horror story about see they use pointers. 213 00:29:23.310 --> 00:29:33.000 William Cheng: You have to memorize. Yeah, yeah, have to manage your memory, all these horrible things so. So in the end, hopefully you will see that is actually, you know, they're actually not so bad. Yeah. 214 00:29:34.740 --> 00:29:44.280 William Cheng: Alright, so the lecture slide over here. I also have something called extra slides. So exercise or the one that I will skip right so you can actually look at all these slides over here in every slide. 215 00:29:44.490 --> 00:29:53.760 William Cheng: At the lower left hand corner. They're all these great acts that means that you are now responsible for the slides as far as exam is concerned, and also the corresponding material in the textbook you also now responsible 216 00:29:54.120 --> 00:29:56.220 William Cheng: Okay, so therefore all the slides I'm going to skip that. 217 00:29:56.460 --> 00:30:05.580 William Cheng: And if you ask me a question about them. I usually have I'm going to ask you to say, well, maybe we should ask me after the semester is over because during the semester we need to focus on slides that don't have an X on that. 218 00:30:06.390 --> 00:30:13.260 William Cheng: Yeah. Alright, so we're going to skip all this and we're going to go to, you know, the second part of chapter one. 219 00:30:13.710 --> 00:30:17.760 William Cheng: The second part of chapter one is known as a simple opportunities them. So we're going to talk about 220 00:30:18.000 --> 00:30:24.960 William Cheng: The structure of the operating system. And then we're going to sort of talk about what our processes. What is the interface to deal with processes are these kind of stuff. 221 00:30:25.170 --> 00:30:31.860 William Cheng: What is the address space look like what about threat or these kind of stuff. Right. Okay. We're still in chapter one, where we're talking about these at a very, very high level. 222 00:30:32.430 --> 00:30:41.340 William Cheng: OK. So again, this kind of go to sort of give you what the operating system interface look like. And also, what does it mean for the system have an interface, right. So we're going to talk about these issues. Yeah. 223 00:30:44.190 --> 00:30:49.800 William Cheng: Alright, so the main focus of this class is how to build an operating system. Right. So we're going to talk about the interface what obviously 224 00:30:49.980 --> 00:30:55.140 William Cheng: Facebook Live and then in chapter five, six and seven. We're going to talk about how to actually implement the operating system. Yeah. 225 00:30:56.100 --> 00:31:07.380 William Cheng: So so so since this is the introductory class we will sort of focus on the fundamentals of building operating system. So again, this is not a tech class. We're not going to talk about what's the latest and the greatest in operating system features. 226 00:31:07.740 --> 00:31:11.070 William Cheng: If you're interested in that you should take an advanced albinism class. Okay. 227 00:31:11.610 --> 00:31:18.930 William Cheng: Alright, so one of the things I'm going to focus over here is it's called sixth edition Unix. So that sounds like a really, really old UNIX and then and then that will be correct. 228 00:31:19.500 --> 00:31:30.870 William Cheng: So this is the the UNIX where the source license are available to university in 1975 from Bell Laboratories. Right. So again, the Berkeley people took you know pay pay licensing for it. 229 00:31:31.230 --> 00:31:36.690 William Cheng: You know, for, for, for this version of a Unix and then they rewrite the entire UNIX and then they have their own ISIS. 230 00:31:37.170 --> 00:31:48.060 William Cheng: Okay, so that will be the 1975 will call the sixth edition Unix. Okay, so most of the time in this class. When we talk about operating system. If I don't say that these are the newer Unix feature. We're talking about 16 Unix 231 00:31:48.600 --> 00:31:52.590 William Cheng: Yeah so. So this way we can sort of focus on the operating system design issues. Yeah. 232 00:31:52.980 --> 00:32:03.720 William Cheng: Again, because the picture that I show you I hopefully I can convince you that it has major influences on all the modern operating system such as, you know, I guess, hilarious hilarious. 233 00:32:04.200 --> 00:32:10.410 William Cheng: It's one of the sort of the very well known Unix operating system. And then there's Linux, Mac OS windows, all these kind of stuff. 234 00:32:11.340 --> 00:32:20.100 William Cheng: Alright, so one thing very special about six division UNIX is that this unit is tiny. Okay. It fits into 64 kilobytes of memory. 235 00:32:20.670 --> 00:32:28.200 William Cheng: I mean, you know, I mean, today we're used to megabytes or even gigabytes. Okay, so in the good old days that operating system fit into 64 kilobytes of memory. 236 00:32:28.440 --> 00:32:36.270 William Cheng: Okay, it's a single executable. The complete story in a single file so you can sort of think about it, this is your desk. Okay. Will you turn off the machine will 237 00:32:36.720 --> 00:32:42.930 William Cheng: Will. Will you turn off power on your machine where, where is the operating system. Well, the obviously is not just sitting on disk. 238 00:32:43.200 --> 00:32:51.930 William Cheng: So you can sort of think about this operating system. It's a single executable file just like your warm up one. Okay, it's going to completely stored in a single file on the day. So this is the operating system. 239 00:32:53.250 --> 00:32:56.370 William Cheng: Okay, so what will happen is that when you turn on the, the, the power on your machine. 240 00:32:56.580 --> 00:33:00.540 William Cheng: Will happen is that at that time, you're going to go through the boot process when you boot the opportunities that 241 00:33:00.720 --> 00:33:06.810 William Cheng: What happened is I know we're going to take this file that are sitting on the desk and then we're going to copy them into memory, right. So over here, here's 242 00:33:07.260 --> 00:33:10.260 William Cheng: Here's my icon for memory, right. So it's a rectangle, a blog over here. 243 00:33:10.440 --> 00:33:17.100 William Cheng: So what I will do is that the operating system is also typically they are compressed sitting on the desk. So in this case I need to uncompressed it 244 00:33:17.250 --> 00:33:23.220 William Cheng: So the terminology I will use is that we're going to take this operating system that are sitting on this. We're going to unfold it into memory. 245 00:33:23.790 --> 00:33:27.840 William Cheng: Okay well we're unfolding into memory is going to take a rectangular shape and this will be the awkwardness is that 246 00:33:28.320 --> 00:33:32.700 William Cheng: Okay. And then what we're going to do is that we're going to transfer control to it. Remember last time I mentioned 247 00:33:33.420 --> 00:33:44.340 William Cheng: That I mentioned that. Will you try to run program. The program needs to use memory. So, therefore, what you can do is that once you have a program inside memory you can transfer control to start executing code in memory. 248 00:33:45.060 --> 00:33:57.060 William Cheng: That. So once we unfold the code and operating system into memory. Now it's going to go into a rectangular shape we can transfer control, control to the to the CPU and the CPU will start executing code from memory, right here. 249 00:33:58.170 --> 00:34:09.930 William Cheng: Okay, so this particular processes know it's loading so happens that when you're building your businesses and you're going to load the optimism for the data into memory and then you're going to transfer control, control to her and now you're operating system is going to run 250 00:34:11.010 --> 00:34:18.000 William Cheng: Okay, so, so this, this process is actually pretty complicated. So in chapter three winners will talk about exactly what went on. 251 00:34:18.210 --> 00:34:24.810 William Cheng: During the boot process. Right. So at this point, you're in chapter one. All you needed to know is that there's gonna be some way to unfold the the CO. 252 00:34:25.770 --> 00:34:30.660 William Cheng: co founded this into memory and you transfer country to it. And now you start executing our criticism go 253 00:34:31.410 --> 00:34:39.000 William Cheng: There, this kind of operating system is known as a monolithic operating systems, a monolithic is just mean one piece. Right. So there's obviously the most city on this as one piece. 254 00:34:39.210 --> 00:34:43.230 William Cheng: You on floated into memory and you transfer control to it. And now you start running operating system. 255 00:34:44.220 --> 00:34:50.490 William Cheng: Okay so sixth edition unit as a monolithic operating system as the most of the time in this class. We also going to stick to the monolithic operating system. 256 00:34:51.240 --> 00:35:03.300 William Cheng: OK. So again, the model harmony system. They're not monolithic but if you are interested in it should take a more advanced options. The class. Yeah, I mean, we're going to talk a little bit about modern operating system. But again, most of the time we're gonna talk about 16 Unix 257 00:35:06.150 --> 00:35:12.270 William Cheng: All right. One other thing that mentioned the last lecture, I mentioned that your all your application program is not allowed to use hardware. 258 00:35:12.930 --> 00:35:23.850 William Cheng: Okay, if your application is not allowed us to hardware. Well, who gets to use hardware. Well, as it turns out, the operating system is allowed to use hardware. So in order for you to application to to use hardware, you have to ask operating system for help. 259 00:35:24.660 --> 00:35:34.410 William Cheng: Okay. So in this case, you know, you got to be running two different kinds of code, you know, inside your machine one kind of CO is not allowed to use the hardware and the other kinds of codes allowed to use the hardware. So how 260 00:35:34.950 --> 00:35:44.700 William Cheng: So how can I work. Okay, so, so why does it again, long time ago, the ordinances and people to compile it people the horror people they got together and they try to sort of figure out how to figure out how to do this. 261 00:35:45.270 --> 00:35:51.300 William Cheng: Okay, the hardware people to say, Oh, we have to do it. Okay, so in order for you to people, you know, for, for, for your, for your program. 262 00:35:51.570 --> 00:35:56.010 William Cheng: One run in the mode where you don't have access to hardware and the other one have access to hardware. 263 00:35:56.250 --> 00:35:59.400 William Cheng: You know, inside the hardware. We're gonna have we're gonna we're gonna be able to tell the difference. 264 00:35:59.640 --> 00:36:07.500 William Cheng: Yeah, so this is no a CPU mo or processor mode, right. So again, this class we're going to use the word CPU processor core interchangeably. 265 00:36:07.740 --> 00:36:14.820 William Cheng: Okay, so every CPU has to have at least two modes. Okay. In one. Well, you're not allowed to access hardware and the other one. You're allowed to access hardware. 266 00:36:15.390 --> 00:36:24.450 William Cheng: Right. Alright, so the CPU more over here. It's gonna be one bit inside the CPU is going to be a hardware register bit over here is part of the processor state. 267 00:36:24.990 --> 00:36:30.450 William Cheng: Okay, so you can actually, you know, if you are the opportunities and you'll be able to control that that particular state. 268 00:36:30.750 --> 00:36:35.010 William Cheng: Whether you were there, whether you're running your application program or you're running the the operating system. 269 00:36:35.460 --> 00:36:40.590 William Cheng: Yeah, so most computer have at least two modes are actually, you know, we hear what is called the user mode. 270 00:36:41.160 --> 00:36:53.610 William Cheng: Okay, so the user mode is the more that you run your application, right. So in this case, this user mo has the fewest privilege or guys, what kind of problems do you want rise. For example, if you want to use the disk. Well, if you're in the user mode, you are not allowed to use the desk. 271 00:36:54.720 --> 00:36:58.380 William Cheng: Okay, if you want to use the keyboard, you're if you're in the user mode. You're not allowed to use the keyboard. 272 00:36:58.920 --> 00:37:08.490 William Cheng: Okay. So pretty much in the user mode. You're not allowed to use any hardware. Right. The only whether you're allowed to use this use the CPU and you're allowed to use the memory and you are not allowed to use any of the devices. 273 00:37:09.240 --> 00:37:15.210 William Cheng: Well guys, remember right with the by whoring two, three different category. There's a CPU. There's memory and everything else and call them devices. 274 00:37:15.660 --> 00:37:20.100 William Cheng: Okay. So, therefore, if you're a new user mode. You're not allowed to touch devices. Okay. 275 00:37:20.790 --> 00:37:30.360 William Cheng: So now, what, why are you not allowed to do that, right, because again, your laptop, you can run 50 different application if every application. Try to try to try to use the devices directly, you're gonna end up with a big mess. 276 00:37:30.600 --> 00:37:35.340 William Cheng: Okay. So, therefore, if you want to use devices, you have to ask the operating system for help. Yeah. 277 00:37:36.540 --> 00:37:43.980 William Cheng: The demo is called, it's called the privilege mo. So in this mode, you have all the privileges that means that you can use any kind of piece of hardware that you want. 278 00:37:44.970 --> 00:37:49.800 William Cheng: Okay, so the only code that run inside this mo has to be part of the operating system. 279 00:37:50.580 --> 00:37:55.440 William Cheng: Okay, otherwise you are not allowed to use hardware. Right. No, you're not allowed to use any of the privilege, the 280 00:37:55.710 --> 00:38:00.450 William Cheng: Order to do the privilege operation. So are there other previous operation right, one of the 281 00:38:00.750 --> 00:38:09.660 William Cheng: One of the things over here is using the hardware. As it turns out, there are other things that you're allowed to do so again throughout the semester will also talk about what are the privilege thing that you're allowed to do 282 00:38:09.960 --> 00:38:15.450 William Cheng: You know, in addition to touch into hardware. Okay. But at this point, we just want to say that while you know that's one thing that you have to do. 283 00:38:16.020 --> 00:38:20.730 William Cheng: You know that that if you want to, you want to use hardware directly. You have to be in the privilege mode. 284 00:38:21.240 --> 00:38:29.070 William Cheng: Yeah, all right. For sixth edition your ex right that's the units of focus in this class. The entire operating system run in the privilege mode. 285 00:38:29.940 --> 00:38:37.140 William Cheng: Okay, everything else is an application and run, they run into user mode. And so that's one of the reason we like, we love to talk about 16 units. 286 00:38:37.380 --> 00:38:42.420 William Cheng: Because there's six of these units is very, very clear right if you are part of the operating system you run in the privilege mo. 287 00:38:42.660 --> 00:38:48.030 William Cheng: If you are not, you know, running the privilege or that means that you're running the user model that in that case you are navigation. 288 00:38:48.810 --> 00:38:54.660 William Cheng: Okay, so it's very, very clear cut. You know who you know who you know who's an application provider who's the opposite. Yeah. 289 00:38:55.290 --> 00:39:07.830 William Cheng: For other system over here like the modern operating system. Right. So again, we don't talk about this very often but here is one example. We talked about it for other sister, the major subsystem providing opportunities and functionality may run in the user mode. 290 00:39:09.120 --> 00:39:13.650 William Cheng: Okay. So in today's companies, the same, you know, part of the operating system actually running the user mode. 291 00:39:14.070 --> 00:39:23.490 William Cheng: Okay, because you don't really need all that privilege as a unique privilege in order in order for you to use hardware. So if you don't use hardware. What do you really have to be privileged, why not because you don't have to be 292 00:39:24.000 --> 00:39:32.430 William Cheng: OK. So again, today's modern operating systems, a little complicated. Again, most of the time, and I can talk about that. Yeah, right. Just need to understand that, you know, today's modern the modern operating system. 293 00:39:33.150 --> 00:39:47.640 William Cheng: The audiences and functionality may be provided in user space programs. Okay. All right. We're going to use the word Colonel, right. So what is the current arise, though the colonel to me that the portion of the operating system that run in the privileged privileged mode. 294 00:39:48.660 --> 00:39:55.290 William Cheng: Okay, so for 16 units is very, very the sixth edition Unix to work, Colonel and optimism, they're interchangeable. Right. 295 00:39:55.890 --> 00:40:01.590 William Cheng: Okay, because in the 60s you next. The entire operating system running the privilege mo. So the word Colonel equals two operating system. 296 00:40:02.160 --> 00:40:09.810 William Cheng: Okay. In modern operating system to work her know and obviously then don't mean the same thing anymore because part of the organization can run in user space. 297 00:40:10.200 --> 00:40:18.900 William Cheng: Okay. So, therefore, you know, if you're talking about today's albinism to work her no meaning that the colonel means that the portion of the racism that run in the privilege well 298 00:40:20.460 --> 00:40:28.890 William Cheng: Alright, so again, for most of this class we're going to, you are going to be using the word colonel and operating system interchangeably, because most of the time we're focused on the sixth edition Unix 299 00:40:29.550 --> 00:40:33.990 William Cheng: OK, so again that's reason we love to talk about six additional next right because it's very, very clear cut. Okay. 300 00:40:34.350 --> 00:40:45.030 William Cheng: When we do our Colonel programming assignment or Colonel communism is going to be looking like sixth edition Unix. So therefore, again, for our Colonel programming is I'm an operating system kernel, they mean exactly the same thing. Okay. 301 00:40:47.670 --> 00:40:56.100 William Cheng: Alright, so let's take a look at the structure of the operating system. So the reason I'm going to sort of take a look at it from a very, very high level point of view, right. So, 302 00:40:56.370 --> 00:41:00.780 William Cheng: So you know if you're if you forget your laptop. What is your laptop doing right now. 303 00:41:01.530 --> 00:41:05.430 William Cheng: Okay, so the answer is that hopefully your laptop is not doing is not running the opportunity to Sam. 304 00:41:05.760 --> 00:41:13.020 William Cheng: Because your laptop needs to, you know, be devoted all this horror. He spent a lot of money on your hardware you want the hardware to be running application code. 305 00:41:13.470 --> 00:41:18.960 William Cheng: Okay, you want to run your application. Very, very well. So, therefore, you want to dedicate all your hardware to run applications. 306 00:41:19.320 --> 00:41:27.210 William Cheng: Okay, you only call upon the services of the necessary when you have no choice, right. So what do you have no choice. Well, for example, if you want, use the internet. 307 00:41:28.200 --> 00:41:31.380 William Cheng: Okay you application program. Want to use the internet. Can you use the internet. 308 00:41:31.620 --> 00:41:39.750 William Cheng: By the by, by yourself. Well, I'm including you cannot because the internet is hardware. So in order for your application program to use the internet, you have to ask the organism or help 309 00:41:40.260 --> 00:41:46.080 William Cheng: Okay, can you use that this by yourself or again. You cannot anything that's our hardware related, you have to as Calvinism well 310 00:41:46.710 --> 00:41:55.980 William Cheng: Okay, so hopefully know your machine. Most of the time is not running any operating system call because we want it to spend all its time running applications. Yeah. 311 00:41:56.310 --> 00:42:07.200 William Cheng: Alright, so, so how do you actually execute operating system code. Okay, so here's an important slide to tell you that there's only two ways to run application code inside, there's two way to run operating system code their 312 00:42:08.010 --> 00:42:13.470 William Cheng: Number one is that the application program call upon the app or the organism via something called traps. 313 00:42:14.100 --> 00:42:22.680 William Cheng: And so you're going to see this picture draw many, many times over here. So, now look like this over here in the middle part over here is the operating system. So again in six addition units. This will be the Colonel. 314 00:42:23.580 --> 00:42:36.360 William Cheng: Colonel exactly the same on top of we're here you're running the application over here. Okay, and their application running the user mode, right. So on pop over here. We're going to see the word the letter, a letter you to say you're running application or you're running a 315 00:42:37.620 --> 00:42:41.040 William Cheng: running code and the user mode at the bottom part over here is going to be the hardware. 316 00:42:42.600 --> 00:42:51.180 William Cheng: Okay, so if you're running an application over here. You're running code on top over here. How do you get into the operating system. Right. The idea here is that you trap into the organism. 317 00:42:51.690 --> 00:42:58.980 William Cheng: Okay, so you can sort of think about is that this line over here has a bunch of trap door. Okay. And then when you step on a trap door. Boom, you're inside the operating system. 318 00:43:00.390 --> 00:43:04.380 William Cheng: Okay, so that's wrong way to go into the operating system is by tapping into the operating system. 319 00:43:04.800 --> 00:43:15.090 William Cheng: Okay, so they don't want to talk about exactly how you do that. Right. But right now we just need to sort of a concept of you're executing operating system called he want to go into the organism. How do you do it, you have to fall into a trap. 320 00:43:16.140 --> 00:43:25.410 William Cheng: Yeah, right. The second way to go into the the organism over here is that external devices call upon the organism. The something called interrupts 321 00:43:25.980 --> 00:43:34.170 William Cheng: Okay, so you probably heard the term interrupts or so ago, as far as this cost is concerned, every time when we use the word interrupt. We're talking about a hardware interrupt. 322 00:43:34.500 --> 00:43:43.620 William Cheng: Okay, so, so, so again, these are external devices when they have something they want the system to do what they will do is that they will interrupt the CPU, they will generate a highway interrupt. 323 00:43:44.040 --> 00:43:50.250 William Cheng: Okay, these kind of horror interrupt is typically, you know, the kind of interrupt. They have our call IO completion interrupt. 324 00:43:50.760 --> 00:43:58.470 William Cheng: Okay, so these are the IoT devices. If you ask the disk to try some some data for you so so so again the picture that we saw before the desk over here. 325 00:43:58.680 --> 00:44:05.700 William Cheng: There's some data you need to transfer them. What do you trust with them while you transfer them into memory right over here. Here's memory or sitting right here. Right here. 326 00:44:05.910 --> 00:44:16.530 William Cheng: You want to copy data from this into memory. So you need to tell the device. The device over here. It's going to be is going to be caused this controller. So there's going to be a disk controller that control the desk. 327 00:44:17.220 --> 00:44:25.800 William Cheng: Okay, so you can tell that this controller to transfer data from this into memory and then in that case when that data transfer is finish that this control is your turn to say, hey, I'm done. 328 00:44:26.580 --> 00:44:30.450 William Cheng: Okay, so what it will do is that it would generate what's called an IO completion interrupt. 329 00:44:30.660 --> 00:44:39.060 William Cheng: This particular operation is known as the input output operations, you're inputting your copy data from a distant memory if you're out, putting you're copying data from the memory on to the desk. 330 00:44:39.540 --> 00:44:41.760 William Cheng: Okay. And also, this can be copy data from, you know, 331 00:44:42.390 --> 00:44:47.790 William Cheng: From the keyboard. We try to read it up on the keyboard, you're copying data from the keyboard into memory. So that's input. 332 00:44:48.060 --> 00:44:54.630 William Cheng: And if you want to print, you know, information to the screen that you need to copy data from memory on to the the display device. 333 00:44:55.110 --> 00:45:05.910 William Cheng: Okay, so in that case it will be an output operation. Okay, so we call these devices IoT devices when when the IoT devices finishing an operation. What it will do is that it will generate IO completion interrupt. 334 00:45:06.390 --> 00:45:12.780 William Cheng: Yeah, so in this case is going to call upon the operating system to say hey drop whatever you are doing. And then you need to service the interrupt. 335 00:45:13.320 --> 00:45:21.930 William Cheng: Okay, so will you serve as the interrupt the operating system is going to start executing code that's known as the interrupt service routine so that you will see the you know the abbreviation is our 336 00:45:22.740 --> 00:45:31.200 William Cheng: Okay, I saw is the interrupt service routine. So when you try to handle a hardware interrupt you will execute to interrupt service routine and now you're operating system is actually Nicole. 337 00:45:32.730 --> 00:45:41.310 William Cheng: OK. So again, there are only two ways to run up in the system whole. One is that the application profile will trap into the operating system. So you can start executing operating system call 338 00:45:41.520 --> 00:45:49.800 William Cheng: And then the second way is that when you upload your hardware device generate a horror interrupt, which is IO completion or up and then are you going to start executing 339 00:45:50.130 --> 00:46:00.180 William Cheng: You know, obviously some Co. So in this case, you're going to be executing a special kind of operating system co that's know as interrupt service routine. Okay, so you're sick. You're servicing all these hardware interrupts 340 00:46:01.680 --> 00:46:04.500 William Cheng: Alright, so these are the two is getting to the operating system and then 341 00:46:04.740 --> 00:46:14.340 William Cheng: What I'm going to do right now is I'm going to give you a brief overview of what hardware look like, right, so remember the first lecture I sort of mentioned that you know you were supposed to have a prerequisite. 342 00:46:15.000 --> 00:46:22.230 William Cheng: That that so to give you the background of computer organization, right. So now I'm going to give you a brief review a computer organization. Okay. 343 00:46:24.510 --> 00:46:33.120 William Cheng: Okay, so here's a reviewer computer organization. Okay, so what is the computer look like. So this picture sort of show you that what a computer look like. Okay. 344 00:46:33.390 --> 00:46:43.140 William Cheng: On the left hand side we have x86 CPU RAM and CPU processors empty x86 at Intel CPU Intel CPU is kind of like the most popular CPU. 345 00:46:43.530 --> 00:46:53.970 William Cheng: For desktop and laptop computers. Okay. So, therefore, we're going to use x86 as an example. There are other CPUs. But, you know, again, because of the popularity wouldn't talk about x86 CPU now. 346 00:46:54.420 --> 00:47:02.640 William Cheng: All right, instead of computer. We have the CPU here on the right hand side over here. There's memory. Memory is the one that you have is called RAM and also known as RAM. 347 00:47:03.180 --> 00:47:11.100 William Cheng: This is why you have four gigabytes a gigabyte 16 gigabytes of those are your RAM, all these other hardware. There are no as device controller. 348 00:47:11.550 --> 00:47:24.120 William Cheng: Okay, so what are device controller right device controller or the one that control to other the US to control devices. So over here, if you have a hard disk over here, right, then this device controller will be a disk controller. 349 00:47:24.540 --> 00:47:31.740 William Cheng: Okay, so, so, so, you know, this controller will have a cable. The connect to the desk over here, this will be the, the, the, the disk controller. 350 00:47:32.280 --> 00:47:34.470 William Cheng: What about on the right hand side over here is your internet connection. 351 00:47:34.890 --> 00:47:44.310 William Cheng: Right in this case on the car over here. It's going to be you're in a network interface card, the network interface card. If it's a wire car, there's going to be an Ethernet plugin. You can actually plug into it. Okay. 352 00:47:44.550 --> 00:47:47.460 William Cheng: On the other side, they also connect to a device controller. 353 00:47:48.270 --> 00:47:54.840 William Cheng: Okay, if it turns out that this one is a wireless internet. Well, then in that case, you're going to see antenna sticking out. Okay, the antenna car over here. 354 00:47:55.200 --> 00:47:59.580 William Cheng: That can receive wireless signals. On the other hand over here. Again, they are connected to a device control it. 355 00:48:00.090 --> 00:48:08.310 William Cheng: Okay, so. So in this case, all these things are connected together using a bus architecture. Okay. There are other architecture out there, you know, for 356 00:48:08.640 --> 00:48:15.390 William Cheng: You know, for for your computer. But typically, what we see is that a computer is this thing called the bus architecture. Okay, so what is the bus architecture. Right. 357 00:48:15.810 --> 00:48:26.910 William Cheng: So over here, there's a bus, a bus is a collection of signals. Okay, so what kind of signals do you have right. So over here on the left hand side will sort of show you what are the typical signal on the bus that 358 00:48:27.390 --> 00:48:37.080 William Cheng: So the first 32 signals over here again the bus is very, very wide. There are lots of signals on their 32 of them is known as the address signals. Oh, guess what I addresses, right. So we try to 359 00:48:37.380 --> 00:48:45.090 William Cheng: We try to talk to any of these devices right on the right hand side over here a bunch of devices when you try to talk to one of the devices over here, you need to 360 00:48:46.290 --> 00:48:55.830 William Cheng: You need to be very, very clear exactly which device, you want to talk to. Okay, so what you will do is that you will put an address onto the bus to address one of the devices over here. 361 00:48:56.580 --> 00:49:00.120 William Cheng: Okay, so by controlling what address, going to the bus. You can write 362 00:49:00.390 --> 00:49:10.200 William Cheng: You can actually talk to the memory, a memory is really not a device memories, kind of a special piece of hardware right so you can use the address to talk to memory. You can also use a different address to talk to different devices. 363 00:49:10.800 --> 00:49:21.570 William Cheng: Okay, so this way, all these memory, all these devices. They basically what they're doing is that they all they all they also connect to the bus. So what they will do is that it will look at this 32 bit address over here and try to sort of figure out that 364 00:49:21.960 --> 00:49:25.170 William Cheng: You know, is the CPU, try to talk to me or the CPU tried to talk to somebody else. 365 00:49:25.860 --> 00:49:33.210 William Cheng: Okay, if the address map to your device, then your device will have to interact with the CPU. If the address nap or somebody else will then your device will stay quiet. 366 00:49:34.110 --> 00:49:42.750 William Cheng: Okay, so this is the basic idea of the bus architecture. Okay. Everybody's looking at us look at the address to see if you know the CP want to talk to them or the CPU want to talk to somebody else. 367 00:49:43.320 --> 00:49:49.470 William Cheng: There. Alright, the next 3232 signals over here is known as the data they're written as the zero to 31 368 00:49:49.980 --> 00:49:59.940 William Cheng: So if the CPU want to write data into memory, what he will do is that it will put an address that will map to the address for the memory. And then what it will do is that it will pass, they will put a data pattern. 369 00:50:00.150 --> 00:50:10.260 William Cheng: On the zero to 31 and 32 bit data. So in this case, the memory will be looking at the bus, say, oh, this pretty good operation is for me. So therefore you will take data from the bus into memory. 370 00:50:11.010 --> 00:50:19.950 William Cheng: Guys. So in this case, in this example here, we are trying to write data onto the bus. So therefore, we need to set the signal to equal to zero and the right signal equal to one. 371 00:50:20.970 --> 00:50:26.220 William Cheng: Okay and get all the signal will go on to the bus the memory over here sitting on the other side of the bus. Look at the signals. 372 00:50:26.460 --> 00:50:39.090 William Cheng: Oh addresses for me and they're really equal to zero, right, equal to one. So the CPU want to write data into memory, the CPU will put some data pattern over your onto the bus and then the memory will take the data pattern over here and write it into the memory location. 373 00:50:40.290 --> 00:50:45.810 William Cheng: Okay, this is how you write to memory. Okay, how do you prefer memory, right. So sometimes you know your city wants to 374 00:50:46.140 --> 00:50:53.460 William Cheng: You know, refer memory. So again we will do the same thing. It will use the address over here, you know, put the address that will map to the memory location over here. 375 00:50:53.700 --> 00:50:58.980 William Cheng: And then he was said, I'm going to clean out the screen a little bit with said really equal to y right equal to zero. 376 00:50:59.790 --> 00:51:01.800 William Cheng: Okay we equal to one equal to zero. 377 00:51:02.220 --> 00:51:11.070 William Cheng: So in this case, the CP will not be putting any data onto the bus. In this case, the memory over here, it will see that the address over here map to his address range. 378 00:51:11.310 --> 00:51:18.330 William Cheng: And then you will see that re equal to one, right, equal to zero. So, therefore, the memory over here will be providing data for the bus. 379 00:51:19.170 --> 00:51:23.460 William Cheng: Okay, the technical terminology over here is that the memory will drive the bus. 380 00:51:23.730 --> 00:51:33.120 William Cheng: I mean it's kind of funny. It's like driving the bus over here. So in this case, the bus over here. The address and all the other signals they are driven by the CPU, while the memory over here will be 381 00:51:33.420 --> 00:51:41.820 William Cheng: Will will be driving the zero to 3031 from the memory over here. We'll put the data onto the bus, and now the CPU will take the data over here into the CPU. 382 00:51:42.720 --> 00:51:52.650 William Cheng: Okay. Where would it CPU take that into, well, I mean the CPU is really big over here. So the data will go somewhere. Again, if you want to know exactly where it goes. You have to take a double the class on computer organization. 383 00:51:53.460 --> 00:51:58.770 William Cheng: Okay, so now we just need to trust that the CPU will make sure that it will go to the right place. Yeah, right. 384 00:51:59.520 --> 00:52:04.020 William Cheng: There are other signals over here. There's a lot sick, though, we're not going to talk about a lot signal until chapter five. 385 00:52:04.410 --> 00:52:08.820 William Cheng: Okay, and then there's not a secret. Over here is the interrupt signals which we just talked about. 386 00:52:09.360 --> 00:52:16.620 William Cheng: Okay, so what happened is that all these devices controller over here, when they perform an IO operation. So again, how do you transfer data on a distant memory, right. 387 00:52:17.160 --> 00:52:22.470 William Cheng: So this is sitting over here, right, the data is right here. So in order for you to transfer data from this into memory. 388 00:52:22.650 --> 00:52:31.140 William Cheng: It has to go through the device controller and the device controller will transfer data to memory using the bus and then eventually the data will go to memory over here. 389 00:52:31.350 --> 00:52:37.950 William Cheng: When it finished transferring all these data into memory, what he will do is that it will pull the interrupt signal. So the interesting thing is like when you're on the bus. 390 00:52:38.160 --> 00:52:46.230 William Cheng: There's this line that you pull right when you pull the, you know, pull the line the buzzer will go off and the bus driver knows that you know he has to service your interrupt. 391 00:52:46.950 --> 00:52:48.510 William Cheng: OK. So again, that's exactly the same thing as 392 00:52:49.080 --> 00:53:02.160 William Cheng: As on this particular bus. So when one of the device controller over here when it finished it I operation, what he will do is that it will set the set the interrupt signal to equal to one. OK, and now the CPU over here. What it will do is that he will react to the interrupt. 393 00:53:04.380 --> 00:53:12.840 William Cheng: Okay, so, so, so, so anyways. So any of these devices over here. They can say the interrupt a signal to wine. So you can sort of think about all the signals over here. 394 00:53:13.080 --> 00:53:25.320 William Cheng: They are logically or together. So if any other device controller pulled the interrupt signal or pull the the buzzer on the bus, then in that case the CPU will get interrupted. Okay. So this guy is a senior start running co as part of the operating system. 395 00:53:26.940 --> 00:53:32.610 William Cheng: Alright, so again this is our simple introduction to the bus architecture. Right. And this is basically how it's gonna work. Okay. 396 00:53:33.360 --> 00:53:38.490 William Cheng: Alright, so let's go. The next thing we're going to talk about is what goes on inside the x86 CPU. 397 00:53:39.120 --> 00:53:49.350 William Cheng: So these, you know, these things are x86 CPU specific every CPU, they have a different set of register. They have different set of organizations again to learn the full picture. 398 00:53:49.560 --> 00:53:54.360 William Cheng: You have to take a computer organization class or maybe some advanced, you know, hardware class. 399 00:53:54.960 --> 00:54:04.620 William Cheng: But since we're focusing on x86 CPU. We're going to sort of talk about some of the important register inside the x86 CPU, we're going to divide all the registered into four different category. 400 00:54:05.040 --> 00:54:15.450 William Cheng: One of them called the index register and the other one is called the segment register and then there's a general purpose register and then everything else. We're going to lump them together, call them the other registers. 401 00:54:16.050 --> 00:54:20.700 William Cheng: Okay. Alright, so the first we're going to look at our the index registered in that register are very, very important. 402 00:54:21.150 --> 00:54:27.030 William Cheng: All the way to the end of the semester. We're going to continue to talk about in that register inside x86 CPU. Yeah. 403 00:54:27.840 --> 00:54:46.620 William Cheng: Alright, so there are three register over here. So, by the way, Intel the letter E over here means that it's a 32 bit register. Okay, so again, this is the x86 CPU x86 mean that it's it's a 32 bit CPU for Intel, there are 64 bit CPU. So there are call 404 00:54:47.850 --> 00:55:01.860 William Cheng: You know, I guess, a n d 64 something like that and called Customer different thing. So when you see the letter 64 that means a 6040 CPU six will be CPU right if you see the word x86 or I 386 or something like that. They are the 32 bit CPU. Yeah. 405 00:55:03.540 --> 00:55:07.590 William Cheng: So he stands for 30 to be registered. So these register so panel one or registers. Right. 406 00:55:08.100 --> 00:55:21.390 William Cheng: So again, if you take an hour class you are very familiar with the register. So, so instead of CPU. They are very, very fast memory device. So they're very, very fast memory locations and these memory locations have names for it and they are specialized 407 00:55:21.780 --> 00:55:26.100 William Cheng: Okay, so these specialized memory location inside the CPU. They're called registers. 408 00:55:26.580 --> 00:55:36.540 William Cheng: Now alright so let's take a look at the first one is called VIP so Ii Ii, P stands for. It stands for instruction pointer. So they point to an instruction to be executed. 409 00:55:37.410 --> 00:55:43.500 William Cheng: Now guys, what does that look like right so let's take a look at the picture looking like this. Okay. On the right hand side over here. Maybe I should look move this 410 00:55:43.890 --> 00:55:51.090 William Cheng: This video to a little higher up over. It doesn't matter. Okay. So on the right hand side, I'm going to remind you what the address space look like 411 00:55:51.630 --> 00:55:57.540 William Cheng: Okay, the address is over here again memory location zero and the no BS zero x F, F, F, F, F, F, F. 412 00:55:58.200 --> 00:56:03.810 William Cheng: Okay, the top bar over here is going to be the tech segment on the coast admin, followed by the data segment, followed by the dynamics. 413 00:56:04.410 --> 00:56:08.970 William Cheng: And the bottom part when we have the stacks like man, the stacks happening are divided into stock frames. 414 00:56:09.360 --> 00:56:21.180 William Cheng: Every Frame over here correspond to a Tu, Tu, Tu, Tu, Tu, Tu, Tu a function. So at the beginning when you start running your program your programs. FIRST FUNCTION IS MAY right so the bottom stock room over here is going to correspond to the main function. 415 00:56:21.660 --> 00:56:24.120 William Cheng: OK. So again, what's you know I mentioned before. 416 00:56:24.570 --> 00:56:35.640 William Cheng: The function argument and local variable. They live inside the stack rank. So for the main function. The function arguments RV and RC right so we're here inside the Starcraft over here we have the RFC and the RV. 417 00:56:35.910 --> 00:56:38.850 William Cheng: And if we have also a local variable. They all live inside staggering. 418 00:56:39.480 --> 00:56:52.080 William Cheng: Okay, so your main functions not cause some other function right so it's gonna call function x x gonna call why why is gonna call z. So, when we're writing the function z over here, we are so, so again, what we're running the function see over here. 419 00:56:53.580 --> 00:57:05.220 William Cheng: Let me backtrack a little bit when you write your code in C or maybe when you write your code in c++. I don't know if you have an Evernote is that every piece of code that you have ever written. They are all part of a function 420 00:57:07.140 --> 00:57:20.130 William Cheng: Okay, let me repeat that right every piece of code that you have ever written. Okay. That is because going to do anything. They are all part of a function. Okay, so in order for you to execute code your code has to be inside of a function 421 00:57:22.290 --> 00:57:31.560 William Cheng: Alright, so, so, so whenever we talk about a function, the function as a stack frame. So, therefore, you know, all the function argument, a local variable. They are alive. They're living inside the sack. Right. 422 00:57:31.980 --> 00:57:42.330 William Cheng: Okay, so when your main function called X x Y Y called z. And then in this case we're executing the function z. So, therefore, the stack frame for function z is going to be the top stack frame. 423 00:57:43.080 --> 00:57:47.250 William Cheng: Okay, so that will be correspond to the function that the code that you're actually running inside your CPU. 424 00:57:48.900 --> 00:57:56.400 William Cheng: Alright, so again, this is the example again main core x x or y y called Z when you're in the function z your stack will look like this. 425 00:57:56.880 --> 00:58:03.090 William Cheng: Okay. Alright, so now let's take a look at the CPU and there's sort of final word the CP register pointing into now. 426 00:58:03.840 --> 00:58:09.600 William Cheng: The IP race over here. That one is the instruction pointer is going to point to the code that you're executing right 427 00:58:10.290 --> 00:58:20.400 William Cheng: Okay, because their instruction pointer need to point your instruction, where you instructions, your instruction is the tech segment over here. So he IP. I'm going to draw the picture like this. He IP will point to the code that you're running 428 00:58:22.050 --> 00:58:27.180 William Cheng: Okay, that's the purpose of VIP right so again this location zero, this is zero effort. 429 00:58:28.170 --> 00:58:38.430 William Cheng: So this code right here. It's going to have a virtual address okay that virtual address is kept track of inside the IP register. So yeah, if you registered. Tell you what, CO, you're going to execute next 430 00:58:39.240 --> 00:58:47.790 William Cheng: Okay, that's the purpose of the IP register. Again, it's a very, very important, very important register, because that tells you what co you're about to execute then 431 00:58:49.170 --> 00:58:53.940 William Cheng: The next point of view is called ESP ESP over here, point to 432 00:58:54.960 --> 00:58:56.550 William Cheng: Point to the top of the stack friend. 433 00:58:57.390 --> 00:59:04.380 William Cheng: Okay, so remember at the top of the screen is very important. It tells you what's that friend that you are very you using and this is the current code that you're running 434 00:59:04.650 --> 00:59:11.340 William Cheng: Okay, so in this case it. This is the functions if this stack rank correspond to the to the z function. Where is the z function. 435 00:59:11.820 --> 00:59:16.380 William Cheng: What is the function is executable code. So the Z functions that you're sitting over here in the tech segment right here. 436 00:59:16.950 --> 00:59:27.870 William Cheng: Okay, and he IP will point to the middle of the z function as a function of her left curly bracket. I like curly bracket. So he IP will be pointing somewhere in the middle of the z function instead of tech stack, man. 437 00:59:28.380 --> 00:59:34.500 William Cheng: What the star pointers a USP obvious stands for the stack for a pointer, the stack pointer always point to the top of the stack. Right. 438 00:59:36.330 --> 00:59:49.470 William Cheng: Okay, so, so the, you know, so over here you know that this is the function that that the the running over here. So in order for you to find the find out about function argument and local variable. Where do you find it. You find it right below the stack pointer. 439 00:59:50.760 --> 00:59:55.620 William Cheng: There. The next point over here is known as EEP EEP EEP is known as the base pointer. 440 00:59:57.300 --> 01:00:06.270 William Cheng: Okay. So in this case, what are the base pointer pointing. Alright, so that this picture over here will show you that the best the base pointer over here will pointed the middle of the stack frame that 441 01:00:06.600 --> 01:00:20.580 William Cheng: Of the code that you're running right so again you are calling the function z over here, here's the code for z IP will point right here ESP will apply right here. Okay, this is how you execute the code inside function z. 442 01:00:21.780 --> 01:00:27.660 William Cheng: Okay, so therefore, when you're writing the code is a function see over here. Yeah, IP will tell you what is the next line of code, you have to execute 443 01:00:27.900 --> 01:00:35.340 William Cheng: And then, yes, P will tell you, and ESPN ABP they are working together, they will tell you, where are the function argument, a local variable. 444 01:00:36.240 --> 01:00:43.620 William Cheng: Okay, more importantly, what is your function going to do your function at some point is going to call another function, it will you call another function, you need to build the next stack frame. 445 01:00:44.040 --> 01:00:54.330 William Cheng: Okay, so let's say that the z function over here called the prime. Right. How do you, you know, execute function is the prime. What you have to do is that you have to build a stack frame for z prime right this is gonna be a stockbroker z. 446 01:00:54.870 --> 01:00:59.940 William Cheng: And z primes code is going to be somewhere else you're going to build the stack, Ray. Where do you build a stack rank. 447 01:01:00.420 --> 01:01:10.410 William Cheng: Okay, you build the stack right on top of the current point. The point where ESP is pointing to. Okay so ESP is pointing right here so that you know where to build the next x ray 448 01:01:12.750 --> 01:01:21.450 William Cheng: Okay, so therefore, these three register are super important. You know, all the way until the end of the semester, you're going to continue to look at these these register EI P pointed a stag. 449 01:01:21.930 --> 01:01:36.240 William Cheng: Point of the text like man telling you which instruction to execute next ESP point at the top of the sacraments, so you know where to build the next step for him and he VP pointed the middle of the top stack right so this way you can access function argument and local variables. 450 01:01:37.920 --> 01:01:41.640 William Cheng: Okay, so these are the three most important registers that 451 01:01:42.360 --> 01:01:49.110 William Cheng: Alright, so again we will sort of give you a brief introduction here and then later on, you're going to see these three register over and over again until you're sick of it. Okay. 452 01:01:49.470 --> 01:01:51.870 William Cheng: All right, so, so I promise you will see them get there. 453 01:01:52.680 --> 01:02:03.480 William Cheng: Alright, the next set of register over here is known as the segment register. So these are Intel specific so they have something called a co segment register that describe what that is. Well, you know what the CO look like 454 01:02:03.930 --> 01:02:06.990 William Cheng: They have the stack segmented describe what the stack look like they have a data segment. 455 01:02:07.650 --> 01:02:22.050 William Cheng: So discover the data segment look like. So again, they're not very, very important. And because they are Intel specific they're only one thing is important. I want to point out inside Intel inside the cyber registered. There's a bit over here that's that gives the CPU mode. 456 01:02:23.220 --> 01:02:33.810 William Cheng: Okay, so get every CPU has have a CPU mode for Intel for some reason they actually used to bits for the CPU mo. So if it's too bad can be 000110 and one one. 457 01:02:34.320 --> 01:02:51.420 William Cheng: Okay, so he called them brings that can be ring 0312 and three, and these are the CPU mode and they are inside the coast segment registers. Okay. So one thing that you should know is that since there instead of CO regimen second register over here ring zero over here correspond to 458 01:02:52.680 --> 01:03:00.480 William Cheng: Renew zero over here correspond to the privilege Mo and ring three over here correspond to the to the to the user mouth. 459 01:03:01.230 --> 01:03:11.160 William Cheng: Okay, what about we wanted to. Well, for some reason, into a long time ago when it is that the CPU. They said, well, we're going to sort these our CPU, so that we can actually have other privilege small incisions are nobody actually use them. 460 01:03:12.000 --> 01:03:22.260 William Cheng: Okay. So in the end, pretty much. Pretty much every school. Yes. Yes. Just to mow Mosey mosey over here or ring zero is for the privilege Mo and ring three over here is for the user vote. 461 01:03:23.460 --> 01:03:26.970 William Cheng: Or so again for intelligence inside the CO segment register. 462 01:03:28.440 --> 01:03:35.640 William Cheng: Right. The next set of register over here is known as the general purpose register. So, entire column, E, F, CBS he CX EDS 463 01:03:36.150 --> 01:03:42.960 William Cheng: So they are used for general operations for the CPU. So what kind of operation in general operation. Right. So for example, you want to add something. 464 01:03:43.170 --> 01:03:50.460 William Cheng: You want to subtract something you want to perform logical and logical or or like an operation. So those are called arithmetic and logical operation. 465 01:03:50.880 --> 01:04:05.670 William Cheng: Okay, so in that case, they will involve the general purpose register. Okay, so let's take a look at an example over here to see how they're being used over here. So let me clean up the clutter over here a little bit there. So for example, you want to say X equals to y plus z. 466 01:04:06.840 --> 01:04:11.970 William Cheng: Okay, so, so, so how do you actually do that. Right, so x y&z their, their variables. 467 01:04:12.240 --> 01:04:22.770 William Cheng: Okay, so where are the variables rise again the global variable living the data segment that dynamically allocate a variable there live inside the dynamic region. And then if you're a local variable function argument they live inside the sack. Right. 468 01:04:23.400 --> 01:04:31.920 William Cheng: There so be here. So let's say the x, y AMP Z. They're all you know global variable right so axis here. Why is here and these here. Right, so their memory locations or correspond to it. 469 01:04:32.160 --> 01:04:40.560 William Cheng: And you want to go to y and z. And then you need to add the you know the number together and put it into the memory location, known as x 470 01:04:41.370 --> 01:04:48.060 William Cheng: That. So we mentioned before that these are virtual addresses. Right. They are mapping the physical addresses. So where are they in physical memory. 471 01:04:48.990 --> 01:04:59.250 William Cheng: Okay, so, so this is the physical memory, right. This is why you have four gigabytes. So again, part of your address space map into physical memory. So maybe X is actually sitting right here and why sitting right here and Z sitting right here. 472 01:05:00.240 --> 01:05:07.260 William Cheng: Okay, so they're sitting at three different places in their physical memory. So again, we're going to use this technique of memory mapping, who's going to cover that in chapter seven. 473 01:05:07.560 --> 01:05:12.780 William Cheng: To map these virtual addresses to physical addresses. Okay, so that mechanism. We're not going to talk about how to do that yet. 474 01:05:13.260 --> 01:05:22.110 William Cheng: Okay, we just need to know the X, Y, and Z there somewhere. Sitting in physical memory if they're not in physical memory, the ordinances and we'll bring them on this into memory and then they will be sending a physical memory. 475 01:05:23.430 --> 01:05:32.610 William Cheng: So now how do we perform x equals y plus the right so we need to take them the content of why and contact with z, we need to add them together and put it into the memory location, known as x 476 01:05:33.690 --> 01:05:39.810 William Cheng: Okay, so it turns out there's no way for us to tell memory, just say hey go add in these two memory location. To do that, I'm putting an X. It doesn't work that way. 477 01:05:40.140 --> 01:05:46.560 William Cheng: Okay. So in this case, what we need to do is that we need to bring those the data into the CPU inside of CPU, we need to add them. 478 01:05:47.100 --> 01:05:57.510 William Cheng: That. So inside CPU to perform a radical logical operation. There is a unit called al unit inside the CPU. It's got a value for Earth earth matic and logical unit. 479 01:05:58.530 --> 01:06:11.460 William Cheng: Okay. So in this case, what we need to do is that we need to bring why maybe into yaks and then bring Z EBS and then we need to add them together and then we need to put it, and then we need to write it back into a memory into the memory location or sex. 480 01:06:12.240 --> 01:06:16.920 William Cheng: Okay. So, and this is how we do it right. So what we need to do is that we need to start a bus operation. 481 01:06:17.790 --> 01:06:24.990 William Cheng: Okay, so, so let's say that the first thing that we need to do is over here is that we need to say what he is. Okay, this is C code right 482 01:06:25.560 --> 01:06:31.530 William Cheng: Yes. Are you CPU. There's actually a sequel so opposite when he is the compiler to compile the sequel into machine code. 483 01:06:31.800 --> 01:06:37.050 William Cheng: Right. And then we're going to give the machine code and CPU. So instead of texts segment over here. It's going to be the machine code. 484 01:06:37.680 --> 01:06:44.640 William Cheng: Okay, so what we need to do is that we need to go fetch the instruction from that the tech segment over here. Okay. By starting a bus operation. 485 01:06:44.880 --> 01:06:48.570 William Cheng: Put in the address that corresponding to the code over here. So again, whereas this code. 486 01:06:48.840 --> 01:06:55.950 William Cheng: The code is is the physical memory somewhere, right, we need to go through the code over here, start a bus operation, put our address to address the memory. 487 01:06:56.130 --> 01:07:02.910 William Cheng: serie equals two, one, right, you go to zero. And now we're going to read this machine structure into, you know, insert into the CPU. 488 01:07:03.420 --> 01:07:14.370 William Cheng: That. So in this case, this see statement of year is going to get compiled into for machine structure. Okay, the first thing started might look something like this. Yeah, X, get the content of why 489 01:07:16.110 --> 01:07:16.980 William Cheng: Okay, so therefore we're going to 490 01:07:18.210 --> 01:07:28.950 William Cheng: Take the address of why over here. So why in this case will be a virtual address. We're going to convert them into a physical address. We're going to start a bus operation. Put the physical address of a why so I'm gonna write it this way. 491 01:07:29.220 --> 01:07:32.820 William Cheng: Address of why knowing that this address with it means the physical address of why 492 01:07:33.480 --> 01:07:41.190 William Cheng: Okay, we're gonna say a zero to a 31 equal to the physical address of why we're gonna say three equals two, why right equal to zero. And then we're going to put this on to the bus. 493 01:07:41.730 --> 01:07:49.140 William Cheng: Okay, all these devices will say, oh, this memory address is not for me before memory will say, oh, this addresses for me. So, what it will do is that it will take 494 01:07:49.440 --> 01:08:02.550 William Cheng: The content of memory location that's known as why and then drive the bus. Okay, and what the CPU will do is that it will take this data into the from the zero to 31 and then what it will do is it will route it to. Yes. 495 01:08:03.390 --> 01:08:08.760 William Cheng: Okay, so is this data eventually will go to. Yes. And now inside. Yeah. So we're going to have the content of why 496 01:08:09.810 --> 01:08:20.760 William Cheng: OK, the next instruction that will get executed is going to be EBS gets the content of z over here. So again, we're going to start another bus operation. Now we're going to put the physical address of 497 01:08:21.060 --> 01:08:29.280 William Cheng: The memory location as noisy, but to put it onto the bus or equal to one, right, equal to zero. And now, again, the memory will take the memory location AS NOA z. 498 01:08:29.550 --> 01:08:45.180 William Cheng: Take this content over here, drive the bus, and now the CPU will take it in and it will put it into the EBS general purpose register and now EBS will contain the the content of memory location that's noisy. OK, the next instruction over here is called ad 499 01:08:46.350 --> 01:08:56.700 William Cheng: Okay, so in this case the ad operation. What it will do is that it will row. He is to the left side of the arithmetic illogical. You are the unit and route EBS to the right side of the logical 500 01:08:57.300 --> 01:09:04.440 William Cheng: reversing a lot of logical opera operational the ACLU and then he will set the operation over here to be addition. 501 01:09:05.520 --> 01:09:09.750 William Cheng: OK, and then it will take the output of the ACLU and route it back into yes 502 01:09:10.350 --> 01:09:23.040 William Cheng: Okay, so when this operation is done. What's going to be in the year so yeah to register what the year to register used to have the content of why and now it's going to get replaced by y plus z and now it's going to be sitting inside the year to register. 503 01:09:23.940 --> 01:09:29.250 William Cheng: Okay, there's one more thing. So you have to do is to say X is gonna is going to get the value of x. 504 01:09:29.940 --> 01:09:38.040 William Cheng: Okay, so what it will do is it will start another bus operation, he will figure out what the physical address will exit as he will put you with drive the bus, put the address of x onto the bus. 505 01:09:38.280 --> 01:09:42.030 William Cheng: In this case we will be equal to zero and right will be equal to one. 506 01:09:42.270 --> 01:09:53.910 William Cheng: And now the CPU or drive the bus for the data and then what it will do is that it will put it will route. Yes, back to the zero to 31 and now what's on the bus is going to be wiped out z that value is going to be going to the US. 507 01:09:54.450 --> 01:10:07.080 William Cheng: So again, the memory over here, we'll look at the address of this memory locations for me and they're equal to zero, right. Good one. It will take the data from the bus and then it will put into the memory location or is now x is going to end up with a value of y plus eat. 508 01:10:08.730 --> 01:10:17.340 William Cheng: Okay, so that's how you execute you know the CCA mount x equal to y z you compile them into for machine structure, you're going to end up you know 509 01:10:18.660 --> 01:10:22.080 William Cheng: Running three different bus operation. The first two are you going to refund the bus. 510 01:10:22.290 --> 01:10:29.610 William Cheng: And then you do an internal operations at a CPU to add the values together and put the value back to the yes register yeah X register. 511 01:10:29.790 --> 01:10:37.380 William Cheng: And then you started another pass operate a purse operation you write the data into the memory location on his legs. And this way you store the result back into x 512 01:10:38.250 --> 01:10:46.410 William Cheng: Okay, why does it. Why is it done this way. Well, because long time ago, the hardware people, the compiler people to Albany system got together and sort of figure out that this is the way to go. 513 01:10:47.910 --> 01:10:57.420 William Cheng: Okay, alright. So, this is the reason for the general purpose of the register and finally all the other register over here. There's a registered called the flags register. 514 01:10:57.930 --> 01:11:05.220 William Cheng: What our flags whenever you perform an arithmetic logical unit it to resolve equal to zero. There's a flag bit called the Z bit 515 01:11:06.270 --> 01:11:12.240 William Cheng: Okay, when you perform arithmetical logical unit if the result equal to zero equal to zero then z will be set to one. 516 01:11:12.690 --> 01:11:20.910 William Cheng: Okay, if the result is not zero. Well, then this guy is. He will be set to zero. Okay. So that will be the Z flag there. There's also a flag called the carry flag. 517 01:11:21.390 --> 01:11:31.920 William Cheng: Whenever you perform arithmetic illogical, you have. So whenever you perform an addition operation or subtract your operation if there's a carry, well then, in this case, see will get one. If there is no carry you'll get zero. 518 01:11:32.580 --> 01:11:35.250 William Cheng: Okay, there's also another big called the overflow bit 519 01:11:35.850 --> 01:11:45.660 William Cheng: When you perform a floating point operation if there's an overflow that oh will be set to one. Otherwise it will be set to zero. So there's a lot of flat inside the CPU when you perform these are theoretical logical units. 520 01:11:45.870 --> 01:11:51.600 William Cheng: Are they always set all these bits inside the CPU right so collected least they are known as the flag register. 521 01:11:52.560 --> 01:11:58.380 William Cheng: There. There are also other bits, instead of like register. One of them is they're very important. It is known as the interim enable bit 522 01:11:58.650 --> 01:12:06.210 William Cheng: Okay, we're going to call them IE interrupt enable over here so i equals two, one, that means that we are unable to accept interrupt. 523 01:12:06.780 --> 01:12:18.030 William Cheng: Okay if i is equal to zero, that means that we're going to ignore interrupt. Okay, so for example if i said i equal to zero this pair of ears inside the flag register if i said i equal to zero. 524 01:12:18.510 --> 01:12:29.040 William Cheng: Okay, and now if a hardware device when it finished and I operation. What it will do is that it will pull the interrupt the signal over here to say, hey, I want to interrupt. If I equal to zero, nothing will happen. 525 01:12:30.180 --> 01:12:38.730 William Cheng: OK, so the terminology that we're going to use over here is that way you have interrupt disable and then somebody generated interrupt. Now the interim is going to become pending. 526 01:12:39.840 --> 01:12:45.870 William Cheng: Guys are going to go to the next slide. I'll show you this definition over here. These are some of the very important term that you're going to get used to. 527 01:12:46.260 --> 01:12:53.760 William Cheng: Okay, so when I eat over here equals zero. And then if somebody generator interrupt. Then in this case the interval become pending. 528 01:12:54.600 --> 01:13:02.670 William Cheng: Way later on. Well, you said, I go to school for a while you are enabling raw if there's a pending interrupt and now the interest will get delivered 529 01:13:03.300 --> 01:13:10.290 William Cheng: Okay, so you know of delivery, meaning that. So what does it mean to the delivery interrupt that means that the operating system is gonna start executing the interrupt service routine. 530 01:13:12.120 --> 01:13:21.450 William Cheng: Right. Yeah. Let me do this again right if i equal to zero. Somebody generating interrupt to enroll become Penny when the interrupt become enabled by setting i equal to one. 531 01:13:21.630 --> 01:13:26.940 William Cheng: Then in that case the interviewer will be deliver when you get delivered the interrupt service routine will get executed. 532 01:13:28.620 --> 01:13:33.090 William Cheng: OK. So again, these are important terminology. We're going to sort of use these kind of technologies throughout the entire semester. 533 01:13:33.870 --> 01:13:42.690 William Cheng: There and also the other thing that I was serving leader and they need to introduce is that when you are executing interrupt service routine code, you are in the interim contacts. 534 01:13:43.080 --> 01:13:47.250 William Cheng: OK. So again, we talked about the exclusion contacts the work student contacted before 535 01:13:47.550 --> 01:13:56.190 William Cheng: Okay, so in this case what will be the interim contacts. So when you see the word interrupt contacts. All that means is that the CPU is executing the interrupt service routine. 536 01:13:57.030 --> 01:14:05.730 William Cheng: Okay, if the CPU is not in the interrupt contacts that what kind of country is it in. What if the CPU is not enroll contacts, it must be in a threat contacts. 537 01:14:06.210 --> 01:14:09.030 William Cheng: Okay, which means that the CPU is executing three code. 538 01:14:09.870 --> 01:14:22.170 William Cheng: Okay, so this is what kind of threat. Right. So again, depends on whether in the user mode or you're you're you're in the previous model if you're in the user mo you're executing code for user threat if you're in the privilege Mo, you're actually writing code for the colonel threat. 539 01:14:23.400 --> 01:14:28.590 William Cheng: Okay, so therefore, again, the Colonel, the other day, you know, the your CPU can be in three different contacts. 540 01:14:28.770 --> 01:14:37.020 William Cheng: It can be in the interrupt contacts. When you are servicing interrupt. Or you could be in the user threat contacts or in the kernel for contacts as okay 541 01:14:37.200 --> 01:14:43.440 William Cheng: The word Colonel opportunities that we use it interchangeably. So when you're in the kernel. That means that you're in the privilege Mo and you're executing 542 01:14:44.250 --> 01:14:45.780 William Cheng: executing code for Colonel threat. 543 01:14:46.620 --> 01:14:59.880 William Cheng: Guys later all was retire you the main difference between the other sort of the user threat and an external threat. So now we just need to start answering to having this concept of the CPU can either be servicing interrupt or executing code for some sort of a threat. 544 01:15:01.020 --> 01:15:09.810 William Cheng: Right. Alright, so I guess this is because I'm into 75 minutes. So, therefore, this is a good time to break. So next time we're going to sort of continue and we're going to go back 545 01:15:10.080 --> 01:15:16.380 William Cheng: And talk about you know trap interrupt again. Okay, so now we're down with your review, you know, for your computer organization. 546 01:15:16.770 --> 01:15:21.030 William Cheng: Okay, so you sort of have the basic concept of what the bus architecture is how to sort of, you know, 547 01:15:21.210 --> 01:15:34.500 William Cheng: fetch an instruction, you know, from the memory into into the CPU and also how the CPU as you can write data into memory card to communicate with all the devices on the bus by using bust cycles. Right. Alright, see you in a bit.