WEBVTT 1 00:00:01.920 --> 00:00:07.470 William Cheng: Okay, this is the second part of lecture one, so I'm going to continue with 2 00:00:09.210 --> 00:00:19.140 William Cheng: The administrative stuff so USC student conduct code prohibit plagiarism every class, they have different rules for what plagiarism is 3 00:00:19.800 --> 00:00:32.220 William Cheng: So for our program, so, so, so please understand that for our rules may be different from other classes now. So for warm up programming assignments all submit a work must be must be your own work. 4 00:00:33.420 --> 00:00:40.500 William Cheng: So that's kind of obvious, but here's the differently. You must not run or look at ko from previous semester. 5 00:00:41.100 --> 00:00:45.210 William Cheng: Okay, if you take other people's code from previous semester. And if you run. And if you look at the code. 6 00:00:45.450 --> 00:00:53.580 William Cheng: That's considered cheating, right, because what happened is that when you look at other people's code, you start memorizing things and you start writing code, even though you're not copying, you end up reading other people's code. 7 00:00:53.970 --> 00:01:02.190 William Cheng: Okay, so therefore that's not allowed. Yeah. Similarly, for the group programming assignments all to submit a word must be worked out by members of your group. 8 00:01:02.580 --> 00:01:07.710 William Cheng: Any members of your team must now look or run a look at ko from the previous semester. 9 00:01:08.610 --> 00:01:15.630 William Cheng: Okay, so if you have one group member have access to the previous semester and you run that code and you look at the code there that's considered cheating. 10 00:01:16.560 --> 00:01:21.570 William Cheng: Okay, so again, you know, these are very important rules. There are two exception for copying coat 11 00:01:21.990 --> 00:01:32.700 William Cheng: Very cold fragments done by yourself or other you know for other classes or given to us class resources in class, you have taken and either completed in a different place. 12 00:01:33.210 --> 00:01:37.680 William Cheng: They must be cited explicitly. Okay. So for example, I mean this is mainly for the warm up assignment. 13 00:01:37.950 --> 00:01:43.170 William Cheng: Okay, for the one of assignment you know maybe you need to use some data structure. As it turns out, what you're taking an undergrad class. 14 00:01:43.350 --> 00:01:47.940 William Cheng: Us some data structure you write some code. Since the CO you written before you're by yourself. 15 00:01:48.180 --> 00:01:54.420 William Cheng: Or there are given to your part as part of the course material like part of the textbook, a part of the you know the the programming assignments. 16 00:01:54.630 --> 00:01:57.510 William Cheng: You're given that co op, then in that case you are allowed to use it. 17 00:01:57.750 --> 00:02:06.120 William Cheng: Yeah, but this guy's, you have to cite them properly, by saying that. So, so here's your code. Are you going to use, right. So what do you need to do is that you need to put a barber a comment blog. 18 00:02:06.330 --> 00:02:11.610 William Cheng: Saying that, you know, begin Co. I didn't write all the beginning code that I wrote in a previous semester. 19 00:02:11.910 --> 00:02:22.560 William Cheng: And this is one which class that I took, and this is when I went when when I wrote this. And then at the end over here it says m costs. I didn't I and and code that I didn't write or and code that have written previously. 20 00:02:23.190 --> 00:02:26.400 William Cheng: Okay, so why do you need to do that. Well, in this case, when I tried to catch people for 21 00:02:26.700 --> 00:02:33.000 William Cheng: For for for cheating if another piece of if another co written by another student. If the CO look exactly the same. 22 00:02:33.240 --> 00:02:39.330 William Cheng: As it turns out, you guys went to the same school at the same time you are given you know this co and that's why they're exactly the same. 23 00:02:39.570 --> 00:02:43.950 William Cheng: And since I have written rule over here to say you are allowed to use that. Well, in that case is perfectly okay 24 00:02:44.700 --> 00:02:54.780 William Cheng: Okay, so you have to sign up properly. If you only ready your, your Readme file to say, yeah, I use some code that I wrote previously. That's really not going to cut it, you're going to end up, you know, consider cheating. You're gonna you're gonna 25 00:02:55.740 --> 00:03:03.810 William Cheng: End up getting an F in class. Okay, so make sure that if you use code that you have written or that are given to you as part of the course material you cite them properly. 26 00:03:04.230 --> 00:03:12.510 William Cheng: Then you can also use any code that are given to you as part of this class. What, in that case, you don't have to cite it because I know what they look like. 27 00:03:13.290 --> 00:03:20.670 William Cheng: Okay, I'm familiar with all the code and giving to you. So if you want to use code from the lecture slides for you're going to use code from the 28 00:03:21.180 --> 00:03:30.900 William Cheng: Textbook if you want to use code from the programming the sermon that are giving you two you warm up one you want to use in a woman to that's perfectly okay okay. You don't have to sign it, because I know what they look like. 29 00:03:32.190 --> 00:03:42.600 William Cheng: Alright, so these are the only two US exception. Otherwise, if you have co from previous semester I strongly encourage you to thorough so away them now, because sometimes students don't know how good of their memory are 30 00:03:42.840 --> 00:03:51.630 William Cheng: Until you know the old caught cheating and it's got all my memories that good. Okay, so, so again, soda away. Don't use them gave you a question about them send email to me. 31 00:03:53.880 --> 00:03:59.670 William Cheng: Okay, you're encouraged to work with other students for individual assignment or the other group for current for for the colonel assignments. 32 00:04:00.090 --> 00:04:10.080 William Cheng: But again, work with is working at a high level, okay. Don't write code together and then everybody get a copy and then you try to massage the code to make them look different. That doesn't work. 33 00:04:10.800 --> 00:04:21.930 William Cheng: Okay, so don't do that you can work with other students talk about how to implement stuff but don't write a single line together when it's time to write, write code, turn your back against each other and start write your own code. 34 00:04:22.800 --> 00:04:25.170 William Cheng: Okay, that will be the only way to avoid cheating. 35 00:04:25.830 --> 00:04:29.910 William Cheng: Okay, so again if you don't know how to do this. I recommend you not to work with other students right 36 00:04:30.150 --> 00:04:40.080 William Cheng: Otherwise, you know, if you know if we can be discipline. Then, then it's no problem, working with other students then so whenever I say work without a student. I mean, working with a student at a high level. Yeah. 37 00:04:44.250 --> 00:04:49.590 William Cheng: Or Africa, no assignment. If you know that your partner is cheating you know that they have, you know, CO from the previous semester. 38 00:04:49.800 --> 00:04:57.210 William Cheng: You must tell them to stop and even if they have written some code, you should take away all their code and rewrite them, you know, 39 00:04:57.450 --> 00:05:10.290 William Cheng: rewrite them among other teammates, right, because you don't want to take the risk of one students code because they copied you on a previous semester and now your entire team only make one submission, or in our case any part of that code is tainted the entire team is tainted 40 00:05:11.610 --> 00:05:17.220 William Cheng: Okay, so therefore the only thing you can do is that once you find out your team is cheating. Well, then this guy. You have to rewrite all their code. 41 00:05:18.810 --> 00:05:24.900 William Cheng: Okay, so, so, so please understand that I cannot make exceptions there. So, by the way, how do you know that your, your teammates cheating. 42 00:05:25.770 --> 00:05:35.670 William Cheng: Okay so so happens that you should meet with your teammates and when they say, and then you talk the talk about your code that you write, and if you as a team to say, hey, why did you write your code that way and your team. He says, I don't know. 43 00:05:36.390 --> 00:05:41.520 William Cheng: Okay, well, then that will be really, really suspicious, you should take away all their code and we rewrite all their code because India. 44 00:05:41.730 --> 00:05:49.140 William Cheng: You don't want your entire team to fail the class. Right. Some people says, oh, I only have one team a cheating. Can we get partial credit. It doesn't work that way. 45 00:05:50.250 --> 00:05:57.840 William Cheng: Okay, if your entire team turning one, you know, turning one submission any of part of that code is cheetah code then everybody get an F. 46 00:05:58.530 --> 00:06:08.670 William Cheng: That's the only way that I can proceed. There's no way for me to give you partial credit. Okay, so please take this very seriously. And that's another reason I want you to make sure that you don't work with people that you never worked with before. 47 00:06:09.090 --> 00:06:20.850 William Cheng: Okay, you want to work with honest people you want to work with people who don't have code from the previous semester. Those are the people you want to work with. Right. Otherwise you're risking yourself okay don't take this kind of risks. Okay. 48 00:06:23.310 --> 00:06:28.950 William Cheng: All right. Also, you must not post your code to the public code repository. Okay, if he 49 00:06:29.250 --> 00:06:38.460 William Cheng: If he posted to a private repository, you need to verify it and nobody else can see it okay i strongly discourage you to use GitHub com even though GitHub com 50 00:06:38.670 --> 00:06:45.720 William Cheng: You know, there's a funny place they they they basically they want people to use it. Okay. They want as many people to use it. They wanted to develop 51 00:06:45.990 --> 00:06:52.260 William Cheng: Open source code and get help that com that's the model right they want all your code that you posted there, they all become public up 52 00:06:52.980 --> 00:07:03.150 William Cheng: Okay, we're not allowed to have that. Okay. So, therefore, if you, you know, whatever code that either you do for this semester. You are not allowed to help the future students at USC to cheat of your code. 53 00:07:03.720 --> 00:07:16.680 William Cheng: Okay, because you know if you have, if you agree to be a USC student you have agreed on the USC student Conoco USC student conduct co prohibit you to cheat off other students and also prohibit us to knowingly let other people shoot it off, you 54 00:07:17.610 --> 00:07:23.520 William Cheng: Okay, so if you post your postal code at a public place and other people can choose to view that you have committed plagiarism. 55 00:07:24.780 --> 00:07:36.330 William Cheng: Okay, so therefore, don't do that. Okay, did have that calm. They said, oh, if you have a code that only have, you know, less than three people, they will stay private. But guess what, as soon as a fourth person get access your code. The code become public 56 00:07:37.650 --> 00:07:47.400 William Cheng: Okay, so therefore don't use GitHub com and Apple can Oh, Simon. I know people try to collaborate within the, within the team, you need a place to actually share the CO. Another place you can go. It's called bitbucket.org 57 00:07:48.210 --> 00:07:57.300 William Cheng: Day. It's the same idea. They also use GitHub. They also use get right. So the basic idea is good, but they have a policy that if your code is private, they will stay private forever. 58 00:07:57.870 --> 00:08:10.050 William Cheng: Okay, so in that case you want to collaborate. If you use GitHub com your, your company you're cheating already. Okay, so don't use GitHub com, no matter what to get. Hop com say don't use them use Bitbucket the audience that 59 00:08:11.130 --> 00:08:11.490 William Cheng: Okay. 60 00:08:12.780 --> 00:08:19.260 William Cheng: All right, so, so the reason that I have to reuse of our upcoming assignment is that the operating system. 61 00:08:19.740 --> 00:08:26.700 William Cheng: You know programming assignment. They are very difficult to come by. Okay, our programming that's going to come with the textbook. So therefore, there's no way for me to change that. 62 00:08:27.060 --> 00:08:34.650 William Cheng: Okay, I have to reuse. The problem is, I'm and over and over and over again. So, therefore, you do not have, you know, have permissions to post your code as 63 00:08:35.040 --> 00:08:42.540 William Cheng: A public place. Okay, our code is private. They come with the textbook you know they they are you know they they're really not for public consumption. 64 00:08:42.780 --> 00:08:53.460 William Cheng: Okay, so I mean some people they like to use GitHub as their, you know, online resume to say, look at all the code that I wrote over here. I'm so cool. Okay. But if you don't have permission to do that. It's not cool at all. 65 00:08:54.300 --> 00:08:57.120 William Cheng: Okay, which means that you know if you're violating, you know, other people's 66 00:08:57.900 --> 00:09:03.750 William Cheng: You know, a policy. Well, you know what, you get hired by a company. Well, how can they trust you not to leak out the leak out their source code. 67 00:09:04.080 --> 00:09:14.820 William Cheng: Right, because you're gonna do exactly the same thing you want you want to be cool and you want to show that you that you don't really care about cheating. Alright. So again, if you do that, you're going to get an F in the class. So please don't do that. Yeah. 68 00:09:17.190 --> 00:09:24.600 William Cheng: All right. So I mentioned this already. I'm going to use this code called MOS to try to 69 00:09:24.960 --> 00:09:33.510 William Cheng: Catch cheating. I'm telling you what this program is right. Some people say, oh, you know, I have a couple pieces because semester. I'm going to sort of run Mars to see if my code is the same as the other one. 70 00:09:33.780 --> 00:09:38.970 William Cheng: You are not allowed to do that because you're not allowed to have access to co found previous semester. 71 00:09:39.480 --> 00:09:48.660 William Cheng: Okay, some people says that, you know, but, but, you know, we run moss already, you know, that's why you know our code is very, very different for other people. So let's say that you are not allowed to run other people's code. 72 00:09:49.410 --> 00:09:59.190 William Cheng: Okay, so don't don't do that. Just don't cheat, just throw away. Although, right. So again, why don't why, why shouldn't you cheat because I told you what kind of gray, you're going to get right. I want to make sure you understand that and you don't cheat. 73 00:10:00.060 --> 00:10:03.660 William Cheng: Okay, so in the end it's good for your education and they also. So, again, please don't cheat. 74 00:10:05.490 --> 00:10:14.070 William Cheng: All right. I get a lot of email questions over here. One of the most common question I get is that, you know, here's my understanding of X. Am I right, is this correct, correct me if I'm wrong. 75 00:10:14.190 --> 00:10:20.850 William Cheng: So student. Try to be clever they post a question in the cars Google guru and they say that here is my understanding of. So, you know, correct me if I'm wrong. 76 00:10:21.690 --> 00:10:26.610 William Cheng: Okay, if you don't correct them. But that means that this person is correct. I mean, clearly doesn't mean that at all. 77 00:10:27.270 --> 00:10:34.230 William Cheng: Okay. I mean, if, if we are having a one on one meeting and you asked me a question that you said, correct me if I'm wrong, then in that case, I have to correct you. 78 00:10:34.740 --> 00:10:40.380 William Cheng: But if you do it at a public forum, then nobody has to correct you. So just because nobody correct. It doesn't mean that you're right. 79 00:10:41.400 --> 00:10:50.850 William Cheng: Okay. I mean, some people actually use that to argue about, you know, exam and stuff. I just say, oh I post this to this day in the class google google and nobody, correct me. So therefore clearly I'm right. So, so again, that doesn't work. 80 00:10:51.240 --> 00:10:54.030 William Cheng: Okay, you can think that way. But that's the wrong way of thinking. Okay. 81 00:10:54.300 --> 00:11:01.830 William Cheng: Another kind of question I always get is that I'm thinking about now following the spec. Is this okay right what students asking is that, am I going to get full credit 82 00:11:02.130 --> 00:11:09.660 William Cheng: Then you always going to get the same answer from me, you have to follow the spam, you have to follow the waiting to realize okay there's no other type of answer because the greater 83 00:11:09.930 --> 00:11:13.890 William Cheng: The only way the greater can graze to follow the grading guidelines and also the greater has all the spec. 84 00:11:14.670 --> 00:11:19.110 William Cheng: Guys, so I cannot make an exception. Yeah. So read the spec read a great guy. Very, very carefully. 85 00:11:19.890 --> 00:11:29.220 William Cheng: Well, here's a textbook, I look at my job as explaining this test books to you and this textbook is very difficult to read, even though it's only a 400 page textbook. 86 00:11:29.460 --> 00:11:37.140 William Cheng: Okay. The reason for that is that they assume you have two years of solid computer science education and then you know you do pick up this book. 87 00:11:37.590 --> 00:11:38.670 William Cheng: With all with all your background. 88 00:11:39.060 --> 00:11:46.920 William Cheng: Okay, so therefore you know my classes that you know, since a lot of you are now computer science major in undergrad I need to sort of give you some of the background. Now all the background because in the end. 89 00:11:47.100 --> 00:11:55.320 William Cheng: It's your responsibility to have the two years of computer science education. Okay, so I'm going to try my best to give you, you know, some of the background over here so you can understand this expo. 90 00:11:58.020 --> 00:12:05.520 William Cheng: If you don't know. See, you can pick up any online tutorial, you don't have to have this book. But if you have to have a book. Well, then this will be the only book that 91 00:12:06.030 --> 00:12:09.720 William Cheng: I will recommend because this is sort of a standard textbook for see okay 92 00:12:10.620 --> 00:12:16.530 William Cheng: All right, the class structure over here. Let's just slide over here. I'm going to skip all these kind of south of the programming assignment. 93 00:12:16.830 --> 00:12:26.700 William Cheng: The first programming assignment is worth 7% of your programming assignment grades. The second programming assignments for 18% of your programming seven grey. You add them together, you get 25% 94 00:12:27.090 --> 00:12:31.620 William Cheng: All the other Colonel assignment, each one of them is worth 25% of your programming seven. Great. 95 00:12:31.920 --> 00:12:44.670 William Cheng: Okay, a few slides before I talk about your programming assignments 40% will be overall grey you multiply 40% by 25% each programming assignments. Each kernels. I'm, it is worth 10% of your Polonius of your overall grade. 96 00:12:45.000 --> 00:12:53.520 William Cheng: Okay, remember 9% is is a great step. So if you miss an entire kernel of forming a salmon, you only lose a little more than one grey steps. 97 00:12:54.090 --> 00:13:04.620 William Cheng: Okay. So always think about these numbers, put that in perspective. So when you turn turn don't know if you can turn your problem yourself, don't freak out. Okay. Because again, if you do the number you know exactly what it means. Yeah. 98 00:13:06.030 --> 00:13:17.250 William Cheng: Alright, are the colonel Simon's over here are extremely difficult. And that's not my word is actually the word, a professor of the vendor who is the the operating system guru at USC, so I 99 00:13:18.030 --> 00:13:22.560 William Cheng: He taught this class one time using the textbook seasons of programming assignment. 100 00:13:23.160 --> 00:13:30.120 William Cheng: After I finished talking that I saw at that time I co teach with him. I teach a separate section we use exactly the same material. After that, he said, this is too much. 101 00:13:30.750 --> 00:13:41.190 William Cheng: Okay, so what happened is that after that semester so he stopped teaching this class I continue to teach this class, I have developed more and more material and now they become reasonable to do the programming assignment. 102 00:13:41.640 --> 00:13:52.530 William Cheng: Okay. In the beginning in the raw form of the problem is is almost impossible to do. But now, so for every programming assignment. I also come up with a lot of programming of assignment FAQs the frequently asked questions. 103 00:13:53.040 --> 00:14:02.490 William Cheng: So will you read the Spec. Spec point to the FAQ, you need to read the FAQ. So by reading all the FAQs, you should be able to complete all the programming assignments. 104 00:14:03.510 --> 00:14:15.480 William Cheng: Alright, so. So again, these are very, very difficult assignment. But if you spend a lot of time on it. It's actually very doable. OK. So again, you need to follow my recommendation, you need to keep up with the lectures and everything is possible. Yeah. 105 00:14:17.100 --> 00:14:19.980 William Cheng: I mean, if you do late one day you're going to be in big trouble. Yeah. 106 00:14:20.220 --> 00:14:32.190 William Cheng: All right, all assignments must be done or 32 bit of a bunch of 16.4. Why is that is because that's the only platform that graders allowed to grade. If you ask the greater degree anywhere else. The Creator has to say no. Okay. 107 00:14:32.940 --> 00:14:38.430 William Cheng: We want to see the model for the different sub version, you can use the latest version. I mean, right now I will Ubuntu 16.0 108 00:14:39.150 --> 00:14:47.700 William Cheng: Well, but is that 20 point oh four. So again, anything above 16 point or for I know for sure that your current or summer will not work on that. 109 00:14:48.360 --> 00:14:55.860 William Cheng: Okay, so don't waste your time. Right. But if you have a virtual machine, you know, if you have using virtual box you can install as many different versions of bundle as you like. 110 00:14:56.100 --> 00:15:04.320 William Cheng: Okay, make sure that you have one clean one only for testing your programming assignments. So this way you know how the grid is going to grow your assignment on that particular system. 111 00:15:04.500 --> 00:15:12.780 William Cheng: And you need to make sure that no matter what, no matter what other system that you have tried. In the end, your programs. I'm a has to work inside a 32 bit 64 112 00:15:13.380 --> 00:15:23.400 William Cheng: Okay, your virtual machine can be a 64 bit virtual machine. But, you know, the, you know, I mean, your, your Virtual Box could be a 64 bit the Virtual Box, but your virtual machine has to be a 32 bit 113 00:15:25.830 --> 00:15:31.500 William Cheng: Okay, if you try to install something else, send an email to me first and try to find out what you're getting into. Now, 114 00:15:35.490 --> 00:15:41.910 William Cheng: All right, here is the Colonel assignment grading. I mean, it's a little too early to talk about as I'm going to skip all this kind of stuff. 115 00:15:42.180 --> 00:15:52.050 William Cheng: About Colonel group for me. So feel free to use the class Google group to contact other students who form Colonel teams. Again, my recommendation is that start with start a big group. 116 00:15:52.560 --> 00:15:57.300 William Cheng: So again, you need to know how to use zoom to how the online meeting and then this week and coordinate with people. 117 00:15:57.540 --> 00:16:04.980 William Cheng: Talk about programming a semi in the high level concept and then find out anybody's habit and India you commit to a team of most for students. 118 00:16:05.520 --> 00:16:10.680 William Cheng: Okay, so go work at a high level. Don't copy code from each other. Okay. If you have any issues with this, you know, 119 00:16:11.520 --> 00:16:19.650 William Cheng: Talk to me. So please understand that I cannot get involved in forming Colonel teams for you. Okay. Some people say, I don't know anybody. Well, nobody knows anybody 120 00:16:20.310 --> 00:16:30.690 William Cheng: Okay, so therefore you are in the same boat as everybody else. We have remote students, they might be at a different time zone and things like that. So again find off on each other how you can actually get things to work. 121 00:16:31.290 --> 00:16:35.640 William Cheng: Maybe talk about each other's back. Wow, you know, things like that. And eventually, sort of form a team. Yeah. 122 00:16:37.170 --> 00:16:39.780 William Cheng: All right, so what else is here. 123 00:16:43.050 --> 00:16:48.660 William Cheng: I'll we make a submission. I'm going to use a different system from everybody else. I'm going to use a system called the beast sources them. 124 00:16:49.110 --> 00:16:57.450 William Cheng: So every you know programming assignments back if you scroll all the way to the bottom, there's a submission procedure. There's a web form for you to make a submission 125 00:16:57.780 --> 00:17:01.890 William Cheng: Okay, so you can make as many submissions as you like. By default, we're going to create the last one. That's 126 00:17:02.400 --> 00:17:05.550 William Cheng: On time as I we're going to be the last one. If the last wisely. We're going to take 127 00:17:06.210 --> 00:17:11.520 William Cheng: A deduction or if you want us to create an earlier submission, you have to tell us, right, because otherwise we're going to create your final submission 128 00:17:11.940 --> 00:17:21.210 William Cheng: OK. So again, you should read all about it. What's important over here is that whenever you make a submission. It will take you to a page A with display a ticket to you a ticket is a 129 00:17:21.750 --> 00:17:26.730 William Cheng: The ticket is actually a proof to say that my my server has received your submission 130 00:17:27.300 --> 00:17:36.690 William Cheng: Okay, so in that case it would tell you what is the name of the Father, we have received. What is this file size that were received and also what is the timestamp on the server. When we receive this video submission 131 00:17:36.990 --> 00:17:45.630 William Cheng: Okay, so those are the things that you need to look at, okay, well, you see the ticket, it will tell you what to look for. Once you verify that those things are okay, you should, you know, maybe save the webpage as a PDF 132 00:17:46.050 --> 00:17:54.570 William Cheng: PDF. This will be proof that my server has got your submission or not. Okay. You don't need to send me any other confirmation, because the ticket is the confirmation itself. Okay. 133 00:17:55.080 --> 00:18:00.690 William Cheng: It also supposed to send you an email but email can take a long time. So I'll get emails not important that ticket is the most important thing 134 00:18:00.990 --> 00:18:04.650 William Cheng: That the other thing that you're supposed to do, is that again at the end of every speck 135 00:18:04.830 --> 00:18:13.230 William Cheng: It will tell you how to verify your submission. So basically what you need to do. So you'll go through the verify your submission a step, step by step, and not miss miss a single step. 136 00:18:13.470 --> 00:18:22.320 William Cheng: You guys are basically what you have to do is that you have to pretend that you are greater, and you're agreeing your assignment. And this way you can make sure that everything you have submitted is everything you want us to great 137 00:18:22.830 --> 00:18:28.470 William Cheng: Okay, so in the end if you make a mistake you sent me the wrong file. There's really nothing I can do. Because of my fairness policy. 138 00:18:29.010 --> 00:18:38.520 William Cheng: Okay if I allow you to, you know, substitute one of your files with something else. Well then, after a lot. Everybody's do that. Okay, I'm not. And then I will never do that. Okay. Some people will say, oh, look at my 139 00:18:39.090 --> 00:18:51.270 William Cheng: File. I have a, I have a file. I have a timestamp of earlier time. Okay. So, therefore, you have to send me. No, I don't have to send your files like that, right, because there's the operating system class. I know how to change timestamp on a file. 140 00:18:52.410 --> 00:19:04.260 William Cheng: Okay, so do for a file system timestamps are meaningless unless your file reach my server when my server put a time on. I've been in that case I will be good. Okay. Anything on your system. I cannot count on anything on your system. 141 00:19:06.060 --> 00:19:13.140 William Cheng: So, therefore, is your responsibility to make sure that everything that you have submitted everything you want us to grey and you have to make sure you're on time, all these kind of stuff. 142 00:19:13.290 --> 00:19:19.170 William Cheng: So you need to be a little paranoid and verify your submission and read the ticket very, very carefully to make sure everything is perfect. 143 00:19:19.650 --> 00:19:29.370 William Cheng: Okay. I mean, I don't want you to be totally super paranoid. Be a little paranoid, to make sure that everything is actually is actually. Okay, okay any kind of question feel free to send me email. 144 00:19:31.440 --> 00:19:44.010 William Cheng: All right. Ah, OK. Let me see what else late policy I submitted my late policy that you can only be one day late if you if you have one day late you lose 10% of the assignment grade. 145 00:19:44.700 --> 00:19:48.120 William Cheng: But I also don't want you to get too excited right around the submission time 146 00:19:48.570 --> 00:19:55.980 William Cheng: The submission tab is set at 11:45pm there's a 15 minute grace period, which means that if you send it before midnight. It's considered on time. 147 00:19:56.490 --> 00:20:00.090 William Cheng: Okay, after midnight every five minutes, you're going to lose 1% 148 00:20:00.570 --> 00:20:08.100 William Cheng: Okay, so therefore, on the day of the submission. If you are 15 minutes later it's going to go to 90% for the rest of the days I'll show you a graph of looking like this. 149 00:20:08.400 --> 00:20:21.480 William Cheng: Okay right admin, I will be here, you're going to lose you know 1% every, every minute, every five minutes so 15 minutes later on you can drop the 90% and for the rest of the day if you make any submission is going to be a 10% reduction. 150 00:20:22.020 --> 00:20:28.230 William Cheng: In the next day and midnight. Again, we're going to start all over again every five minutes going to lose 1% you have 90% left 151 00:20:28.800 --> 00:20:39.450 William Cheng: Five minutes time 95 is going to be 450 minutes so at 730 in the morning, you're going to lose all 100% okay so after 740 after 730 you should not bother to summit. 152 00:20:40.080 --> 00:20:50.580 William Cheng: Guys, again, this will be the only policy, there was some people always ask for special extension again due to my fear is policy. There's no way for me to offer that to you unless you have documented. 153 00:20:51.060 --> 00:20:57.390 William Cheng: You know illness or document a family emergency why, in that case, you get an extension back, but I have to see the documentation there. 154 00:20:59.910 --> 00:21:10.680 William Cheng: Alright, so again, I must stick to all my policies don't ask me individually extension unless you have a document that mission and my fear is policies, wherever I get this right over here says, What if your laptop died. 155 00:21:11.250 --> 00:21:18.240 William Cheng: What if the home internet got disrupted. Well, if your car is broken you cousin got stuck at the airport. How's it was on fire need to go to Connie Kodama 156 00:21:18.420 --> 00:21:27.360 William Cheng: So these are personal emergency. They are not documented Jonas, they are not documented family emergencies. Okay. So, therefore, what are you supposed to do with these kind of things have a 157 00:21:28.020 --> 00:21:38.070 William Cheng: While you're supposed to submit early so that you will not get into the sticky situations. OK. So again, when you submit early enough. You're going to get extra credit. So again, try to submit early that 158 00:21:39.210 --> 00:21:51.690 William Cheng: You have all the information for all the point means I'm in, you know, there are people who submit every assignment or, you know, with 10% extra credit. It's completely doable if you start your assignment early. Okay, don't wait until the last minute. Yeah. 159 00:21:53.550 --> 00:22:03.360 William Cheng: Alright, so after the submission deadline has passed. You know, if you submit, you know, if it's within 24 hours of the submission deadline, where you're going to get 10% you know deduction. 160 00:22:03.990 --> 00:22:14.490 William Cheng: If you submit three lines of changes they are free. Okay, but only within 24 hours of the submission deadline. Okay, so, so, so, so, so, so, so 161 00:22:15.450 --> 00:22:24.030 William Cheng: So just during that time, the first three lines are free, after that, after your first three night every additional lines going to cost you three up three points a deduction. OK. So again, 162 00:22:24.480 --> 00:22:28.710 William Cheng: Over here I need to define exactly what the line is because you can put the entire program in one line and see 163 00:22:29.190 --> 00:22:42.300 William Cheng: So therefore, a line is 128 character max and the modification of ally is defined as you add a line before a certain line number you delete a line number you replace a line by another line that's 128 characters long. 164 00:22:42.480 --> 00:22:44.970 William Cheng: And then you can move alive from one place to another place. 165 00:22:45.390 --> 00:22:55.860 William Cheng: Okay, so these are considered one change. So when you have the first three lines of changes within 24 hours of the submission deadline, the first three are free additional cost us three points or per line. 166 00:22:56.250 --> 00:23:06.240 William Cheng: After the first day additional changes is going to cost you 10 points per line after the first week you can continue to make changes, but every line is going to cost you 25 points per line. 167 00:23:06.660 --> 00:23:09.270 William Cheng: Okay. Some people actually use that after they get your great 168 00:23:09.810 --> 00:23:22.740 William Cheng: When you get your grade and you say, oh, I made a silly mistake. I didn't verify my submission. If I do this one little things going to cost me 25 points, but I will get 100 points, right. So, in that case, you can spend one lender change. And in the end, going to end up getting 75 points. 169 00:23:23.880 --> 00:23:27.990 William Cheng: Alright. So again, these other rule. You need to understand this, any questions, feel free to send me email. Okay. 170 00:23:28.560 --> 00:23:36.210 William Cheng: Oh I I'm extra credit. I just mentioned, I mentioned it already. So again, you know, if you, this is your submission time right if you submit 171 00:23:36.720 --> 00:23:48.540 William Cheng: More than 48 hours with before that you can get 5% extra credit if you submit a 72 days before that. Are you going to get 10% extra credit and if you summon only 24 hours before the submission deadline, you got no extra credit. Okay. 172 00:23:50.730 --> 00:23:54.840 William Cheng: All right, this I mentioned already are required policy. 173 00:23:55.290 --> 00:24:02.370 William Cheng: Well, when the greater finished grading. I'm going to give you your grade. So when you receive that email you have one week to complain to the greater 174 00:24:02.580 --> 00:24:08.070 William Cheng: A need to tell the greater where you think the greater has made a mistake. Okay, after one week. Then there's nothing we can do. 175 00:24:08.310 --> 00:24:15.240 William Cheng: Okay, so the rule. Here's how you have to complete within that week, right, the greater is is a master student 176 00:24:15.360 --> 00:24:24.690 William Cheng: So the grid might have other classes that are taken over here. So they may not be able to perform the regret doing that one week. Right. So what you have to say you have to initiate the regret doing that one week. 177 00:24:24.930 --> 00:24:30.000 William Cheng: Okay, the actual regret can be done after that one week period. Okay. Alright, so please understand that. 178 00:24:31.920 --> 00:24:42.030 William Cheng: All right, so then I HOPE THAT YOU HAVE GOT MY MESSAGE over here is that you need to ask questions. Great. If you don't ask question and then toward the end of the semester you say I'm falling so much behind you got to get this look for me. 179 00:24:42.570 --> 00:24:46.410 William Cheng: Okay, so there's a you were confused and you didn't ask any question you didn't ask for help. 180 00:24:46.860 --> 00:24:50.820 William Cheng: Guide, because the message has been very, very clear is that whenever you are confused by anything 181 00:24:51.060 --> 00:25:01.320 William Cheng: Feel free to send a message to me. Okay, the words I can say is that, well, I can tell you the answer right because. But otherwise, most of the time I'm going to give you a response. Okay, so make sure you ask questions. Okay. 182 00:25:03.330 --> 00:25:13.050 William Cheng: All right, I guess I'm going to skip to the end over here. So things you should do, you know, read a website and you still wonder 16 point for the course content credit 183 00:25:13.650 --> 00:25:21.600 William Cheng: The lecture slides, mostly come with a textbook, so they are written by Professor Tom, Tom. Dubner Brown University. 184 00:25:22.080 --> 00:25:28.830 William Cheng: He's wonderful the textbook some additional slide for the course material or come from Professor Cabinda and again he taught this class was 185 00:25:29.040 --> 00:25:34.320 William Cheng: Some of the way he taught it. I like it. So I took his slides. And I'm making to my. So, some of them are due to him. 186 00:25:34.830 --> 00:25:45.240 William Cheng: Some of the Tesco for the parameters for the corner for me and Simon, part of it is done by Professor favor. He no longer teach at USC. So if you see a test code a call favor this paper that 187 00:25:45.660 --> 00:25:54.420 William Cheng: Those are called the written by him also doctor saw him. Then he was the first TA for this class. He also wrote some test code. So I'm going to sort of give them credit. Yeah. 188 00:25:55.050 --> 00:26:05.940 William Cheng: Alright, so now I have finished with the administrative style. And now I'm going to go to chapter one. So before I do that I'm going to sort of go briefly, you know, back to 189 00:26:09.420 --> 00:26:12.540 William Cheng: Back to the page over here. 190 00:26:15.810 --> 00:26:19.470 William Cheng: Okay, so if you look at the lecture slides over here. There's a tentative lecture slides section over here. 191 00:26:20.010 --> 00:26:27.090 William Cheng: So they go from Chapter one to seven. So that's the coverage of the class. Okay. So I'm basically, I'm going to go down this list linearly 192 00:26:27.240 --> 00:26:33.450 William Cheng: Except that when I say that I need to skip something over here I for example over here it says we'll go over this second after chapter five. 193 00:26:33.630 --> 00:26:40.800 William Cheng: So after I finished chapter five. I'm going to go to this thing that's cover first chapter five and I go to second. Okay, so otherwise I'm going to go through these, you know, 194 00:26:41.100 --> 00:26:55.410 William Cheng: These lecture slides linearly. You can also, you know, look at summer night 2019 lecture to see how things are getting covered. Okay, so again we're trying to cover exactly the same thing as summer 2019 okay not not nothing more, nothing less. 195 00:26:57.270 --> 00:27:01.770 William Cheng: Alright, so now we're going to start with chapter one. Chapter one, its introduction 196 00:27:02.280 --> 00:27:10.170 William Cheng: You know. So first, what they do is that a sort of talk about the ass I'm silly question. What do you think an operating system is we're going to skip that and talk about the real answer. 197 00:27:10.740 --> 00:27:19.410 William Cheng: Okay, the operating system is an abstraction. Okay, provide an abstraction for interface for the application to use your machine. 198 00:27:20.370 --> 00:27:31.530 William Cheng: OK, so the reason we we have an operating system is that, you know, if you think about what your software is doing. If you run an application profile, what does your application. Well, I'm doing okay your application proba is trying to use the hardware. 199 00:27:33.540 --> 00:27:40.890 William Cheng: How does the application, you use the hardware while we need to provide an abstraction for the application to use the hardware, right. So that's what the operating system is for 200 00:27:41.100 --> 00:27:50.670 William Cheng: It so that you can actually use the hardware when you run your application program. Okay. All right. So, so we're going to take a look at what kind of hardware. I'm going to talk about right over here. When I see it on the next slide. 201 00:27:51.210 --> 00:27:56.190 William Cheng: So, by the way, what, what is an abstraction. Abstraction is an abstract representation of something 202 00:27:56.460 --> 00:28:04.170 William Cheng: Okay, so if you have taken a computer science class before you probably heard about something called the abstract data type, the abstract data type is try to provide an abstraction. 203 00:28:04.470 --> 00:28:06.810 William Cheng: For you know for something, for example, the list. 204 00:28:07.110 --> 00:28:13.260 William Cheng: Right. So what is the absolute data tab right. The list can, you know, can is sorta so we can ask them to a list you can delete stuff on the list. 205 00:28:13.380 --> 00:28:19.710 William Cheng: So basically, it's kind of like a data structure with a bunch of functions that you can actually manipulate data inside this abstract data type. 206 00:28:20.550 --> 00:28:30.270 William Cheng: Okay. So when we talk about an abstract, you think about the abstract data type is in the abstract representation of something, why in this case for the operating system is an abstract representation of the machine. 207 00:28:30.780 --> 00:28:36.780 William Cheng: Okay, so this way by going through the organism, your application program will be allowed to use the machine, right. Why do you have to do that. 208 00:28:37.320 --> 00:28:45.810 William Cheng: Well, because the machine is shared by many, many application or your laptop is probably running 50 different applications simultaneously all of them want to use the same hardware. 209 00:28:46.290 --> 00:29:00.300 William Cheng: Okay. So, therefore, if you just allow them to just use the hardware is going to be a big mess. So therefore, they use the operating system so they can actually share the hardware safely and sort of make it look like they're simultaneously sharing the same hardware. 210 00:29:01.410 --> 00:29:01.680 William Cheng: Yeah. 211 00:29:02.790 --> 00:29:13.500 William Cheng: Alright, so, so let's take a look at the example that would that we're going to use the warm up. Why in one more point you're gonna you're going to implement a list object. Also by the way what you know this is not a C plus plus, plus. Why do I say object. 212 00:29:14.190 --> 00:29:20.430 William Cheng: Okay. So for people who provide in. See, we're going to use the word object to represent any data types. 213 00:29:21.030 --> 00:29:30.270 William Cheng: Okay, so what does the data type, right, the data can be a primitive data types like an integer, like a character like a floating point number. It can also be a complex data type, like a data structure. 214 00:29:30.570 --> 00:29:43.620 William Cheng: Okay, or it can be a pointer that point to a data type appointed can be used to point to a manager can be used to point to a data structure. It can be used to point to a pointer and that point O company to another point on the y su stop pointing to things you can do anything. 215 00:29:44.640 --> 00:29:46.860 William Cheng: Okay. So all of these things are objects. 216 00:29:47.340 --> 00:29:56.190 William Cheng: Okay, so in this class. Whenever we use the object we mean any kind of data types, including appointed data type. Okay. And again, why does he have a pointer, you can have appointed to a pointer to a pointer to a project. 217 00:29:56.970 --> 00:30:09.390 William Cheng: Okay, and then 2.0. We don't know what it's pointing to. All we need to do to know it's a pointer. So, by the way, what's the pointer there. That's one of the major confusion for people who don't have a CS background a pointer is just an address. 218 00:30:10.530 --> 00:30:15.930 William Cheng: There. So for example, you know, if you live in a house, right. You didn't the house it and address what's inside the house. 219 00:30:16.290 --> 00:30:19.470 William Cheng: Well, I mean, if you ever pointed that point of the house, or you can talk about the house. 220 00:30:19.830 --> 00:30:28.980 William Cheng: Okay, we don't really know who's living in there and maybe right now somebody in there, maybe five minutes later, somebody else will be in there. We don't really care what's important is to understand the concept of an address. 221 00:30:29.430 --> 00:30:40.800 William Cheng: Okay, so therefore, when you have a we have a pointer. All you have is the address exactly what sitting at that address, you don't know unless you actually follow the pointer to go there and then you can find out who's actually living at that address 222 00:30:42.210 --> 00:30:51.780 William Cheng: Alright so this might sound very, very vague. Okay, so once you the semester, going once you start writing some, some of your program. Hopefully, you're gonna have a better appreciation of exactly what a pointer is 223 00:30:52.200 --> 00:31:01.470 William Cheng: Okay, it's very, very difficult to explain it. You try to experience it. Okay, so do programming a seven. Number one, and hopefully you understand what a pointer is and pointer is a very important 224 00:31:01.680 --> 00:31:13.500 William Cheng: Concept here because in the end, what you will find out is that all we are manipulating our addresses. Okay, we don't really care what actually live inside an address what we're doing that we were manipulated and manipulating all these addresses. 225 00:31:14.010 --> 00:31:17.940 William Cheng: That hopefully by the end of semester. This will be clear. Yeah. Alright. 226 00:31:18.570 --> 00:31:24.690 William Cheng: So, so, so, so, you know, one of why you're gonna have a list, right. So, so what can we do to a list, right. So, for example, the list. 227 00:31:25.110 --> 00:31:28.350 William Cheng: Was thinking. Think about is that your list. You want the list to be sorted 228 00:31:28.920 --> 00:31:37.260 William Cheng: OK, so maybe this list. Over here we have a function to cause sort. I mean, our programming some, it doesn't have a sore function right but you can sort of imagine there's some other list over here. It's going to provide a sore function. 229 00:31:37.680 --> 00:31:44.910 William Cheng: I'm going to ask the question over here to say, Can my list really sort of self. Okay, you have a list sitting there is a piece of code and sitting there, he said goes toward yourself. 230 00:31:45.570 --> 00:31:54.060 William Cheng: What is the list going to do the list gonna say, the list is gonna say nothing had to live. It's a list, they cannot do anything by myself. Okay, so how can a list actually store to sell. 231 00:31:55.170 --> 00:32:09.930 William Cheng: Okay, so in order for you to for the list to be to be able to sort this out, you need to put the list inside an execution contacts. Okay, if you put the the list inside the execution context, then the list will be able to sort of self. 232 00:32:11.070 --> 00:32:14.610 William Cheng: Okay, so what does an execution context. And we don't know what that is. 233 00:32:14.910 --> 00:32:26.460 William Cheng: So, excluding contact is what the operating system will provide. So, the job of the operating system right in order for you to actually execute code is that part of the job in the operating system is to provide you with the execution contract so you can execute code. 234 00:32:27.750 --> 00:32:35.370 William Cheng: So in this case. Yeah, what is that going to be Go go go go go go to be involved. Right, we're going to use the word contacts all over the place. Okay and contacts is actually very difficult 235 00:32:35.520 --> 00:32:47.850 William Cheng: To explain again once you start using it. You're going to start being able to use the word and then you sort of get a feel of exactly what the contract says so exclusive contract is whatever that that needs to be provided in order for you to run a piece of code. 236 00:32:49.320 --> 00:32:54.930 William Cheng: Okay, if you if you need to use hardware while, then you better, you better make sure that the operating system provide your hardware to execute that code. 237 00:32:55.110 --> 00:33:02.760 William Cheng: If you want to you if you want to list of sort of self. Do you need a CPU to do that. Well, of course you need to CPU to do that right. What else do you need, what we're going to sort of 238 00:33:03.180 --> 00:33:11.760 William Cheng: That's the purpose of this class, we're going to talk about how to provide excusing contacts, including hardware, including all these other kinds of stuff in order for you to run code. 239 00:33:12.210 --> 00:33:21.420 William Cheng: Okay, so that's the purpose of the organization is run code for you, right. That's okay if there's stuff that you don't understand perfectly it's okay because we are at the introduction. 240 00:33:21.900 --> 00:33:31.860 William Cheng: Okay, so when you get to the end of the semester, you don't understand why. Then we have a problem guys hopefully by going through all the chapters in this textbook, India, you understand everything perfectly okay 241 00:33:35.790 --> 00:33:40.350 William Cheng: Awesome, what kind of hardware. Do we need to provide direction for. So some of the stuff they use 242 00:33:40.860 --> 00:33:47.820 William Cheng: I don't know if you ever over ever open up your computer. He said the computer, you're gonna have discs. Right. So these are my icon for the desk. They represented this 243 00:33:48.270 --> 00:33:57.240 William Cheng: They can be, you know, a hard drive, looking like this that can be optical drive that can be USB sticks. All these things are storage devices. We call them disk in general there. 244 00:33:57.900 --> 00:34:04.500 William Cheng: The other kind of device that we have one they're really not a device is called memory memories. When you buy your laptop, you have, you know, 245 00:34:04.830 --> 00:34:10.980 William Cheng: You know, four gigabytes a gigabyte 16 gigabyte. So these are called physical memory. They're also called RAM. 246 00:34:11.610 --> 00:34:16.170 William Cheng: OK, so the RAM, or we have to just draw a square box with the word memory. And then, so these are your memory. 247 00:34:16.740 --> 00:34:21.960 William Cheng: Okay, so again, memory as hardware, we need to share memory among all of the 50 program that are running on your laptop. 248 00:34:22.350 --> 00:34:36.060 William Cheng: Yeah, this is my logo for the CPU or the processor, as far as this cost is concerned, we're going to use the word processor CPU core, they are all interchangeable. They all mean exactly the same thing is it's it's a chip over here that can execute code. 249 00:34:37.140 --> 00:34:42.390 William Cheng: Guys. So, therefore, you know, the logo here is going to be a check the network over here is like your internet, right, I'm going to draw 250 00:34:42.930 --> 00:34:48.360 William Cheng: A wire over here are this one over here is going to connect you to the rest of the world does your internet. Yeah. 251 00:34:49.170 --> 00:34:55.110 William Cheng: It could be a wire iannetta could be a wireless Internet if it's a wire the internet that you're going to have an Ethernet jack that's connected to your machine. 252 00:34:55.290 --> 00:35:00.180 William Cheng: If it's a wireless internet. Is it going to be antenna that sticks out. So again, it doesn't really matter what it, what it looks like. 253 00:35:00.540 --> 00:35:09.090 William Cheng: You'll be able to connect to the rest of the rest of the internet. Yeah, other hardware is like your monitor your keyboard your mouse. All these things are your hardware. 254 00:35:09.720 --> 00:35:17.520 William Cheng: That so so you need to remember that what's important. Over here is at the application program are never allowed to use the hardware directly 255 00:35:18.930 --> 00:35:29.130 William Cheng: Okay, because if you do that, then you're going to fight with other application program. So therefore, there's not allowed. Right. So this is why we need to provide an abstraction. So your app, your application profile will need to deal with the abstraction. 256 00:35:29.310 --> 00:35:34.620 William Cheng: So that they can add India, they will be able to use the hardware sort of in a nice way. 257 00:35:35.430 --> 00:35:40.320 William Cheng: Right, so you have to go through the operating system. So the operating system will allow you to access to all the things that 258 00:35:40.980 --> 00:35:49.530 William Cheng: Are here are some of the operating system abstracting you probably heard of them for the desk over here, the operating system abstraction. I'll call files or they're called the file system. 259 00:35:49.950 --> 00:35:58.680 William Cheng: By the fastest. I mean, are you going to have, you know, folders you might have directories instead of folder or sub folder or sub folder. Eventually a file. So these are the operating system abstractions for you. 260 00:35:59.190 --> 00:36:09.510 William Cheng: There. So again, they are the Father, the fastest them the abstraction for memory. As it turns out, is pretty we're over here. So again, this is, you know, you will not be able to appreciate this until you're almost at the end of the semester. 261 00:36:09.930 --> 00:36:15.930 William Cheng: There the app charging for memory is actually called progress. Okay, so if you have, you know, if you actually take a 262 00:36:16.260 --> 00:36:22.110 William Cheng: Computer Science class before you probably know the difference between your program and a process. So what is it different when you pull out our process write 263 00:36:22.380 --> 00:36:25.830 William Cheng: A book program is that when you compile your code is sitting on the desk. That's a program 264 00:36:26.190 --> 00:36:31.140 William Cheng: Will you double click on it, will you start running, running that program a running program is a process. 265 00:36:31.410 --> 00:36:38.340 William Cheng: Okay, so for the same product you can run it 200 times you're going to end up with 200 different processes. They all they all come from exactly the same program. 266 00:36:38.850 --> 00:36:46.740 William Cheng: Okay, so in this case we're going to use processes or programs to represent memory. Okay, so how to use memory, what you need to have a process. 267 00:36:47.910 --> 00:36:54.930 William Cheng: OK. So again, you know, this might not make sense at this point. But, you know, over time, distributed this constantly be more and more clear. Okay. 268 00:36:55.470 --> 00:37:05.580 William Cheng: What is the abstraction for processor, though the abstraction process or somebody will say it's a process. So that's wrong. Okay. As far as this is concerned, the abstraction will processor is called a threat. 269 00:37:06.360 --> 00:37:13.350 William Cheng: Okay, it's called a threat of execution is called a third of control or it's called a thread. Okay, so if you want to use the CPU, you need a threat. 270 00:37:14.190 --> 00:37:24.030 William Cheng: Okay, well, so what if you are four CPU, you want to use for CPU simultaneously. Well, then in that case you have to create a program that has four threads in that way. So this way you can use the four CPUs simultaneously. 271 00:37:24.420 --> 00:37:32.220 William Cheng: Okay. So, therefore, you know, so the abstraction for CPU or threat or the CPU or processor or core is a threat or control or threat. 272 00:37:34.560 --> 00:37:42.630 William Cheng: For the capture the internet, you need the communication substance them to abstract the monitor. You need a Windows the graphics upsets them. 273 00:37:43.110 --> 00:37:49.200 William Cheng: If you need to abstract away the keyboard. You need an input subsystem, you need to abstract away the mouse, the Court locator substance them. 274 00:37:49.590 --> 00:37:57.270 William Cheng: Some of the stuff over here I draw them in blue, because when I spend a lot of time talking about that. Okay. All the other ones, you know, maybe we're going to spend, you know, 275 00:37:57.600 --> 00:38:01.710 William Cheng: Five minutes 10 minutes talking about it, but they are not the focus of this class. Okay. 276 00:38:02.430 --> 00:38:08.070 William Cheng: So for the Father, the file system. This is Chapter six, right, we're gonna we're gonna sort of talk about how to actually implement them in chapter six. 277 00:38:08.640 --> 00:38:16.470 William Cheng: For processor, you know, the abstraction of a memory. This is actually Chapter seven is the last chapter, we're going to talk about so different. This is, you know, this more complicated. 278 00:38:17.250 --> 00:38:23.220 William Cheng: The threads over here is chapter five. Okay. In chapter four. We're going to sort of talk a little bit about the abstraction for your keyboard. 279 00:38:24.420 --> 00:38:36.360 William Cheng: That all the other ones. We're going to briefly touch upon them. OK. So again, to remember that, you know, for your application program. If you want to use all these hardware, you have to go over, you know, you have to go through all these all these abstractions. Yeah. 280 00:38:39.270 --> 00:38:47.040 William Cheng: I asked the main focus of this class is talk about how the operating system to provide all these abstraction to you. Okay. I mean, don't just hack it until we're done. 281 00:38:47.220 --> 00:38:54.420 William Cheng: Okay, so we're going to sort of talk about what is the operating system design principle, so that you can actually provide all these apps, if you're in a nice way. 282 00:38:55.230 --> 00:39:03.810 William Cheng: Okay, so, so, so again this class is more about, you know, the sort of the fundamental of the cynicism, how to provide all these kind of abstraction in a generic way. 283 00:39:04.200 --> 00:39:08.040 William Cheng: So that, you know, and also, you know, they actually use for the generic companies is there. 284 00:39:08.280 --> 00:39:15.690 William Cheng: Is enough for a special purpose operating system right if you have opportunities me like in this day they have these internet of things, you know, you want to have a toaster. 285 00:39:15.900 --> 00:39:20.850 William Cheng: You need an operating system. Well, that obviously them can be a specialized opportunism. You don't need a general purpose operating system. 286 00:39:21.270 --> 00:39:26.490 William Cheng: OK, so the focus of this class or general purpose operating system. They are much more difficult to write 287 00:39:26.730 --> 00:39:36.900 William Cheng: And we're going to talk about the design principles for all these general purpose ordinances them so that your application program you're going to run all kinds of application program that will use the hardware of this particular system. 288 00:39:37.740 --> 00:39:48.780 William Cheng: OK. So again, this cause more about the fundamental and this is not a test class. What is it that class. The tech class talk about what is the latest and the greatest out here, you know, what are people using this kind of stuff we don't talk about that at all. 289 00:39:49.230 --> 00:39:59.340 William Cheng: Maybe I'm probably gonna talk about that a little bit. But most of the time we're going to talk about older system. What kind of, you know, how did they actually provide all these abstraction and even today, we still use exactly the same abstraction. 290 00:39:59.970 --> 00:40:09.720 William Cheng: Okay. The other thing that we need to worry about. Because again, we'll talk about the design principle, we need to worry about how to make sure that they run fast Raza performers, you know, the performance. There are different. 291 00:40:10.050 --> 00:40:18.330 William Cheng: Dimensions. It could be, you know, in the time dimension, you need to be fast. Also the could be space, we need to be space efficient, right, because if you use up all the space. 292 00:40:18.750 --> 00:40:24.840 William Cheng: You know your hard drive or on inside memory over here. Well, in that case, we're going to be out of space and therefore we're not, we will not be able to run our program. 293 00:40:25.680 --> 00:40:33.360 William Cheng: There are today because of cell phones and tablets. We also need to worry about energy efficiency, because if you use up the battery. Well, then it's really not very, very useful. 294 00:40:33.870 --> 00:40:40.020 William Cheng: Now, we also need to worry about sharing all these resources right like the four gigabytes of memory on your laptop. 295 00:40:40.260 --> 00:40:46.410 William Cheng: They are shared by all these 50 different programs, how do we actually share you know the limited amount of memory, all these programs. 296 00:40:46.770 --> 00:40:53.250 William Cheng: Okay, so that's all can talk about. Also, they need to be a failure, tolerance, right, if you're operating system crash. If you lose power. 297 00:40:53.640 --> 00:41:01.200 William Cheng: We don't want to lose the entire operating system we have to start our machine from, you know, the guy reformat our hard drive install a new operating system that will be terrible. 298 00:41:01.770 --> 00:41:10.620 William Cheng: Okay, so we're going to sort of talk about how do you design the operating system so that in case you lose power. You don't really lose anything. Okay. All you have to do is do a reboot and then you get everything back. Okay. 299 00:41:11.370 --> 00:41:24.000 William Cheng: We also need to worry about security. I mean, so again, these are the old operating system, the kind of security that we worry about is that how do you protect one application from another application. And how do you protect the operating system from all the applications. 300 00:41:24.690 --> 00:41:32.400 William Cheng: Okay, we don't really talk about it the kind of operating the security that worried about today. So what do we were about today, you know, you heard about Drive by download all the kind of hijacking, all that kind of stuff. 301 00:41:32.610 --> 00:41:39.990 William Cheng: Those are not the focus of this class, right, we only worried about isolation this class when we talk about security. Yeah. Finally, you know, you're 302 00:41:40.500 --> 00:41:47.460 William Cheng: Talking about a little bit about marketability, the basic idea what we hear is that you need to pay attention to, to, to, to sort of figure out what what does the user want 303 00:41:48.090 --> 00:41:58.020 William Cheng: Okay, if the user wants to have certain kind of the functionality for general purpose offices them, you need to provide with them. If you don't give it to the user. The user is going to go somewhere else. 304 00:41:58.590 --> 00:42:07.770 William Cheng: Okay, so therefore we don't create an operating system inside of action, we need to create operating system with feature that people actually want. Okay. As it turns out, that's really not that easy. Yeah. 305 00:42:09.720 --> 00:42:16.830 William Cheng: Alright, so let's sort of briefly at a very, very high level talk about what are these, you know, these three three important chapter 100 306 00:42:17.310 --> 00:42:18.870 William Cheng: The abstraction that we need to provide 307 00:42:19.290 --> 00:42:26.850 William Cheng: The first one over here is going to be the found in the file system. Right. So again, the hardware look like this. But what about the abstraction, right, the abstraction is that 308 00:42:27.000 --> 00:42:37.860 William Cheng: We're going to have a file cabinet. We're going to have folder is not a folder we have sub folders and then instead of sub folder. Maybe there's a file. Maybe there's another sub folder. So on the left hand side over here on the right hand side, they look completely different. 309 00:42:39.240 --> 00:42:47.730 William Cheng: Okay, so therefore all the opportunities, the abstraction over here is actually very, very complicated using this abstraction all left inside. We need to build on on the actual hardware. 310 00:42:48.210 --> 00:42:53.130 William Cheng: Okay, so in chapter six. We're going to sort of see how this is done. OK. So again, we're not gonna talk too much about it right now. 311 00:42:53.460 --> 00:42:58.980 William Cheng: Since we're in chapter one, we're going to talk about the basic kind of, you know, sort of design decision there. You have to make 312 00:42:59.400 --> 00:43:03.750 William Cheng: For example, how do you provide device independence. That's what is device independent 313 00:43:04.050 --> 00:43:10.260 William Cheng: Why we saw that there are different kinds of heart, different kind of drives. There's the optical drive. There's the hard drive. There's a USB stick 314 00:43:10.500 --> 00:43:17.550 William Cheng: It will be really, really bad if for every kind of device, you have to have a different way to name your files or to be able to find it on your files. 315 00:43:18.000 --> 00:43:27.240 William Cheng: Okay, so you want to be able to locate all your files using a device independent way. Okay, so therefore device independent over here, become very important. So, by the way, what is the device. 316 00:43:27.840 --> 00:43:36.660 William Cheng: That we talked about all these different kind of hardware in general, these are divided into three different categories. Right. One of them is a CPU CPU special because they can execute code. 317 00:43:37.080 --> 00:43:40.800 William Cheng: Okay. Your memory is memory is also special okay because you know 318 00:43:41.640 --> 00:43:53.070 William Cheng: Because you know every program sort of needs memory that every program is all the other devices devices out there, everything else. We call them a device right so the hard drive is a device your USP is a device. 319 00:43:53.520 --> 00:43:59.130 William Cheng: You're, you know, network interface card so device your displays of device are keepers of device your mobile device. Everything else is device. 320 00:43:59.640 --> 00:44:07.170 William Cheng: OK. So again, we need to provide device independent. So when whenever you try to, you know, swap out different devices, your program will continue to work. 321 00:44:07.590 --> 00:44:14.580 William Cheng: Yeah, and also when you try to allocate space on these devices. You don't really want to have too much overhead because otherwise going to use up your storage space too fast. 322 00:44:14.730 --> 00:44:23.250 William Cheng: Okay, so in chapter six, want to sort of address the issue, what kind of data structure is the efficient, how do you actually use all these device without using up too much resources. 323 00:44:23.640 --> 00:44:26.430 William Cheng: There and also we need to shop with them between this memory. 324 00:44:27.210 --> 00:44:38.250 William Cheng: When. So why is that, okay, as it turns out our program. Right. So again, our program. Can I use devices directly with our problem. Can I use hardware directly, although we can actually use memory in an indirect way. 325 00:44:38.850 --> 00:44:48.060 William Cheng: Okay. So in a way, we sort of have a quick access to it to memory, but we can. Let's go back to the previous slide over here. Right. Okay. In order for our program to run, we can actually use memory. 326 00:44:48.960 --> 00:44:53.760 William Cheng: Okay, but there's no way for us to use any of the devices. So in order for us to use any of the device. 327 00:44:53.970 --> 00:45:03.480 William Cheng: What we have to do is that we have to ask operating system for help. So the organism can go to this devices, copy the data from the device into memory and then we can use it. 328 00:45:04.050 --> 00:45:10.770 William Cheng: We, how do we use it well. So again, the process is the abstraction for memory. If you want to use memory, we have to use a process. 329 00:45:11.220 --> 00:45:17.580 William Cheng: Okay, so once we copy the data from this into memory, then we use the abstraction of a process in order to have to access the data. 330 00:45:18.420 --> 00:45:22.740 William Cheng: Okay, so one of the things the obvious isn't will have to do is that they will keep copying data from this into memory. 331 00:45:22.890 --> 00:45:32.970 William Cheng: And also if your program dies, we need to copy all the data from memory back to the desk. So the audience isn't going to submit a lot of time copying data from a distant memory. Memory to this and this needs to be done in a very, very fast speed. 332 00:45:33.780 --> 00:45:43.200 William Cheng: Okay, so this way you don't really feel that you're operating system is slow or your devices are slow. Right. One of the problem with the devices over here is that typically all these devices are very, very slow your CPU is very, very fast. 333 00:45:43.470 --> 00:45:51.480 William Cheng: But these devices are slow. So therefore, the operating system over there is going to try to shuffle data between the disk and memory and make it look like it's actually running very, very fast. 334 00:45:52.020 --> 00:45:54.060 William Cheng: Okay. So as it turns out, this is really not so easy. 335 00:45:54.900 --> 00:46:05.370 William Cheng: Okay, all right, and also the file system. If you crash. We don't want to lose the entire this. I mean, you guys are pretty lucky, just like 15 years ago, every time when when when I, you know, if I use a computer every time when I lose power. 336 00:46:06.060 --> 00:46:13.200 William Cheng: When I repo. I'm going to see this thing that's going to spin this a checking that this to make sure that this is okay. It is possible. I will lose my entire desk. 337 00:46:13.590 --> 00:46:22.440 William Cheng: Okay, so these days, you don't have to worry about it anymore. We're going to sort of talk about, you know, a modern operating system. What kind of techniques they use so that you can actually cope with all these crashes. 338 00:46:22.830 --> 00:46:27.510 William Cheng: That so again I right now we're in chapter one, just a very, very quick introduction that 339 00:46:28.740 --> 00:46:38.340 William Cheng: The second option over here is going to be programmed. Right. So again, the application program going to use the address space abstraction to represent memory. So what is the address space. 340 00:46:38.790 --> 00:46:45.810 William Cheng: Okay, the address space or addressable memory locations. So if we have a 32 CPU. A third to the CPU rise to to the 32 341 00:46:46.170 --> 00:46:51.930 William Cheng: Okay, so we have a 32 bit address space and that will be a four gigabytes address page, whereas over here. Here's four gigabytes over here. 342 00:46:52.200 --> 00:47:04.020 William Cheng: Every memory location over here. They're all addressable so in this case the addressable memory locations going to go from zero. So the first memory location of your is going to be zero. The last memory location over here. It's going to be a 32 bit of once 343 00:47:04.500 --> 00:47:10.500 William Cheng: We're going to get used to writing addresses in hexadecimal notation. So that will be zero, x F, F, F, F. 344 00:47:10.830 --> 00:47:20.070 William Cheng: F F F F right every character over here is for this long go from 0123456789 and an A, B, C, D, E, F. That's from zero to 15 345 00:47:20.430 --> 00:47:26.820 William Cheng: Guys over here. There are eight characters over here. Each one of them is for beer that 32 beds and this is our addressable memory location. 346 00:47:27.540 --> 00:47:31.920 William Cheng: Okay, so the way that we think about our program is that the program is divided into memory segments. 347 00:47:32.160 --> 00:47:41.970 William Cheng: The first memory segments over here. They're sitting and low memory location over here is known as the tech segment of the coast segment. So all the code that you have ever written, they're all sitting over here. 348 00:47:42.960 --> 00:47:48.750 William Cheng: Okay, and the next memory seven going over here is called a data segment that data sermon contains all your global variables. 349 00:47:49.590 --> 00:48:02.340 William Cheng: OK, the next memory segments over here is going to be known as a dynamic segment or the heap segment. When you call are what we do any kind of dynamic memory allocation. So in C and c++ so you can see you're going to use the function called Malik. 350 00:48:03.120 --> 00:48:10.200 William Cheng: There, when you use the function Mela you're going to allocate memory out of the heap and what it will do is that is a Malik 400 over here. 351 00:48:10.770 --> 00:48:20.100 William Cheng: What the memory allocated will do is that it will find 400 bytes of memory over here and they will return you with an address and use a pointer to point to a to remember what has been allocated for you. 352 00:48:21.450 --> 00:48:28.260 William Cheng: Or I forget if you're not familiar with Malik and free, you need to start writing, you know, doing your warm up one and then try to get get used to the idea 353 00:48:28.830 --> 00:48:30.000 William Cheng: That this particular operation. 354 00:48:30.300 --> 00:48:41.670 William Cheng: allocate memory by asking them and memory allocated for memory. And then when you're done with that, you can call free, right. So over here, you said a pointer to be the return value of malice. So this is the point of variable. All it means that 355 00:48:41.970 --> 00:48:49.920 William Cheng: It contains an address this address got a point into the heap segment inside your address space and this will be 400 bytes of data. That'd be allocated. 356 00:48:50.370 --> 00:49:03.090 William Cheng: Okay, when you're done with this 400 bucks or memory or here you're going to call free with the point of PR. We had to say I'm returning this 400 bytes of memory back to the memory alligator. So that can be reused and from this point. Now, I promise not to touch it. 357 00:49:05.010 --> 00:49:12.540 William Cheng: Okay, so why do you actually use the dynamic memory or the heat memory segment over here. Well, because you don't really know what kind of data that you need when you start running your program. 358 00:49:12.990 --> 00:49:24.240 William Cheng: Okay, so our warm up one so is designed to force you to use the dynamic memory segment over here because you don't really know how much data you need process. So every time you deposits memory, you need to 359 00:49:24.540 --> 00:49:31.290 William Cheng: Every time we need to process data you need to allocate new memory over here from the dynamic region over here and then you need to learn how to manage it. 360 00:49:31.800 --> 00:49:40.710 William Cheng: Right. So again to warm up line to understand exactly how the heap works. OK. And then at the bottom you either serious over here. It's going to be your program stack your program stack. 361 00:49:41.280 --> 00:49:50.760 William Cheng: So I'm going to stop when you whenever you run run C code every sequels, you know, every, every, every piece of code that you have ever written. They are all inside of the function 362 00:49:51.480 --> 00:49:58.500 William Cheng: Okay, so if you see a function over here. Here's the function over here, right. So what are, what are the functional black right he has function argument. He also have local variable. 363 00:49:58.860 --> 00:50:07.320 William Cheng: Right. So the purpose of a program stuck over here is that I'm going to clean up this a little bit. Okay, so in the program stag over here. There's going to be someone called stack frames. 364 00:50:07.620 --> 00:50:18.030 William Cheng: Okay. Every star friend correspond to a to a program. So if you ever put out what we call the function over here, the function argument at a local rebel, they are actually allocated inside the stack. Right. 365 00:50:20.280 --> 00:50:30.990 William Cheng: Okay. So whenever you call the function. So, for example, your main function, your main function has function argument RV and RC right so they live inside the stock room over here. And then we declare local variable. They all live inside. Is that right, 366 00:50:31.560 --> 00:50:36.810 William Cheng: Okay, so why is it done this way or this way you can actually, you can actually make make a recursive function call. 367 00:50:37.410 --> 00:50:41.940 William Cheng: So recursive on you go for example the factorial function right this f bombs over here to the factorial function. 368 00:50:42.150 --> 00:50:44.730 William Cheng: So if you try to compute the factorial of three. 369 00:50:44.910 --> 00:50:52.440 William Cheng: What happens at the function is going to call us out. So what it will do is it will call this function with three and next time when it call itself. We will call the fact function with the argument to 370 00:50:52.620 --> 00:51:01.410 William Cheng: And then when they call the function itself has been called a factor of one to one. So in this case, the function argument over here was simultaneously be three, two and one. 371 00:51:02.280 --> 00:51:07.530 William Cheng: Okay, so in that case, how can a variable actually have three instances. And every one of these things and they have a different value. 372 00:51:07.830 --> 00:51:18.330 William Cheng: Yeah, so the trick. Over here is that in the program start over here. We're going to have the factorial function over here with the argument equal to three. And next time when the function call a cell. We're gonna have to create another 373 00:51:19.200 --> 00:51:26.940 William Cheng: Another stack right over here for the function itself with an equal to two and then when they called us up again app over here, able to walk. 374 00:51:28.200 --> 00:51:33.420 William Cheng: Okay, so, so this is the reason why the function argument, a local variable over here. They live inside the stack. Right. 375 00:51:34.140 --> 00:51:39.210 William Cheng: Okay, so the bottom part of your talking over here. It's going to be the main function and means I'm call some function. I'm going to pause and watch it. 376 00:51:39.360 --> 00:51:48.630 William Cheng: Whenever you make a function called going to create a new stock friend. We're going to copy the function argument and local variable into the stack friend and then we're going to start with and then we're gonna start running the code inside the function 377 00:51:49.740 --> 00:51:56.490 William Cheng: So for that function to cozy living inside the stack segment over here and then the function argument local rebel. They live inside 378 00:51:57.720 --> 00:52:08.520 William Cheng: men and men of segue over here when you try to run a piece of code inside of function. The code is live inside the the tech segment over here, what the function argument and local variable. They live inside of slack segment. 379 00:52:09.300 --> 00:52:21.570 William Cheng: Okay, so the purpose of your, of your, of your program is to manipulate your address face that and when you when you're required to use the hardware at that point, you need the ordinances for help. And then you can actually use all the other hardware. 380 00:52:23.520 --> 00:52:33.270 William Cheng: OK. So again, this is basically what the program is the program is something that you use to manipulate the address space where here's your global variable. Here's your dynamic variable. And here's your function. 381 00:52:33.750 --> 00:52:41.220 William Cheng: Function argument, a local variable, putting them all together your program with change all these value. And in order for you to program to proceed to the next date. 382 00:52:42.270 --> 00:52:54.840 William Cheng: Okay, so. So again, you know, so that's the abstraction of what your program look like think about the I just face every time we talk about a program. Think about the corresponding address space. Okay. And the goal will be a program is to manipulate the address space and to use the hardware. 383 00:52:55.980 --> 00:52:58.590 William Cheng: Okay, so that's what a pro vendors that 384 00:53:00.150 --> 00:53:05.400 William Cheng: Are very important that this picture over here if you compare with that with the picture instead of textbook. It's upside down. 385 00:53:06.090 --> 00:53:13.350 William Cheng: Okay, so in the textbook. The low address over here at the bottom, the zeros at the bottom over here and then the address goal of increasing to the top. 386 00:53:13.890 --> 00:53:14.970 William Cheng: So what did they do it that way. 387 00:53:15.420 --> 00:53:19.830 William Cheng: Okay, because you know when people try to draw you know these picture over here. There's basically two ways to go. 388 00:53:19.980 --> 00:53:31.230 William Cheng: One is that you know the value increase, you know, going up and the other one is going down. So typically wild is that people who are doing math right. What will you do math. You know, when you have x this way and why this way. Well, why it goes up this way. 389 00:53:31.890 --> 00:53:40.500 William Cheng: Okay, but when you're doing computer science over here x usually go this way. And why is actually going downwards, especially if you have taken a computer graphics sighs You will know that this is actually how it works. 390 00:53:41.010 --> 00:53:49.110 William Cheng: Okay, so why do they do that. Okay, so here's the reason. Over here, it says that, you know, the you know the the the reason we do this is that 391 00:53:52.890 --> 00:53:59.640 William Cheng: Okay, I'm not clear out the clutter. Here the memory loss matches an array. Okay. If I have an array. So here's an array over here like here's a race pretty big. 392 00:54:00.030 --> 00:54:08.520 William Cheng: So let's see that disarray. I put in the integer value. So here's the interviewer will be here. I'm going to put the value 0123456. I'm going to put 100 numbers in that 393 00:54:09.240 --> 00:54:12.420 William Cheng: Okay go from zero to 99 right when I tried to lay out this 394 00:54:12.630 --> 00:54:21.750 William Cheng: You know this array element in memory of what would I do. Right. So over here I say what a over here, as I said that presented this array is a global variable, so therefore they live inside of data segment. 395 00:54:22.080 --> 00:54:33.540 William Cheng: Is right here is actually right here. Okay, here's every element zero right here as a value of zero area number one over here has a value of one and then two and three and now I raw space was going to be for 396 00:54:34.290 --> 00:54:39.840 William Cheng: Okay, there are two places I can write full. Why is I can write it for right here. The other way I can write for above it. 397 00:54:40.410 --> 00:54:44.550 William Cheng: Okay, why would I rather above or below what depends on the address for this array element. 398 00:54:44.880 --> 00:54:51.900 William Cheng: Okay, to read over here. Everyone has the integer again for a 32 bit machine integer is is four bytes long 399 00:54:52.110 --> 00:55:04.680 William Cheng: So therefore, every one of them occupied four bytes over here. So over here. Here's four by four by four by four by the next four by if you chart below it over here. That means that the address over here below is larger than where the array starts 400 00:55:06.360 --> 00:55:10.920 William Cheng: Okay, so that means that this is going to be a low address and it's going to be a higher address if you write for this way. 401 00:55:11.160 --> 00:55:23.340 William Cheng: If it turns out the, you know, if the address is actually points upward by nutcase. The force, you'd be written this way. So use right 01234567 and eight 910 11 but nobody writes it that way. 402 00:55:24.030 --> 00:55:32.610 William Cheng: Okay, so that's why it's more reasonable to turn your IP addresses place upside down. So this way we try to lay out the elements inside array, though I should look correct 403 00:55:33.960 --> 00:55:45.120 William Cheng: Okay, so this is the main reason for all my address space I flipped them relative to the textbook. So that low addresses. Is that a top and high address at the bottom, guess what, again, it's very important to understand that. 404 00:55:46.860 --> 00:55:54.930 William Cheng: All right, and also one more common over here, this is not the only possible memory layout, the compiler actually decide we're all these memories segments are 405 00:55:55.410 --> 00:55:59.850 William Cheng: Okay. So, by the way, one of these memory segments, right, the memory segment. Basically, they are you know kind of 406 00:56:00.000 --> 00:56:08.340 William Cheng: The same kind of data they have the same kind of characteristics. So for example, if they're all program code that you wrote my neck. Is there a group together. And there are put into a memory segment. 407 00:56:08.730 --> 00:56:17.610 William Cheng: Okay, all the global variable, they are kind of similar. So therefore, there are put into a data segment or the dynamic a alligator. You know, memory, they're putting a dynamic region. 408 00:56:17.850 --> 00:56:24.660 William Cheng: And then all the programs that sacrum over here. They're packed together into the programs that okay in the middle part over here. It's going to be a big empty space. 409 00:56:25.470 --> 00:56:35.700 William Cheng: That this is not the only layouts. Right. So in this layout, the smallest a memory segment of here's the tech side man, followed by data, followed by dynamic and then there's a big gap, and in the end of the stack over here. 410 00:56:36.210 --> 00:56:46.170 William Cheng: Okay, so later on when you're doing your kernel Assignment going to see that this is not the only memory layout of the memory layout is also possible, as it turns out, it's the compiler decide what the address space look like 411 00:56:46.680 --> 00:56:55.920 William Cheng: Okay, so let's turn the Robin has a long time ago, the hardware people the ordinances and people at the compiler people they got together and then they sort of sort of figure out who should be doing what 412 00:56:56.610 --> 00:57:12.420 William Cheng: Okay. At that time, they decided that, you know, the layout of the or the sort of the, the layout of the address space that decision is made by the compiler. Okay, why did they do that. I don't know. But anyways, that that that's that's kind of decision that they end up making yeah 413 00:57:14.460 --> 00:57:22.200 William Cheng: Alright, so when we try to run our program over here we're going to run multiple for right so again you know you love how you might run 50 program I'm joining three over here. 414 00:57:22.410 --> 00:57:29.760 William Cheng: Every time we think about a program, we're trying to address face right so we here. There are three program. There are three address space over here. So again, how do you run your program. 415 00:57:30.390 --> 00:57:37.380 William Cheng: Okay, so in this case you want to map your program over here into all these hardware devices and into memory into CPU over here. 416 00:57:38.310 --> 00:57:47.010 William Cheng: How do you actually, you know, sort of shared this memory right this memory over here is four gigabytes long over here. Okay, everyone or the address spaces for goodbyes long. I mean, it's already doesn't fit. 417 00:57:48.780 --> 00:57:57.150 William Cheng: Okay, so, so again if I run three programs over here, they don't fit in four gigabytes of memory. So in this case, maybe I need to 15 gigabytes of memory. So maybe one solution over here is that 418 00:57:57.300 --> 00:58:02.880 William Cheng: I need to buy 16 gigabytes of memory. So therefore, the first one over here is going to be for the first program. And the second one is for a 419 00:58:03.420 --> 00:58:15.090 William Cheng: Second pro black to throw off and circle the opportunities and also the memory. So maybe organisms are occupied the rest of memory. I mean, clearly, that's not a good way to go. And so in this case, I can only run three program and a couple of other memory. 420 00:58:16.110 --> 00:58:23.430 William Cheng: Okay. So, therefore, we don't really do it this way. Okay. I want to do it in a very, very flexible way so we can run many programs, much more than three programs. 421 00:58:24.210 --> 00:58:30.840 William Cheng: There. So the technique that we're going to use over here is to map on address space into physical memory, right. So, this is known as memory mapping 422 00:58:31.110 --> 00:58:41.370 William Cheng: Memory mapping is a very, very complicated subject is going to be covering chapter seven. So right now we're just some sort of go give you a tiny little introduction to what memory mapping might look like right by drawing a picture. 423 00:58:41.760 --> 00:58:49.020 William Cheng: Yeah, so the idea here is that we're going to use these these things called a map to map your address space over here to hardware. 424 00:58:49.650 --> 00:59:01.950 William Cheng: Okay, so here's your four gigabytes or address space over here, right, the speakers will show you part of your address space will map the physical memory or you all who will map to read. And the other part of your address. So after the desk. 425 00:59:02.580 --> 00:59:13.410 William Cheng: Okay, every program is going to be like this part of them after remember a part of them after this. So this way. If you have 50 program on the left over here, they will actually be able to fit in memory, because most of these programs. There are sitting on desk. 426 00:59:14.550 --> 00:59:21.240 William Cheng: Okay. So inside the corner. We're going to use this data structure. What a sort of give them a very, very big name is called the virtual memory map. 427 00:59:21.990 --> 00:59:29.670 William Cheng: Okay, this virtual memory map will actually map part of your address space into physical memory and party address space into other devices. 428 00:59:30.210 --> 00:59:38.430 William Cheng: So this way when you try to use your, you know, we try to run your program. If everything that you need are in physical memory. Well, in that case, your program will be a person 429 00:59:38.670 --> 00:59:47.580 William Cheng: If it turns out you start using part of your program. They're sitting on this. In that case, you need to have all the Albany says that the offices that will actually pulling the data from the data into memory. 430 00:59:47.820 --> 00:59:51.840 William Cheng: Change the memory map over here. And now you can use it. And now you can continue to use your program. 431 00:59:53.520 --> 00:59:59.760 William Cheng: OK. So again, this is a very, very complicated process. We're going to talk about them in detail in chapter seven. Right now, if you don't know, it's okay. 432 01:00:00.780 --> 01:00:04.890 William Cheng: Alright, so we're going to sort of itself, by the end of the semester, you will know exactly how this one is done. 433 01:00:05.100 --> 01:00:13.440 William Cheng: And also the great part is that while you're doing your kernel three assignment you get to implement the virtual memory map. So, therefore, you really know how this actually works. Yeah. 434 01:00:15.810 --> 01:00:20.160 William Cheng: Alright, so in this case since since we're doing map over here. So in this case, 435 01:00:20.430 --> 01:00:31.920 William Cheng: The address that you have into your program. They are not physical address right the physical address is the address on the physical memory. So here I'm going to say that you know the address that you use on the memory over here. They are physical address so 436 01:00:32.220 --> 01:00:40.290 William Cheng: The address that you use inside your program. The one that go from zero all the way to zero, x F, F, F, F, F, F, F, that those are called virtual address 437 01:00:41.100 --> 01:00:48.720 William Cheng: Okay, so what is the virtual address the virtual address the fake address restaurants turns out when you're running your program. All the address you're using. They're all fake 438 01:00:49.320 --> 01:00:57.990 William Cheng: Okay, so who's using physical address. Well, I mean, clearly, only the optimism will know anything about physical address your program is a oblivious to physical address 439 01:00:58.440 --> 01:01:03.930 William Cheng: Right. So this way you're pulling will work no matter how much physical memory that you have. So, so, you know, it's kind of a great thing. 440 01:01:04.260 --> 01:01:10.440 William Cheng: Okay, so by using this virtual memory map. So part of the job of the virtual memory map is to map virtual address to physical address 441 01:01:11.130 --> 01:01:16.470 William Cheng: Okay, exactly how this is done. We're going to sort of introduce that to you a little bit at a time. So, eventually you get to chapter seven. 442 01:01:16.680 --> 01:01:23.010 William Cheng: You will know how this is done. And then more importantly, you're going to have to implement that in chapters are using your kernel three assignment. 443 01:01:23.580 --> 01:01:32.730 William Cheng: That. So again, this is all going to say for now that all right. The last part over here is going to be the abstraction for the CPU. We're going to call them threats, right. So, so again threat. 444 01:01:33.750 --> 01:01:46.890 William Cheng: So, so, so, so, so, so in this case, what are your strengths are as execution of threats of control at the represented CPU. So here we said I, you know, so maybe inside your machine, you don't have one CPU. Okay, we're gonna run multiple thread on the CP 445 01:01:48.210 --> 01:01:56.940 William Cheng: One CPU. So in this case, we're going to sort of think about. We're actually creating, creating these are these virtual CPUs over here that are each one of them represent a threat. 446 01:01:57.930 --> 01:02:11.010 William Cheng: Okay, so in this case over here. Each one of them each one of them is a separate thread the separate sort over here is basically a virtual CPU. So in this case, what we need to do is that we actually, we need to multiply. So real CPU among all of these virtual CPUs. 447 01:02:12.120 --> 01:02:19.830 William Cheng: Are also in the see examples over here I have three threads over here. I only have one CPU. So in this case, the middle whenever you have a solid arrow over here to say that right now. 448 01:02:20.010 --> 01:02:25.650 William Cheng: This CPU is over here, the physical CPU is actually running this virtual processor are running this particular threat. 449 01:02:26.610 --> 01:02:37.500 William Cheng: Okay, so at some point, I need to, you know, so, so, so, so I want to sort of give the impression that you have, you know, 50 different processes that are running each one of them. I have three threads, you have 150 threats altogether. 450 01:02:37.740 --> 01:02:45.480 William Cheng: I'm actually what I need to do for the organism over here is to juggle 150,000 on a single CPU. Okay. So, and this guy is you have 451 01:02:45.990 --> 01:02:55.830 William Cheng: To be a really, really fast juggling act so they will look like you're you're 133 or running simultaneously. So some people call this parallelism and some people will call them concurrency. 452 01:02:56.130 --> 01:03:09.510 William Cheng: For the purpose of this class, we don't really distinguish between concurrency and parallelism. Okay, if you have one CPU something called concurrency. Again, we want to look like. All these things are running in parallel, as if we have 150 CPUs. 453 01:03:10.650 --> 01:03:15.780 William Cheng: Guys, and this is what do we have to do, right, so what's important. Over here is that right now we're running this particular a particular threat. 454 01:03:15.960 --> 01:03:25.680 William Cheng: At some point we're going to give the CPU to a different way. So what we need to do is that we need to save the execution contacts with the CPU. When I say I'm going to save it somewhere. Where do you say that 455 01:03:26.670 --> 01:03:37.380 William Cheng: Once again, that's what this causes all about. We're going to sort of talk about how the awkwardness to provide the execution contacts. So this way. If you want to suspend the execution of a threat, you need to say the execution contacts. 456 01:03:37.800 --> 01:03:43.950 William Cheng: Okay, and then you need to, you know, give the CP to somebody else and then then and when you finished with the other SEO side. 457 01:03:44.250 --> 01:03:50.550 William Cheng: You're going to get into some other thread and then you get a CP two another thread to another, another thread eventually when you come back this 458 01:03:50.760 --> 01:04:02.100 William Cheng: Back to this original that you're going to restore the contacts from the execution Carter's whatever data structure that you still put it back into the CPU and now you're going to continue to execute this as if nothing has happened. 459 01:04:04.050 --> 01:04:17.730 William Cheng: Okay, so that's the hard part. The hard part over here is a. How do you suspend a threat, so that later. You can resume the execution of the software so that so that you know the site doesn't really know that you that you actually you have suspended the sweat and resume the execution. 460 01:04:19.200 --> 01:04:29.670 William Cheng: Right. So again, the terminology that we're going to use again if you don't know what the context is, it's fine. But we're going to start using this particular term we're going to save the executing context of this CPU seven somewhere. 461 01:04:30.180 --> 01:04:36.660 William Cheng: Okay, and later on we're going to load the actually going into contacts from wherever you say that restore them back to the CPU, as if nothing has happened. 462 01:04:38.190 --> 01:04:44.460 William Cheng: Okay, so in chapter five. We're going to sort of talk about how this actually is done that. So again, only a brief introduction, we're going to 463 01:04:45.270 --> 01:04:48.060 William Cheng: Tell you all the secrets, you know, much later in the semester. 464 01:04:48.990 --> 01:04:59.850 William Cheng: Right. What do you have more than one CPU or if you have more than twice, if you will, can do exactly the same thing here. We have three different CPUs. We're going to still use through as we use virtual processor. In this case, we have 150 of them. 465 01:05:00.150 --> 01:05:07.410 William Cheng: Every one of them over here, we need to multiply them. We need to both by every one of these are the physical CPU about some of these threats. 466 01:05:08.130 --> 01:05:17.430 William Cheng: OK. So the idea of thirds over here can actually work with multiple CPUs. Right. All you need to do to determine that when a CPU, you know, become available. You know, which threat you run inside a CPU. 467 01:05:17.910 --> 01:05:23.400 William Cheng: OK. So again, we're going to do juggling. And now we're going to pretend that we have three hands. Okay. And then we're going to juggle 100 468 01:05:24.840 --> 01:05:31.290 William Cheng: Over 150 threats. Right. But the basic idea is the same thing as we don't have one hand we try to juggle 150 sites. 469 01:05:32.190 --> 01:05:38.880 William Cheng: Right. So for this class. Most of the time, we're not going to talk about multiple CPU, because every time when we talk about multiple CPU, a situation 470 01:05:39.510 --> 01:05:46.410 William Cheng: The organism gets a lot more complicated. Okay, so most of the time in this class will talk about a single CPU case. 471 01:05:46.920 --> 01:05:59.130 William Cheng: Only once in a while. We're going to talk about the multiple CPU case. Well we design our businesses and when you sort of make sure that it works under multiple CPU or under single CPU. Right. So again, some people will call multiple CPU power them. So, and then single CPU. 472 01:06:00.150 --> 01:06:07.680 William Cheng: Is going to be concurrency again in this class. We don't distinguish the difference. Okay. But most of the time we're going to focus on the single CPU case. Yeah. 473 01:06:11.760 --> 01:06:19.620 William Cheng: So, so I guess. Right. That's a good point too big. So again, I'm trying to follow the lecture slides in summer 2000 and it 474 01:06:20.010 --> 01:06:30.930 William Cheng: The first lecture ends right here. So, therefore I'm going to end exactly the same place. From this point on the lecture might be, you know, one or two more slides or something like that but but but I'm sort of tried to sort of go go at the same speed. 475 01:06:31.950 --> 01:06:40.950 William Cheng: Go at the same speed as a year ago. Okay. Alright, so I'm going to see you, you know, in the next lecture, lecture to over here. So get started with lecture to, you know, 476 01:06:42.420 --> 01:06:47.820 William Cheng: I'm going to record the video and then I'm going to start having live lecture, starting with lecture to go. Alright, see you next time.