Transcript for:
Understanding Operating Systems Fundamentals

hello everybody so uh as you can see the room's a little full uh we'll talk a little bit about that later but uh if everybody breathes say 30% less than you normally do we'll still have oxygen by the end of the the lecture um I'm John kattowitz and uh I will be talking about operating systems so if you're thought you were going to talk about something else you can run screaming out of the room uh but do that really quickly okay so who am I so I mentioned my name is John kubitz uh most people call me Professor Kuby because they can't pronounce my last name that's okay um actually I was in Eastern Europe a few years ago and everybody was pronouncing a katavich or something like that which is probably more correct uh in some distant past but I'm fourth generation so kubba totz or Kuby is fine uh I have a background in Hardware design so when I was at MIT I actually uh design parallel processors uh one of them that I worked on was the AL wife machine and uh there's a picture of the communication and memory management unit that we actually built um I also have background and operating systems I guess you would hope uh I uh worked for project Athena at MIT for a while we were uh one of the first organizations to actually build distributed systems where you could sit at any workstation and your files were available now I know that seems pretty odd to you guys now but that was a big deal back then uh I was a device driver developer uh worked on early versions of the network file system I also did some uh High availability work for a company called clam and I'm I'm also uh the head Pi in the par lab on their new operating systems effort for uh minior and I'll talk about that later in the term uh there's a picture of our logo for tessellation um that's our new operating system I also did a lot of work on peer-to-peer so when I first got here yeah 12 years ago or whatever my biggest project was called ocean store and uh there we were kind of interested in preserving Digital Data for the very long term like a thousand years uh and then making it widely available and we're getting closer to that although uh those of you who like to store your photos online uh may get rudely awakened someday to find out that all your photos that you thought were safe got killed off by a system error uh so I don't know that we're actually there yet but uh and then finally I also do research in Quantum Computing which probably is the least relevant thing to this class but uh I'll be happy to talk to people if they're curious offline about that uh so our goals for today you know what are the goals for a first lecture is usually something like well here's the topic here I am here's how the course Works hopefully you like it enough to stick around although maybe I want to scare off enough people so the room fits I don't know we'll see I'm just kidding but uh today we're going to start by talking about what's an operating system and what is it not uh we'll give some examples of operating systems design we'll talk a little bit about why maybe studying and operating systems are a good idea and uh again say a bit about what how the class operates and uh interactivity is important so feel free to ask me questions okay so somebody ask a question come on you can do it yes well not very long I have to keep trimming it another question yes you looking at you know we're g to stick with this room so and the reason we're going to stick with this room is because it has the screencast which gives us webcast so uh I will talk I will talk more about the fact that we're over subscribed uh a little bit later there was another question yes did you get your yes I did thank you very much so uh why is this fun so I'm a systems person I don't really consider myself operating systems I don't consider myself a hardware person I designed big or networking person I designed systems and the Heart of uh the reason systems design is so fun is this thing called mors law which you've probably all heard about but let me reiterate a little bit it basically says that the number of transistors on a chip has been doubling every say 18 months for a long time okay and that's uh pretty amazing when you think about it in the course of uh well let's take the easy thing six years that says what you've gone up a factor of 16 in number of transistors so you can do a lot when your resources keep growing okay and and uh this by the way is Mo's law Mo's law is not about performance okay that's a confusion which uh I will try to get rid of in a couple of slides here uh and in case you hadn't noticed the world right now is a huge parallel computer okay at the high end we've got uh big servers we've got Googles we got Amazon we've got all sorts of huge server Farms out there and on down to lots of little devices down at the bottom so for instance at Berkeley here people are looking at the you know little devices made out of silicon that move okay and everything in between here's a here's a picture of uh a car I purchased a few years ago uh how many processors are in a typical car these days does anybody know yes 100 yeah 50 to 100 yeah believe it or not that's a lot right that means your car is a parallel system and you hope it doesn't crash too often right uh here is here's my new phone right this is the Evo uh that is very definitely tied into the world parallel system as our probably every other phone you guys have yeah form is this the new class or is this be so this is uh so there is some move of foot to restructure 162 a bit this is the uh the original version of it so but obviously I put in new material every year so six and one six and a half of one half of Bakers doesen to the other so basically uh what I want you to know is to start with the world is based uh this huge parallel system with lots of components somehow interacting together and often uh doing so in a way that does what you want okay and sometimes not and this class is really about what structure can we put on to a system like this to help it perform more than often the way you expect okay now there's this other Trend by the way which is kind of fun uh David Culler uh talked about the peopl to computer ratio over time so this is a log oh by the way on Moors law these are always uh linear on the time axis and log on the number of transistors axis and it's a straight line okay so that means it's exponential uh this is another case where it's linear on the year axis and log number of uh people people per computer and that's been rapidly going down so uh basically whereas in the beginning there might be one computer and uh many many many people for that one computer now you've got a 100 computers in your car you got one in your cell phone or your two cell phones or your five cell phones you got an iPod you know the number of CPUs that you've got personally is large it's a different it's a different era that we're in and it's the one that you're all used to right because this is where you grew up now this is what people typically called Mo's law and this is actually Joy's law for Bill Joy and what it says is that the performance of computers has been doubling roughly every 18 months or so up until about 2003 does anybody know what happened in 2003 or 2002 somewhere there yes get so the question is did the transistors get so small that so it turns out that uh Believe It or Not Moore's Law is still continuing so the transistors are still going for a few Generations uh but somebody said power wall yeah so one of the biggest problems is somewhere around here it was uh it got to the point where you couldn't improve improve performance anymore without increasing the power drastically which means if you got a laptop you're burning your lap right if you've got a battery powered device it's draining out in a few moments okay and so the power wall was a really big problem here and there are other ones which is for instance this performance Improvement depended on uh being able to extract parallelism automatically uh from software without telling the programmer about it and that's something that if you took 152 you'd learn a lot about okay but we're not going to talk about that in this class the bottom line though is that this performance has fallen off so if you had a programmer who was lazy which was basically most of them it's nothing against programmers right was basically said well my program's too slow now if I wait 18 months it'll be fine because the computer's twice as fast okay that doesn't work anymore so now what well I guess we put multiple processors on a chip okay you probably cannot buy a laptop or a netbook or a desktop computer these days without talking about how many cores are in it does it have two cores does it have four cores six cores okay they're off onto some weird non- power of two thing which is always a little jarring like 12 cores okay that's that's enough to to screw you up for days right but anyway the point is that they've given up trying to make individual processors faster and now it's all about more processors and so that makes the complexity higher even down at the lowest level okay so it won't be all that long before the cell phone you're carrying has multiple processors on it and then how does it work does it crash all the time okay so uh back in 2007 here was a test chip from Intel that actually had 80 processors on it you've probably how many people have heard of that one before anybody couple of you there's a new one that they call the single cloud computer that just came out this has only 48 processors on it but it's got a lot more interesting stuff for them to talk to each other so it's got an actual mesh Network it's got lots of uh memory bandwidth uh Hardware support for message passing so this one is much more like an actual parallel computer where this one was kind of a demonstration of concept yeah we can put a bunch of processors on a chip so Minore is a term I'll probably throw around we like to talk about it in the par lab all the time and what does it mean well you probably if you look in the industry you see multicore but if I say many core what am I saying well 64 processors 128 hard to say exactly but uh let's say 64 so we're talking about a lot of processors as a target for where the industry is going it's kind of interesting so what do you do with a 64 or an 80 processor thing well you have two CPUs for your the video and the audio you have one for your word processor one for the the browser and 76 of them are doing virus checking okay now uh yeah that's probably not a particularly good use of resources but it's the one that's kind of obvious right and I would say what's interesting about this is now that parallel computer that is the world that I mentioned earlier we've got to figure out how to do parallelism at the lowest level it used to be very it's very easy for Google to use hundreds of thousands of processors why because hundreds of thousands of people every second are asking them to do things and each one can be an individual processor not a big deal okay parallelism by independent activity when you get down to the lowest level it's trickier and you got to actually take your PowerPoint or whatever it is you're doing and divide it up in parallel much trickier okay any questions on that so we're in a kind of a Brave New World here where Intel and Microsoft and all of those are not entirely sure what they're going to do with all these processors okay but they're basically producing them anyway so here's another Power chall that somebody said the power wall earlier which was great here's uh a funny thing if you were to actually take and go on Mo's law curve of transistors and just use all those transistors what you'd find is that remember everything's getting smaller and there's more and more of them on a little tiny chip if you were actually follow and use all those transistors you very rapidly get into the regime where your power density is something like a rocket nozzle okay and I don't know about you but I don't want that while I'm sitting with my laptop on my lap okay seems kind of unfortunate so this is this is exactly the power problem okay if you you put all those transistors on a chip you can't afford to use them all because they're all burning power or they're using up your battery either of those are not desirable okay so this is where we're at okay parallelism so we're now in a we're now in the world where parallelism is everywhere and part of this is uh what we're going to be trying to deal with in this class although we're going to start out with a Serial view of the world we're going to uh move into parallelism fairly rapidly okay at least we're going to start uh with serial view then we're going to move into a concurrent view we're in theory things could be moving in parallel or not and then we'll get into a parallel view uh of course this is about operating systems so we're going to spend some time talking about the organization of the operating system that's what this class is about so here you might say is a you know a typical interior of some computer this is a picture right out of your book and what you see here is that there's a CPU but then there's also all of this other stuff right there are disc controllers that talk to dis there's sort of a USB controller which talks to a whole bunch of things printers and keyboards and mice there's Graphics adapters Etc so the interesting part about the computer is not just the processor okay there's a lot of other interesting stuff there's the io okay and if you take uh if you take a computer processor oriented class like 152 sometimes depending on who's teaching it you might get the impression that all that matters is the c okay fortunately in this class we know better because we have to deal with IO and that's going to be something we talk a lot about okay uh and for instance this is a an older chipset now but the Pentium 4 chipset what's kind of interesting as you take a diagram from Intel and here's the processor up here and then all of this other stuff okay so there's typically What's called the North and South Bridges and the North Bridge is handing a handling a bunch of memory and the graphics controller and then the South Bridge is handling a bunch of other things like audio and USB and Flash and networking and all that's dis drives Etc so again the complexity uh of the io is kind of an interesting thing okay now I the way I view complexity in this class is it's something that you can't avoid and the better thing to do is to tame it okay so I'm trying to point out that there is some interesting complexity that you get just because you're dealing with computer systems and it's really a question of Can you tame it in a way that gives you what did we say what you would expect it to do most of the time okay now ideally you'd like it to do what you expect it to do all of the time that's a pretty tall order so if you were to actually take uh so I used to teach 152 I've also been known to teach 252 I do that pretty regularly these days there's a lot of topics in computer architecture we talk about uh you know what's inside the processor there's a lot of issues there we talk about the networking side we talk about storage side various sorts memory hierarchies Etc all of these in theory are levels of complexity the operating system may need to deal with now we'll touch on a lot of these things just because uh we have to as part of the topic of this class okay but if you were to actually be interested in the hardware aspects of this you'd probably take a 152 252 okay this I find kind of an interesting statistic here here's the increasing software complexity so if you look uh down here we've got sort of number of lines millions of lines of source code and you can see the space shuttle right here and then you see Vista there and I I should really try to get an updated version with Windows 7 but uh kind of interesting what do you see you see trend up okay complexity you wonder why it is that uh modern operating systems give you the blue screen and crash all the time okay I suspect it has something to do with number of lines of code okay and as much as one likes to maybe make fun of Microsoft sometimes or even Apple Sometimes some of it is not really their fault it's because everything is so complicated and complexity breeds faults okay now that isn't to say that I'm not going to make fun of said organizations I I like to do that over time but um just realize that the more complicated thing you're trying to do the more chance there is of being failure uh involved in it and then it's all about how do you structure your code to have the least likelihood of failure I I sound almost like a software engineering uh pundit here you know it's all about the the organization of the software it's all about how you engineer it but in fact that's true okay because this is 60 or 50 million lines of code is a lot of millions of lines of code okay I don't know how many of you have written 50 million lines of code anybody bu sorry that's an old reference uh so let's suppose for instance we were interested in say a martian Rover okay now there was uh the Pathfinder was one of the uh the Martian Rovers that that actually uh did reasonably well and uh Pathfinder because it was going to Mars had some Hardware limitations now what's kind of nice is if you stay on Earth you sort of get the latest stuff and you're maybe not as limited but let's look into this for a moment there was a I know this is uh hard to believe a 20 megahertz processor okay yeah that's M okay 128 megabytes of dam okay V X Works uh VX Works operating system which is a real-time operating system it had a payload with cameras and instruments of various sorts and batteries and solar plan panels and obviously uh Locomotion equipment so it could drive around lots of independent things all worked together so you got it's driving itself around on Mars it's avoiding craters and rocks it's somehow positioning the antenna so that it's actually able to receive commands from Earth uh what have you all of these different things need to be going on simultaneously without them crashing each other okay and because when it's on Mars it's not like you can fix it you put in a service call right um can't hit the reset button all right so that actually is kind of an interesting challenge in itself it says kind of that you got to make sure to be able to hit the reset button remotely if possible okay so that control alt delete right somehow you got to be able to send that command uh of course you want to hope that the uh the aliens aren't sending that command too often but it's always needs among other things to receive commands from Earth okay and individual programs can't interfere with each other was there a question back there no so for instance uh you got the Martian Universal translator module which is hoping to communicate with the natives and it better not screw up the antenna positioning software okay and those two things hopefully as an as the programmers and the program teams involved could think about them separately without worrying about how they interact okay think about how bad it is you're you you have enough trouble trying to make sure that this thing can avoid rocks and the guy who's trying to avoid rocks has got to worry about whether the translator unit is going to crash at the wrong time okay that you just couldn't do that so in order to make something like this work well you really need to uh engineer it carefully okay okay and of course all software crashes all right it doesn't matter how good you are and of course the key thing there is make sure that a crash doesn't screw you up too much okay so this is all about fault containment which is an interesting topic that you probably haven't heard a lot about up till now and it's uh how can I make sure that when something does fail it doesn't propagate its failure onto other parts of the system okay and of course the other thing is certain functions are time critical uh how many of you have been listening to music on your PC and you went to pull a window up and the first thing that happened was you heard a glitch in the audio and then the window came up anybody experienced that or you're looking at a video and you go to you go to do something else in the video glitches why is that why why does that happen anybody issues what about concurrency issues okay so something about the way they work together let's uh what there was another person with their hand up anybody want to add to that yeah overed yeah okay so if there's an on yeah if there's a network somewhere there might be overloaded as a result of what you're doing right let me ask you this let's take the audio example specifically do you think that playing I don't know Taylor Swift requires uh a lot of CPU or network how many people think you can you can insert somebody else if you like how many people think that playing an audio requires a lot of either CPU or networking anybody how many people aren't sure that's okay to be not sure okay how many people think that it doesn't Okay so it turns out that playing audio really doesn't require anything in resources relative to Modern machines they're so F so fast the reason you get a glitch is because even that little bit that they need get taken away by a bad scheduler okay that I would say is kind of a bug it means the system doesn't respond well to real-time tasks I will tell you that a martian Rover better handle real time well because if it's about to try to avoid going off a cliff and there's a glitch like we're talking about with the audio it's going off the cliff okay so the reason I bring up this this uh Pathfinder example is it it kind of illustrates some of what we want to make sure to understand here if you're if you're going to design a system you got to sit down and know what the requirements are and then as part of knowing the requirements you want to know how the pieces interact with each other and how to avoid unintended consequences of those interactions okay and that's what this class is about how to avoid unintended interactions so how do we tame this complexity well just to throw more complexity at you every piece of computer hardware is different you have different CPUs uh pennium Power PC cold firearm mips you name it or there are different generations of those CPUs whatever you have different amounts of memory of discs you have different types of devices like mice keyboard sensors cameras fingerprint readers whatever you've got different networking environments with firewalls and tcpip or or some sort of Wireless whatever uh lots of complexity if you're a programmer should you have to worry about every different computer your program might run on how many people think that might be bad okay yeah that would be very bad right you guys understand permutations come up with how many permutations of possible computers there are and imagine writing one program for every permutation you'd go blue in the face right that'd be awful so somehow we've got to fix this problem okay and this is all part of the same complex problem so the first question was do the programmer need to write a single program that performs uh many independent activities together okay well you got the guy worrying about navigation the other guy worrying about translating Martian speech those two shouldn't have to worry about each other okay uh and then does every piece of you know do you have to alter every program for every piece of Hardware hopefully no and does a faulty program crash everything okay so hopefully uh the answer is no to all of these questions and that's part of what we want to do in this class okay question in the back no stretching okay good so and then there's of course this other question of does every program have access to every piece of Hardware so why should the answer to that be no who said security okay why what about security Compu okay so one key problem so you did you uh talked about what I'd call a denial of service attack which is that if one program can use up all the hardware then it could prevent another one from using it okay what other types of security problems yeah root access to the hard drive yeah so what do you mean by root access to the hard drive okay right so if you have multiple different people with data on the same computer and you know you have a program that has access to the disc drive without any intervention in the operating system they can get all that data doesn't matter if they own it or not yeah what else certain programs don't need access okay so certain programs don't need access to other piece of Hardware okay I'll buy that so why is that a useful thing then to deny you don't want them good good so everybody hear that so one reason we may want to prevent other people from using all of the hardware is just because if by accident they might screw the hardware up by putting firewalls and I'm going to use that term loosely around your program you make sure that it doesn't have any unintended consequences okay what there was another person anybody else okay so there's this General notion of virtual machines they talk about this in your book and we're going to sort of use it as a way of thinking throughout the term and this is a rough diagram of what I mean by this and at the bottom we have all of our Hardware okay this is uh your memory your processors your diss your networking whatever on top of it we have the operating system and then up on above that we have the application okay now this line here is what I'd call the physical machine interface because the operating system is basically working on top of the hardware directly in most cases uh not always we'll talk about that in a moment and then the operating system prevent presents a new interface to the applications that new interface is one that's been virtualized it's the firewall that we draw uh around the application and give it kind of a a rose colored view of the hardware okay we're not going to allow the application to have access to pieces of the hardware and the other thing is Hardware is kind of limited in many cases so simple example is you take uh a network okay the ethernet uh protocol we'll talk a lot about that later in the term uh takes packets but those packets can get lost they're small okay etc etc they don't uh a single segment doesn't get you from here to China and so what we want to do is put on top of that a much better interface say tcpi P that allows you to have an abstraction of a stream which you open a socket on another machine in China and you send bites and they all make it there much better interface okay so Hardware is limited and we want to fix it so this is all about virtualizing now uh so you could say that we're again software engineering right we're turning Hardware software quirks okay which is some combination of of hardware and something maybe a little bit into the operating system into something the application user wants okay and we're going to optimize for convenience and utilization and security and reliability and all of these things this interface is going to be a much more stable interface hopefully than the hardware okay and for any operating systems area you pick one file systems virtual memory networking scheduling whatever you ask yourself a what's the hardware interface B what's the application interface you compare those two you have a good idea what's going on in between okay and so a lot about what we're going to be talking about this term is how to get from here to here and do so while getting all of these kind of nice properties now uh this is one of my favorite slides that Patterson put together okay how many people have ever had a class with Dave Patterson okay if you if you ever get a chance you should definitely take a class with him because he's a lot of fun but this is the uh instruction set interface okay which was stable for 20 years and this is basically he likes to say this is Microsoft dancing on Intel but um this is a good example of a stable interface in this case a hardware interface that was put together and basically stayed there long enough for software folks to be able to rely on it okay and so in many cases these interface here are all things that are stable over time that somebody's put together uh in a way that the applications can rely on them okay and you know there's lots of classes in Berkeley here about interfaces right uh and the funny thing about interfaces is in many cases they're historical okay I I hate to tell you this but sometimes engineering Elegance is not the reason the interface is that way okay it's kind of like you go to you go to a city that wasn't engine well go to a city in Europe okay is it nicely ordered with concentric circles or grids probably not right uh sometimes you can see cities in the US that were engineered from the beginning and they're nice grid-like or nice uh concentric circles but off that's rare right um and unfortunately you take a city like that that's beautifully laid out and then when they put the suburbs in it's just a mess right um so interfaces are as much about history as they are about engineering so there are some times where we'll talk about interfaces and there'll be some quirks and we'll have to talk about the quirks but for instance 152 is about the machine interface 160 is about human interfaces 169 uh is about human interfaces to Big projects good class by the way uh and you can ask questions about should you ever move something from one interface to another so for instance just to go back to our example here maybe you find that a certain interface here is extremely useful but also slow because there's a lot of layers of software what could I do well maybe I could actually migrate some of this down into the hardware and then the amount of software between here and the application's a lot smaller okay good so what's a virtual machine so it's a software emulation of some abst track machine makes it look like the Hardware's got the features you like take tcpip I said earlier you make it look like the Hardware's got this great Network Q interface that reliably sends btes to China okay and one of the advantages of virtual machines which I'm just going to briefly mention is it also sometimes allows you to run programs that it thought they had one piece of hardware on different Hardware how many people have heard of VMware okay good this is the company that made their uh made their Mark doing that and uh virtual machines give you Simplicity this is just restating what I said every process thinks it has all of the memory in CPU does it no the virtual machine mediates but it can pretend it's got them all it can pretend uh like it owns all the devices does it actually well no it tries to go to a device it doesn't have access to it is prevented or more subtle is uh take our networking example with a video that we want to make sure always plays no matter what we could actually give access to the network from some other device but make sure that it never uses too much Network to screw up the video right so we can actually talk about quality of service uh virtual machines can give you fault isolation Okay because if the thing screws up the virtual Hardware that's okay because it's virtual okay and finally it can give you prot uh protection and portability so for instance Java which you're probably very you you guys hopefully all love an adore because you'll definitely love and adore it by the end of the term if you don't um is a good example of a virtual machine implementation where the Java program runs inside of a Sandbox that then runs on the real Hardware okay so Java itself is actually a virtual machine okay and here is example of what you could get with uh VMware for instance so here's Hardware you've actually got say the Linux operating system that's just one possibility here and then VMware provides a virtualization layer and then I can actually boot BSD and Windows NT and windows XT and Windows 7 and all that sort of stuff each in their own little container on top of VMware and they can all be running simultaneously and each one of these operating systems thinks it has complete access to the hardware okay so this is a the kind of the ultimate example of fooling the application which is now actually an operating system into thinking it's got the whole hard level of Hardware okay everybody see how you can uh recurse this uh as much as you like although nobody ever goes more than two levels okay cursing and recursing so okay so I'm if anybody has any more questions about virtual machines then I'm going to talk about the class so questions okay how anybody here have a laptop with VMware running on it out of curiosity few of you do you more do you you probably do that to run more than one operating system at the same time yes okay good use um all right so let's talk about the course I'm John kubit totz as I mentioned uh I am in 673 soda Hall um some of the time I'm actually in the par lab uh the other times and that's on the fifth floor of the soda Hall I have some tentative office hours which I put together Monday Wednesday 2:30 to 3:30 although sometimes that doesn't work out for people because uh you know they have a class during there so just let me know and I can move office hours around or set up special meetings whatever uh there are three Tas which would I like to stand up please TAA so we've got Angela okay we got kristos yeah in the back and we got hilie Hello everybody welcome and uh by the way you three should come down here at the end of the class so you can help hand out course forms okay um labs are going to be on the second floor of soda Hall although people can import the nachos environment typically on their own laptops and stuff and they do that too uh there is a website which hopefully people have noticed it's been mostly updated recently but uh basically my primary mirror is actually the one off of my homepage uh here so if you go to www CS Berkeley edu Tilda cubitron cs162 that's actually the original version this one that's off of the instructional websites a mirror okay so the only reason I tell you that is that sometimes you go to that instructional website and you're like Professor Kuby said he put something up and it's not there try my website because it's possible I just forgot synchronize okay um but anyway this will be your portal into the class everything is there okay so let's uh let's take a look there for a second so um so here's the website there'll be announcements on there uh there's some overview of the class there's information which we'll get a little more updated as time goes on the lecture page is the key okay because this is the ultimate schedule so if you're trying to figure out when things are due and whatever go to the lecture page uh I just realized I did not I forgot again to make the nachos page up to date we'll fix that but uh if you're ever wondering whether a date is such and so always go to the lecture page because I will put assignments on here and so on okay and uh this will also show you topics I'll try to get slides up uh early but even if I don't the uh the ones that are in italics are actually from the previous last term so you can kind of see roughly what I'm talking about uh there'll also be readings in either the eth or seventh edition of the book I'll talk about that in a second sometimes even the sixth and sometimes there's also interesting uh links here that are reading so here's a touring award lecture from uh carbado on Building Systems that will fail talking about uh a very interesting extremely complicated project uh that we'll talk about later okay so that's the website uh to know it is to love it um and what else there's also a uh News Group which the Tas will be reading oh webcast hopefully this class is webcast now what do I mean by that well it's actually you see there's no cameras uh that are visible here this is actually what's called screencast which means that uh they take the capture from uh my laptop and my mic and they put it together into a video that goes up that I'll put up on the website uh that will also be available within a day or two of the class so this is not a live webcast it's sort of a delayed webcast uh the unfortunate thing is since there are no humans involved sometimes it doesn't capture uh so for instance if I plug my laptop in slightly later than 9 after the hour then it doesn't always guarantee to capture the video things like that so uh hopefully we won't have too many instances of that but sometimes it happens um people find the webcast to be very useful uh there's a News Group the Tas will be reading from okay UCB class CS 162 uh course email okay this is a way to get a hold of the Tas and so on if you have problems uh there's going be a reader which uh is not quite ready yet but it'll be down at Copy Central on Hurst how many people know where that is you know where that is right so uh the reader people ask me is the reader required well nothing's required but I highly recommend it what it is is it's a copy of all of my slides and uh the source code for nachos that you guys will need and it's so it's very useful to be able to carry that around rather than trying to print out stuff okay and you know using up the Amazon rainforest so uh we will tell you as soon as the uh reader is ready okay schedule class time as you're well aware is uh 4 to 5:30 or according to the clock in the back it's uh 20 to 8 to uh 20 to 8 and um make sure to come to class even though there is a webcast what you see here is there's a lot of good interaction and good uh questions and answers and so much better if people are here uh I find that while people can get a lot of information out of the webcast it sort of gives you a disconnected view of the class so I'm a big fan of actual people being in person um and uh 10% of the grade is actually from class participation so your Tas over time are going to get to know who you are they they know who you are and uh so they'll know whether you're participating this will be in section as well okay so make sure to come and participate um so sections are important for this class okay because we actually give information in sections uh that may not have been fully covered in class or we may expand on things uh so go there now t bears all right how many people weren't able to get into a section in tars do we have anybody okay okay so there are now five sections there used to I'll show you them in a moment yes there used to be four but there are now five and uh your tele Bear's assignments are completely irrelevant in the grand scheme except for Friday this Friday okay so you should all go to the one that you were assigned by tele Bears this Friday hopefully by next Friday the following one we will have given you your new sections and the idea of the new sections is that everybody who is uh uh in your project group has to attend the same section okay and this is a requirement because the Tas first of all need to uh be able to interact with the whole group at a time and also uh for course for load reasons we want to smooth things out so we want to make sure that everybody in your group is in the same section now usually we are able to make this work but there will be a time in a little bit later this week when we'll put up uh the ability sign up for sections don't do that quite yet and uh hopefully it'll work but uh very important that unless absolutely required you sign up for two sections okay so try to figure out which two sections you and your group can attend and those of you that can only attend one section uh may have to send me good justification of why only one section is good that's doable but yeah you mean were there any sections last Friday no there's there are definitely section this Friday so whatever that is Friday the 3 or something there's definitely section this Friday go to your tele bear section only this Friday there other questions yeah no yes you have to attend two sections a week no no uh put it this way we are going to do a a massive on the-fly reassignment of sections and if you give us two sections your groups can attend it's more likely to converge um you know it's kind of like trying to compute the last digit of pi which is my favorite number we'll learn a lot about you know the more the more options we have the better it converges uh higher terms in the series um other questions now let's talk a little bit about the weight list how many people in here are on the weight list okay so here's the story I don't know what it is about this term but uh we had 200 people that wanted in this class that's a lot uh we as of last week at some point I believe we booked this room to 100 to 110% so if you're still on the wait list your chances of getting off of it are vanishingly Vanishing now I don't want to scare you away because what typically happens every time uh for you know every first week is that people you know came here to sit in and see what's going on and then they drop or something so it's not to say that you won't get in the class but uh it's it's right now we're kind of overbooked for this room now uh I'd love to actually have everybody in here but the problem with moving rooms is that then we lose the webcast and things get tricky and so uh yeah that's a problem now um because there are very few rooms like this one this actually there aren't too many people that know this but I think in our department this may be the only one that does this uh trick it may there may be a new one over in the uh the Citrus building but I'm not sure um the other thing is uh there is a pecking order that deals with seniors and and then Junior and then concurrent enrollment folks so you can kind of Judge where you are in that scheme um but anyway I would say wait until it shakes out a little because it always does okay don't give up hope yet but if you're you know if you're number 30 on the weight list that's probably not good okay now textbook uh silver shots a Edition uh this is a pretty good textbook we uh it's got different Viewpoint from mine in a lot of topics which is makes it good it's a good thing to look at uh and everybody should get a copy of it I put readings up on the lecture page remember your friend uh that sort of say what readings are appropriate for my given lecture so that's useful um this actually has uh more modern material than in the seventh edition so I know that you know people who shop at Neds and so on like to get older editions but uh is Ned still around do they yeah okay um you know I actually haven't been over there for for a year so I don't know um but uh I would say um try to get the eighth if you can I know there are still sixth editions floating around that one's getting pretty long in the tooth as it were um the eighth edition's been out for a couple years now so I suspect you can even get uh used versions pretty easily um there are online supplements so if you go to the information link there's actually supplements to this uh interesting readings uh appendices some sample problems and so on which is useful um so I guess I answered this about the eth Edition uh our topics of coverage are going to be something like this we're going to talk about fundamentals uh for the first week we'll talk about processes and threads then we'll talk about synchronization and scheduling uh talk about protection address translation and caching demand paging file systems networking protection and security other uh you know last year they shortened this uh the term by a week to give us the rrr rrr week uh the problem with that is that sort of killed off time for one of my favorite things which is is a lecture that uh you guys construct in the sense of by topics you sort of say what topics you'd like to hear about and uh I put together a lecture on it and sometimes I talk about such things like you know dragons was is one of my topics uh or I'll talk about Quantum Computing sometimes people get me to do that or uh or on the operating systems front uh talk about research Topics in operating systems now I do do some of that for sure anyway but what I may do and I'll pull you guys as it gets closer is I may have an optional lecture on the Monday of R of that form which doesn't have anything to do with the final and you can just attend for your interest and you guys can submit topics so would anybody be interested in doing that okay well maybe I'll do that I mean it again no required attendance think of it as studying relaxation or something um okay grading so rough grade so another thing that happened when they removed a week is they kind of took out I had to make a choice between material and an extra midterm I'm not sure whether I did the right balance there or not um usually I have two midterms in a final last fall I did only one midterm in a final uh the nice thing about two midterms I know it's sounds like a pain but it gives you one more data point on how you're doing in the class um I may PLL you in a little bit to see if people would be interested in another midterm you'd be surprised how many people raised their hand when I asked you want an extra midterm it's uh more than you might think but if for some reason we did two midterms then this would be a probably a 15 15 15 split right now it's a 20 25l um there's also four projects Each of which is 125% uh and then a participation which varies from somewhere between 5 and 10% depending on how things work out okay four projects uh are actually working with the nachos uh system which is a virtual operating system it's not Linux or uh an actual operating system and the reason for that is the virtualness of nachos lets you ignore things that sometimes get in the way like a weird pointer reference causes the uh interrupt controller to lock up and you sit there staring at a blank screen okay these are fun kind of bugs for an advanced operating systems class uh what we chose in this class was to go with a system that lets you look at the particular Concepts we're trying to learn without that weirdness okay now the downside of that is it's missing some of the deep device driver kind of stuff that you could imagine getting now uh somebody earlier mentioned this restructuring of 162 one thing that may happen is uh I or some others may actually put together an advanced operating systems class that uses Linux uh and goes to the internals um which would be this would be a prere for that but uh we'll see uh would anybody think they might be interested in a course like that if it exists oh interesting okay uh might happen yeah 16 162 and a half um the other thing I want to mention is this fourth project is a networking project for sure I may actually do what they did last term I haven't decided yet which is a cloud computing networking thing uh how many people would be interested in trying to do some cloud computing stuff okay uh we uh that's a possibility so the late policy okay well this is a class which means I can't let you guys have an infinite amount of time to turn things in yeah I know hate it when that happens but we will give you slip days now what's a slip day well a slip day is a day that your group can invoke in turning in the final code of a project okay and you get five of them throughout the term so you're working Along on Project three and you're just not going to get the code done in time you want to turn it in the next day you can invoke a slip day okay and you get five of those now do not do we've had a group or two in the past who have invoked all five slip days on Project one I can tell you this is not clever use of your time uh or slip days but why the the reason we put slip days in is we know that with any complex project things happen Okay but you should make sure and I'm actually going to give you half a lecture on how to interact in a group because surprisingly few people uh have that right off the bat but uh you should make sure that your invoking of slip days is for good reasons rather than you know know you didn't get started in time okay but we will give you this now what happens when you run out of slip days well then it's 10% per day on projects okay now there'll be two phases to your projects by the way one is a design phase where you turn in a document describing the design and a second is a final code phase where you turn in the functional code you will allow be allowed to do slip days on the code not on the design and the reason for that is we want to make sure that you're not slipping on your design phase because there are design reviews and everything and that would just get screwed up okay all right don't worry if that seems too complicated uh we can repeat it multiple times so why do we do groups so groups are four to five members uh they have to be in the same discussion section and uh why do we do groups because because the real world has groups okay that's one reason another is uh these projects are sufficiently complicated that it's good to have more than one person working on them uh it's good to have four or five people working on it now how many people have not done a four or five person group project yet here at Berkeley okay so interacting with four or five people is surprisingly complicated uh when I first got here my very first year of teaching an undergrad class uh at the after the end of the term I had a letter slid under my door and I open it up by the way I'm thinking ah I've survived right I open it up it says Dear Professor kubba totz you have ruined my life I'm thinking boy that was a bad term so I'm reading on and it turns out the reason that I had ruined this person's life was quote made them work with other people now that is kind of unfortunate um but uh clearly this person did not have a good group experience uh your group experiences will vary uh but hopefully won't be that bad okay I do not I do not intend to ruin anybody's life that's uh probably not a good thing um you can quote me on that by the way uh but what I want you to know is dealing in groups of four or five is challenging and you have to figure out how to work with the other people to figure out how to adapt your schedules how to communicate how to organize okay uh believe it or not there's a whole class 169 which I mentioned earlier on software engineering okay we're not going to spend time going over all the material 169 but I will give you some tips on how to deal with the groups but just all I want you to know today is be aware that working in a group can be challenging that's the important thing to remember okay and if you know that up front then hopefully we can avoid some of the pitfalls and you can help get help with your TA by your taas sort of intervening or talk to them before there's a pro major problem okay but I stick to the fact that groups are important okay they basically mirror what the real world is like and you're going to be you're going to be you know Engineers that go out and change the world and so you're going to have to deal with groups if you think 4 five is a lot you go to Intel how many people design a processor well there's four 500 people that design a processor at Intel okay so four or five is small number of course they actually have 12 levels of hierarchy of management to deal with it too but so uh just keep in mind communication problems are natural um you need to figure out what people have done you know sometimes uh I actually when I was a grad student my office mate had this very strange notion that all code had to look a certain way with four characters worth of indentation after ifs and that all variables had to start with a certain you know uh format depending on what functions they were in and we were buil buing a huge system and the problem was he was a night owl so what would happen is we'd all go home and ah our code Works isn't this great in the middle of the night he'd come in and he work and he he'd look at the code and it just didn't format right and so he would reformat all of the code change all the variable names check it back in and we'd come in and nothing worked now I'll tell you it's only because the windows were sealed on that sixth floor that we were on that he didn't sort of uh yeah anyway so dealing with groups is challenging okay uh so you need to think about you know how to know what other people have done what answers you need from them what you know document things uh keep online notebooks whatever okay and we'll talk more about this uh and try to communicate with your Tas if there are problems okay and in some sense we actually have short progress reports which are the design reviews that you're going to go through about what you're planning to do and that's going to help a bit in the communication process as well okay any questions about this so let me show you my typical lecture format this one is not typical but uh so back in the early days of soda Hall and and Cory Hall uh people would spend the first 10 minutes of lecture talking about uh administrative matters you know well there's GNA be exam coming up next week and you got to remember that project four is due here and you know they go through all these things and then they get to the material and basically somebody who knows a lot about uh how people learn came in and uh said well you know the attention spans are high at the beginning of class okay and they fall off so basically people were teaching administrative methods really well so years later you could remember when the exams were so in light of that my basic idea is the following we're going to start right in with material a little bit of a review session of the previous and real material right at the beginning and of course you're you know going to wne a little and then we're going to take a break which in the case of uh the first break is going to amount to actual administ rvia so we'll talk about things having to do with the class sometimes I'll give some interesting news items uh Etc and of course that'll allow your brains to recover a little bit and then we'll be going well and then of course so at that point we'll have another break where I might actually let you guys go out and have some water you know talk a bit these are five minute breaks not 20-minute breaks so then we come back up and of course this is going to improve a lot and you'll have the last bit of class and of course at this point you're in kind of trouble but watch for the keywords and in conclusion okay because what's not notice uh what happens with an in [Applause] conclusion wait for it what you want to do is wait for me to summarize what happened today that information Spike before you pack up okay so when I say in conclusion don't pack up right away actually pay attention for that last few moments and then we'll let you go okay so this is basically One Minute review 20 minute a couple Minutes review sometimes 20 minutes lecture 5 minute administrative 25 minute lecture 5 minute break where you go out 25 minute lecture Etc and I'll try to get here a little bit early and stay a little bit late uh if you have any questions okay uh the lecture goals interactive I'm hoping that you guys ask me questions okay that's important um I much prefer lectures with questions in them um your Computing facilities uh we're going to have forms here after class is over so everybody should uh make sure to come up front where there'll be Tas handing them out but they're basically your account forms and I don't know whether we have enough accounts but please only take one form okay and you should take this form and log in to your account and it actually will ask you some information that you need to do right away okay things about what's your right email address question yes do groups get a grn or something yes we'll deal we'll worry about SVN in a little bit but not not today but yes okay yeah we still use SVN uh I've had questions about other things but um so try to log into your account this week make sure that nothing's screwed up uh take a look at the projects and nachos link off of the main page uh remember the web page is your friend uh because that's your project information uh and uh read the news group regular okay and of course academic dishonesty yeah so if you look at the uh if you actually look at the various forms and websites about this you know copying all or part of another person's work or using reference material not specifically allowed are forms of cheating and will not be tolerated student involved the incident of cheating will be notified by the instructor and the following policy will apply you can look it up bottom line is is do your own work uh and you'll be fine work with your group okay you know we actually run moss on occasion and catch people so try not to be using things from previous terms or other groups okay because that's bad all right I think if you uh just take to the straight narrow you'll be fine okay and people feel free to uh talk to me later if they want so what I want to do unless there's any questions about administrivia I will finish up the lecture by just talking about a little bit of what's inside an operating system got about yeah 15 minutes left or so any questions on course administra viia yeah how important is what the recommended book I I would say try to get a copy if you can or read it in the library I mean it's it does does give an important kind of alternative view to things so it's good um you know if you can't afford to purchase it there's lots of places you can go with the library or whatever to actually read it or read it in friend you know you don't necessarily have to own your own copy to get good use out of it but I would definitely make sure I had access to it good any other questions yeah uh there are no homeworks in this class uh sometimes I post uh homework that you can do optionally just to help you along to see where you're at um but pretty much it's the projects and the midterm or midterms and final okay any other questions all right so what does an operating system do well if you read your book an OS is similar to a government now of course this is Berkeley so immediately we say that means an OS is bad right you know does a government do anything useful by itself well that could be another Berkeley style question um uh one of the things an operating system does is a coordinator and traffic cop it basically manages all the resources uh it settles conflicting request for resources uh prevents errors and improper use okay so that's the uh coord Ator traffic cop kind of uh idea it's a facilitator uh it provides facilities like the file system and the uh the wind windowing system and standard libraries and so on that everybody needs okay so in that sense it's preventing you from having to deal deal with uh ones and zeros to do your Martian unit you know translator okay um and you know basically some combination of these two so but what is it really well okay so maybe it's the memory management piece maybe it's the io management maybe it's CPU scheduling maybe it's communication is email in the operating system okay I see a lot of people saying no uh maybe multitasking and multi-programming allowing more than one thing to go on does that belong in the operating system how many people think that probably belongs there okay I'd buy that how about uh the file system okay believe it or not you can get by without having the file system in the operating system we may talk about that a little bit how about multimedia support like video okay maybe video doesn't belong in the OS yeah kind of like this what about the window system okay now it's interesting I see some yeses and some NOS that one's a kind of a scratcher because uh you know one would think that window is graphics and application oriented on the other hand Microsoft made a a conscious decision about 15 years ago or so to put windowing into the operating system uh which is one of the reasons it crashed all the time but um what about other user interfaces I don't know how about the browser oh now you guys are a little too young to remember this but um Microsoft was sued by Netscape and a whole bunch of others because they were claiming that internet explorer was a fundamental part of the operating system okay and it looked like uh they were kind of honing in on the uh internet browser market and doing so kind of in a way that wasn't kosher okay now uh it's interesting that people don't even worry about that much anymore right because we have alternatives to Internet Explorer like Firefox and you know uh Safari and all these others and it's not as much of an issue but I'll tell you the passion were high 10 year 15 years ago about whether the uh browser belonged in the operating system and you might ask is this only interesting to academics I don't know maybe uh there's no universally accepted definition of what an operating system is so uh everything the vendor ships when you order an operating system unfortunately you buy a computer from Dell or you buy a computer from you know whoever your HP whatever who your vendor is and what do you got you got all of these pre-loaded apps that you never ever want to use right the very first thing I do when I get a a new uh computer is I delete everything that I didn't want now uh you got to be careful doing that because sometimes you delete too much but you know details um there is one program and I say that kind of in quotes that's running all the time typically that's called the kernel and most people would argue that the kernel is they would not argue that the kernel is the operating system or the key part of it it's the core it's the thing that's doing the multitasking and the oftentimes the file system and doing the protection and the security okay it's the core and a lot of what we talk about is going to be about the kernel okay uh what if we didn't have an operating system well then we take our source code we compile it we get object code turn that into uh load it on the hardware okay so what's wrong with that well how do you get the object code onto the hardware believe it or not loading the program is a function of the operating system in many cases here how do you print the answer out well that's missing uh here is an alar 880 so if you were a hobbyist many many ago you might buy one of these things as a kit put it together and what you don't see here is there a bunch of switches and a bunch of lights and this you programmed in machine code and what you do is you take your program you translate it into machine code You' print it out and you'd set all the ones and zeros and then you'd say first bite second bite third bite okay and the way you got output is on the LEDs okay now I don't know about you but that does not sound [Laughter] fun okay so believe it or not the operating system is actually a very useful thing in terms of giving you access to the hardware okay it's giving you an abstraction that's useful now what if you only had one application so very early computers ran personal computers ran one application at a time okay or maybe an embedded controller like an elevator might only run one app or remember those 100 computer 50 to 100 computers in a car each one of those might do one thing like airbags or brakes okay do they need an operating system I don't know that's an interesting question uh maybe in those instances the OS is less about the protection piece and more about the services it's providing to make it easier for the person designing the airbag app um but you know here's m MS DOS does anybody actually have a computer that runs MS DOS okay probably not oh somebody in the back does good good um this is interesting because uh this was the ultimate in Simplicity you actually had some ROM in the Bios which actually basic input output operating system is still at on a computer you buy pretty much it is a set of really basic routines that are encoded in uh ROM that tell you how to do input and output and all that stuff on top of it were some simple device drivers and this thing called command.com which lets you type commands in and that was the operating system okay and then your application program went on top of that now this is fine and dandy except there was no protection in here so if the application program decided to trash something in a device it could okay it's very easy with this kind of structure to lock the system up and basically get nothing useful out of it okay uh so what about things like cell phones and Xboxes and PS3s and whatever is it enough to have an organization like the MS do one do do you think that you know I have my I have my new Android phone which I love my HTC uh Evo uh does that run only one app at a time okay how many people have a smartphone of some sort okay more than one app at a time yeah probably right so huh Can you put the OS in the the ROM or flash it well yeah probably right uh could you get rid of the OS entirely and build it into Hardware maybe huh all right so you collectively have been in a world where more than one app at a time is the norm right and so basically we need to uh have full coordination and protection we have to have interactions between different users or at least different programs we have multiple things running simultaneously we have very complex Hardware resources uh still have standard libraries out of your OS and the question you might ask is here's a bunch of complexity of an operating system that handle more than one thing at once let's go back to the what if I only have one app running would it make sense to have this complexity okay how many people think no doesn't make sense if you have only one app how many people think yes it makes sense even with one app okay anybody want to defend that lad position yeah like it might be that you have one application running but it's not like it can't have okay great so today an app means parallelism remember I started the lecture that way so that would be one reason another one which people didn't uh might have been thinking about is all of the protection that the OS gives you against other apps is actually protection against yourself if you have a buggy app it means that when your application crashes you can still get good tobg information you don't lock the whole system up okay so uh let's briefly I'm going to close on an idea here let's let's start into the operating system idea here for a moment what if we want to run multiple apps in such a way that they're protected from one another okay the goal is to keep user programs from crashing the operating system and from crashing each other and some mechanisms that are going to help we're going to make the policy mechanism uh division quite obvious in many cases this term one is address translation and the other is dual mode operation and a simple policy which we're going to invoke is that programs are not allowed to read or write memory of other programs or the operating system okay so stay with me for a second very simple policy right the way I get protection is I am not allowed to read or write the memory of either other programs or the operating system I'm going to make a little virtual container okay now what's address translation well basically the idea of address space is it's a set of addresses that a program reads and writes we'll talk a lot more about this in a moment and address translation takes the the addresses the programs reading and writing translates them into other addresses okay stay with me what does that look like well here's a spaghetti diagram that shows you two programs program number one and program number two two and program one has its address spaces which is being translated to spots in physical Dam and program two is translated to different spots in physical Dam and notice how because of the translation these spots don't overlap so the physical Damm in the middle is uh not going to serve as a conduit for program one to screw up program two because program one can't even overwrite program two or do anything to program two okay so this is a good example of the kind of mechanisms in Hardware we'll talk about and the kind of os policies that we'll invoke in order to protect okay questions good so we're out of time but uh we'll talk talk about some of these later so here we go hold on so why do we want to study operating systems one we want to learn how to build complex systems and an operating system is a really complex system it's a great great way to start we want to learn about engineering issues like why is the web so slow sometimes Etc you guys hopefully will have a much better idea in some of these uh when you go to buy computers or understand the specs you'll have a much better idea what they mean and uh you might actually have business things you could understand but bottom line in conclusion oh by the way we'll also talk about security and viruses and stuff so in conclusion operating systems give a virtual machine abstraction to handle diverse Hardware operating systems coordinate resources and protect users from one another operating systems simplify applications okay operating systems give you fault containment fault tolerance fault recovery okay protection and finally cs1 162 combines all sorts of things from uh other parts of computer science languages data structures Hardware algorithms will touch on all of those because we got to use them the end