Okay, let's go ahead and get started let's.
Okay, good morning, everyone. I'm so I think attendance today is even smaller than normal.
I'm not too surprised. So, um, so just quick, so some first administrative updates First off, there is no class on Thursday.
Was it us Thanksgiving. So, I'm going to be off doing stuff with my family, so. Yeah.
But, how much our classes actually left, that's, that's a good question.
We are getting near the end.
So where are we now we are.
So we're right now hear us Thanksgiving.
And the final exam and I'm happy to do a study session after the I need that I need to update that that's December 21. That's it, but you know announce.
How much of your classes actually left, I'm still like 200 people.
So, oh yeah so we still got, you know, good number of people still left.
Just Um, but yeah I know we have the time wise yeah we're near the end.
I'll have to remember to update that with the exam schedule so if you look at. So assignment three.
Simon three I
actually make it so that it.
When people join that are automatically muted so I forget to do that. So, Anyway, up.
So I'm now allowing submissions through Thursday so on, so I'm not going to go over.
So I'll post solutions on Friday.
The reason I did this was because last night, I was saw about 70 people like we're still working on it frantically as we're as like.
Fine.
I'm odd. A number of people drop operating systems.
People, drop it and come back and drop them come back.
It's like, But, I mean, you know, I think.
Yeah.
Anyway so assignment three is so you still a bit more time, but
I was doing the thing, where the tutorials.
So you still have some time for territorial five and six but really, now you should be working on tutorial a tutorial line. Now I mean, yeah, you're behind if you're still working on those.
If you write down each I got checked off that's one thing but yeah and you really should have those done before doing assignment three so a four
is finished. So I am finished, I finished up the code yesterday but got late and I was like, Okay, I need to look at this with fresh eyes and make up the questions.
And my goal today with lecture is actually to make sure you have all the concepts and things necessary for understanding the last assignment
is a for a long assignment, um, it's I don't think it should be too long, but there's some tricky parts to it.
Yes, it's completely kernel based and in fact up finished and posted.
Just be clear. The code is finished and post it.
It's all there and you're welcome to look at it, I'm not going to be changing the code anymore I just need to update the questions I start I've got a couple of questions here, but those are so what I've got this here, what is a sign up for is 3000 is,
I added to see because the thought some identifier starting with a number was messing me up so I have seen 3000.
So what this program is is basically the is basically a combination of the code from tutorial eight tutorial nine with a with a with a minor I mean, actually that's really it it's, it wasn't simplification but I tried to streamline the code and just have
a things, but so like this.
There's a lot of extra stuff in tutorial nine in terms of the code as a few other bells and whistles, like it has an octo thing which is this way of interacting with a device it's kind of good to see, they're not used as much.
But here I know there are some other technical reasons for that but I think I fixed them here with how the without this code works. So
what we're going to talk. We'll talk about the concepts underneath.
So yeah, so it's definitely, so Oh, one thing about mind is that there's a.
This is the main code. And then I have a little, a little script for for PPF trace, which will actually help you watch what happens with the driver as it runs.
So instead of just using these.
Oh, I meant to get, you know, I didn't get rid of but
I got rid of a lot of the some of the messages that this message is going, that the listeners might want to keep but I got rid of some of the messages like just all where is it in the code what's running.
Now you're watching it with BPM choice.
Anyway, before getting into all those details there's some big concepts that I want to talk about in the.
The haven't talked as much about.
So,
first off, why I want to talk about his tasks.
I don't think I've talked about this so much.
So tasks in the Linux kernel are things that can be scheduled.
So what runs on a CPU core.
That's a task.
And so.
so a task is really if you look at it it's, you know, the CPU state. And, you know, an address space, and other various things so.
But at the address space is not necessarily exclusive.
So.
So in, when you're inside the kernel you don't actually see it mentioning the concept of a process where the concept of a thread. All it talks about our tasks.
And so tasks are what are actually scheduled and so as a result.
There's a struct in the kernel call the tasks struct.
That is the structure that represents a task if you look at it has a whole bunch of fields, I'll maybe look at it later, but that's what it's up to, that's what it's and.
So anytime in kernel code, if you see a reference to current current refers to the task that made the system call request because normally, there's parts of the code that are running in the context of any, you know,
is.
So these are, if you look at Colonel Colonel calls basically running in one of three contacts. It's on behalf of a task. It's on behalf of the device they processing and interrupt the Cardinals, you know interrupts happen so that has to handle it, a task
is made a system called and so it has to handle it, or as a kernel thread, which is doing background processing for some reason traditional kernels would basically try to get the background processing done as a second thing to do.
While you were handling a task, you know, having a, you know, an interrupt or handling a system call, but now I do that now there's this other thing and you can see this, where you go to.
So if I do.
He is a UX on my system.
So I do pay PSAX everything that's in square brackets, is a kernel thread.
That means, that's a thread running in, you know, in supervisor mode in the colonel context. That's right that but it's being scheduled like a task, but instead of the address space being, you know, some new space code some program, it's doing stuff on
behalf of that, and the stuff it's doing is all kind of like there's all these k worker things. I don't know the drinks all of them I mean some of these things are probably doing background encryption and decryption because my, my main home directory
is encrypted.
You know, there's like most like there's a. What else is there. Oh yes, VirtualBox has its own scheduler they're doing some stuff, their stuff for my Nvidia card that's in my machines as I are this is for USB storage there's one so like, so like you'd
almost think of these as separate programs that were, you know, that are just running separately and that will take requests, but instead of them running as a separate process we don't have access Colonel data structures, these are running as threads
inside the kernel so they have access to everything.
Tassler Lewis, if debts
are, are they protected from things that the Kill Command.
Colonel threads. I don't think respond to signals at all.
They don't think they do much of anything with signals they're completely under control the colonel and they're kind of serve.
Well this is PSAX. That's what shows the names, you'll see on my arm.
You might notice I have AMD GPU, and I have Nvidia here, you know envious for Nvidia, um, there's a lot of stuff for that. That's because of my laptop has an AMD CPU with integrated graphics.
So, and it has an Nvidia GPU, you know, an external GPU so it has both of those things. And both those are painter required drivers and so yeah you got, you know both those working so there's all kinds of stuff here.
I don't know what all this does. I can probably, I can certainly. Oh look there's my wireless card, sitting there, you know, you know crypto is probably doing the encryption scuzzy stands for small computers has been a great that's a thing typically for
doing talking the disks, but there's also ones here for talking to. I mean, the complexity here is enormous envy me, that's my main hard drive.
So that's being supported there so there's just all kinds of stuff going on the Colonel's very busy.
So.
I haven't honestly tried sending signals I'm basically certain it would be ignored. but they're there.
So, so what would you say well I think Chris was talking about threads.
What does it look like when a process is multi threaded.
So,
so here I've got Emacs running.
Well,
yeah.
So there's Emacs. So if I go into slash proxy 5804.
This is all the info on the Emacs process that I'm actually running.
But notice in here.
There is a directory called task.
And in this directory, there's a bunch of other process, you know, bunch of other numbers.
Yeah.
You know it's each of them has their own thing. That's because.
I'm using kernel threads now.
bosses
call these tasks.
I'm replaying I'm changing my terminology a little bit because I'm using the same word for multiple things so just realize that that does not make much sense.
So, they're so in a process, there's this test subject it shows all of the.
others listed.
So LS.
And those are also listed at the top level.
is a, is a task.
So,
this whole distinction of processes and threads and other things we're not going to talk about in too much detail, but I just want to put this out there so you can understand what you're seeing here is that Emacs in this case, and Firefox to an even greater
degree is a multi threaded process is a multi threaded process. When we were in Firefox going on multiple prophecies entirely. But if you have a multi threaded process, what it will look like is, you look into, you look at it and you see task.
And you'll see a bunch of numbers. Now in another window, I'm going to start running top.
And so here, top I know is not multi threaded.
So top is running now in another window on my system. So, Brock says 6373.
Now while this is running.
You'll see there's only one thing there, which is the same as the one we start with so.
So,
hopefully I didn't confuse you too much work this, but
yeah so you can access the other tasks in the house, exactly you can, they're all just proc. So, but you know what was it, Phi Beta for so Phi Beta for ya so so I go into proc Phi Beta for.
Now I want to know what is this.
So, calm tells me what the name of the program is this is Emacs. But am I going to task.
Oh, that's interesting.
So what's happened here is there's these things called GD boss and other things, these are all part of running a desktop application. Turns out they all get their own threads in Emacs and they've set their name to be part of that but they are all these
are all part of Emacs, which means are all in the same address space, but they're all running in parallel, and so they can connect your talk to each other using
machine basically shared memory.
So, once you start getting into this and start looking at under the hood of real desktop application and seeing all the stuff that's there, things get complicated, very fast.
because it turns out there's a whole software infrastructure to do the gooey and also in particular to allow applications to interact with each other and send messages things there's just a whole bunch of stuff like GD bus.
I'm pretty sure that's the no desktop bus.
That's probably ended ology means by the domain because I'm running a GNOME Desktop.
So one task has one address space.
So, a task. So, so now I want to talk about address spaces now that's actually the reason why we're talking so let's.
So, so we talked about dress spaces, it's around virtual addresses.
So we say their virtual virtual addresses. It's a very simple thing, every process has its own address space which means it has its own virtual so it means, you know.
So, when we program, when you deal with a process, you're, you're, you're running a program process you don't exactly. It has a memory map.
The addresses in that memory map where everything is where the stack where the heap is where code is and everything, those addresses are private, they are specific to that process.
They're not this, they're completely separate from that of any other process and in fact if you refer to a given new America dress in one process, there's nothing to do with the new America dress and another process.
But the CPU needs a way of uniquely identifying every bite of RAM that it has every bite of RAM has to have a unique address, and we can have this weird thing of like, Well no, we have the same number for two different things.
It's like, no, it needs to know where its RAM is what knows how much it isn't so you can allocate it
know so there's no so.
So physical addresses is like what you actually out of the computer, virtual addresses, is what, you know, passes us.
Alright, so I say, I said program here because if you talk. If you talk about an older system.
They don't even have necessary the notion of a task is an abstraction.
If you're on a system that doesn't have virtual memory you don't actually support the concept of a task, you can have multiple programs running, be in memory.
But they're
well they don't necessarily run at the same time and in fact when they run is very common. If you really want to see.
You want to really learn about what it was, how to, you know, develop on a system without virtual memory. Look, you know, there's things called terminate and stay resident programs for MS DOS.
So, you know, how did things work when if you don't have virtual memory virtual memory is really an abstraction, to help you run multiple programs at the same time on a system, and ideally to run them in parallel, that's what we have, you know, that's
when we talk about a process we're really talking about multiple programs running at the same time on a system, and you can have processes and stuff, even if you have a single core, they just take turns on it but there are logically all running at the
time, but they're each just a little bit of time on the, on the CPU thinking kicked off and someone else runs on my own, you know, the first computer I ever seriously used an old Apple to see the way I would switch between programs is, I would take a
floppy disk, I'd stick a new floppy disk in a turn it on and then if I wanted to do something else. I'd take out that floppy disk I put a new floppy disk or reboot the computer and I've got a new program, at most, but I might have on a disk is maybe I
might have a couple of different games on a disk, but then I'd have a menu that would start when the disc starts up I've selected my menu run the game and then when I was done playing that game, I'd have to reboot the whole computer.
So, that's what you're talking, if you, If you want to just have war
without virtual memory what you often end up are now, there have been systems, without virtual memory that allow you to run multiple programs at once, either them taking turns or just having it there, but it's a pain because then you have to make them
so they aren't don't recite it a particular dress makes a lot of things more complicated they can see each other they can mess with each other's memory.
So when I talk about memory protection the whole nice thing about having this abstraction where multiple programs are running in separate address spaces is they can't see each other so they can't mess with each other's memory.
And so if one crashes.
You kill it and it doesn't kill everything on your system. I mean, before that one program misbehaves you're rebooting the entire system
magnet your core memory Yeah,
What I will be trying these older computers like when I taught Apple tues I'm talking about the 1980s
for PCs.
So, So I'm the.
So, you know.
Jason yes exactly and an embedded system if you don't have virtual memory.
If a program misbehaves and doesn't do allocate all the resources.
Yep. You're stuck with it, and you just have to reboot the whole device, in order to get things.
So I'm getting to the to be in a second so,
so, so, so first off I'm just talking about pay you know pay to look up so. So, this is data structure called the page table that are, that default, that are the data structure that defines this virtual physical memory mapping so.
So, logically.
Yeah, I'm going to talk about the eyes.
So I.
Jason, your first thing to pay to laser negligible on the page tables latency cost is actually quite high.
If I call the page file which I'll talk about page files in a little bit.
I haven't gotten there yet but you asked me about that later.
Um, So, this is the page two.
So, the page tables a data structure is normally structured as some sort of tree. It's not a binary tree, it's a bit different but it's a tree. And so, looking things up in it can actually take a bit of time you have to actually do a cut out you have
to walk the tree. In order to do things so what accessing things in that page table is slow.
So, patient but no, so.
fit page table don't fit into the CPU cast is the TLB. That's.
Yeah.
When you go embedded there's lots of other things but actually increasingly embedded chips do exactly the same thing that I'm described. Originally, all this technology that I'm talking about here with virtual memory was first implemented for mainframes
then for many computers, then for microcomputers, and now they're showing up a little controllers.
So, so how, so that's the, so the TLB it's super fast.
Oh.
So the TLB is not very, it's not very big. Now to understand what it's how this cash works and why talking about virtual the physical memory mappings.
I have to talk a bit about how this is done.
But let's.
What I will maybe show you me see if I can find this.
I'm going to try seeing if I your phone
will tell.
No, that's not useful. Okay, I'm just trying to see if I can find sign that says.
always do this race share my screen here.
There we go.
So if you look here this is a thing talking about the TLB. This will tell you all about how you know it does. Um,
there's a, you know, there's a lot of things here but like the size of these things, you know like, 4096.
Let's see how much anyway.
Don't worry about this this is all beyond the scope of this class.
But where was I going where's my chat window.
No, no. The to be does not reside in some CPU cache. The to be is a, is a is.
So the TLB is super fast and is really weird relative to other kind of caches because what you're doing is you're querying it with an address that checks all of his entries, and then gives you the corresponding physical address.
But what's really happening is, these aren't happening on a per bite level, but per page level.
Pages just a block.
It's a terminology thing logically there about this thing that you know.
So, is there a reason for the difference in terminology, um, it's, It's historic
a potentially yeah I mean it's, yeah, there's mean blocks are on disk.
You know, memories and pages but basically, you'll notice the block size noon talking about our 4k. Here we're talking about something that's about 4k is typical page size sometimes are eight K's and we underestimate aka, but I'm with ram you sometimes
have very large pages.
So the.
Every address that you use is really you can think of it as in two portions. You know there's a prefix plus an offset the prefix is, you know, the is either the virtual or physical address, and the offset is and, you know, and you know an index into a
page.
Now there's
this there's some cool data structure stuff.
so much.
so, page tables are fun data structure. I don't know if I have time later I'll talk about it but just at a high level. It's a, it's interesting data structure because it's pieces.
You want to use efficiently these units. These pages and so how do you efficiently use these pages to store the data structure but you can't have things just arbitrarily spanning portions of these pages we want to say okay this portion, you know, here's
a 4k chunk How do I use that. Here's another 4k chunk How do I use it. 4k chunk. Same thing with a file system.
Just noting that we talked about the data structures used to organize data on a file system, versus data in RAM. There's actually a huge amount of overlap between these, but when you're doing on disk, the priority is persistence, because in RAM, you can
always be like, throw it away we start there's this notion of processes are ephemeral. So if there's a problem you could just, you know, you're always gonna, you know, we make it but stuff on disk that has the last three years.
So corruption is a huge deal. You can't just erase it and start over. So if you look at how file systems are structured.
They're built with all these mechanisms for detecting errors, but in RAM Yeah, we just throw it away we do it.
When we say, how does when we say virtual memory and address space.
So, Martin Does that answer your question
or, you know, how to relate to a jacket so that's all it is, it's like, and there's a bunch of technologies involved this like like like the TLV is part of virtual memory, you know, in other words like technology stack know page tables how they all work
work and then there's all this stuff. I mean, it gets complicated, frankly, it gets quite complicated, and how this is all implemented. And
what's your.
Well I think I might have some time I can talk about a bit about how it's doing.
Yes, I'll just repeat it my browser will say that.
So if you look at the. So this is, you know, virtual address space physical address space. If you look at the textbook. It also has really nice chapters, explaining all of this, and it's definitely work if you look here's the TLB here's the page table.
So you might notice one of the nice features.
pages.
We say an address be split for a process mean all the tasks within the process share the same address space to exactly that's exactly what happens. That's what defines the process.
The process is really one or more threads that together, share and address space.
The memory stuff is linear.
I'm.
What exactly I'm kind of kissing you say this stuff is linear in 3005. I know that's databases, there's definitely some overlap here. If you talk about this.
Yes, a process does process that was he. I'm not saying, a task isn't is a colonel specific concept which unifies processes and threads.
So, the user space we know a talk, you know we have a process and we have the processes multi threaded or single threaded for the colonel it just goes, I've got a task.
The task as a reference to an address space, you know, and that task is something I can scheduled to run at a core. And then, whether it's threat multi threaded or not it's like I mean, I've got a task, that's a thing that can run.
Does that task, have an address space that share with another task. Then we call that a multi threaded process if it doesn't then it's a single threaded process
for back right oh yes okay okay you're talking about that stuff okay.
Oh this page in process. Okay, so look like so.
So when we talk about page tables, the page table is actually a tree. It's, we're really a multi level page tables and the idea is that when you have an address
the address, there's if you. What we want to have a page.
So page tables are really data structure organizing page table entries.
So we're really looking at as these page table entries that's the data structure that we look at and this thing should have a things from zero
to try or not.
Hmm.
to try to not sorry in tutorial nine though you have a bunch of point you have a structure and you repeatedly access, you there's like a number one and you're allowing yourself to access the data for each level in this multi level page tabling system.
Exactly.
So, so, what you're talking to. So what's happening here and I just want to bring up the code that probably makes it a bit more concrete. So, if you look at 3000 physical view what this is the point of this, of this module is to show you how the colonel
maps virtual memory to physical memory.
And so you, you basically give it an address this is a virtual address and then it tells you what's the corresponding physical address for it. And in order to do this.
It walks the page table for the current process.
So what happened, it turns out that this is the PT the page table entry.
And basically there's four levels, potentially above this and mainly the reason we have so many levels mean so is be in order to accommodate very large address spaces.
So, for a 32 bit address space, you just needed to know it was basically three levels you have the page directory, you had, you know, kind of the middle of page tables and then you have the bottom actual pages so that was, it was a tree with just, you
know, a root a middle layer of notes, and then a bottom layer.
And each of these nodes is a page. So it's like a tree, but instead of there being two pointers at any level, there is 1024.
That's why 32 bit pages, no page tables working together, one.
So I'll explain this.
So, so just so when you look at the page table, we're looking at how does this data structure work. It's basically a tree.
But each, you know.
So, it's a tree that has a each node having 1024 pointers, instead of two. It's a very fat wide tree, rather than a very skinny deep one. And why do we do that because we're not allocating data in for an eight K, no four bytes, eight bytes or something.
We want to allocate data in 4096 bytes or 8192 bytes. So often, so if you work out the mouth, eight k page tables, I think, pages I think we're much better for 64 bit systems to play and things are broken up in that way.
So, always, always say the pace. It's the multi level page table here. It's, you have instead of three, it's added two more levels.
Five, so as to be able to accomplish what's needed to map a 64 bit virtual address and into, of course, the 64 but it's not so much mapping a 64 bit virtual address because actually, this actually isn't enough for a 64 bits of physical memory This is
enough for like 40 something bits of physical memory.
And you added.
Yep. So, with the God actually holds are the indexes at each level of this tree.
No.
Okay, no to be doesn't, it just holds the entries.
Okay. It just holds the entry where we're literally it's. I've got this virtual address, what's the what's the corresponding physical page for this physical page prefix for it.
And it just, you know, has that mapping.
That's what the. That's what the to be a story is that direct map so you're, you're short circuiting this whole walking of the tree. it's a cache of recently accessed pts.
So literally, it just remembering Oh when we looked up this virtual address.
But this virtual just prefix. We got this page table entry for the physical address, and it just remembers that association
that parent, and that it's a cash like a look that up very quickly but it's very small, it's good if you've got good memory locality or be fast, but the moment you're accessing some other memory, it taught me to go to walk the page table and it's time
to walk a tree, like, five levels.
So you really don't want to be doing this that often
is the MMU that has to be integrated into the CPUs diet. Yes. That used to be an interesting thing but now on this day of systems on a chip, everything's integrated into the dye.
If you go back to the 1980s.
Yeah, he's 1980s.
There are processors like the 68,000
that had an external MMU had like there was a separate chip you would add in for the memory that the MMU is the thing that implements the TLB and all this page to have a logic for walking a page table and something.
It's the thing for, it's a memory management unit.
But nowadays the MMU is integrated into the CPU it's just another thing there, and it's not relative to everything else, it's not that big.
But used to be relative other things, it was pretty big and it'd be on a separate ship.
Now it's just in there.
Yeah, yeah, you definitely it's on time but everything's on Dine Out with modern chips.
So, what do I expect you to understand of this, what I'm expecting you to. So, I recommend you so if you go to the.
If you go to the
textbook textbook has some great things for explaining.
Where's the textbook.
So if you go here and you go to
virtue, you go here. So this talks you scheduling, this is all talking about paging translation look aside buffers. Here is a thing talking about TLC entries.
Here's a chapter, Introduction to paging
page friends and stuff so it goes through and explains it in.
Very nice detail and it's I think it's worth your time looking through this.
I'm explained, you know, and also starts here with address spaces, and you know time sharing and it walks you through this in a very nice systematic way, I'm not doing that in class because I don't want to test you on that.
Um, that's good background things for you to understand but really what I want you to get out of this class is enough of a mental model so when I show you code like this, you at least going like, Oh, That must be what it's doing.
And then you can go I want to understand exactly how this code looks, then you can go look at our luck, but more it's a look, this is what the Colonel's doing.
And I want you to run it and see the physical addresses and see the virtual addresses and look for the patterns in those and see how, you know, how they change it don't change.
I want you to see the phenomena of it. I don't want you to get bogged down in the mechanism of all this.
Yeah. No, it's, it's a very approachable textbook, I'm not teaching directly from the textbook, but I do definitely endorse it, it's a good textbook. But what I'm really looking for in this class is to give you some a bit more of a hands on, like code
centered view of operating systems I really want you to go like, I've got this code here, what the heck is it doing, how would I figure out what this is doing.
Yeah.
Oh operating systems that
some people say Operating Systems Research is dead. It's just a practitioners, I think there's actually so a lot of stuff. But the real reason why operating systems as a field keeps developing is really because hardware keeps developing and what's the
best ways to make use of it also the other challenges like operating system security, lots of research there gets very, it gets very complicated.
But if you look at
if me much of this is a driver just you know this this code is a driver just like it is, but the the thing that's fun about this program is remember you ran this program before, many of you remember those 3000 men view.
This is 3000 men view to. And what this does is it shows you are the NFP messages, it shows you all this stuff there.
But what it's going to show you for all these things. Is it also shows you
know the the you know the virtual and the physical address of these things.
So
that's, it's out there if you look at what report memory does report memory shows you the virtual and the physical mapping for each of these things. So you can see where they all lay out and RAM.
So, I want you to be able to get this and go like, how did it do that to really understand how this all works is complicated, very complicated because the kernel is very complicated, but at a high level understanding this that you should be able to understand,
so I don't need you to, I want you to answer the conceptual level of 3000 physical view works.
But I don't need you to understand it at in a detailed level.
No, no, a task is not a setup process, a task is something that can be scheduled by the colonel, a task, maps, either to a process or a thread.
Now, there is this idea of kernel threads versus user space threads.
If you want to look up things like threads versus fibers and other things.
That's what it's getting into you can basically if you have to switch between tasks by going to the colonel and then coming back out. That is extra overhead and so there are ways to switch what you're doing, purely inside the process.
That's user space scheduling.
It's a thing, you forget about it we can just say, you know, we'll call these threads and processor.
So a task is anything that comes from a clone call. Yes, exactly.
So a task, a task executes a sequential series of instructions in an address space.
Yes, Exactly. That's what a task is doing.
Now, if we go to.
And so if you want to have more than one thing happen at once. That's when you have multiple tasks.
No, no, no, no threads make phone calls.
You can use clone, to make a task, a clone, when you look at the implementation level I'll just make this very concrete.
So let's go to.
So we go here, we look up tasks dropped.
This is the test start.
It's a big old struct.
It's got a lot of fields. There's a lot of state that the let me, used to be simpler, but the Linux kernel keeps track of a lot of state associated with these things.
It's just nice because it has keep track of all the IO that's associated with the process of the things, you know, we're doing multi threaded multi core CPUs where is it running on different court.
You know, we're doing multi threaded multi core CPUs where is it running on different court. This is big, but inside of this you can see things like here like I Oh look there's a stack.
Look there's, you know that's that's the kernel stack associated with it.
Task groups, because you can have groups of tasks together that's basically what you think of as a process as a group of tasks.
Um, you know CPUs what CPU is it running on is it supposed to be migrated between CPUs.
But this is all the other tasks associated with this one here. Mm hmm struct, you know that's that's basically the page table.
The MA cash because of course it isn't just that there's a, you know, virtual memory cache associated with it to speed things up an exit code exit state exit signal, you know like, how, you know, how is you know terminating I mean, this is what you think,
Oh, here we go, process it, you know, task group ID so there's this, you know, where the children, whereas the sibling was a group leader parent, there's additional concepts in here I haven't completely talked about me, It's a rabbit hole, there's a lot
of complexity here. The four could die and
it's complicated but now let's look at
find support.
system for cooking this is here.
As a macro okay this is
sis fork. The fine says clone is this clones this fork is this fork.
Oh, I know where it is.
This is not what I want to look at let's go back up here. Let's just go here.
Here. Pull go into
the south, your test a file called here called fork.
So if you want to understand how fork works here is fork.
Works do a
to address.
Here we go.
Here is the definition of the fork system call.
What does the fork system called do it calls, Colonel clone.
Where's Colonel clone. It's right here.
So, okay, this is the main for Christina copies the process that's what kick starts it and weights to fish, using you know the VM if required.
So Colonel clone so this is you know so this for gets turned into clone
exactly the right quick example the current clone call. And this goes through, you know, add entropy set task p ID clone flags wake up new task.
You know, you know, there it is. And then you'll notice I taught you know Colonel clone, and then Colonel thread. If the thread wants to create, You know, you know, a thread, this is it still calls Colonel clone, but it does things like it's not traced
and
it's got some special user mode thread. Look, you know this is, you know, this is what it looks like a user mode thread. You know, it's all defined in terms of, you know, this clone abstraction.
And what this clone abstraction is always working on is,
you know, it was it so do we see current.
We should see a.
The universe, it's got this task here, it's referring to pee here.
And if you look for current.
You know, there's all these references to current.
That's current is past equals current, that's the one that's executing the system call.
So,
this is.
So my goal with this class.
I really want you to do is get enough high level concepts, which are admittedly vague.
And the reason they are vague, is because they are covering up lots of complexity. If you want to see. Oh, what is that precisely the concepts, become grounded in the actual code of the system.
And when you look at that code you go like, Oh, that's why we wanted to be vague, because if we're precise.
There's a whole lot of stuff.
But that's important.
You have to be able to take these complex systems and realize something like this sort of thing is happening over there I don't know all the details. I don't care about the details, it's taking care of the details, except when of course you do.
And then you go and investigate and use the tools at hand to learn about it in detail enough to a deal with the task you have
unfair.
I will talk about me, I can talk a little bit unsure I'm not going to be able to talk a huge step. I don't know if we're gonna have time but I can, I will mention some things about it certainly.
Next week, and talking about and talking about assignment three will be discussing solutions.
But we're out of time.
What I want to spend time on the tutorials assignment for sure hopefully make the code from tutorial nine a little more straightforward.
But also, you know, integrate concepts from tutorial seven and nine, and
hopefully that'll give, give you a window into how things are working.
And you won't understand everything that's happening because again, I don't understand everything that's happening, no one understands everything that's happened.
These systems are very large and complex, but they are governed by certain abstractions certain concepts and when you understand those, you can navigate and you can open up the abstractions to whatever degree you need in order to address the problems.that you have..I'll stop here and have, enjoy the time off on Thursday.stopped.And I will see you all next week.