Yeah tomorrow five and six video again look at bright space, it tells you when the cutoff date says it has it has all the due dates there let's let's get started here.
Okay, good morning, everyone. Let's go ahead and get started.
So, first off let's talk about due dates. So first off for due dates.
So, looking bright space, the due dates are all there. I really prefer not to discuss that during lecture because not just waste their time.
Um, so now let's talk about. So there's a good question of all.
So, so let's so quick question so YFSCK needful paths.
So just FSEK is picky. So give it full paths because you want to make sure you're specifying the right one because expect to work on device. And if you're repairing a file system, you could miss repair a file system, and those erase everything.
So, potentially dangerous.
So I'll so that when I talk now about hard links versus symbolic links.
So all a hard link.
So basically first approximation is hard links are named that refer to, I nodes, symbolic links are named 2.2 names.
Okay, so.
So file names are aren't his about links have hard links. Exactly.
Exactly. So,
if you LS dash la O'Shea your account in the top.
Whoo, that's a little different the count the top is
FSEK is used to fixed file systems that you see all that in the tutorial. Let's
right so let's let's do a little demonstration here so let's go to my desktop here.
Okay, so now we're going, let's, let's go let's touch also cat to F cat.
First,
so first file.
This is what f1 looks like. but let's. So notice now.
It has a one here. This one matters.
Now,
ah, Get lose out, sir.
Oh.
Okay. Can you can you all see that fine right now. How's this. Okay, good.
Okay, so uh, so, so my dad do ln f1 f2.
I've now created a hard link from f1, f2. So cat F to f1, they're the same. They're both referring to the same I node. And if I add. You can see they're both the same I know number here.
But now, if I make a symbolic link.
Now we can see here now instead of it being a dash the attachments are regular file D is there but l is a link.
And here what saying is, f3 refers to F to f1. So if I can't f3 it acts like that.
But now.
But now, notice what happens if I get rid of.
So, f two is still there.
That's gone because f1 has been removed by name, but F to referred to the same I note, so it's still there.
So that's basically what's happening with symbolic links is now. Now the question is.
Yeah, so the target filename change assembly will stop working. Yes, exactly. And that's No No, you can't.
You can't broken links less the file system described.
Broken Heart links less the file system described.
So it's very similar so symbolic links are similar to shortcuts, except they work basically everywhere.
Okay still remove f3 yo yes I can still remove f3.
So, well, let's let's first.
So now I've effectively recreated f1. Now fire. Now, if I remove.
I can move f3 no matter what
I can make this for until we've got this. But now, If I say start of f4.
following.
Okay, so
we do that, this, this, and we do this one.
We see this, but if we don't say that the reference. We actually are getting else that versus stop f1 will be the same but a for gives us information that it's a symbolic link, and then we see the access.
Was it.
So basically one's doing an L stout. The other ones doing a stout so compare these
compare these two things see this one is giving us information on the symbolic link itself. Notice the access is all like this. But then compare it to this one where we actually have the reference to the actual file content so it follows a symbolic link
can Somalis click from outside of directory.
Yes, they can they can connect with anywhere.
Is there any way to list all the hard links playing to an AI node. In general, know what you will know is that there is multiple. You can do it basically what you have to do is you have to go through and find all the files and have the same I note that
in its essence FSCK does things like that as part of checking the file system, but it's not a normal operation, and I, you, but you could write a script to do it by just checking all the files I know numbers and looking for ones that have the same ones,
but you always know that they're out there.
If you look at this count here. No symbolic symbolically to only have account one these off to remember directories also this is there but remember the directory gets counted also gets hard links from its contents, you know, for any sub directories and
stuff.
Okay so busy box.
Well that that's not that's not exactly what's happening with busy box is a reason why symbolic links have full access by default.
Yes, because they are just a reference, there's no point, basically Unix doesn't put a permission on the reference the question of where the boxes the actual file contents.
So, so else that is the symbolic link itself with a Scott follows us and Baka Yes,
I forget I forget, stop vs else not one of them follows it and the other one doesn't iOS.
If you're brand new f1 with a symbolic link.
If I create a new f1. Ah, good question.
See if I delete your symbolic links are really to the name not the I know.
So, if I delete the original file, and I get printed again, I'd symbolically will still refer to it, a hard link will refer to the old one.
Okay.
It's worth it up a new symbolic between say f5 and f4.
Okay, say, for five.
Yep.
Can you stop risky stock symbolic links Yes you can.
There is a limit to the depth, I forget what the limit is you cannot do this infinitely because it has to have a check to make sure if I think we'll do at least.
Yes, it's a pointer to a pointer and by default it will D reference it fully. So know if we start at five step five minutes for, for, you know, components l one and then start at one.
That's the actual contents.
Yep, exactly so you can you can definitely do that and it will automatically do reference it up to a certain number of things.
So, for example, if I want to help this aware what I use. So the real time to use a symbolic link is when you want to get outside of your file system, or if you want to allow the original file to change.
So, like for example, if I want to refer to, I cannot make a symbolic link.
Now I've made it. I've made a symbolic link to No, I have not created a new one. That's all. I can't do ln
valid cross device link.
You can't make, um, you know, some hard links across file system boundaries.
So, you know, slash dev is another file system from here so you can't do that also.
Yeah, so reason hard links are hard to break is because when you delete something you just remove the name not the actual content. Exactly, and any other names are still valid.
So, let's see now.
So let's you know, else dot versus so so
so else that returns information on the symbolic link itself, whilst out which follows symbolic links
Would the user be able to hard link to files that a user doesn't necessary own well route, kinda owns everything so yeah they could they can hardly anything
by again it would but.
So I make a symbolic link from A to B, and then change the name of b2b one, the link will be broken. Yes, exactly.
Yep.
Okay, so I suggest I'm going to, I'm not going to talk anymore about these things, play with them. If you don't understand anything of this once you play with hard links and symbolic links, you'll understand you understand them more if it's not kind of
making sense to you right now.
But what I want to go and now let's talk about device files.
We've seen these already some know where we seen device files we've seen.
You know, we've seen death know you seen things like dev random which is showing up by for that that's a tutorial seven but turns out these things like you know def zero, we've seen that, which is you know so you read from dev know you get never, never
any bites, but you write to it and write as much as you want, Dev zero, you don't really write to dev zero but you can read as much as you want from dev zero and you always get a bunch of zeros, we, um, there's also things like dev random and dev you
random, which lets you read random bytes.
And then there's also the loop ones.
We've seen but.
So the key thing to understand what distinct What is this, so.
Ah, so dev know and slasher under different file systems. Yes. So, so we go to slash.
This is our main file system slash, but if I, if I go into Dev.
I'm in the you Dev, a file system.
This is just my, you know, my current thing and so that's actually understanding file systems, And how these all fit together that's really what assignment three is all about.
All I'm doing. So if you go to assignment three. If you haven't, you haven't started on it yet.
You'll notice that what I give you the script and the script isn't very long but it does some interesting things. and I'll kind of, I'll show you now a bit of what it does, but the, the purpose of this is to bring together your knowledge of user accounts
and and file systems and show you what you can do. The one thing that I introduced in this is this true root command that's the one thing that's new in this assignment everything else you've covered.
Well to route and busy box.
Those are the two things.
The file systems definitely yeah file systems look like a tree. Exactly, that's exactly what they are is a tree.
That's what they call the hierarchical file system. It's a hierarchy. It's a tree.
Notice the processes also form a tree with parent child so you have the process hierarchy, and the file system hierarchy.
So we're.
Oh yeah, so we're going to do is let's.
Oh yeah, it's very unbalanced.
Is there a command to visualize the file system tree, um,
ah, isn't tree.
Yeah, yeah, I've not played with true.
But yes, there of course there's a command to do it. I'm
to the process hierarchy at all times fall under the file system hierarchy.
Not exactly.
Not exactly. Let's first.
Let's first get this here.
Okay, so first off, we've got 3000 make of us.
So you should make it run a ball.
Get yeah we're gonna go, we're going through the assignment now so first.
First let's run it.
And our tree won't damage or thing.
So first off, notice it says, can't right now, strictly speaking, you don't actually have to run this, you have to make it executable which you could do is just type bash for any shell script, you can just give the interpreter and run it, and it will
do the same thing
is running this as root make the script dangerous. Yes, it is very dangerous and in fact, when I use a prospect. It is, it is very dangerous and in fact, before doing this stuff before doing the assignment three before you should be really running the
backup command run this copy your files anything in your VM because you may need to throw it away and backup things.
How does it, how does sex backup work.
This is FCS backup.
It's just are sick.
Here, and that's why I posted in the forums how you reverse it. This is what this is the arcing command. So you basically just reverse this. In order to do this you basically turn around because access over here and put on student there.
You don't need this exclude line because you're copying files back and you can go there.
So, this is all sex backup is, it's in bash aliases, you can do that so I specifically didn't do a restore command because I figure if you have to restore it.
you should be learning are saying
Yes, and it saved in a savings account on your thing basically whatever your microbes in one, your sex username and access is put there in this calm and backup.
How do we not run it as at the root. So, well gee I'm, you have to run it as root. This will this won't run otherwise without being rude because it can't do what it needs to do.
Because it's, it has to, because we're doing stuff.
So let's pseudo.
So, you run it, you should see this.
So, we now have a file system.
So now I am in the dev loop for device, which is my slash and you notice it's only 362 megabytes in size, nine properties both windows up seeking, so we can contrast this
know our regular machine has 4.3 gigabytes but over here now for some reason, it's gone down really small.
Yes.
Angie exactly you're exactly right. Yes. So, what are we doing here, what have we done here we've just combined a few commands together, which are no it's worth work let's look through the,
the shell script. So what does it do here first we defined a few variables.
Because, you know, good programming practice let's define a few things. And then what we do now is we check, are we root.
If we're not root, This is built into bash is not built into standard shell built.
It's built into bash, and so because this has got to run as root so exit If not, then I do a little cleanup I try to make it make it so you could run the script more than once and it will clean up after itself and undo it so you wouldn't get really weird
things. dollar in the dollar sign in shell scripts is for the referencing variables.
So I tried using system CTL but the system ignore my command.
It did not ignore your command, it didn't know what system CPL was
what let's, let's explain why that is.
So, first off we do is we could delete the old image was there. Then we make a new image within your DD makeup sex before so this is all stuff you should have done already.
And then what I do is I check to see if the mount point exists. If the mount point exists. Then I announce proc, and the, you know, and anything there and remove it basically I try to be, again we're doing these removal things to kind of get rid of it
if you, if you're running this again so you run the script were the ones that will delete what you had before and make a new one.
It said, ignore it because it came from a true, really.
I don't know what the.
Okay so right well as I ok so the dash D here says, Is this a directory.
This is doing, you know not equal to here, this is just a dash q from in quiet so it doesn't produce an error messages, and I just I'm out these I get rid of it.
Then I make a directory for the mount point, I mount the image, and I CD into the mount point. So now I'm in the mount point directory.
how to install system Cpl. Okay. Well, that that's kind of a, that's a whole different thing.
So you see you do now. Now what I do is I always make a bunch of directories. And then I copy busy box into this directory. now busy box is a really cool little program
so busy box a Swiss Army Knife of embedded Linux.
What it is, is it's one program binary, which can give you access to a whole bunch of standard command line utilities. So these are not the ones you normally use they're all kind of cut down to make them small, but they do the basics.
It's really like a Swiss Army knife in that sense it just so. And if you look, these are all the commands that are in this thing, you know, DBCP Deepak me just look at this this is insane.
It's all in one program binary.
So, so it turns out the way it knows which one to be is by looking at the name it is called under so we make symbolic links or hard links to it, and that will.
Yeah, she should hold a wine bar.
Yeah, exactly.
Case for example of using it.
I'm using it right now.
Inside the inside the, you know, inside of this environment, you're using busy box. The, basically, there's only a few programs inside of this. If you actually look at how this is constructed.
What I've put in here is I've put busy box in there. And then I put bash in there, and the all the files that batch needs. See, busy boxes dynamically linked.
But bash is not so I have to copy all these things to make dynamic linking working inside of there so basically I literally like you have to have this in the document linker need the configuration the diamond linker, this is all that stuff.
And then I have to update, I have to copy all the libraries that are needed by bash into there. And then I have to go that's just making there and so this is all setting up things that dynamic linker
say the Korea is like the colonel with busy box Stockley link is on, that's basically the whole thing, except for bash, and in fact, you got rid of bash you could just use busy box.
And as the shell and it would just work fine except you're using the busy box shell not bad. So it's less feature for, but it's there.
How come we can't use the original libraries on the device you need to be in the same file system.
So,
let's look here.
Keep in mind, so what we've done is we've done this thing called True root, which is, so I'll get you in your truth in the second year but it's a very interesting command.
What we've done with true is so see this here.
This is slash now LS slash, is this
your LS been is this.
But here, if I do LS, then I get something completely different. It's still the same machine, but completely different things. I'm sure route changes.
Yes, exactly.
No Limit.
Hello.
Yeah.
I think someone's unmuted themselves.
Hold on one second year.
Okay. So at that, um, so
you zoomed in on the file system hierarchy system such as a route is now 3000 FST I was about to say that but I'm so, so, so is this clear.
Busy box.
You're in one binary
so busy box here. Let's just look at the normal system.
Then LS is this one binary here. Here it's a symbolic thing to Biggie box, busy rock,
which is here now know busy boxes that pretty chunky binary.
But it's, well, it's only like two, two megabytes me so
I mean, considering all the stuff it has it it just wouldn't know it's just there so anyway so we've got busy box here.
And that's, that's everything so but notice that are the meaning of slashes changed over here.
And so,
only file systems now are this, but now.
You'll notice that. And this is the way you really understand what's going on here. If you look here, you see in this environment that All I've got is dev Luke four, which is slash and you dev which is here.
Here I've got.
I've got doesn't actually lyst Dev, interestingly enough here, I guess I mounted there but it is it is mounted.
Same amount.
So this is what's there, if I zoom out.
Here's all the things here. But notice in particular, This is mounted on this directory.
And then here we noticed Dev.
Here we notice dev loot for his matter on slash
dev live for. That's what's there is definitely for that's the same device, but here it shows up as this directory and here it shows up a slash, that's the essence of change which is basically saying, I have a directory, I want this to be my new root
directory.
Yes, and we have, we have mounted.
So So Jason, here we point the command Yes exactly, that's exactly what busy boxes.
Was it similar to symbolic links.
These are not similar, these are symbolic links. I can also, if you notice when I ran.
When I ran the script. When I so the thing that actually made all the symbolic links was this. If I instead of doing dash install I instead of saying dash is if you get rid of the statue us, it will make hard links.
And then you'll see, you'll just see you know all these things so I suggest. When you do this, run this but run the script again without the dash us, and then see how the file system differs, I put this in here specifically so you would recognize that
there's just one binary there and, you know, but but it defaults to doing things with hard links.
Oh, you mean the change room is like changing what you want I want to be the root directory oh that's kind of
the, what is Dashti mean in for the mount I assume. This means the type. So I'm saying, so you can mount different types of file systems here so they are mounting saying of type proc, this actually doesn't exist.
This is ignored.
But you have to put something in there.
So we're mounting def tempeh fast and mounting proc on slash proc so like for our regular file systems REXD for, but it can figure it out from the file system.
No. ln dash is is how you make symbolically chocolate which are where you're saying, Oh, this is making a whole bunch of symbolic links.
Why doesn't proc show up when I do, I can do df dash by do df dash, a, it shows me everything.
But notice we're not even running the same df command in these two things.
So this is def here.
df. These are completely different commands see here this is no, this is not a hard link to some other weird multipurpose binary, this is, you know, just, you know, a standalone D E F command here, this is pointing to busy box.
So, basically this version of df doesn't show all the directories by default it filters out some of them because look at how many of them are, but this df doesn't filter anything so you see everything
right here if I could just filter out some some filters outside Spark, so def Dasha,
we are running his route.
Let me show you the, well what was what's dangerous about the script. Oh, I'm just make, I'm just writing a bunch of stuff over the things which can override a file I'm making a new file system here in that I sure hope images pointing to the right thing,
you know.
Yeah, there's there's a lot of stuff in here, up finishing my.
Do you have to sync your instance every time you run the script.
Definitely don't, because you might back up garbage stuff just run it once before you do stuff to make sure and then play, can you create file systems and C code you can but you're creating a file system is a complex thing so what you would end up doing
C code is calling you program to do it unless you want to re implement the program, it's not like a library. Oh, how are you creating a bunch of symbolic links at once.
Because busy boxes creating the symbolic links, you can make symbolic links. So, you can definitely do all a symbolic link is is.
Yeah, so make a new name for a file that's all.
You know, this is how you make hard links.
This is how you make symbolic link so you can do it all from see
so busy box just makes this makes things different these commands. You can do it me. All of this is being done from see.
We're just you. The reason you do things at the bash level, at the show level is because you have programs that do lots of things for you, so it's easy to string together those programs rather than implement it yourself and see yes so exactly so busy
box is calling the, the link. Call. Yes, exactly.
So, so the call was going through this code here. So now this part here is very important to understand.
A la Why do sin Why do symbolic links versus hard links.
I'm actually space is a fire actually if you do symbolic links.
It actually takes up more space.
Then if you do hard links to think a bit about that.
But, by default, it does hard links, which actually is more compact I did symbolic links because sometimes if you're hopping across file systems like EF different things mounted there, you can't actually make hard links everywhere.
Oftentimes slash user would be on a separate file system from slash, so you couldn't do it
is busy box link to the main busy box of the main file system. Well, how do we get busy box in there, we did a CP.
So no, and in fact, if we didn't copy it and we tried just doing a hard link that will be bad because it would, because we're now going to put a new file system so you wouldn't work anymore.
And,
yeah, you would do and if you just symbolic link, you wouldn't be able to access it.
So how does busy box know the command that's being run RV zero.
That's how busy box knows just are the V zero you know what program it's being run outs.
That's what you always get as the first element of your argument list is the name of the program as it's being run.
So, the important thing to understand here Oh by the way, why do, what am I doing here. This is a cool thing you can actually take a variable and this is just saying turned her to the first character of your terminal.
So I put this. So it turns out in order for things to work. If you're doing anything visual, like if you want bash to be able to command line editing, or if you want to be able to run nano or anything else like anything that needs to know the terminal,
be able to do like some sort of positioning or something. You need to have information on the terminal. And so instead of copying the entire terminal database into the thing I'm just copying the terminal that you're using right now.
So it literally is just looking at saying, Oh, you know, what's the first character of your terminal. It then makes that directory there here and, and then copies the appropriate file over.
So this is. And so, so we now we've set up the terminal we set up everything else. And then we make this little script.
And then the idea is that we run when we run. We run through twice. First we run it with this to do the setup. So that means in the polluted environment, it does all these things.
So, this is all running under the busy box shell.
And basically, this is how we get busy box to install itself properly because you really can't set up symbolic links properly. Unless you're in the right file system there and you know, it always will try to sign up for your regular thing you don't want
to run just busy box dash dash install on your main system otherwise it will overwrite your main binary.
I don't know if it weren't, it might just blow everything away.
So again, maintain backups, because if you just decide to play around and just run this command normally outside of the truth environment you're going to be very unhappy.
Basket back does now the special privileges any shelf we use this kind of purpose. Yes. So, in the busy box environment, the only show that I can rely on really working.
Is this one because busy boxes directly linked. I haven't run LD config so I can't come on bash necessarily working quite right until I run that that's that's a direct link or.
This sets up all the busy box scripts, and then we mount proc and we mount def.
So this is all running inside the truth environment. And so, and that's what I do here is I run the setup. And then I delete that script, and then I to route and this is how we have a shell script.
Now some of you are saying that you're getting CCSH in there. I don't understand how you what setup you have for that because we didn't copy CSA so of course it'll break you copies, you instead of calling back a few copies TSH up here.
Or you could just type in bash here.
Well, check it out So Jason check to see a check to see what else is is LS now symbolic link to busy box.
But there is a static sh. Yes.
Yeah, in the static.
It's a link to.
Okay. Yes.
So, yeah,
go ahead and play with things but yeah, this is a this is a good script to just mess up everything in your VM,
trying to think of anything else here so tutorial three. The other thing tutorial free does. You'll notice that I do this line, I'm copying the password files over because otherwise I wouldn't have accounts so
busy box may only override it if it didn't exist.
Isn't that also dangerous.
Well, this, this is, I mean this is what we're copying those files to the etc directory here if I said slapshot overwrite them, but potentially.
You know you're copying files over so, but some things are copying files, what's the real dangerous things, you know, I'm saying one character errors in many parts of this file could trash your entire system.
So be aware.
Oh, this is a cool little fascism, this will not work in the busy box shell or the standard sh environment. But what this is, it says, it just saying, started index zero, give me one.
So this gives you the first character of the term variable. So I just want term directory to be this, because if you look at term info.
It has all these characters.
So, which is basically to divide up things all the ones x you know here and go be obese.
But for those of the seas.
So it's a cool little sub string Trek. And so that there and then I make that temporary directory and then a copy though.
It's like slicing yes exactly very much like slicing.
So, try to understand every line in here, I'm the only lines, I'd say you probably can't necessarily fall so much as this. This is just crap to make the dynamic link or work.
If you want to study this fine, I know that's not that important but just realize the dynamic link or needs certain files to be there. These I think yeah Michael the kind of done a little more than this but I certainly know this is sufficient to get it
working. And the nice thing is once all this is copied. Then as long as you make sure as long as you. You should try our arc arc is cool.
arc is basically parsing here the output of led to get the list of libraries, you need the second to last true this truth. This turrets running the script.
And this one gives you a prompt.
Again, do a backup play with this stuff. Trash your system, it's perfectly fine. Create a new one, or maybe do all this in a new VM and then delete it when you're done, like don't just keep, lots of the AMS around but
no. So what this is saying is
this no this one right here.
162.
This is running the setup script, which we created right here.
True, just changes just runs the command. So you'll notice that this shell right here is running with this weird though.
But if I exit the show.
I'm back out.
One thing to keep in mind about what we're doing here is this is actually a very simplistic container.
It's not a full container if you look at things like Docker, and what Docker is doing Dockers essentially doing stuff like this, but with a little more work to provide a little more isolation.
Specifically, so basically right here if I'm now if I go into 3000 Fs
route. Go.
So now I am in my back in my, my thing here.
You'll notice that
I can see all the processes on the entire system, even though I can't see all the files. Also, I can actually remember like what how do I access all the other files.
Everything's there.
Here's all the things they're inside my but notice that my current directory is main Fs home student here, where.
Here I'm home student there so I can access everything in the main file system. Since I have access to all of Dev, and proc.
So,
Okay.
Oh yeah, I should be able to yeah let's let's do that. So, so let's go into main Fs.
Yep.
Now we're now we're kind of.
Yes, we're back to where we work so it's not providing full confinement, but there are ways to.
This is actually a research area. How do you properly secure containers and we've written papers on this is an active research thing if you're a kind of curious like how do you actually lock this stuff down.
I'll just say right now by our papers explain it much more but the state of the art right now is actually pretty bad for combining containers, even if you do all best practices.
And we think we have some better solutions and without papers about that.
So, uh, so anyway, up.
So what did I do here.
That's all I did.
So all true is does is, it just changes what the root directory is, but when you change the root directory, you change the paths of everything. So everyone's going to get confused you have to have access to all your binaries and things the new environment.
Otherwise all files, you know nothing makes sense. So whenever you do a true, you have to make sure in your new environment, you have everything you need all the files and directories that you want.
And there's a lot of files and directories that standard things depend on to work, but if you don't need them. You don't have to have them. So you can just put whatever you need in that environment for things to function.
You run the script using true your change the root directory to wherever we made the file system, 3000 Fs. Yeah, exactly. Thanks, Jason.
So, why are we looking at this, so this is all kind of.
You can just call it again, or exit the process, because remember to route is just for a given process.
This is the thing to really understand is that every process implicitly has its own view of what the root of the file system is it's essentially the file system is a tree.
You know, it's basically it's actually a collection, it's actually a forest because each file system is a tree.
And then the overall file system is really all those trees connected to each other by mounting so as to make one big tree, but how, but you can always change that and you can quickly change where your route is and then you might go like, oh, if I have
a new one like me I had this big tree and I was going to start over here, and then you take a look well I didn't have access stuff over here. Well you can mount it under here.
If you have access to right devices, and you can access them again.
So, it's up
the file system hierarchy isn't quite so static, as you might think it's a dynamically created thing that can be changed at runtime, with the right permissions.
And so now we're really getting out is what's really happening with these processes, and what's going on here, and you should have a sense of, you know.
so basic once you're outside of your inside your process whatever's in there you kind of have some amount of controls, as a programmer, but once you get outside of it, it can be Who the heck knows is whatever the colonel wants to tell you.
And so,
the thing that we're now going to get into with tutorial seven is,
is what this is what's going on here with this what were your transition things. Um, oh let's do a poll here.
I'm just curious, five out.
Well call this
should be.
Okay, let's try that.
Let's see what you all think.
okay your meta here so the reason I'm asking this question is because this is a
will still go to the next one.
Can you all see this window with the way you see the program running as root, does this show for everyone. Be good.
Okay, our will stop at a second here.
I should maybe pull this off, motivation, show it to you when you pick them he's kind of curious to see.
And you're not getting graded on this I'm more running away you're sincere opinion is.
Okay, well we'll call this good.
Eight.
Nine.
Done.
So, yeah, so this is what y'all got up, So the answer is, is be.
That's the answer. So,
So what you have to get in your mind.
you again, if you missed the poll, just ask a question,
process that is running as root
is.
good running.
Effective user ID.
So when you think about root processes versus kernels I, there was this in past years people get very confused about this is you have processes are running programs that are in a sense, always confined they are limited.
They have their own address space.
But in order to get outside of it, they have to in order to ask for additional resources to get more memory do access the outside world, they have to make system calls the kernel is the code that implements the process abstraction.
So, now.
So, this is, this is the thing is that what is in the kernel what functionalities there can vary.
There's no set rule on what code you put inside the kernel, and what code you put in regular processes.
It's really a design decision, most mainstream systems are in effect model if the kernels, even if they started out as micro kernels, say, Mac OS and Windows had some micro Colonel like things back in the past, but they're effectively monolithic kernels
and at this point, they, they're so interconnected and stuff that's.
There's lots of functionality. So when I say
so.
we can talk about the, the pros and cons later when we have time.
But let's first just talk about what's here and I can talk about ways but so know what goes inside of a kernel then you know the process abstraction.
So.
yeah so minor crows. So, the idea of a micro kernels is.
So, in order to really understand what's going on here we have talked a little bit about how CPUs work.
So if you don't want to get older system, like if you're talking about some embedded systems, or you're talking about like microcomputer from the 1980s or something, a Commodore 64 and Apple to those are the things I grew up on all the code on the system
runs at the same privilege level so if you're running.
You're running machine code you're running assembly as a lot of stuff was written those days because there are so limited.
They're all running with the same privilege level so any code can do anything. You might have an operating system.
So, you're on those sort of systems we talk about an operating system. All it is, is library code is just routines for accessing the, the disk drive or something, all can do everything.
One Fun fact, If you look back at old eight bit computers.
16 bit not too much particularly eight bit computers,
many commercial programs particularly games would implement copy protection by implementing their own routines for reading from the disk. So the way they would make sure you didn't protect you couldn't read things from the desk was because it had custom
routines for accessing it. That was obfuscated that was non standard so you put it in a standard copy program it would look at the desk and go like, I don't even know what this is it.
So, how can I copy it.
Um, Yeah.
For.
QNX global auto company, their stuff is there lvl for micro kernels now heard our micro kernels.
Heard on micro kernels. A isn't read doc so re implementation of, I forget where we boxes.
Q And x is a is owned by blackberry Yes.
Although actually what happened was is blackberry bought Q and x, and it's probably going to, I suspect you an ex and blackberry will separate at some point, because qx is a thriving business and Blackberry, otherwise not too much.
So old machines, our code would write the same level so all cocoa Do everything you can implement your own operating system you could do anything.
So here's the big problem with a letter writing all code at one privilege level is.
essentially to do current currency properly you need multiple privilege levels, because you have to be able to.
you do concurrency because you're gonna have your main program doing stuff. and then you're going to have background programs doing things. And you have to make sure you the background stuff happens.
So, when you go back to Windows 3.1.
Yeah.
So, I'm getting to the privilege holes in a second year of.
You need to, so the you'd say the high, high, the highly privileged part.
So, the idea. So this was the motivation here is to manage concurrency because we have to be able to handle many things happening at the same time, in particular, if data is coming in off the network and so we dealt with as it comes in, or if someone
goes like hey you sent me some pockets but I lost them resend, You have to do that in a timely fashion.
computers that had only one level of privilege for code that tried to implement internet networking became very flaky, and that's why MS DOS,
you know, so yeah so 16 bit of issue, Ms. MS DOS doing networking, old, old Mac OS before mac os 10 like Mac OS nine and before.
Those were very unreliable doing networking, I mean, Mac OS, like older version of Mac OS you hold down the mouse button and the computer would stop responding to the network.
So, not good.
So, what will modern CPUs actually have that, you know, have at least two modes.
Look at your history, look up a system called multi six.
The x86 processors when Intel first created the privileged instructions with the 80386, copy the privilege levels of a system called multi, multi Unix is a castrated version of multi x.
Basically simplified a lot of ideas of it and realize you only really need two modes, you don't need all these rings of protection. So, you have supervisor mode for kernel code and user mode for regular process.
Anti cheat.
So pseudo isn't user mode. Yes.
A man Ty cheap software in general wants to run a really, I'm not sure about Carlton's anti cheat software but in general, it must run in the kernel. In our do things that's why they typically install a device driver.
So here's a little basically what's the real Why do people want to do nano kernels or don't why do network roles and move to monolithic is that switching between user mode and supervisor mode and the CPU is an expensive operation.
And so we try to do it less so. And just to end things up.
Basically, this is why you have to use a special instruction, in order to make a system called because the CPU has to switch from user mode to supervisor mode and order to run the kernel code.
And so normal code shouldn't be able to do this you don't do this all the time so that, so you have to a special instruction.
That's what and that's why you like buffering, because then we could yeah that's why we like to buffer things so we've reduced the number of system calls, because switching between the scenes between per user mode and student and supervisor mode is me,
it's much more expensive generally to do IO operations. But, like you're actually accessing a distance of but it can vary and so if you're doing too many system calls, it can hurt performance.
Anyway, let's stop here.
I will stick around. We will talk more about tutorial seven on Thursday, but now you should have at least the conceptual foundation for understanding what's going on there.