Placeholder Image

字幕列表 影片播放

  • hello everyone i'd like to welcome you all to this fall's this terms instance

  • of this course is a fish way either 15 213 from computer science or 18 213 from

  • electrical and computer engineering but a large number of people enrolled in

  • this course are in one called 513 which is for graduate students and to be

  • totally honest you're not supposed to be here because you supposed to watch the

  • videos the lectures by video later but we're not checking any cards so i don't

  • really know who you are

  • Oh anyways this course is a as you can see a very popular course on campus we

  • have over 700 700 600 shouldn't exaggerate students on campus and rolled

  • in one of those three versions of the course which if you think about a

  • university of the size of CMU it's like about five percent of the total student

  • population so we're very glad to have you here in this game is too high think

  • we overdid the game try that

  • that's better so my name is Randy Bryant and my co-instructor is Dave O'Halloran

  • and those names might be familiar if you have been to the bookstore

  • because the book was written by us and we actually wrote this book of we

  • started to 13 is a course in 1998 are and I know that your children them and

  • all that stuff but up out of response for our new type of course that you'll

  • see today that sort of gives people are in depth understanding of systems but

  • more from a high level or programmers perspective and we'll talk some about

  • the philosophy of the course later

  • so this book as you see are just came out its third edition last March and

  • that's the required text for the course and there is nothing you can do to avoid

  • buying that book and it's not because we're greedy actually we take the money

  • we get from royalty for students in this course or any CMU course and we donate

  • it to CMU so we're not actually making any money out of you buying the book but

  • it's a simple reality that the new version is different than the old we

  • expect you to be using the new version there are no electronic copies there are

  • no pirated version so you basically have to buy the book but and I don't really

  • apologize for that because i know you or your parents or somebody's paying a lot

  • of money for you to be here and so the price of the book is really a relatively

  • small amount relative to that and up this course by the way is is not some

  • courses there's oh yeah this book you might want to look at it once in awhile

  • but actually the course has nothing to do with it

  • this course the book and the course are one they're very tied together there'll

  • be parts of the book that we don't go into all the details that are in the

  • book sometimes but we expect you to be able to figure it out and so really the

  • course in the book are tied together and they very much the the progress the

  • course the topics covered how it's covered everything about it is

  • consistent with the book and we wrote the book because of the course think of

  • them as course notes so and the reason why we are teaching this term by the way

  • we haven't talked together in several years but because this is the first roll

  • out of this book and not only is it being used here but it's actually used

  • by about 250 schools around the world and many of those people are also going

  • through the same of activities of teaching for from this new edition for

  • the first time and so we wanted to make sure all the material for the course was

  • sort of put in order and thanks

  • because other universities and other colleges use this material of the

  • supporting material we've developed so that's the course and today is the first

  • election we're sort of doing a tag team here I'll talk the high-level what the

  • course is about what the main themes are and today we'll talk more about the

  • logistics so we refer that the saying we have one of the very first time I type

  • the number of this course into a text editor i realized i've typed those five

  • digits many times in my career because it's the zip code of CMU 1521 three so

  • that's where we come up with the same so arm there is a few things about this

  • course for the most part you know and your normal undergraduate curriculum

  • when you learn programming you've been very much separated from the realities

  • of the Machine you you just think about code just you put some text into some

  • little box somehow and outcomes of behavior that it hopefully is what you

  • intended the program to do the purpose of this course is to give you enough

  • understanding of what that box is doing when it executes your code and through

  • that to help you

  • I'll become better at what you're trying to do so some of the outcomes is there's

  • really two types of outcomes from this course one is that if this is the only

  • systems course you ever taken your whole life you will get useful material from

  • it you will learn tools tricks methods that will help you if you ever are

  • involved in software development a large-scale software engineering

  • projects systems hardware design any aspect of of computer technology

  • this will help you be better at what you do you'll understand what programs do

  • how they work

  • what the machines that support them do why sometimes they work really well and

  • why sometimes they don't work so well

  • oh it also is intended as a sort of stepping stone into a whole number of

  • other courses at CMU that will give you more in-depth understanding of computer

  • technology but are sort of specialized by topical area whether it's computer

  • networking or operating systems or embedded systems where you'll take the

  • sort of ideas from this course and be able to then learn it as somewhat

  • narrower but deeper sense what's really going on and so it really is trying to

  • serve those two goals of making you more effective giving you useful ideas and

  • tools right away but also preparing you for later courses so one way we talk

  • about this is sort of what why what kind of stuff will you learn from this course

  • is to go through a series of what we call great realities places where sort

  • of computers meetup real-life computers get meet up against your expectations

  • and maybe they're not quite the same

  • so one of them is in the first part of the course is going to take a fairly

  • detailed look at how numbers are represented in computers and you'll

  • learn some things that are on one hand surprising and another

  • your hand will start to make sense when you understand it better

  • so are a simple case is for numbers i don't know when it was but it was

  • probably in about eight grade algebra that I've learned that if you square a

  • number it will be at least 0 if it's not an imaginary number

  • so a either an integer or a real number you'd expect to square and it to be a

  • positive value or perhaps 0 right arm and that's actually generally true with

  • floats a representation of floating-point numbers but with integers

  • are hints you know the the computer representation of integers it's not so

  • clear so for example a few square 40,000 on most computers then you'll get

  • $PERCENT of whatever that should be as you'd expect but what if you square

  • 50,000 so you could do this in your head but actually built into this laptop is a

  • computer so i'm going to go ahead and use it just sighs

  • and use the to all which on unix systems is called know what's going on before

  • we are on our linux systems is called GDB but on a macintosh OS X it's called

  • lld but they're pretty much the same program you will get to know this

  • program really really well this term so like i said if you square 40,000 you'll

  • get what you'd expect but let's change this to 50,000 and you get a very

  • peculiar number that doesn't look anything like you'd expect 50,000

  • squared to be and in fact it's negative and so that might just seem like well

  • there must be a mistake or something know that that's just the way it is

  • because of this computer is expecting numbers to be represented as 32-bit

  • values and the bit pattern that you get when you do this multiplication happens

  • to be the representation of a negative number so that's a an example of where

  • your normal expectations about integer arithmetic may or may not hold up on the

  • other hand there are some places like if i try to do the same thing multiplying

  • 300 by forward by 500 x 600 then all of a sudden i also get a number that

  • clearly is not what you'd expect because the same thing has happened

  • I've gotten an overflow it happens that it's overflowed to value that's positive

  • not negative but it still is obviously not the integer product of those four

  • numbers on the other hand one thing you'll find is even though this

  • arithmetic is not a normal sort of integer arithmetic it actually has some

  • well-behaved properties so for example if you look at it

  • what i've done is i just moved the 300 around from the beginning of the product

  • the end of the product and so now if you think about how associate ility and

  • community works basically multiplying these four numbers in a different order

  • but what you see is you get the same funny-looking result

  • uh no matter how you do it so what you can say from this is integer arithmetic

  • is commutative and associative sobes some of the conventional mathematical

  • properties it just isn't what you'd expect it to be it's not a up

  • normal sort of mathematical integer arithmetic so the cartoon here shows an

  • example that similar possibility we get to it

  • oh I guess it comes at the end up so that the next question is is edition

  • associative right can you order that the numbers and then you probably might have

  • figured both it in the integer arithmetic even though as this potential

  • for overflow it is associative and it's a community of two but four floats it's

  • not really quite the same because the range of values you can get in floating

  • point or so extreme that some numbers kind of disappear on you so the example

  • I'll show without having to use a computer to do it is if you take a big

  • number and subtract it from itself you'll get zero so if you add that to

  • 3.14 you'll get 3.14 but if you take those two numbers and you reorder the

  • how you combine them so that that 3.14 compared to minus ten to the twentieth

  • is so insignificant that result gets turned into a minus ten to the twentieth

  • and you add that to one ten to the twentieth and you end up with zero so

  • it's not associative and so what you see is the both these numbers systems have

  • some peculiarities and it all comes down to the fact that they use finite

  • representations of things that are potentially infinite and their expands

  • and so there's some compromises in how those work and what the compromises you

  • can overflow an integer and and run out of room and in floating point numbers

  • you have roundoff problems where you should drop the digits that are

  • significant you can also over floating point but the more common problem is

  • round of so this is shown in this cartoon this idea of overflow of

  • somebody counting sheep which in the u.s. is are in english language at least

  • a way to fall asleep and when he or she goes from 30 2767 and then increment set

  • by one gets minus-30 2700

  • 68 and we'll see exactly why that happens but basically the numbers are

  • going up to the largest value can represent and then when it goes one more

  • becomes a negative number so these are really important understood thanks to

  • understand I mean ninety percent of the time maybe you can just get by writing

  • programs and not worrying about whether your numbers are going to exceed their

  • possible range but they sometimes when this could be really important if you're

  • like you know controlling a rocket you really don't want the positive thrust to

  • become negative or something like that so you can see you there

  • this could be an important consideration similar way there is well known

  • instances of security vulnerabilities where somebody wrote code that sort of

  • expected a positive number in someplace and clever person figured out if I

  • supply a negative number i can fool the system and get it to do then thanks

  • so these are the kind of corner cases that you need to understand better if

  • you're either working in programs where it's really really important that it

  • worked correctly or you're really worried about security vulnerabilities

  • anytime you have possible for corner cases you have to understand these

  • nuances better assembly for floating point if you're going to use floating

  • point for serious computation whether its scientific research or for designing

  • bridges or nuclear power plants or something

  • you better understand what the characteristics are so that's our first

  • one and we'll spend a couple weeks talking about numbers and number

  • representations in their properties here

  • the second is we're going to spend a lot of time in this course learning about

  • machine level programming meaning what

  • the instructions are that actually get executed by the computer and that can be

  • diff described in assembly language which is a text version of it or an

  • object code which is the actual bit-level binary encoding of

  • instructions and we'll learn

  • a fair bit about that and spend a fair amount of time seeing how code that you

  • write in C I'll gets turned into machine code and how that gets executed on the

  • machine

  • one thing I'll say is it historically courses like this would teach assembly

  • code by having you write programs and assembly that I do various things not

  • usually very interesting because a lot of work to write assembly program this

  • course is much more about taking the assembly code that's been generated by

  • compiler a/c compiler and looking at it and understanding that's a different set

  • of skills then you need to write it on your own and in particular we're going

  • to look at the language of of intel processors the most recent versions of

  • them are called x86 dash 64 the 64-bit version of their instruction set and one

  • thing that's new in this course compared to previous ones we used to teach 32-bit

  • stuff

  • this course is 64 bits all the time on another one that will talk about a fair

  • amount that is really fairly visible to programmers surprisingly visible is

  • aspects of the memory system so modern computers have a very complex layered

  • memory system to try and give you high performance and high-capacity at the

  • same time and there's some results of that system that can mean that if you

  • program write a program well it might work really well and if you don't it

  • could run very poorly because it's not making use of this hierarchical memory

  • system so and also there's a lot of bugs that show up especially in C programs

  • that have to do with memory referencing errors and so understanding what those

  • errors are what their manifestation is how to prevent them as a big part of the

  • course so for example if i define a struct that contains a to integer values

  • a in an array and a double-precision floating-point number

  • d and if I this function if you end you'll see what it does is it is given

  • an argument I and it sets the ice element of Ages some strange-looking

  • value so as you know I should really only be either 0 or 1 of with this code

  • because that's the range of possible values of this array a but uh we can try

  • other things too

  • so in particular if you run it on either one or two you'll get what you'd expect

  • that you assigned 3.14 to element D of this structure and when you read it back

  • you get the same thing and in fact up but now if i set a of two to this number

  • all of a sudden you'll see that my floating point number which seems to

  • have nothing to do with a has changed and if i do that same thing with i equal

  • to three you'll see i get a number that's closer to two them to 3.14 and if

  • I keep going well

  • nothing much happens until I hit six and then the program crashes so something

  • interesting is going on here at least something quirky is going on and the

  • reason is again it has to do with how data is wait out in memory and how it's

  • accessed and one of the features of C and C++ is it doesn't do any bounds

  • checking on a raised it will happily let you reference element number 5 million

  • of a two element array and not complain but the operating system might complain

  • as it did here and it are in this particular structure and we'll see more

  • about how structures are implemented and wait out but basically the two if each

  • of these of

  • blocks in this vertical chain represents four bytes and so the two elements of HR

  • 4 bytes d is eight bytes and then there's some other of El stuff in the

  • other beyond their that's not actually in the structure itself so you'll see

  • that if I reference either a 0 or a of one then i will just modify that array

  • as designed

  • but when i'm calling fun of two or front of three when i'm actually doing is

  • altering the the bites it in code this number d and that's why you saw the suit

  • of funny numbers come out of it and as I go up at some point when i hit 6 i'm

  • modifying some state of the program that it's using to kind of keep things

  • organized most likely how it keeps track of of allocated memory and that's

  • causing the program to crash so this is a pretty good demonstration of a YC

  • programming can drive you crazy because as you saw it doesn't do bounds checking

  • so it's easy to write code that does invalid stuff arm it's also often the

  • case that you'll cause some problems and it has a sort of action a distance

  • feature that you can modify some thank you

  • modifying some data structure and what you're doing because of the way things

  • are organized memory you're changing something totally unrelated somewhere

  • else in the program and imagine they're not just one apart but they're 10,000

  • apart and things might just run fine for hours days or weeks and then always said

  • some point that data that got corrupted a long time ago

  • it's accessed and something goes wrong so this can be some of the worst

  • nightmare debugging nightmares that exist on earth is to try and figure out

  • memory referencing errors

  • oh so this is actually one argument not to program in c or c++ and it's a valid

  • argument

  • I'll admit but also as a person who's writing a lot of c programming you just

  • get more experienced and you know what times that you should actually put

  • bounds checking in your own code and there's also tools available that will

  • help you sort of of of bulletproof your code so that it will detect these kind

  • of problems so it's not like you have to change languages but it is a particular

  • feature of these languages and so understanding sort of the Machine level

  • representation of data structures and how they work is very really makes a

  • huge difference in your ability to deal with these kind of vulnerabilities and

  • things Varner abilities by the way also from a security perspective arm the the

  • fourth sort of theme will cover in the courses are getting performance out of

  • programs other parts of the curriculum and CS do much more emphasis on getting

  • the right algorithm at the right data structure and that's really well and

  • good that's important stuff i don't deny it but they some amount of the the sort

  • of low-level optimization that you need to do that you need to understand what

  • the system does what makes it run well what makes it run for way in order to be

  • able to do that kind of optimization so the example we like to use is these two

  • functions do exactly the same thing in terms of their their behavior what they

  • do is copy a matrix or array from scald source or SRC to a destination DST

  • they're both size to be 2048 rose 2048 columns two-dimensional arrays and

  • you'll see that the programs do the obvious thing you have a nested pair of

  • Hoops to do the row and column indices and you just copy from one source

  • element to a destination element the only thing that's different

  • you'll see is that the two loops their nesting is different the nesting orders

  • you

  • in one case I'm going kind of a row first going through all the rows and

  • then the columns and the other is for any given row i'm copying all the

  • columns that's really the only difference between these two programs

  • but what you'll find if you run it on a typical system is that there's one is

  • much faster than the other in this particular machine we ran it on it was

  • about a close to 20 times difference in performance so something fishy is going

  • on if the same program that differs only and the seemingly insignificant way a

  • way that has no effect whatsoever on its functionality can have this much

  • performance difference and so to understand this you need to stare at the

  • cover of the book because basically of your two different points of this

  • strange-looking picture that's on your book and since there's no axes or labels

  • on it it makes no sense whatsoever but it's there

  • oh so what you see is this picture shows four different memory access patterns

  • and i won't go into the details of what the throughput measured in megabytes per

  • second on on a basically a copying program was and without going into the

  • details what you'll see is these two functions sort of sit at different

  • points in this memory access pattern the one that goes through row by row is much

  • better than the one that goes through college like all and as a result you're

  • getting a lot better performance and it has to do with this memory hierarchy and

  • that what they call the cache memories of that you're getting way better

  • performance out of it in one case and the other so that's explains what the

  • cover of the book is about and we'll talk about it more later in the course

  • and then a final part of the course talks more about not just getting

  • computers to run little programs in isolation but getting computers that

  • talk to each other over networks and implement services like web server

  • and other functions like that which of course is where most of the world of

  • computing sits today it's not just isolated machines but computers that

  • interact with each other over the network

  • they're embedded controllers that are interacting with the physical world so

  • really but the world of computers is a much richer environment and we'll cover

  • that we some aspects of that in the final part of this course so arm as i

  • mentioned the other feature of this course is it will get you ready for

  • other systems courses you might take it CMU and here we've listed actually a

  • subset of the courses at the University that require this course is a

  • prerequisite and they're mostly in computer science and ECE but you'll see

  • it's quite a range of of different courses and I each of them builds on in

  • one or multiple aspects of the material learned in the course so of the reason

  • why we make everyone take this course including incoming mass to students is

  • that all these other courses at the University have come to rely on students

  • being familiar and having done the work of 213 or 513 as a prerequisite and they

  • can build on that material and sort of cover more ground as a result rather

  • than having to do what would otherwise be somewhat remedial work on it and in

  • fact one of the part of the genesis of this course was the people who taught

  • the operating system course a 4 1030 complain that they were spending too

  • much time at the beginning of the course talking about some very basics of

  • machine programming and and David I said oh well we can cover that so that was

  • part of what got this course started

  • oh and as I mentioned that the course has a sort of perspective that's very

  • different from traditional systems courses most systems courses including

  • that whole array you saw there were about how do I build some particular

  • feature how do i implement an operating system

  • how do I did

  • sign of pipeline microprocessor and those that's all important stuff to know

  • we really want the people who are out there building operating systems and

  • designing micro processors to have learned how to do it up on the other

  • hand is a way to start to get new into this and get the introduction and get

  • the experience we find it more useful to take what we call programmers

  • perspective meaning our understanding of what you as a person who sits in front

  • of a computer screen and types code I need to know about that machine you're

  • typing code for in order to be effective at doing it as opposed to somebody who

  • is someday going to be designing that the actual machine itself up so that by

  • taking that perspective it gives you sort of an understanding so now when you

  • go off to implement it you actually know what these features are and why it's

  • important to implement them well but also that's by doing this programmers

  • perspective it lets you right away get tools that you can use in other places

  • where you're writing programs are doing anything related to it and be more

  • effective at that

  • so this programmers perspective really gives this duel our benefit to it that

  • we feel is very useful and students have taken the course in the past have

  • expressed that as well so as I mentioned we have two instructors for the course

  • and they also happen to be authors and the the longest we've probably taught

  • this course of more than anyone else but it's also taught by other people on

  • campus as well so what I'm going to do now is hand my pair of microphones over

  • two days right uh welcome good afternoon is great to see you

  • my name is stable hollering and I'm just delighted delighted to have the

  • opportunity to be one of your instructors this this term this course

  • is

  • one of the reasons i'm so excited to be teaching this course I mean I just love

  • this course and the real reason is is the the opportunity of represents to

  • have an impact on people's lives that we really believe that the material learned

  • this semester can have a really positive and long lasting impact on on your

  • careers and it will help you not only with your future classes but also future

  • positions you have and I i hear this from people all all the time

  • former CMU students and students around the world to have taken the equivalent

  • of 213 it at their schools and even a couple years ago we were interviewing a

  • faculty member attended tenure track faculty member who went to Disney

  • undergrad see of you and then went off to Stanford got his PhD at stanford was

  • coming back to you know join the faculty and he told me that 213 changed his life

  • in our interview I don't like he's trying to butter me up but i i i i think

  • i believe it he he said he'd changed his whole life in the sense that it gave

  • mode research direction you know I didn't really know what what he knew it

  • kind of like computer science but it didn't really know what direction to go

  • in and after he took 213 he knew they wanted to to do is work his life's work

  • in systems now it was just remarkable right to come by and tap we ended up

  • actually hiring him and he told me that everybody in his lab at Stanford all of

  • the grad students had a copy of the book on their desk from the neighbor from all

  • over you know all different schools and so I mean I even I was in a bookstore in

  • Beijing couple years ago right outside the EKU campus and I was up on the floor

  • trying to see if i could find a copy of the textbook and I i found that yet

  • english version in one mile and then a couple hours over i found the Chinese

  • version i was going through the Chinese version and the sky tapped me on my

  • shoulder

  • and I turn around he says oh man that that book is really good you should the

  • english version is two aisles over

  • and I mean it just blew me away to be to be in the head of someone like halfway

  • around the world it was just that it was just one of those moments and so I'm up

  • I'm not trying to post I'm just trying what i want i want to give you a sense

  • of what it what an opportunity this course represents for Miranda and I to

  • to have what we hope will be a really positive impact on on your lives so let

  • me we have kind of a kind of a funny organization for the course to it in

  • response to that just that the tremendous demand we have we found that

  • we have for it so there's there's actually three course numbers but it's

  • all the same course

  • ok identical course 5 13 15 5 13 is for master students and the 513 513 doesn't

  • have a formal lecture so there's no seats assigned to it instead will

  • videotape the lectures and we'll make those available on the course web web

  • page for our for graduate students and the reason we do this is just because in

  • the past we we didn't have enough seats for everyone and there would be cases

  • where there might be a hundred a hundred fifty master students on the waitlist

  • they wouldn't be able to get into the course and we we didn't really want that

  • because they need this course for to take other courses so that's the reason

  • why we have this sort of does not meet version of 213 is 513 because then we

  • can admit as many all the master students that that need to take the

  • course now 15 to 13 and 18 213 or are for undergraduates in computer science

  • and ECE respectively

  • ok and the undergraduate will go to lectures and recitations okay in person

  • graduate students watch video tapes of those but otherwise yes

  • yeah we're making them available to everyone

  • actually sorry and lecture slides as well everything's available on the

  • course webpage so um so you'll be doing up the all students will have equal

  • access to office hours on this staff mailing list and everybody does the same

  • labs and the same exams

  • ok so it's just a question it's just a matter of whether good election in

  • person or if you're watching on video

  • in fact if you know since it's available to everybody if you miss lecture it will

  • be there on the web page and you can catch up which I know you'll probably do

  • actually know most of you will never miss class right but the few of you do

  • you'll be able to watch the video

  • ok alright this is the one part i miss the party

  • I hate love teaching but this is this is the one part teaching that none of us

  • really like but we have to talk about it and that's academic integrity if you're

  • new on campus coming from international school for an international student new

  • on-campus there might be different notions of academic integrity and

  • different notions of cheating at your undergraduate school your old school so

  • if you're new on campus pay very close attention to this because a carnegie

  • mellon we take academic integrity very seriously

  • ok it's not a wink wink nod nod

  • we're very serious about it and we want you we want everybody doing their own

  • work to preserve the integrity of the courses so what exactly is cheating

  • so if you share code with anybody either copying

  • retyping it looking at somebody's coat like if you look at somebody's coat on

  • the screen or if you give somebody a file all of those all of those examples

  • of sharing are cheating if if you describe your code like line-by-line to

  • somebody that's cheating if you coach somebody line-by-line that's cheating

  • searching the web for solutions just the act of searching is cheating right and

  • this is a this is a real problem for us in particular because the courses is are

  • offered all around the world and people in maliciously yours or sometimes just

  • they're proud of their work and they post it you know for employers on like

  • public github sites so it's it might be tempting to to search for these

  • solutions but even the act of searching is cheating and definitely if you find

  • some solution in and use it

  • that's cheating even if you modify it afterwards and I just want you to

  • remember I can I know how to use google just as well as anybody else right so I

  • i can search for solutions to sew on copying code you know you might be

  • tempted you might be tempted to copy code from someone who took the class you

  • know a previous semester

  • don't do it that's that's cheating to know what's not cheating so you can you

  • can help each other use tools you know somebody's having trouble using GDB or

  • you know they have questions about how to run not use a text editor that

  • stuff's all great you help each other out on using the tools how to log in the

  • shark machines all that kind of stuff and you can help you can discuss sort of

  • high-level design issues and that's probably a good idea

  • yes

  • yeah

  • yes it did you get a previous semester

  • okay okay yeah the question was if you took it in a previous semester can use

  • your your work and answers yes

  • so if you can also talk to each other about high-level you know design issues

  • you know how are you are using a explicit list or you could are using a

  • segregated list for Malik lab okay that kind of stuff is is is ok a high-level

  • ok low-level not okay and basically what we want you to write your own code this

  • is not you know it's kind of a cut-and-paste world these days right you

  • look stuff up on Google's stackoverflow you cut and paste it but that's not

  • that's not the way we do it here we want you to do the work yourself

  • we want you to enjoy the experience of figuring things out and learning how to

  • to solve problems now the consequences for cheating

  • there's a single sanction if if you're caught cheating you'll get you'll be

  • expelled from the course within our there's no exceptions if you drop the

  • course we'll just reinstate you and then

  • it's really up

  • it's a very serious very serious penalty because we just take it we take it so

  • seriously its sub it's just it's just something we don't want you to do we

  • have amazing tools to detect code plagiarism

  • we have amazing tools to detect plagiarism that are on that a resilient

  • to renaming reformatting they operate a very deep syntactic level and so just

  • please please don't do it

  • we have I think 18 TAS will have office hours almost every day of the week

  • there's plenty of opportunities and ways to get help start early if you get stuck

  • start early enough so if you get stuck you can go ask for help

  • we have but automatic extensions built-in if you need more time I'll talk

  • about that later form of grace days but please please whatever you do don't

  • cheat it's just tragic when it happens last last fall 25 students were expelled

  • from the course some were expelled from the University because it was a second

  • offense many were sent hope I talked to students who were like the only person

  • in their family to go to college

  • the only person in their village to go to college and they were going home

  • without without a degree and it's just tragic it's just so please please please

  • don't do it

  • do your own work on and it will be a wonderful experience has really

  • mentioned the the textbook is a computer systems a programmers perspective third

  • edition you can there's a whole bunch of supporting material on the on the books

  • website at csa PP . CS at CMU edu and as Randy mentioned this this book really

  • matters for the course because actually the book came out of the course right so

  • the book is the course of course if you look on and so it'll really help you

  • love that the labs that we do come directly from material that we discussed

  • in the book so what I would encourage all of you to do and i'm not sure if

  • anybody is that

  • taking this advice but I say it every year anyway because i believe it but i

  • think a really good strategy for studying and preparing for this course

  • would be to read each chapter three times

  • okay read it three times work the practice problems so we have littered

  • throughout the book or practice problems with solutions at the end of the end of

  • the chapter and these practice problems like little sort of bite-size morsels

  • just kind of just kind of check your kind of sanity check your understanding

  • of the material so i think if you read this if you read the book each chapter

  • three times and work the practice problems you at that would be an

  • excellent way to go through the semester and prepare the other book we use this

  • that Kernahan Richie's classic c programming book I think of this is

  • still this was written a long time ago it's still the best book around i think

  • four seats it it's a beautiful example of technical writing it was one of the

  • inspirations I used to when I was writing the book you know I could try to

  • find that same clarity and precision that they that they return hand Richie

  • have in their book so this is a this is a really good book i mean this is kind

  • of book it's a reference but it's the kind of book you can just read from

  • beginning to end and get a really good understanding of of see there's a

  • there's four main components of the course there's lectures where we go over

  • the high-level concepts recitations where which meet once a week for an hour

  • led by a TA and the root of the purpose of the recitations is really to help you

  • with that the labs it's very practical hands-on there's the there's seven of

  • those labs and these are really the the heart and soul of the the course this is

  • where this is where all the real learning comes then I think when you

  • actually have to do this stuff

  • and that's why we take the cheating part so seriously because if you do these

  • labs you're going to learn an incredible amount of really cool stuff if you don't

  • do it you won't learn anything so each one of these these labs is one or two

  • weeks each and involves a typically some kind of programming or measurement

  • there's also two exams and midterm and a final the exams are proctored their

  • online proctored in wien and and gates and what we do for the exams as we have

  • like we take like four days from 10 to 10 and then you can sign up and then we

  • have like multiple clusters that are networked isolated and then you can sign

  • up for a slot like a six hour slot and that the the midterm is like nominally

  • like an hour 80-minute exam right the same exam we just we gave when we we use

  • that people sitting in person so it's normally like 80 minutes but we give you

  • like a five or six hour window to do it

  • ok so there's so you can sign up anytime anyday that there's a slot

  • ok so there's flexibilities that can kind of tailor it to your your schedule

  • and we I think we've also removed all the time pressure right so which is you

  • can you can go back you can check your work can you can just kind of relax and

  • not not not be worried about how quickly do it

  • now there's many different ways to get help the main source of information is

  • the course webpage that's a WCS CMU edu till the 213 and all the information is

  • there we've got a complete schedule of lectures and assignments we don't change

  • it that's it's fixed it so you can look at that and and plan your semester

  • knowing that those dates so won't change we've actually even got all the lectures

  • posted ahead of time for for the other instructors around the world who are

  • using the books that we needed to get them all already there's also on news at

  • the at the very beginning there's sort of news if you need to make

  • announcements will post it there we don't use the blackboard are Piazza in

  • the course instead we have a staff mailing list that you can that you can

  • send mail to if you have questions and all of the tas and all of the faculty

  • ar-ar-ar-ar subscribe to that staff mailing list and so will all see it and

  • we usually try to have you know really fast feedback right so there's so many

  • people so many people looking at at your emails that chance to write how you get

  • up and answer back quickly the the disadvantage of having this may have the

  • advantage of this mailing list is that allows us to control the message and

  • control what were its what feedback for giving back to you and the disadvantages

  • that we often get the same question over and over again and so for that we

  • established the fact if we find we're getting same questions over and over is

  • that we've established a fact on the on the course webpage for are organized by

  • labs

  • ok so you can you can see the answers to frequently asked questions on the on

  • there and we have office hours i think we're still trying to eat we are still

  • trying to meet with the staff and figure out the exact office hours but what I'm

  • what we're thinking now is that will have

  • office hours six days a week every day but saturday the $DAY they will be at

  • the same time and same place every day so from 5 45 2 830 in winter coat

  • between 5207 cluster will have to 13 th there too to help to answer your

  • questions

  • ok so you don't have to make appointments and you can make an

  • appointment to see any staff member of course but you don't you you know that

  • at the same time same place every day there's somebody you can go to for help

  • ok for our labs and exams every assignment every lab is a single person

  • so we don't have any group projects we want you to do the work yourself now you

  • know it's important to work in groups and you will learn how to work in groups

  • and other classes CS classes but not in 213 we want this is a kind of course we

  • want you to figure stuff out yourself all of our hands will be doing 1159 p.m.

  • on either tuesday or thursday and this is you can see which on the schedule

  • page on the course webpage and all of our hands are using auto lab where you

  • know you probably use that for some of your other classes but it's a it's a

  • oughta grading service that allows you to get instant feedback on your on your

  • in your hand and so when you handed in to get feedback right away the exams

  • like i mentioned are going to be networked isolated clusters held over

  • multiple days and and you can just sign up for a slot that's available now what

  • what usually happens if if we offer like the exam tuesday wednesday and thursday

  • thursday slots fill up immediately and so you know i guess i should try to try

  • to sign up soon if you want but people always seem to want to defer to the end

  • rather than and it was me I'd want to get it over with but so I just that

  • sort of about a constraint right that you can always sign up four slots that

  • that are available

  • ok now you know we make mistakes there's we always make mistakes especially with

  • just so many students so we there's a there's a specific process for appealing

  • grades if you think that there was a picture the work wasn't great properly

  • so what you do after after either an exam or after your labs are graded you

  • have seven days to file an appeal and appeals have to be in in writing and

  • hardcopy ok so there's no we won't we won't we won't consider any email any

  • appeals by email that has to be in writing and hardcopy and you get those

  • to me and if I'm not there you can just slide it under the desk

  • ok and what the reason we do it that way is it allows us to treat everybody

  • fairly so we get all the appeals together and once and then we can we can

  • we can treat everybody the same way rather than just sort of doing them one

  • at a time like that

  • ok now for our labs we have 10 machines that were donated by Intel call the

  • shark machines so initially our first version of 213 and I guess we started

  • using intel machines in 1999 used alfa processors that for the first year I

  • like to fish

  • so all of our machines work they were called the fish machines right they were

  • freshwater fish and then we upgraded a few years after that and those were the

  • saltwater fish machines and then we upgraded like in 2011 to these nehalem

  • class servers had run out of freshwater fish in saltwater fish so the next grade

  • up with sharks right so every fishes is named after some kind of sharp but these

  • are the same machines that that you will that auto lab uses for grading right so

  • there's

  • I'm consistency for performance-oriented laughs like Malik lab and you can access

  • them that their you the names are listed on the course webpage and so you can ssh

  • to a specific machine they're all identical if you have an andrew account

  • you've already got accounts on the machine so there's nothing special to do

  • or you can just ssh2 sharp that ICS and we'll just randomly put you on on one of

  • the shark machines

  • ok if but if you have any trouble logging in just send send mail to the

  • staff mailing list

  • ok we know that during the semester things come up

  • grandparents died especially near the near the final

  • that's harsh huh but that things come up right and you got your very busy you're

  • taking a lot of courses so instead of sort of dealing with requests for

  • extensions and you know all these special cases what we do is we give you

  • five grace days that you can then spend as you wish

  • so if you had your work in late one day late you'll automatically consumed a

  • great day

  • ok we don't allow you to sort of allocate the grace days you you spend

  • one of your grace days by handing in late so if you have a great day lot then

  • you hand in late you'll spend that grace day but you won't be penalized for the

  • late and so we have five grace days over the entire semester and a maximum of two

  • grace days for the assignments now we're going to set up since the first three

  • assignments are kind of not as programming intensive and don't take as

  • much time we're not going to allow any grace days for those because 01 grace

  • day when sorry one grace day and then for that the latter for labs which are

  • much more intense we're going to allow you to a max of two great days and the

  • reason we're doing this is because we don't want you to burn your great these

  • grace days are valuable their critical especially later in the semester when

  • every you really really busy so we don't want you to burn up your grace days

  • early in the semester and this happens every semester and it and then when Alec

  • lap comes up

  • there's no gray space left it's really it's really sad to see that and so we're

  • going to limit it to one for those first three just to help you save you from

  • yourself now

  • um it

  • the the phenomenal late penalty if you don't have a great day as fifteen

  • percent per day and we don't allow any hands three days after the due date and

  • also that are live shots often then and then that's it

  • now if there's some kind of catastrophic about you know then you know please

  • contact us for a friend extension right so we're not you know we try to be

  • reasonable but most of the most of the most of the reasons that for requesting

  • extensions you can handle yourself about using your grace days and just uh i mean

  • this is this is advice I give every semester too but I but it'sit's people

  • often don't don't pay attention but are just they're unable to but really for

  • every one of these assignments you want to start early and the reason is you

  • need to give yourself time to end to go seek help if you get stuck because the

  • nature of these very programming intensive assignments like we have in

  • 213 is that you're going to get stuck and often it's very hard to to bound the

  • time you spend on on some of these assignments you know it's not like

  • problem sets where you can kind of project you know this will take it would

  • take me like three hours to do these problem sets for a lot of the 213

  • assignments is very difficult to to sort of manage your time and bound your time

  • so for that reason you really want to start early to give yourself a chance to

  • get help when you get stuck now in the lecture hall of your permitted to have

  • your laptops but we ask you not to send email or instant messaging or cell phone

  • texting or anything like that if you're here we want you two to be attentive and

  • engaged the for your presence in in lectures recitations is voluntary

  • so we don't take we don't take role in either of those we encourage you to come

  • but it's not required

  • and no recordings of any kind except this one day the exams and labs are

  • weighted equally 50-percent midterms 20 finals 30 and final grades are based on

  • a straight 90 80 70 scale now rough outline of the semester the the first

  • three labs cover programs record the Machine representations of programs and

  • data data loud that's how we teach you about that level representations of data

  • so you'll sell collection of puzzles and see like a puzzle might be is it is a

  • little function that you have to implement like absolute value so a

  • function that returns the absolute value of its art input argument

  • the kicker is that we restrict the set of operators that you can use and it has

  • to be straight line code no conditionals are loops and so to solve these puzzles

  • so imagine how you might try to solve absolute value without using an if

  • statement right the normal way to do it would be if x less than 0 return x- x

  • yeah

  • see I told you we make mistakes but imagine how you might do that without

  • using conditionals and only using bit-level see operations right so this

  • is how this is how this is our way of teaching you how data is is really

  • represented in the machine now the bottom line which you probably heard

  • about this is this is that kind of famous all over the world now and uh and

  • at CMU the bomb lab is the way we teach you how to read and understand assembly

  • language and a bomb just briefly out obama is it is a sea program that

  • consists of a collection of six phases and each phase wants you to type

  • something into the keyboard if you type in the what it wants you to type what it

  • expects you to type then you have diffused that phase and it goes to the

  • next phase then you have to type with that face once and if you defuse all the

  • phases then you've defused the bottom

  • however if you type in the wrong thing then the bomb explodes by printing boom

  • and you have to try it again and the kicker is in either case when if you

  • explode the bomb or diffuse of a phase that information gets sent to auto lab

  • if you and we use the diffusing string that that your bomb sends us and we will

  • check it out on a copy of your bomb that we keep on on the server that's another

  • thing every everybody gets a different bomb slightly different by

  • so we check so when you defuse when you defuse a phase auto life takes a string

  • that it that your mom census and then compares against the local copy of your

  • bomb if you explode phase you lose half a point so there's a real consequence to

  • exploding bomb it's very very tense

  • until you learn how to use gdb to set a breakpoint before the function that

  • sends the information to the server and we want you to do that right so the

  • bombs are really the bombs really beautiful it's kind of fun it's kind of

  • like a video game it

  • it teaches you how to read compiler generated code because the only all the

  • kicker is sorry that the kicker is we don't give you the source code all we

  • give us the binary hence the binary bomb so in order to defuse a bomb

  • you've gotta fire up GDB single trace through the fine for the code is for

  • each phase single trace through that code and sort of reverse engineering and

  • figure out what it wants you to type in and then you'll quickly find out where

  • that function that explode the bomb is and you put a breakpoint there and so we

  • want you to do that because it the bomb besides teaching you how to program

  • assembly language it also teaches you sort of organically how to use gdb

  • because you really can't do it if you don't use if you don't run gdb and then

  • the the third lab is that this is a new lab this semester there Randy's develops

  • called the attack lab and we developed this lab specifically for a 64-bit

  • architecture so this is a reflection of the change from 32 bits to 64 bits on

  • and this is that we're really excited about this one you'll learn how to you

  • learn how to write exploits using return to a sort of a modern technique called

  • return to return oriented programming which is kind of the modern modern way

  • that hackers deal with the fact that stacks in newer machines move around on

  • and and are prohibitive and make it impossible to execute code on the track

  • so this is a brand new labs really i think it's really going to be really

  • going to be neat

  • in the memory hierarchy when we study the memory hierarchy we we have a cache

  • lab lab called the cash lab where you build your own cash simulator so this is

  • how you sort of learn how this hardware that Randy was mentioning called cache

  • memory works you'll build a simulator and ce4 that and then you'll take a

  • small transpose function and you'll try to make that that code run with his

  • nephew mrs. as possible on your simulator and this will involve sort of

  • understanding of how the memory hierarchy works and how to exploit it

  • ok the part of the course where you we sort of transition from hardware to

  • interacting with the the system software that the operating system there's sort

  • of a concept that we call exceptional control fault that exists in all parts

  • of the system and it's sort of represents that intellectual transition

  • from hardware to software so this is how this was sort of a key idea that allowed

  • us to kind of smoothly move from from hardware to software in in some

  • intellectually consistent way and so the the ideas that you cover an exceptional

  • control for like low heart low-level hardware interrupts and exceptions and

  • and then at the higher level or involving hardware and operating system

  • software is the idea of an operator of a process context switch

  • ok so this is this is where you start to learn what processes are and how to how

  • to ask the colonel to create and manage processes for you at the next higher

  • level or us a software form of exceptional control flow called a signal

  • so this exists solely on the linux kernel and then and then even at a

  • higher level that there's an application c language version of exceptional

  • control flow a call set jump and long jump

  • so this notion of exceptional control flow kind of exists in all parts of the

  • system we covered all at once

  • and the lab that we use to sort of exercise all these ideas is called the

  • shell lab and in the shell lab you'll write your own linux show is really cool

  • that's the program the command line program that you interact with whenever

  • you log into a linux box you're going to write your own and I don't look for me

  • that was really exciting when I could like write something that looked like a

  • real shell this is pretty neat the next areas will study is called virtual

  • memory virtual memory is a sort of combination of hardware and software

  • that presents an abstraction to you of this very of memory as a very large

  • array of bytes when in reality memory is a hierarchy of hardware and of cache

  • memories and d Rams virtual memory provides a very high level abstraction

  • and as just a linear sequence of bytes and also does provide a lot of a lot of

  • other useful abstractions that make many different parts of the system much

  • easier to manage okay so we'll learn we learn about virtual memory will learn

  • how it works will learn about the performance impact potential performance

  • impact that has any programs and and will also learn how to manage that large

  • pool of of memory that it makes available to you and the lab that we do

  • that the lab where you'll do that is called Mallik lab and then in the Mallik

  • lab you'll write your own malloc and free functions

  • ok so you'll you'll reimplement the functionality of the lipsy malloc and

  • free and this is a maybe I that minute maybe it's two pages of code but it'll

  • be a guarantee it'll be the most sophisticated difficult to pages of code

  • you she's written not only because since its managing the memory system you can't

  • use all of you mean she doesn't have many she doesn't help you out a lot with

  • the

  • abstractions for data structures but when you're writing but at least it does

  • give you ideas like strokes unions that you can use to to structure your memory

  • when you're riding a Malik package you can't use any of those you have to ride

  • exclusively on pointers and casting because you're the malefactors working

  • at such a low level and so it's a very very difficult piece of code for that

  • reason but also the design space for Malik is is enormous

  • you have many options they all have implications that trade-off performance

  • and and memory efficiency and finally the last part of the course we deal with

  • IO input/output so so far in the course we just talked about sort of running

  • programs are machines in the last part of the course we'll talk about input and

  • output sending data into and out of the machine so we'll look at basic concepts

  • of one xio will and since I think the most interesting form of i/o is is

  • networking which allows you to talk to machines anywhere in the world using the

  • internet will also talk will learn how to do network programming you learn how

  • to write programs that use a socket interface which is the basic interface

  • for the internet to talk to machines any potentially any machine in the in the

  • world and that's really exciting

  • I mean once I can still remember when developing this course i had to windows

  • open on my machine I was ssh into two different machines and i wrote a program

  • to send a message like hello world from one machine to the other and when that

  • hello world appeared on the second windows like so exciting I mean if

  • you're a nerd it's really exciting but but just the thought that that could

  • have been any machine right that could have been any machine that that is just

  • like opens up a whole new world

  • ok all of our are all of our hands are using a system called Auto lab which was

  • developed here and you can access it if you if you are on the roster as of this

  • morning if you go to the auto lab link then you'll see this course was staying

  • on your page if you're not enrolled you won't have an auto lab account and you

  • have to be enrolled to get an auto live account so if you're if you want to try

  • to wait it out and wait for people to drop i'll make the first couple of least

  • the first assignment to available from the course webpage so you can work on it

  • without actually having into auto web but at least you can keep going ok if

  • you enroll actually I didn't update this but i updated the audio lab accounts

  • today now for one final thing if you have weightless questions please don't

  • don't send email to the staff because we don't control the way this so you should

  • contact one of these either Kathy Catherine or Sarah depending on which

  • class you would

  • ok so that's that welcome again looking forward to a great semester and we'll

  • see it on thursday

hello everyone i'd like to welcome you all to this fall's this terms instance

字幕與單字

單字即點即查 點擊單字可以查詢單字解釋

B1 中級 美國腔

第01講 課程概述 (Lecture 01 Course Overview)

  • 48 2
    Dean 發佈於 2021 年 01 月 14 日
影片單字