 All good? You showed her the green thing? Yeah. Yeah, awesome. All right, I figured you might as well start watching the videos this year. In the past, they've always been hidden, but why not? It's kind of cool, right? OK, so today is assignment zero setup day. Just wanted a couple of announcements. We have office hours today. There are people who are there this morning. We have them after class as well on the first floor of Davis. Please check the calendar, which is embedded on the syllabus. I would also suggest that you add this calendar to whatever calendaring program you use. And these office hours are not necessarily going to repeat. We'll have the schedule for office hours for next week and the rest of the semester up soon. All right, there are just a couple of things I didn't finish last time. So we sort of finished the cheating policy part last time. Does anyone have questions about the collaboration policy for the class or how that affects you? I certainly want to answer those questions because I don't want people to do something that they didn't understand was not OK and fail the class for that. Any questions? OK, just a couple of other sort of random notes. In case the winter seems fairly mild this year, which is great, but in case there is some sort of snowstorm, if Buffalo Public Schools are closed, then we won't have class. So I live downtown. If Buffalo Public Schools are closed, I'm not coming in, so there won't be class that day. So just keep an eye on that. Listen to the radio or the internet or whatever you use to find that out. And obviously, if the university is closed, we won't have class. That sort of goes without saying, but sometimes the university doesn't realize that it snows in other parts of the city and so they don't necessarily close even if people can't get here. All right, last chance for questions about course policies from yesterday. Yeah, Zach? Did you get a new shirt? Me? Yeah. A new shirt? Yeah, did you finally get a new shirt? A new shirt? Well, I mean, maybe what Zach is trying to do as a friend is prompt me to explain that I tend to wear the same thing all the time. I actually have five of these shirts. They all look basically the same and several pairs of jeans. So if you see me wearing the same thing every time, you don't have to stand several feet back because you're worried about the stench. It's actually the clothes are clean. I just am engaged in uniform dressing. I actually have two different gray shirts now because I've experimented with buying high-priced luxury gray shirts, which I hope are going to last for 1,000 years, but we'll see. It's an experiment. So that's actually what I got for Christmas this year from my in-laws, was three gray T-shirts. That's it. And I was actually pretty happy about that. That's exactly what I wanted. All right, thank you. Any other questions about me, course policies, whatever? Yeah. Yeah. I mean, if you find yourself on the internet learning C by reading somebody else's solutions to the problem sets for this class, that's a problem. But there's a lot of C code on the internet. This is a fair question. There's a lot of C code on the internet that is OK. Now, I want to caution you guys because I will point out, I realized this this morning because I googled assignment 0, like all one word. And at least for me, maybe Google's trying to make me feel better about myself through some local customization. But the assignment 0 right up on OpsCast.org is the first hit. So I was like, that's awesome. The problem is, every other hit on the page are GitHub accounts that have code for the class of them. So you do need to be careful when you're looking around. I have no control over what people put on GitHub. Every year, I contact the people that have GitHub repositories that people have used and have copied from and have failed the class. And I say, oh, I'm sorry. This is going to be an issue today. Hold on, let me see if I can fix this. I contact those people and I say, could you please take down your GitHub account? People are going to fail the class because you have code up on GitHub. And usually, I don't get a response. So we do our best to try to keep things off the internet, but you do need to be careful when you're looking around, particularly for stuff that's related to this class. Looking for general C help, like how do I program in C? That is a question that's probably not going to lead you to things that you don't want to use. That's a good question. Did I answer your question? I mean, mainly what I would say is probably the list of approved sources is empty. We want you to write the code that we ask you to write in this class. If someone came to me and said, now I've found this cash map library or something like that, I would say, first of all, why are you doing that in the first place? And then the second thing would be, you'd learn a lot from writing that yourself. It's actually not that hard. So did I answer the question now? Yeah, like how do I allocate memory? How do I de-reference a pointer? How do I, stuff like that, it's totally fine. How do I compute the length of a string or copy a string or whatever? I mean, simple things like that are totally OK. Yeah, it's a really fine balance. I mean, I wish that I could give you guys assignments and just be like, use the internet as much as you can because that's how real people write real code. And I'm aware of that. The problem is these assignments took like a gazillion years to develop. And so we can't just, I've had colleagues be like, why do you use the same assignments every year? And I'm like, because I don't have a thousand years every other year to write new assignments for the class. I mean, these assignments represent an enormous amount of work, not really entirely by me. I shouldn't say not entirely by me, not mainly by me. The assignments and the environment really represent a lot of time and effort by somebody else. And so being like, let's come up with all new assignments every year would just be, it's completely undoable, right? So, all right, any other questions? Where we go on? Okay, cool. So, right, okay, so music that's played before class, I'll start up a discourse forum thread on this. One request per semester, but the request has to be made in person. So you actually have to come to office hours and talk to me like a human being in order to make the request. I don't accept it via email. We can talk about them on the forum. Actually, you know what? I'm not gonna create a forum thread because I'm not gonna take them on the forum. So you have to come to me. And if your request is accepted, I'll play your song before class. Assuming it's not terrible. I mean, I do get to, and terrible according to my definition of terrible. So I do, this is my class, so I do get to exercise a little bit of self-control about what gets played, right? Also like, nothing super explicit or hardcore, whatever. I wanna play that stuff on a regular basis, right? And I don't because I don't wanna offend anybody. So, all right, and then this semester, I may be away a little bit more than usual. I usually try not to travel in the spring because I like teaching this class, but the spring is a little bit unusual. So I will let you guys know when I'm gonna be out of town. Actually, I'll put this up on the syllabus. I already have one couple of trips planned. When I'm gone, there's a couple of things that might happen. One thing is that Carl or Scott or Jinghao or Ali or Vicky might give the lecture to get some experience. Or we can show videos in the past years. There's a gazillion videos in the past years. And so I might just assign one of those for class. So, okay. So what we're gonna do today is we're going to sort of walk through assignment zero. How many people are ready to do assignment zero? Okay, good. How many people have done assignment zero? Okay, well if you've done assignment zero, I guess maybe help the person next to you or something like that because, or you could leave if you want to. I mean, I'm not trying to chase you away from the classroom, but this is gonna be sort of dull. Actually, I have some advice for how to approach the, let me ask you guys a question. So I have some general advice for how to approach the assignments. If we talk about that now, maybe we'll get through the assignment zero setup and maybe we won't. We'll probably can at least get started. Should I do that now for the people that haven't have finished assignment zero or should I wait? Who things do it first? Who things wait and do it at the end? Who doesn't care, apparently most people. I'll do it first because there was like five to two or something like that. All right, so here's my quick, people started to come to me and they said I've heard this class is difficult. How, what can I do to make it as enjoyable as possible? Because, I mean, if someone came to me, I've heard stories of people like crying and having like nervous breakdowns and all this really bad stuff. And I do not want that to happen. I mean, that is not a good way to learn. I don't want you guys to get to the point where you're that panic. That's also when people tend to cheat, which I don't want to happen. So the goal here is for the class to be enjoyable that does require a little bit of discipline and planning on your part. So here are my suggestions for how to make this fun because I think you'll learn more if you're actually enjoying yourself as opposed to, oh my gosh, it's 24 hours before assignment two and I haven't done anything. And then I can guarantee that that's not gonna be a particularly pleasurable or enjoyable 24 hours. All right, so here goes. This, you know, I've taught here for like six years and it took me a long time to figure this out. Some of you do not know how to type. How many people don't, well, I'm not gonna ask because you probably won't admit it, right? It's a little, you have to know how to type. Touch typing with all of your fingers, right? You have eight fingers that can push the keys. If it's seven, it's seven, whatever. You have one hand, there's like Dvorak keyboards for people with one hand. I kid you not. Typing, what's that? Yes, I use the Dvorak keyboard, but I have two hands. So I use the two-handed version, but there are versions of the keyboard for people with only one hand, right? You need to be able to use all the fingers you have to type and you need to be able to type rapidly. So if you're interested, I put this link up on the slide. So it's a typing, there's a gazillion of these, but here's the one that I found, someone said to me. Here's a typing desk you can take online. My best score is pretty awesome. It's like 100 words per minute. So I'm pretty sure I can get a job like transcribing documents if I need to because I can type pretty quickly. So that's nice. I have a backup career in case this one doesn't, didn't go very well. So, and I'm sorry if this bothers you. It's like, oh, it's not operating systems. This is what I didn't want to, I didn't come here to learn how to type. That's for sissies or that stupid or whatever, but it's not because if you can't type, anything that you try to do that involves programming or computers is just going to go slow. So I have people come to office hours. It's like, okay, here's the three things you need to do. You need to change in that directory, run bmake, bmake install, bmake depend, whatever, and then change into your root directory, run your kernel using sys161. And I come back 10 minutes later and they're still fumbling around trying to figure out where they are on the computer, what things to, they've got two fingers going or whatever. You have to know how to type. Sorry, if you don't know how to type, if you don't feel comfortable interacting with the computer using the keyboard, I would suggest that you make it a priority this semester to learn that now. Trust me, it's just so frustrating if you're a computer scientist and you can't, I don't know what that would be like, it would make me sad. So do this, first thing. If you don't know how to type, learn, okay? Sermon over. Start the assignments early. This is one of those things that I can say a thousand times and people are going to do it one time. But I really can't emphasize this enough. I think people at UB have gotten into this mode because you've taken classes with assignments that you can do in a couple of hours. So it's like, okay, the assignments do on the 21st of February, I'm gonna start the assignment on the 21st of February. Like, during daylight, right? I mean, it's due in midnight. So if I start it when the sun is still up, I should be able to finish it. That's not a problem. In fact, I'll probably get it done like before the sun goes down and I can go and have dinner and have a beer or whatever. Like that is not gonna work for this class. So when we release an assignment, when the period of time that you are intended to be doing the assignment starts, you should be working on the assignment. You should be budgeting in a couple hours a day to work on the assignment starting on the very first day. If you do that, the amount of time that we give you to complete the assignments is sufficient. There's three weeks for assignment two this year, five weeks for assignment three. If you don't start early, it doesn't matter how many weeks to do the assignment I give you because you don't use them, right? So we could give you a thousand years to do assignment three and you would still not get it done because you would start it the day before. So please start the assignments when they're released, when the time period. You know, maybe I'll put this on the calendar. I'll just put a reminder every day, do assignment three, do assignment three, do assignment three. You know, to help you guys out because, or like just a huge long event that last five weeks, work on assignment three, right? Because that's really what it's like. If you start early, work consistently, you will do much better. Partly because you have more time, partly because you will realize how much time you need earlier when there's still time to make corrections. Look, if you finish the assignment in a couple of days, you're done. Turn it in, you know, peace out, do something else. That's not a problem. The problem is only when you wait till the end, okay? So please start the assignments early. Work on the assignments frequently and often, I guess those mean the same thing, actually. Partly what I was trying to point out is, writing kernel code, writing any sort of computer code is a activity that requires a fair amount of high cognitive function, all right? Coding is not easy. If the coding you're doing is easy, you're either really, really good at it or you're doing really boring stuff. You're doing the stuff that you can do in Eclipse, maybe like generate all the getters for this method and it like automatically generates code for you, right? So that kind of code is easy. Most interesting code that you were gonna write is hard. It requires thinking, you know? It's fun, it's enjoyable, it's interesting, it's like a problem to solve. But it's not something that you can just do, you know, when you're really tired or when you've had too many drinks or whatever, like coding takes time and energy. When I worked at Microsoft, which apparently I didn't, I couldn't work there and came back here to teach or whatever, but back when I worked at Microsoft, they had an event every week for the people who worked on Windows where they would give you a lot of food and a lot of beer and there was music and stuff like that. That was mainly because they were just about to ship XP so they were trying to kind of get people pumped up. But there was a rule about, they called it the Windows Informational Meeting that people used to refer to as the Windows Intoxication Meeting because that's what happened at this. It was huge. It's like thousands of people that work on Windows, so it's fun, no free beer, but there was a rule about the whim. The whim was on Fridays and the rule about the whim was you don't write code after the whim. Go to the whim, enjoy yourself, have a couple beers, go home. Do not go back to your desk and try to fix that one piece of code that's not working because it'll introduce like six bugs that are gonna cost massive regressions. Windows XP is not gonna ship on time, Microsoft's gonna lose a billion dollars, okay? So don't, you know, and the same thing applies here. Why does this affect how you work on the assignment? So when you start working on the assignments, your cognitive function is here. As you spend more time working on them, as the hour grows later and later, you're getting dumber and dumber. I mean, they've done tests on people like Navy SEALs and stuff like that. When you stay up, I can't remember, like when you stay up 24 hours, your IQ decreases by a massive amount. So you're just a dumber version of yourself, okay? And that dumber version of yourself, the smart version of yourself might be having a hard time on the assignment. Imagine what the dumb version of yourself is gonna think of the assignment. So you think, oh, I'm making progress, right? I'm still writing code, but the code you're writing is full of bugs. And when you wake up four days later from the bender that you went on, you're gonna have to solve all those problems. And not introducing bugs into your kernel is really important. We'll come back to that in a minute. So you want to work on these assignments in short bursts. And of course that requires starting early because you can't just wait until a week before and then try to code 120 hours that week and finish the assignment. It's not gonna work. Okay. This is one thing I'm really gonna push this here. I'm gonna encourage people to do this. When you find a partner, talk to your partner, and when you post the office hours, which we'll do in the next few days, find four office hours a week that you are going to be at. Four, at least four. Four is better. Four is the minimum that I would suggest. We're not gonna take attendance. You guys are seniors and juniors and you guys can figure out, you guys can do this yourself. But I would say four is the absolute minimum. You do not need to have a question to come to office hours for this class. Maybe that's your impression from working on other classes that I can't go to office hours if I don't have a question and I'm gonna walk in and everyone's gonna be looking at me like, why are you here? Speak up. It's just like, no, come in, sit down, get out your laptop, start hacking when you have a problem. You have a TA there. You have other students there. So it's kind of fun. There's some camaraderie involved here. You can talk to each other. You can certainly help each other during office hours as long as you're not cut and pasting code from somebody else's project. Come to office hours four hours a week, probably the same four hours. That way you get to know the other students that come at that time. You get to know the TAs. Make a commitment to doing that. And that is gonna really help you because it's the time that you work on this class. Not the time that you work on other stuff or check Facebook or do whatever else you wanna do. It's time set aside for working on this class. And once you get going with these assignments, you're good. I think for a lot of people, the hard part in this class is getting started. Getting past some of the initial hurdles, getting things set up, figuring out what's where. The actual coding challenges that we're giving you are not that hard. Once you figure out what you need to do, it's the figuring out what you need to do that is usually what trips people up. So come to office hours and the TAs will be more than happy to help you with it. Okay, obviously there's two slides for this because there's like lots and lots of advice. You need lots of things to survive this class. Okay, pair programming. So how many people write code in languages like Python and JavaScript and even Java, I guess? Sorry, whatever, go, things like this. Okay, so when you're writing certain types of programs, it's very common. I do this as well. Here's the approach to writing the program. I sit down, I write some stuff, and then I try to see whether it works by looking at the command line output or if you're awesome writing some tests and see if they pass or whatever. And then I iterate to fix things. So I find bugs and I fix things. So part of the goal here is I write code that's a little bit loose at the beginning. I'm not exactly sure how it works. Maybe there's like some method on the library I'm using. I don't know exactly what it does, so I'll just try calling it with the data and see if it does the right thing. And if it does, I'm good. It's very, very hard to write kernel code this way. And the reason is bugs are very, very hard to fix. So a lot of you probably encounter a lot of bugs that are easy to fix, right? I noticed that the program crashed or the output was wrong or whatever. And the kernel bugs can manifest themselves in weird ways that can cause strange behavior and it's frequently very unclear what code you wrote is causing the problem. And so rather than writing code that's full of bugs and then trying to go fix them, that is not a good way to handle this class. You will not do very well. Instead, what you wanna try to do is avoid introducing bugs into your code in the first place. And so some of the suggestions here are designed to do that. Pair programming is probably a good way to accomplish that. If you think that pair programming is some sort of weird thing that only people in like intro level CS courses do and like no one in the real world does pair programming, my PhD students do pair programming. They don't set up a time to do it together like hey, let's do pair programming. I would just see them all the time like looking over each other's shoulder, someone's like hey, I'm writing this complicated piece of code, can you just sort of ride alongside and look at what I'm doing and give me some feedback and tell me if this looks right. So even people that have been doing this for a long time and are really good at it, still deploy this method when they're writing stuff that's really hard to get right. So I would suggest that you and your partner, again during office hours or other times, one person driving, one person steering, looking for bugs, reading larger pieces of code, like when you're typing, you're looking at the one line that you're trying to write. The person who's sitting next to you could be looking at the 10 lines above it and the 10 lines below it and trying to figure out okay, what's going on here. This will be very, very helpful. Make sure that you switch drivers from time to time so that one person isn't doing all the work all the time, all the typing all the time, but I would very, very strongly suggest this as a development approach for this class as much as possible, as much as you can. Obviously sometimes you and your partner are gonna have to work separately. There are probably some cool software tools for doing this like screen sharing programs and stuff like that that you could use that would be helpful if you want to try pair programming with someone who's not next to you, but whatever, just do it. I think this will help. Liberal use of K-asserts, which you guys will start to encounter in assignment zero and assignment one. How many people use asserts in their code when they write code? Come on, okay, well, something else you'll learn this semester. What's that? Yeah, Zach knows what it is, right? Yeah, so asserts, what is an assert? Assert is a point in the code where I try to, I tell the computer, this should be true. At this, I use asserts all the time. I use asserts in every programming language that I use. I use asserts in JavaScript, I use asserts in Go, I use asserts in Python. Every language has this construct. The idea is you're making a statement about something that should be true in the program. At that point, an idea with an assert is if it's not true, the program blows up. It crashes in the case of your kernel, a little panic. Why do this? It's because it allows you to, first of all, it allows you to make sure the things that you think are true are true. It's like I really think that this array is uninitialized. I'm about to initialize it. Hmm, maybe somebody else initialized the array. So if I'm wrong about that and I'm about to do some more work that might cause a consistency problem, really good to know upfront that things that I think are true at various points of the code are actually true. You can probably not have too many assertions. Sometimes the assertions that you are gonna put in are gonna fire incorrectly and you're gonna realize that something you assumed about the program is not true. And that may be okay, you just learned something about the program that you didn't know before. So anyway, this will make more sense. Write and run tests. How many people write tests when they write code? Okay, well that's better. I don't know why people don't write tests. So I think people think that testing is kind of, I don't know, like annoying, there's more code I have to write, it's like that. Here's the thing that's fun about writing tests. Every few minutes, something good happens to you cause you pass a test. So when I write code, it's like I'm always writing tests cause I like to feel good about myself. And then the little test that I wrote to test the function that I wrote just wrote that computes the length of a string or something stupid, it passes. I'm like, yay, I did something good today. And then five minutes later, another test passes and five minutes later, another test passes. And the whole time I'm getting these little bits of positive reinforcement as opposed to starting the day writing eight hours of code and then trying to run the program that you just ran, what's the likelihood that the program's gonna work properly, zero. And then you go home and you're like, I accomplished nothing today, my entire life is a waste. You don't wanna feel that way. So write tests, run the tests that we give you. They're laughing cause they're like, yeah, this has happened to me too. I was like, oh my gosh, you end up in, you wake up the next day and you're like, I just have to rethink my entire life, as well as the project that I just started cause I'm going about it completely wrong. When you write tests, you know you're accomplishing something, you know you're making some forward progress. The fewer lines of code you write before running a test, the happier you will be this semester. If you find yourself having written 1,000 lines of code without running a single test, I have bad news for you and the next several days of your life, right? It's just not gonna work well. All right, and this is what I just said, find a way to quickly iterate between writing code and running tests, limit the number of untested lines in your system. I get nervous when I write like 10 lines of code that isn't tested. Cause I'm pretty sure that I probably made some sort of dumb mistake. And so I would do this. We give you a lot of tests, we do certainly encourage you to write tests yourself. You can also run the tests that we gave you, but run tests constantly. I mean, your iteration loop should be write code, run test, write code, run test, write code, run test. When the test succeeds or when I've done something I think is interesting, get commit, get push, write code, run test. The faster you can iterate back and forth between those two modes, the more smooth things will go. Part of this requires breaking your code into smaller pieces that you can test and that you can validate work. So writing big blobs of code and trying to test the whole thing typically doesn't work very well. We'll come back to this when we talk about assignment three later in the semester because this is particularly important for assignment three. All right, okay, let's go back. So next time we'll talk about what the operating system is, this time we're actually gonna go through some assignment zero setup. So any questions about advice for the class? I actually think the best thing I could do in lecture this year is just repeat that every day, right? But I won't because I would get tired of saying it. All right, so I'm gonna show you, so I'm working on a Mac. If you're using Windows or if you're using a Buntu natively, then you probably have a little bit of an easier route. So like I told you guys to do, I've already installed my Vagrant virtual machine so I can just run Vagrant SSH. Uh-oh, it needs to be up. Okay, I'm gonna boot it and then I'm gonna run Vagrant SSH to get into the virtual machine. In case you didn't realize this, if you've installed Vagrant and it's using virtual box, you can actually monitor the state of your virtual machines also through the virtual box shell. So this is the ops class one that I just booted up. If I halted this machine, you would see this go into the power off state or whatever. Okay, so now I'm gonna get in here. All right, so hopefully everybody got to this point. I just set this up about 10 minutes ago so this is a brand new machine. One thing I wanna point out to you guys just to be careful. The virtual machine that we gave you is completely isolated from your actual physical machine. This is like a completely separate computer that's running inside of your machine because virtualization is awesome. You can do this with lots of different types of machines. So for example, from time to time I need to use Windows. That's usually a really sad day, like something went wrong in my life and I'm required to use Windows. Oh look, yeah. Of course it didn't shut down properly, right? There's like a few pieces of software out there that still require Windows and then there's a few websites that are so broken that they still require Windows which is kind of incredible. Here we go. So here's a Windows virtual machine. So I'm running Mac OS. This is a Windows virtual machine that I've set up to run Windows mainly so I can use this one piece of software called the VMware vSphere Client, right? Do you have that too? Yeah, yeah, okay, there we go, yeah. Really, really sadness. This is too bad. Anyway, so do you guys understand this? How many people have used VirtualBox before? Okay, awesome. Oh, I'm so happy. VirtualBox is fantastic. Okay, so I don't really need to extol the virtues of VirtualBox at length. But I certainly will. I mean, it's an awesome piece of software and being able to use virtualization to experiment with things is really important. Now, if you've used VirtualBox and you're familiar with this, you understand that this machine is completely isolated from my Mac. So if I wanted to do an RM-RF in this machine and remove every file, that would be totally okay. The virtual machine that I just created would be totally hosed, but my Mac would be fine. Now, here's why we're talking about this. See this? This is the prompt that tells me that I'm inside my Mac, right? See this? This is the prompt that tells me that I'm inside the virtual machine. These are not necessarily different enough for my taste. Because when I'm inside the virtual machine, I probably want to know that. Because for example, I might leave the virtual machine accidentally and then run the RM-RF and then I would be very unhappy and sad. So I might suggest doing something like coloring this prompt or doing, just doing something so you can visually tell the difference between the two machines. Now, on the other hand, you may just have to get used to this because when you start maintaining machines, when you start logging into servers using SSH, this can happen to you all the time. So I just did this last weekend where I got confused about what machine I was using and I ran a reboot that I don't actually don't know what machine I was trying to reboot. I was just sort of confused, but I rebooted a remote server that was in the middle of doing an upgrade to Ubuntu so that was unhappy. But anyway, so just be careful about where things happen. So I'm inside the virtual machine. Now, how many people here use a GUI-based editor? Like Sublime, Atom, Eclipse, whatever. Okay, so how many people in that category cannot use a command line editor like Vim, Emax, whatever? Okay, good. Someone just came in this morning and we were having this conversation. If you don't know a command line editor like Vim or Emax, I would suggest that you learn one and this may be the semester to do that, it may not. The reason I would suggest this is very simple. You're gonna find yourself in positions where you have to use a command line editor. You're gonna be working at Twitter and you're gonna need to log into one of Twitter's machines to reboot a cluster that's not performing properly or to readjust the configuration file and you're not gonna be able to launch Sublime from that stupid machine, right? You're gonna have to use a command line-based editor and if you don't know how to use one, at least reasonably well, you're gonna be set. Yeah. Which one would you recommend? Oh, God. Oh, God. No, no, no, we're not going there. I use Vim, they all, look, they all suck, right? They're command line-based editors. What else would you expect, right? I mean, it's the modern world. Now we have GUIs, GUIs are great. Just find the one that you get used to one, right? Like I'm used to Vim. I know 10 commands in Vim, but I can type really fast so I can apply those 10 commands really quickly, right? So yeah, it doesn't really matter, right? They're all terrible, but you need to learn one and you need to figure out how to get it set up so that it doesn't irritate you incessantly, right? That's the other thing. Okay. Now, if you, there's another option for setting this up for people that are using Mac and Windows that I just want to go into quickly. This is not necessarily something that we documented on the website yet, although I'll probably add something to it. So if you want to, you can also install an Ubuntu virtual machine with a desktop environment, right? So I did this right before I came to class. This is my, this is just a copy of Ubuntu 16.04 that I downloaded from their website and installed using VirtualBox. So this will boot into a GUI. So if you want a GUI, if you want to use Sublime, if you want to use Adam, this obviously also can help you because it's visually much different than the environment that your PC or your Mac. So it's a little more obvious that you're inside a virtual machine when you run something like this, right? So here's, I did a little bit of work customizing this. So here's my Ubuntu desktop. So this is another option. If you don't want to use Vagrant and if you don't want to edit everything using the command line. So it's up to you. All right. And I got to get out of here. All right, so let's go over to the, all right. So the first thing we were gonna have to do is get, actually get the code that we're gonna be using, right? Where is the download part? Oh, there it is. All right, so I'm gonna, I want the HTTPS, it doesn't really matter. Okay. All right, so that's done, right? So now, what did this do? I cloned a remote repository. This is the starter code that we give you that's hosted on GitHub. So these are public sources. There's no solutions in here or anything else like that. Please be careful if you're using GitHub. Don't send us pull requests for a solution code into our base sources. Somebody did that by accident and pull requests are actually really hard to get rid of on GitHub. I had to email somebody at GitHub headquarters to delete it for us, right? So just don't do that. You are certainly, so one of the things that you're gonna need very quickly is a private Git repository. So GitHub is an option. If you guys have student accounts, GitHub I think now gives you unlimited private repos with a .edu address. There are other Git providers, Bitbucket, I think has private GitHub accounts. GitLab apparently hosed their whole site yesterday so they're down right now. It's back up, okay, good. So take that as you may, right? I mean, maybe you don't wanna use GitHub for your, actually we use GitHub in my group for our stuff. That makes me very nervous. So anyway, so you need a private GitHub account. Private, sorry, a private Git account. Meaning that nobody can access your source code, nobody can clone your source code without permission but this is public, right? So you'll see I didn't do any authentication, I didn't have to enter, use a name or password to get this. Now I can't push to this repository so this is something important to keep in mind. I will not be able to push code back to this repository because you guys don't own this repository, we do. Now it's possible this semester that we will actually push some changes to OS 161, the base sources, in fact I think it's likely because we're making some small changes to test 161. When that happens, we'll email you guys and what you guys will have to do is pull those changes to your repository and merge them in. That merge should not be a problem but it depends on what you've changed. All right, so now I have an OS 161 directory. If I look in here, I can see that this directory is configured to use the remote that I cloned from as origin, we're gonna change that in a minute. And this directory has the OS 161 source code inside it. Okay. Now what we're gonna do is walk through, I actually do know how to do this, I would like to point out. I'm just going to try to follow the instruction so that we do it in the right order. Oh, the other thing we should do is we should rename this remote. I never remember how to do this. I think it's, ooh. Oh, there it is. There we go. Okay, so what did I do? I just renamed this remote to staff so that when I configure things later, I'm gonna push back and forth to origin. So origin would be my private repository. I'm gonna have to configure that in a minute. Does that make sense? This is just a naming thing, right? You could leave it as origin, but origin is typically in Git reserved for the repository that you're gonna push changes to. Actually, Git doesn't really care, but does that by default. All right, so I've got this. So the other thing, if you don't know about this tool or you don't use it on a regular basis, I would suggest that another really piece of really useful piece of software when you start working at the terminal is something called T-Mux. How many people use T-Mux? Okay, how many people use Screen? Okay, time to change. T-Mux is way better. I use Screen for a while. I was like a Screen late adopter and I held onto it for dear life and then one of my PhD students is like, don't use Screen, it's junk. And he's right, okay. So what does T-Mux do? So T-Mux allows me to essentially kind of create a terminal session that persists, could then persist across me logging in and logging out and it can contain multiple windows. So I just launched T-Mux. You'll see at the bottom here, it tells me that I'm in Windows Zero. This is the window that I started, but I can create more windows. Let's see here. Why is that not working? Did I do something wrong? Let's see here. There we go, okay. So now I've got two terminal windows. Can you guys see this at the bottom? Let me pull it up a little bit so it's more visible. So this T-Mux is telling me I've got two terminal windows, both of them are running bash. So let me show you why this is useful. Here is one window. Here's the other one. So I'm switching back and forth between them. By doing control B and control Bp, previous and next, you can go to them by numbers, whatever. Here's the other cool thing about T-Mux. So watch this. I can detach from T-Mux, alright? And now if I run T-Mux LS, it shows me I still have a session there. So I can reattach that session whenever I want. If I run attach zero, oops, I'm back here, right? So let's say I have a really nice set of windows set up and I'm in the right directories I wanna be in. I have everything's working. I can detach from this and I can actually log out of the machine. And then later I can log back in. So this is a really nice way to be able to. You can actually use T-Mux to save sessions like I have T-Mux sessions on my desktop at work and then when I go home, I can log back into the machine and reload those and I can keep working exactly where I left off. So it's a pretty nice tool, okay? So I'm gonna use T-Mux. So let's run the configuration step. So you'll look, if you'll see in this directory there's a configure script. By the way, stop me if you guys don't notice what's going on or if there's something confusing. All right. So I'm gonna configure this to put my, to install my stuff into root. So what I just told the system is I wanna configure this directory so that when I build things, they get put into root. Sorry, no, that's wrong. Let me do this again. It'd be better if I could type, okay. All right, now I'm gonna create that directory. I don't think this really matters, but okay. So now this kernel directory is ready for me to do the next step. So this is something you only need to do once. So as soon as you've done it, don't do it again. Just leave it alone. The next step is something that you will need to do more often. So the way that we build kernels in OS 161 is we configure them using a configuration system and this is covered in more detail in the assignment zero write up. There's a configuration script in here. If you run it, as many things do, if you run them without arguments, it'll tell you something useful. So it says config and then you get a config name, essentially a configuration file. So what these configuration files do, we'll look at one of them together, is they set up options for the kernel that you're about to build. And this is something you guys will learn about a little bit more as you go through assignment zero. All right. So let's configure kernel for dumb BM. All right, so you can see that this finished. It tells us that the configuration is located in dot dot compile dot slash dumb BM. So if we go in there, you can see that it created this directory called dumb BM and inside dumb BM are a bunch of files that the configuration script changes. So these turn on various parts of the system, turn off various parts of the system. Again, this is something that you should do one time per assignment essentially. You configure for the particular assignment you're working on and then once you're done, you can repeatedly build kernels in this directory. So it reminded me to, the first step in building a kernel, and again, this is not something you have to do all the time, is to run something called BMakeDepend. So that clearly generates an enormous amount of incredibly useful output, not really. So this generates the dependencies. Now I run an actual BMake, so what just happened is I just compiled a kernel. If this fails for some reason, it won't succeed and it'll generate some useful output for you to look at, to tell you where it failed. And now I'm gonna run BMake install. So you'll see what the BMake install did is it copied my kernel. This is one of the case where the output is actually kind of helpful. It copied my kernel into home trinity root kernel dumb BM and then it created a sim link between kernel and kernel dumb BM in that directory. So if I go into that directory, I'm gonna use my other Tmux window. You'll see that there's a file, my kernel, and there is a, and there's a, the file is a sim link to the kernel I just created. Now, okay, any questions about this? That's the kernel build process. That's something that you guys will do thousands of times this semester, right? BMakeDepend, BMake, BMake install, change some things about my kernel, rerun that. That is the set of commands that builds your kernel. Now, again, this kernel is just a program, but the kernel is a special program and so it's not something that we can just run on this system. So if I can try this, let's do it for fun. There we go, yeah, okay, good. So if you try to execute the kernel directory, here's what's gonna happen. The problem is this kernel is actually in a different instruction set than the architecture supports. So in order to run it, we need a piece of software called sys161. So sys161 is something that came installed as part of our vagrant virtual machine. If you set up your own Ubuntu virtual machine, there's instructions online about how to install the tool chain. It's very easy, it's like two commands, all right? So what sys161 does is it executes a kernel in a system simulator. So sys161 is itself kind of like virtual box except without thousands and thousands of features that virtual box does. But sys161 allows you to execute the kernels that you build for this class. All right, so I'm gonna do this. And okay, now it's complaining. So what it's complaining about is that I haven't told the system how to configure sys161. So when you set up virtual box, I don't know, if you go into the virtual box GUI, there are things like how many CPUs do you want the machine to have, how much memory should the machine use and stuff like that. Sys161 needs the same information. So hopefully, I think there's a, I think there's a, oh, here we go, okay. So you can download a sample from our website, but there's also one that's located on the machine. Oops, all right. So here's what this configuration file looks like. These are all comments. And then down here, this is like, this is really the only line that you really have to care about. What this says is configure sys161 to use 16 megabytes of memory, yes, megabytes. This is a very sort of small simulator. And to run on eight CPUs. All right, so now, and this is good timing because we are almost out of time, but now we should be able to boot our kernel. So this is what happens when you boot a kernel that you built in this class. Now, you might notice that this is weird. This is not normal. When you boot a normal kernel like Windows, there's like fancy graphics and sounds come out of the machine and then like a windowing thing starts up or whatever. Even if you used to boot like old Windows 3.1 machines, they didn't do this. This is an instructional operating system. So the first time you boot, it launches a menu. Now this menu runs in the kernel, right? So right now there's really no notion of running user space programs and the reason you haven't added support for them yet, which you will do in assignment two. So what this does is it prints out some information. It prints out that there's 1,600 and it puts out this much physical memory available. Remember, we booted it with 16 meg. So this is about right. There's some memory that's taken up in this system by the kernel itself. So it's not quite 16 megabytes. And then down here it tells me that there are eight CPUs online. If I print question mark or a type question mark, I can see a menu for different things that I can run. Some of these tests will run fine. Some of the tests already pass. So for example, if I run the array test, that works fine. If I run the kernel mallet test also works fine. Other tests here will not work. Whoa, sorry. I have forgotten. Here we go. So for example, the locks. Locks are, turn down the volume a little bit please. We're almost done. Locks are part of assignment one. So the lock tests are not going to run. Lock tests will fail. Some of them will actually panic your kernel. If they, oh, I guess. Oh, okay, you need to, those panic on success actually, okay. So anyway, so this is just the basics, right? This is how to get your first kernel built and how to run it and a little bit of how to interact with it. And this is really all you need to do for assignment one. Because on assignment one there's no user space. You're just building kernel privitives. And this is kind of the launching point. So this is the workflow. You edit files under, you know, in your OS 161 kernel directory. You go into the, you go into the, so I would say if I was setting this up, I would have one directory where I kind of looked around. I'd have another directory where I kept myself in my compile directory. And I just repeatedly ran these three commands, right? It's over and over again. That's all you do. I could do this all day, you know? Like this is it. Like this is the iteration loop. It doesn't take that long, right? So every time you do this, there's a new kernel that's gonna get installed in your root directory. And then I'd have a third window where I was actually inside that root directory and I was running my kernel, right? So when I changed something, I shut down, I rebuild, I restart, I run the test that I was trying to run, whatever, right? All right, any questions about this? There are screencasts embedded in assignment zero. This video will be online. If you want more help, if you want to sort of continue on with the rest of this, we're holding office hours right now on the first floor of Davis. We'll have office hours again on Friday. I will get the videos for today and Monday online and let you know when I do. Please use the forum for help, whatever. We'll see you guys on Friday.