Okay.
Okay. Good morning, let's get started here, I just was doing a poll, I am going to stop the poll now.
And let's end the poll, share the results.
So,
so okay so this is interesting.
So it looks like half of you.
Got it.
Half view.
Didn't. So, what I would suggest is up, so we'll, we'll, we'll talk about this more in a minute but I'm
Jason that's a very good summary each page is 4096 bytes in the last three digits of the offset into the page that yep that's exactly right that's exactly what the why the last three digits stay the same.
This is lecture, 23, so that just in terms of questions that came from the chat right here.
It will the final be proctored okay so the final is on sep tember six, I believe was just make sure I'm not saying crap.
It is on December 16 seven to 9pm.
So if you have accommodations a time might be a bit different.
I am also, um, I can I'm
earlier.
Yay.
That's fine.
So, there is no, so of.
So the question is, if I have, if you haven't done a tutorial night at this point.
I have to think about that.
But,
so you'll know your grades before the air Yes, The idea is that yes.
So, the idea is that I mean, primarily I'm looking for the interviews to be helping you raise your grades.
But I'm hoping this provides an incentive that, don't, don't try cheating because I might talk to you and then I might have. And if it isn't your answers then I'll have to report you to the dean and I've had to do that unfortunately for people in the
past.
I've had i doing exactly this thing we found people with suspiciously similar exams, and they've been reported it and they've had to fail to course failing the course is actually the good outcome.
Is it headache and do things report people for cheating.
Oh yes, it is paperwork for me and it's it's a time suck. It's just a waste of my time, and frankly it pisses me off.
So,
don't do it.
Yeah, of course, yes.
Yes, I have to talk to the TA is I have to do that. it's just, yeah so you're wasting everyone's time it takes it takes not just my time. We then there's other faculty members that get involved because all the people in the deans i mean it's it's a whole
thing, and some semesters I go without anyone which is nice but too many semesters I find people and so it it's it's really.
No, don't do it. You don't want that
false accusation. The whole point of this is pure without false accusations.
That's always a risk.
Um, what's actually what tends to happen is you find patterns of this go like wow you know just do it here you've been doing it consistently.
They've been no issues so far this semester.
Yeah, that's why there's a process I mean, there's a process so it's not arbitrary you, everything is very well documented and shown things.
So practice questions. So the question is what are the practice questions.
You should be.
If you try to make up your own and answering them.
So I'm not sure what time to do that I have to check my calendar.
Oh, no, this is what I mean if this is one reason we want you to, if you use outside sources that we can know you use the same source, where the patterns are like it's clear that you're using the same source for multiple questions or like, that's a little
too much coordination
will be recorded. Um, yes.
So, the opera review session will be recorded but I won't be presenting anything, I'll just be answering questions. So, you know,
yo, you know.
So open book.
open notes.
years.
So, I will tell you what my many of you did badly on the mentor that I did that, I can tell this from the interviews,
is that many of you tried to look up most of the answers are many of the answers online.
These questions are not designed for you to look things up, they're designed for you to think about them. And in fact, they are often resistant to looking up the answers, because they won't actually be
be there, I'm Alan you had a question, wherever the source was literally. Let's say you were reading about death know and you learned that it was from an online source that is reliable, and you say wrote that answer, but I didn't copy paste from the answer,
questions are worded in such a way that I'm asking very specific things. You can't just take based, maybe you may learn something online, but you've got to interpret it, and answer the question that's asked, And that's actually the biggest mistake I saw
on the midterm is people read parts of the question they said, Oh, that sounds like this sort of thing we covered like the big question that people really messed up on was when asked about how much memory.
You know how much memory does a dynamic versus a static library take up, you know, but in process memory and I put it into Alex and I said you there and people just gave the answer of.
Oh static files you know stock fighters are bigger on disk and so it's like.
That was not the answer. And it's like, if you look it up. Yes, you'll see me.
But you have to think about like we can process memory what is that what is I mean, what would it mean to be a bigger and process memory requires some thought.
Not looking up, it was based on the information you have, if you just looked at the size of a dynamic library, you'd see it's bigger than the static like binary, and you realize that's loaded at runtime that dynamic library press plus I know the rainbow
it's like, those are bigger.
But you had to put that together.
The detail. so should you know what's in the textbook, the text book is there for context. So, look.
So I for example we haven't talked much about page tables, there is an address space and stuff, the textbook has a wonderful discussion of page tables and things similarly I haven't talked in detail about how file system structure, the textbook has a
beautiful discussion of how file system the structure. What I focused much more on is more of an operational understanding of the abstractions and being able to build a simple mental model that will let you guide that but, You know, you can always expand
that mental model so what you should do is I given you enough that if you're paying attention you should go like whoa there's something going on there oh well there's most of
operating systems is a very rich field.
And there's many philosophies for how to teach this sort of material.
One way is to just teach a very oversimplified subset of it and say that's very nice and consistent. What I've instead tried to do is expose you to the giant mess that it is the massive complexity and realizing that you will understand most of it, but
hopefully you'll have enough of a map, so that when you like well how does that actually work, you can then go and learn more about that specific portion.
As you know, as your curiosity and your requirements change.
You can't learn it all, you're not going to learn it all the assignments and the tutorials provide you a guide of what you should try to master.
But you're always going to have some like you know there's gonna be lots of things like wait I don't quite know this but you should be able to say that's bound it's like, I know I can do this.
I'm not sure exactly why. And then you're just like, well, maybe I should go into a little more depth there.
You're gonna have to judge this and then you're going to wait, why didn't you just tell me everything I knew exactly but this
is because exactly what you need to know depends on how you process the information now you think about it, only you can debug your mental model only you can decide do I understand this or do I not.
I've given you lots of things to challenge your mental walls.
But you have to cultivate them.
Yeah, exactly. So, yeah, just memorization won't do it.
Yeah, exactly. I definitely tend to account thing. I mean, it's very clear when you talk to someone, whether it's their work or not. I mean, it's just clear.
Okay.
Thank you.
I am interested in meditation, but I'll just say that, um, so let's go on from here.
Let's talk about first of all let's talk about assignment for so I tried to structure assignment for as a bit more exam like in terms of the style of questions I didn't put any new material really I just had asked about the tutorials really seven and
eight.
So let's talk about what these answers are the solutions are there, you can look at them, feel free to read along with them and stuff but I'm not watch I can just do this from here because I put both the questions and answers in here.
So I'm system called code in the Linux kernel run in the context of a task, what is the variable name represent this task what type is this variable so current and start testing.
So, what this question was really asking about his new get p ID. So that's what I was, this is what this was asking about because in tutorial seven, and you get p ID.
What does it do.
You know, new get PhD, tell us.
So it asks about current. And if you look at it, what it does is it tells you the process ID of the process that called it.
So, you know, you're all looking at that thing so we're saying, did you understand what this was doing.
So that's what I was so that's what that's what this question was like did you do you get p ID, because if you looked at that code you had to look up correct, you got to understand that.
Um, and then waking a recall from def ones the ones read function is called the reason call takes your organs and for so this is here it was you know I explained the things but what I was looking for here is.
Did you understand the basic thing of what the heck this function is doing, and what it's doing is it's of course wanting to read file and really it's exactly translated from the you know the read system call in fact that's how you see everything in the
kernel, you do it, a user space version of a system call in kernel space, you'll have an equivalent function at some point which basically takes the same arguments, but they'll be slightly different because you have the kernel version of the same information,
you know, from the process side, you have a file descriptor What's it on the colonel side, it's the data structure that describes an open file, as opposed to a number that references it.
So here we have that whole thing. And similarly, implicitly on user space when you use a file descriptor. There is an offset, it's the position you're in the file here it has to be explicit because the colonel is the one keeping track of it.
So here's the offset now it turns out this offsets also in here. So technically this didn't have to be here but it seems like in the kernel API they do this separately because this way you want mutating the file structure inside of this inside of basically
the device driver. And that happens at higher levels. And just as change the offsets, this and that, you know, whatever called this can then deal with it.
So this is a.
Yeah, so that's basically me again, when you look at these questions. Look at the answer that's being asked you know the ask for, but it's always talking about a larger concept.
So anything if you get the answer but don't understand the larger concept step back and go like, what was it talking about.
What is this thing I'm trying to understand how the system works and what I'm really trying to get you to understand is that there's nothing mysterious about file API calls at the end of the day, it's just another function in kernel space that's doing
it, it's just that function kernel space has access to data that you don't have in user space.
And that's why you have to go through this API because you want to access the kernels state and functionality.
I'm here are the ones ones f up structures declare the ones module here was f up specified so again here. Can you see that when you do this, you're implementing an implementation of a file API.
A special file has its own file API. And so you have to find functions, implement that. And this is a structure that says okay here they are.
And then,
then here was you know with buff, I here. What's this, how does it change what here I'm trying to get out. Is that so what you should have noticed is Colonel, oops is all over the place the Colonel's just going like, ah, and the reason why it's missing
is because it's accessing memory and an invalid fashion. And the reason why is that the pointer here in one's read this point or is actually a user space pointer.
It's a pointer in the count that only makes sense in the context of the process that called us.
You know, we don't want it to, you know, interpret this pointer in the context of another process, and we definitely don't want to, you know, consider that pointer in the context of the Colonel's address space, because it has its own memory map, this
thing is specific to the process that made the system call, so we have to interpret it in that context, which is what put user does
know so it says that it was killed. But if you look at the colonel logs, you'll see, oops, it's.
And you know what, I think, what a colonel, oops is is essentially equivalent to a blue screen on a Windows it's basically the colonel, but of course, a blue screen typically the whole system stops.
This is, Unless Colonel can panic and do the equivalent thing.
But a colonel, oops that just saying something went wrong typically you enact access memory that you shouldn't have in some way. And that's the report again because basically doing the end user spaces would be a segue fault.
You don't have seg fault because that would involve signals and core dumps and things like that and the girl can't do that.
So it logs. Whoops.
Yeah, the process is killed, because it causes the kernel to do something weird. And so, you know.
Yours was killed nothing and logs.
Uh, no. You should have seen something in the logs, it's quite obvious.
Okay. Oh,
it was killing the process on my machine but on the VM Yes.
I don't understand if you ran this on your local machine how this works because, on, on a local machine things typically wouldn't work.
Because you can't load the module. In, but if you couldn't load it in then I'm fine. So let me just I'll just so this is a good thing let's demonstrate this.
Okay, we're on the VM
downloaded.
My change it here i think i Yo guys let's do this 103.
Let's download the code here is worth showing
the link.
Okay, let's make this.
Instead we're going to put in
place.
Buff equals.
20 windows.
There. okay so there, that's all in there.
Okay, good.
Okay.
So here we have is, so this is loading the module verification failure. So once we register. And then we got bug, unable to panel page fault for a dress.
So right I kernel mode Erica, not present paid.
Oops, boom, boom, dumping all the registers. Call trace, this is what happened okay so ones read messed up and BFS read, we just give you a nice thing that so so entry system call, which do system call which calls x 64 says read which most cases read
which of the FS read, which calls ones read.
So you see exactly how you got there.
So I don't know exactly what it is but I mean this is me.
And then once device closed, I mean it's not a subtle thing.
Yeah, if you do.
Same thing if the message.
So I have no idea why you wouldn't see this.
The only way I could see it is if you only read a couple of bites.
If you only read a couple of. If you only read like one or two bites from dev ones.
You might not you'd have to read one gig.
Okay.
So, So I don't understand. Yeah, so,
so I can't explain that I mean, if you if you like pasted the logs in and said, This is what I got.
cat does not keep running like a champ.
And it
did it again, I think.
Okay so yeah so 10 three four Yeah, this is the one that just happened.
So I'm not sure cats to power, so I'm not quite sure exactly what happened if you didn't see the errors. Um, so, anyway.
Now, but again this is but but the but the basic concept here so whether you got it working out what figure out how we're going to, you know grade that
mountain renounce.
It
Install the module yeah yeah, one thing is if you have the old version of the. Yeah.
Yeah. We anti debug exactly what happened but the key idea here is accessing user space without doing something special, is a fundamentally bad idea. You're going to cause things.
You're going to cause problems. Because again, you should we like the points are only makes a point or only makes sense in the context of the address space.
It was defined for.
So, a pointer for process, a doesn't make sense in the context of process be.
And similarly the pointer for process a doesn't make sense in the kernel. Everyone has their own address base which means basically they have their own set of addresses, that's what it means to have an address space so you have 2.2 is always in the context
And that's what put user does because by default in the kernel we're using the Colonel's address space.
Oh, Yeah, I have, if you can demonstrate for me, that it doesn't generate the colonel, oops, I'd be interested.
There's of course there's office hours left. And I'll have some additional office hours next week but definitely messaged me but I have office hours after class today.
I'm. Now the question here is how do we do it, make it exactly 10,000 ones. there was a lot of confusion on this one.
What here what I was trying to get get you to understand is, what's happening with a file API in the kernel. What's really what determines how everything works and what it's really about is you give the kernel of buffer.
In the kernel can right up to the buffers number of bytes. But you, but what what it does based is based on where you are in the file and where you are in the file is determined by the offset.
So you have to use both of those things to figure out where you are, we are actually how many content to read from like know disgracing we're just making up ones.
So it's simpler but still conceptually have to have that model. And so my solution I change this to Buffalo end so I could use the same code as laying in here.
um, you know I defined a constant, the max ones if we're trying to repass more past 10,000 just return.
If we're at the start of the file, you know, basically, you know, if you're not the stuff off portion with, you know, fewer ones less would be the offset.
Reduce, you know, reduce the length that we're returning to be the buffer length if we're trying to output more than that and then fill it, and update the offset.
Because we don't update the offset because otherwise, then it will just keep reading.
Well the observation of the question is for question three, not what I think you're talking about question for Julian.
So if you're saying is, how is it one change.
If you say it was killed, and you say it's because you accessed.
A user space pointer and properly, you can get full credit for this. But you should know the big thing is that you have to explain the why you don't have a proper explanation of why you're not gonna get full credit.
Um, so then 3000 pc FIFO, it has all these changes, you're supposed to do. Now, what is the purpose of the questions here What was I really trying to get out.
While I was trying to do is understanding that in to tour, what's going on in tutorial, eight, in particular with the 3000 FIFO, is that
know with his main.
So, what I do in main here is I'm doing a pipe fd and what the heck is this doing this is making a pipe. What is a pipe. It's exactly this is exactly equivalent to making a name pipe, this is just an unnamed pipe and a name pipe if you make FIFO exact
you can use it exactly the same way. So I want you to see the equivalent of how you use a name pipe versus using an unnamed.
That's what this question is about.
Yeah, exactly. Yeah, so what would that also be So, and then Yuy a pipe is different from a regular file.
And in particular, pipe enforces mutual exclusion between the two processes, when they access their shared state in that buffer, a file. If you just use an ordinary file, it doesn't enforce any sort of mutual exclusion.
I am not going to tell exactly about I mean maybe you'll get Personally I'd have to read your exact thing.
I mean, again, what your focus should be is not on how many points you got for your assignment if you feel your assignments improperly graded by the way assignment three is graded.
I'm going to upload marks. After this, I think, if you feel that you know someone's unfairly granted I'm happy to, you know, send me a message doing mark.
What you should be focused on is Do I understand what was going on.
I haven't looked at the averages I have the spreadsheet update to upload so.
And that's, I mean because really, you should be focusing on understand because you have to prepare for the final.
Um, and then so 668 is just, you know, these are just saying like did you play with a regular file. Did you try doing it, you know it's empty it kind of you know you have some problems initially later on.
You should have seen various witnesses and, yeah,
basically it doesn't work because you're not getting mutual exclusion. That's the thing. So, that's what a pipe is it's more than just a connection between process a in process B or to think once we were writing to the pipe, you're agreeing to the pipe
it enforces mutual exclusion between them, which is why it's so useful as the producer consumer problem, it will pause, you know as a producer but it's too much more positive producer until consumers done.
And when the consumer has nothing to read it will pop it will make it sleep you know it handles all this coordination between these proxies. That's what's so beautiful about pipes,
kind of works.
you could use new taxes, but, but they would have to be file based we've Texas, which are a little tricky to do basically you create lock files and you try locking the file and yes that is possible.
And there are in fact API's and Unix to lock files but they are very rarely used because, Well first of all because some file systems are implement them properly, so it gets to be kind of weird when you're using locking files so there are some conventions.
It's a mess.
Get your ethnicity if you notice the issues. Basically, the, the output of basic showing me that you didn't see mutual proper mutual exclusion.
Yeah, I noticed when I saw something you ran it you guys saw different things and I saw so.
But again, the concept is, you're going to see weirdness because it's undefined you have in here at race conditions, who's running, doing what
seven, if we replace the call to em map with a call to Malak. So here what this is really talking about is why are we calling this mouth, what is the key point.
Why can't we just do normal memory allocation and the key thing is, frankly, the shared.
This is the key thing.
And what because what the shared means is after a fork that memory will be shared, normally you would have this this map private so that after a fork, they would be private to the individual processes.
And if the memory is not shared, you don't have a shared buffer and nothing works because you have no communication between the producer and consumer.
So everything breaks.
Yeah Malika, And in fact, if you do, so if you didn't ask trace of these things. I'm not sure if you saw a Malak and map when you did a monologue.
Um, it depends on the size of the, of the mouth you do a small Malik you can see an S break but a larger one would result in a map, and the map will be shipped map, private, and in fact you saw this in an earlier tutorial.
Oh, the man page says it oh nice over more than 128 k you're right and the buffer is.
You didn't straight. okay, cool, cool.
I guess it's more than 128 k i guess i haven't figured out exactly how big is the buffer.
Um,
I guess it is more than another 20 Academy. Yeah. Anyway, I'm begging the exact break off when you use a sprite versus using a map that can vary from implementation of mouth, there's nothing hard coded about that that's just what our particular system
to us right now.
us right now. Up, what is the relationship between again that's below the level of the speculation normally care about it. But if you see mountains, it might be implementation issues so it's good to know these things are happening underneath, and how
at it, which is the part of the point of this class. was released to non empty new text mq non full here. So again here this is just getting you to think about
what's my real thing I want you to understand with tutorial he is trying to understand the concept of mutual exclusion and why you need to do it and how you do it.
And how do you do it properly, and we should see doing it properly is a pain in the butt. But one thing is unique, when you have shared state like these condition variables they potentially have to be, you know, protected by new taxes, some other kind
of lock to make sure that you enforce mutual exclusion, that's the concept I want you to understand. And it turns out like honestly, I would have thought that the condition variables didn't need this.
But they do so.
And that's what the, the P threat API requires.
So was there a reason why we use fork instead of P threads. That is a good question.
The reason I used for is basically to show that you do these two things one is to show that you don't need share, you don't need to use threads.
If you just need shared memory,
and more it's I'd say, if you need shared memory, you probably, you should really think again about using threads. I mean, if you're on Windows threads are a lot cheaper than processes.
So for performance reasons, there's a good thing but frankly on Linux.
If you want kernel level threads, ie, there's this concept of threads, where the colonel doesn't know about the thread, it's kind of completely unplanned user space using timers and stuff it's really gross but it can be lighter weight.
If you're not doing user space threads you're doing threads that the colonel can see as separate things to schedule it, they're implemented as separate tasks in the Linux kernel.
You might as well do processes and share memory as needed as opposed to doing threads because threads just lead to more pain because you have state shared that shouldn't be shared and you're just causing more potential sources of bugs.
That should be avoided, wherever possible.
There isn't always possible in certain high performance architects you need them.
But, you might as well you but what if you can just use your memory,
It condition varies we're not atomic. So, what this is basically when you have them you tax around the condition variable basically it's saying that access to condition variables is not atomic and not for me if it was atomic you wouldn't need to enforce
mutual exclusion.
Because that's what atomic means is that implicit with this, there is enforcing mutual exclusion already on it but these are not necessarily atomic, so you have to do that.
And so that means that two threads or proxies could access the condition variable the same time that's corrupting it state.
Okay, so what I mean by atomic.
Okay.
So this comes from the concept of the Greeks the original notion of a matter was that if you had atoms the atoms will be things that you couldn't break course our modern understanding of atoms is actually atoms can definitely break into lots of pieces
parts. So, but the original concept of it was that it was something that was divisible so atomic operations.
Yeah, man.
splitting them
into technology I'll just say atomic power.
If we corrupt, so it's not a question of corrupt corrupting a condition variable is corrupting anything.
So, so it's going to have state.
Again, if you're really feeling like you don't understand these concurrency concepts and they feel like they're serious.
Look at the textbook.
I really have given the short shrift, there are multiple chapters, covering concurrency, it's a big con, it's a big thing.
And kind of giving you the thing of like, do this and you're going to have, you know, things you know messed up You won't understand why the details.
Look at it but just, like, okay, process, a changes that.
It all comes down to what is the heart of it
time to time.
So that's really when we talk about this as a famous class of security problems are called top towel security problems time of check to time of use.
But it all comes down to, you look at it.
Oh, it's this, and then you take an action based on either changing that data or do some other action. And what if so it changes out from underneath me it's like it's like if I look, if I look and go like, Oh, my phone is right there.
And my phone's right there and I close my eyes and then go to pick it up.
Well I'm closing my eyes, and the picking up, it worked.
Because no one came along and took the phone between the time I looked at it and I grabbed it now we normally think of these things kind of being synchronous but the way computers work it really isn't like, Look, that's all happening very fast You think
I'm doing this really fast I checked it and then I do something but somebody can come in in between.
Which is why the Unix model is so beautiful, is that by separating things into processes, single threaded processes and running lots of processes you minimize, you know.
So, inside of a process you really have minimal concurrency. The only thing that really caused concurrency issues or signals, because those cause these non deterministic jumps.
But.
eg parts there's more mechanism.
And that's the design of Unix was really smart because it you do want concurrent activity and they basically said you single threaded processes have more if you want to do something that's concurrent just have different processes do them.
And then you just have to deal with the coordination between the properties not inside of a process, multi threaded things then your, your coordination inside of the process.
And that's just much more of a headache.
Would you all like to. We don't Would you like some more time to do tutorial nine.
I can you know I can you know, I can open up submissions for tutorial nine.
She says,
Okay, if you're going to spend time so you want to get that grade. I'll just give you an I can give you another couple of days I don't want you to give you, give you too much time because I want you to focus on studying for the exam but if you want like
a day or two to do it, I can do that. So, um, okay, so.
Yeah.
But again, if you look, if you want to understand what's happening tutorial nine really helps you understand what's happening.
IOCTL Sure.
So.
so it says IOC.
That does it.
anything you want to do with a device that really isn't very.
No no no, she's not really why Fast Forward can be seeking.
more like object to take sign that's outside like Fast Forward rewind that's just seeking.
But if you want to object to tape, how does that translate into open read right close. I mean, you could have closed the check the tape but it's really something else other than closed because you don't want to take just a pop out of the drive.
So suddenly they're like, for printers whether you want to inject a piece of paper I mean, There's all kinds of stuff, it's very device specific.
they're like, for printers whether you want to eject a piece of paper I mean, there's all kinds of stuff, it's very device specific. So we made up a device to do allow us to do physical memory and so implement an IOC TL to let us just mess with it.
It's not, it's not so much faster slower it's whatever makes sense for the device,
a USB sticks. I don't know how objects work with a, with USB sticks they might be an IOC TL.
I honestly don't know.
You couldn't you couldn't well for like TT wise, you can adjust the speed that's like, if you change the baud rate of a TTY that's done vn IOC TL.
So that is true.
Our tapes art mounted.
They're not file system their character devices.
So they're never mounted. So you can't cuz they're not a file system.
I know you can know for a USB device. Oh, is it and mounting.
Well there's a separate thing because, well that's.
Yeah, I don't know you have to IO CTOs are completely very specific, they're really kind of annoying because they're, fundamentally, not.
You look at the IOC TL you just have to look up what the heck does this do you can't tell what it does because it's inherently specific.
So,
it's easy to implement in the context of a device driver is much simpler than a lot of alternatives, but
I'm.
Are you gonna be able to volunteer for interviews for the final. Yes.
Time do interviews of necessary I don't want to do too many but if you want to volunteer I'm happy to discuss it. I'm.
Oh really.
Yeah, it's playing all the time.
Yeah, no, no, that sound that is shift.
Shift Come on.
Come on.
Oh.
That's hilarious. You know what shifted. She, she was trying to open the door and then she ran away.
So, you come on in.
And she's out the door.
she might decide to come over.
She's what we'll, we'll see if she, you come in, where you can.
Other, so I'm.
Come. Okay, come on.
My there.
You came into the room, you can say hi to everyone.
Hello.
Yes.
She's just she's really messed up the locked my bedroom, because she, she will jump in open the door for it and we have to lock it.
Yes, hi there we go. Yes Ok.
Ok.
So I'll fire she comes to the last lecture.
So, I'm, I'm happy to answer any other questions for things.
She knew.
She's too smart. Cat really is too smart. I'm guessing she wants food.
I have to reopen the tutorial submissions.
So I'll do that and I'll give you guys another couple of days have a question about static and dynamic can we view the process memory using top.
Oh.
So, can you view.
So when we see top, what are we actually seeing here.
What you are seeing here is resident memory, so you'll be seeing like how much, what's the total address space that's been, that's valid for the process, how much of it is in RAM, I eat.
There's corresponding physical page for each other for, you know, for each of these so only this much physical memory is being taken up.
But this is what's in the address space so where's the rest of it. A lot of it's probably on disk or whatever, and this is how much of it is shared with other processes.
So, can you use top to compare the static and dynamic process memory so there really isn't the concept of static versus dynamic per se, what you can do is see what you can do is look at the memory Mt m.
Um, okay let's look at.
less.
What
that should have output something.
Oh I know what it is. Let's see.
Oh, that's why.
Okay, So,
what is your formula for.
Really.
Okay, so here's the memory map of this process here.
And this tells you exactly where everything is mapped in.
So, you know, ss, the SSH the binary is mapped in here. This is here with the libraries are mapped in different part you know like so, you know, here security you know and stuff and.
And there's, you know, here's the stack is mapped in here, var here's the system call thing because it turns out system call actually has a little memory map there to make faster, a part of the started so yeah
yeah when you dynamically map it in it gets the whole C library. Now, here's the dynamic link or getting LinkedIn to the process, so you can see exactly what's going on here I think this was in an earlier tutorial.
But here this. So when you say step so if I did sign static.
What it really means is, so much that we can try to so busy box.
Sh.
So what, so here what we're going to do is now let's look at the memory map for busy box.
That's 1148.
So here, look at it. This is what it looks like for a static binary.
We got busy box busy box busy box busy box busy box, and nothing else.
No, this is a stack like binary it's much simpler there's only one file that's being mapped into the address space, the binary. Whereas a dynamically linked one has all kinds of stuff mapped in.
So that's what it means for having static versus dynamically allocate one. I'm
clearing the mental model for IOC TL again.
So we say a control. So what is an IOC TL, it's just so a device file is a representation of some.
Traditionally, it's a representation of some physical device.
But we're providing a file API for it so I'm just here.
But we're implementing a file API for it, which means we have open read right close. So the question is, what if I want to do things that fundamentally art file like, how do I do it well you could say well I'm going to make everything follow like I like
a little command thing and stuff but it's like what you normally use read for reading data and right for writing data so how do you do other stuff so in devices, sometimes you do other things like for a terminal you have to set properties of the trouble
if it changes baud rate.
So suddenly for a tape drive I think that's what I Octa out for it says basically a grab bag of other things you can do to a special file.
Okay. So, is there a way to see the difference of process Mary for a dynamically starkly linked file.
I just here and I just showed you.
Well, it's not what difference it is wasting the process memory difference or so, but it's a program, I just showed you the difference, right there. Look at the maps file in Flash proc that shows you the difference you can see the mapping and the prop
in the static versus dynamic process memory only makes it doesn't make sense for a file because the files on disk, have to be for a running process. And so the information is in proc, and the memory map is in maps.
No, that's fine to ask for it but, like, you know.
Yeah, so, connect the dots.
Um,
what are the, you know, what are the values in math fall does it show sighs being mapped in, it shows you
address ranges.
That's the number of bytes, subtract will settle the second from the first and you get the number of bytes that actually I think that's here is the size.
One no no no no no I'm not sure what this is.
I know this, this said, this is the file.
I'm not sure all these columns. This I think is the size of the file.
No, I don't know what that is.
This is the permissions, whether it's read and, or executable or something.
I'm
not sure about the
offset.
Oh yes, that makes sense the offset in the file right this is starting from offset zero in the file. This is starting from offset 1000, and that makes sense because the first, this is starting from here so you.
We don't want to include this first thousand bytes we're moving past that. Yeah. So, this is the range of memory. This is the offset in the file that you're reading.
So
recommend any other books or any other sources for the file system besides three Easy Pieces of.
What do you want to learn.
Just in general about file systems, I mean there's the man pages on.
No, look, I mean if you really want to.
If you want to. If you want more operational stuff or Oh, the Linux file system how to
file system how to.
the final is based on assignment one assignment one through assignment for I will, I will probably have maybe, except maybe a little bit on tutorial might be like one question or virtual versus physical address mappings but it will be very
have a zoom overlay is what I'm typing sometimes okay yeah sure.
Yeah. Okay.
Can you talk participation marks.
What do you want to know about participation marks. You've been getting participation marks of the lectures so your grades can be based on those.
I am decided. Yeah, I will. I have to decide exactly I'm going to convert that to a grade but it will be based on seeing how people have been participating in basically if you've been participating.
If you get a one, at least in essentially all the lectures, you're going to get at least to be for participation.
Your final mark will replace it. Your little replace the final exam mark, it will play some ninja mark, you better Yes.
But if you had poor but if you have poor participation, it won't bring down your grade. It just means that other stuff will be weighed more.
The parties, you all have participation rates in there, the basic participation is essentially, you get a one if you show up for a lecture and participate in the polls.
For the lecture that polls if they didn't have a poll then you just showed up. If it's a two if you actually asked a question that made sense. So
it's, I just have different, so basically I have grading schemes where the participate mark it just isn't counted and other stuff is counted more.
Um, it's it's typically what I'll do is it'll be 20% tutorials 20% assignments.
Yeah, I said, 1818 for.
But again I fiddled with the spreadsheet afterwards I don't know. I'll see what works out to me.
If you did poorly on assignments, um, you know that's potentially that will be great so that will give more weight to the midterm and final.
So yeah.
So yeah so yeah exactly so I have many schemes I just my spreadsheet does it because ideas. I want to give people multiple paths of success so the course, some students are very diligent and do everything, but have trouble on tests.
And so I want to reward them for their diligence that they've been trying to interpret and give the great but then other students. They're flaky on all that stuff, but they will do well on the exams, and I don't want them like okay yeah you didn't turn
the assignments but you clearly knew what you're doing. So I want to reward you for okay yeah you know your stuff.
So, so that's, I mean it's really, if you demonstrate competence, or your demo. If you demonstrate real competence I want to give you a good grade. If you demonstrate you worked hard, I want to give you at least a reasonable grade.
So that's why I do things.
I Tom. Honestly, if you really do probably under short time constraints, you should be talking to PMC.
But mediocre all the way through okay then hopefully you'll always pass
me I suspect some of the stuff you've covered in this course. You may not really understand it for years because it's going to connect with other stuff going, Oh, that now I'll make sense.
There's a lot of stuff here but you know hopefully it gives you the tools to learn more about operating systems as, and how systems work as it fits your interest and, and needs of your career
site.
Yes.
So the tricolor is but again you can't.
Yeah, that's it, you should poke around like there's all this stuff in here.
For years I mean look at this whole thing and slash pop this is all stuff, telling you about what's happening in the kernel.
And this is all stuff related the process, and I've only gone over a fraction of this, but honestly you have the mental model to probably figure out most of this.
If you've been in a painter your classes, or to look up a man page where someone's like, Oh, that's what that is. So you can fill in the blanks. So look, you know, Here's the executable.
You know, here's the command line.
Here's the environment variables.
You know is like you know here Oh look there's the stock Oh look, here's the memory map. Oh look there's the file descriptors.
You know, I mean, this is all.
It's all their CPU set.
Not sure what that's, Yeah.
That is, I mean, you know, scheduling.
So to mess around with your own OS I mean you should always have some fear, if you're really messing around with the system yeah you could definitely mess up a 4000 is distributed operating system so it's really about what's the OS layer that underlines
cloud infrastructure.
So it assumes, it turns out when you go to the cloud. Um, Unix is a component.
Specifically, containers.
And then everything.
Yeah, so, yeah, if you're going to play around with OS is a really mess with stuff, it's good to do it in a virtual machine or on a disposable box. That is the right way to do it, you do not do that for anything but you can poke around and look like looking
into proc is harmless. Just don't write to it.
Just, you know, look at stuff you do look at the slash this that'll tell you stuff. Similarly in Windows you can use Activity Monitor or their assistant turtles which can tell you all kinds of things about what's happening inside of it.
Most of that stuff is quite harmless, you know the stuff that gives you information on what's going on. It's only when you start modifying things that you typically have to worry
windows open sack delete all your instances your instances will should go away by early basically during lb after exams, but I like it so definitely make sure you backup things.
Well, mount is dangerous. You know,
arms RF without, you know, I am this RF is dangerous mountains Yeah, those things. Be careful.
Ah.
All I can say is the night with containers. I mean, I talk a lot about containers and 4000.
But the idea of a container is really just the user land of an operating system packaged up all the libraries, all the things are just they're so you have all the dependencies, you share the colonel, because the colonel there but everything else is there
so when you install a container.
It's like your it's your own box. It's its own. It's like a VM here except when you're in OpenStack each system has its own Colonel containers, share Colonel.
That's basically it.
So all the stuff you've done here with the 3000 Fs. That was all basically a container, just with more security definitely more containment also stuff to virtualize the process IDs and users and stuff like that.
But yeah, I do not have my course assignments yet.
But I think I will be teaching street operating systems next year.
Are you going to have a salad or textiles, um, I will put a validator there for the final exam.
I'd appreciate if you run through it but I'm going to not require it.
Oh yeah, yeah. If you look at BP BP f containers of cool stuff.
Biology.
And can you make a kernel panic from a container. A.
You shouldn't be only a kernel panic from any process.
Except if you're messing with the colonel through loading things as the colonel so if a container can look stuff into the kernel you could add a container really shouldn't.
Please submit a Unix text file. Yes.
I will post it to I'll post today I'm thinking of probably like one or two in the afternoon on the 14th.
But I have to check my schedule.
Okay, I will.
I can't move the exam to two to four.
I can allow some people to take it at two to four. But I can't move it officially, because many people have because I have to allow people to take it that
I'll think about that. I have some ideas
Still seven to 9pm officially Yes, exactly.
I'm going to stop class here, I will. I'll stick around for office hours, but otherwise.