Let's go ahead and get started.
Okay Good morning everyone.
So, We're getting near the end here, just a couple more lectures.
I will. So today, to go over assignment 174 Simon four is just based mainly on tutorial seven and eight. A little bit on tutorial nine.
So there's a
which quite so basically I mean, these questions are really all there's not any new code or anything to do. I
know, Six is a little involved, but really not that hard.
Which question Did you want me to go over anything that's not clear in it.
Because basically, if I go through them individually I'm basically I'm just giving you the answer.
And I'm happy to give the answer. Okay, I'm.
Question one in the context of a task. What I will talk about it. So,
what is a task. So remember, I will just tell you this.
You know, we were talking about
this the hint I gave on
here as I said look at new get PID read.
And you see there's something here that says task.
So I talked about that.
Um,
so yeah so look at task in that one. okay, people ask the question.
Come on. Go.
So question to what I'm asking about here is the question two is just simply this.
You do man.
You do read here, three arguments.
Here, it takes for arguments.
So, when you make a read system call this is what's getting called.
So I will talk about these, I'm not going to talk about this right now these questions but literally all these things are just understanding the code here.
So, asked me about the code.
And then I can, that I can give you answers to things, Alan. Go ahead.
I have a question about the code, what is it a man pages social everything like for example one time I tried to do men, I think, on some see function and doesn't show up.
Why is that, and there's literally like part of like I think the current alive I don't know exactly what it is, sort of, remember that functions that are documented in man pages or user space things, Colonel functions won't be documented man pages because
they're not part of the public API.
Why not just add the colonel stuff in the main pages, because people don't call Colonel functions.
Okay. The only time you would call those Colonel functions is if you were doing kernel development as in running a module, which is basically what most people should never be doing.
So, that's not. And also, there is no guaranteed stability on Colonel functions mean a lot of stuff in man pages of stuff that you can count on. In the colonel gets changed all the time.
All they guarantee with the colonel is the system call interface.
So, so yeah, you won't find man pages up but so yeah so that yeah there's definitely things I need to discuss. And let me go, let's talk about the tutorials, I'm not going to talk about the assignments, but I'm happy to talk about the concepts that assignments
are asking about in the question is talking about the tutorials. So, I'm related to that.
Um, so you'll notice here, there is the struct called file operations. This is the thing that defines the key part of this also I think a.
Yeah, this. Yes, super node operations.
And, yeah, so this. here's super node operate yes super operations. And then there's a file operations and then I note operations.
So notice that the operations for interacting with files are abstracted in the kernel. And the reason they're abstracted essentially with virtual functions you call them and c++.
Or you could say you know as an interface.
This is all abstracted away because there's multiple implementations of these mean every special file has to have its own implementation of file operations, every file system has to have its own implementation of file operations.
because you have to be able to do things with your operating on directories and has to implement a super operations because it has to have its own super walk to define it.
So, in order to implement a file system you're just implementing you know what can you do with a super, you know, super block, what can you do with an AI node, what can you do with the file.
Since a special file is just one file it's not an entire file system we just have to implement this. but again we want to implement all of it, but these will default to being, you know, know operations.
Now, can you see the default implementation like normal files yes you can see it I'm not sure exactly.
I'm trying to think of where you would find that is also possible to make your own file system. Yes, it is.
It's very much possible to make your own file system because again it's just code. And there's even something be called an SSH Fs.
Yes, and make your own file system.
So, you a
space.
So, you ever we played with SSH Fs and sh FSM basically implements its own file system, but the file system is basically an interface for remote file system, you're implementing a whole file system locally, it's just a network file system.
And you do that using a regular process so there's something called file system and user space fuse and this user interface is what SSH Fs does. And so you see this, we and it's just implementing these things, it turns out there's just this nice interface
for doing this new space. In fact, you can implement it as a Python program, I didn't pass versions of this course if you look at old tutorials, you'll see.
For me it's a past assignment where I had an implementation of a simple file system using Python.
So, this is so so if you look at all these, you know even see what they're doing, but now one thing to note here is, you have this struck file that's as an operation here so question is What the heck is a struck file.
So you can go in here.
It's a variable defined as a struct again it's here.
And here is what a struct file is, so this is what a file is inside the kernel, it's a struct.
And there's all kinds of stuff in the years is this path, the I know to corresponds to.
I'll talk about the spin lock stuff in a second.
There's a credentials for that so you know this is the kernel space version of a file. Now remember in user space, a file is.
So.
Remember in user space we said it's a file descriptor. Is this a number, how does that get mapped to here. Well, if we look up remember what is a running process or kernel thread up.
Those are representing the kernel.
As a task.
So here's a task dropped.
And if you look inside the task dropped.
We see this
file struct.
And this is, I'm pretty sure this is the open files. Yeah, this is the open files. So what is this representative, it's representative as a pointer to files and remember pointers and arrays are kind of the same thing there.
There's lots of ways going back and forth the other so when you give a file descriptor when you say zero you're saying you're giving us basically a zero element to this.
And when you do a one, you do similar to this so like if we look now so now what we can do is we can look inside.
So, so where is all the data so I'm curious, I'm just waiting. I'm not answering your question right now because it's not it's not in the top come talking about us getting a bit shady so I'm still kind of confused as to where all the data on the structure
save like where's the file data store.
Okay that's that's that's a good question.
So right we're right there talking about the file struct
file structures and open file.
So it's an open file so that
is reference.
So know what are we looking in, when we go into prod.
And we look at all these things here.
So,
these all referring to open files. So note that.
Yeah, so, so don't close files also need to start it yes they do need to store stuff. I'm getting to that. So, first we have.
So what was I going here so so that's so the task struct is representing the open files. And, oh, that's what I was going to look at I want to look at, Linux, not linear, I want to go here, I want to go File System.
I want to go
read Right.
Right. Okay, so here's the basic input that the general implementation of the read write up functions,
says, read.
Oh, here we go. So, this called define read so this is the definition of the read system call.
This is the code that is called when you do that and so this, you'll. So, note that we have system calls have,
Colonel.
So basically, you have to do some special Glue Code special magic in order to do the system call you that special thing on the user space side to get into a system called on the colonel side to pull the arguments out and stuff you have to do some special
magic. So here, but once you.
We after you get into the kernel, you're just calling c functions.
So here we have this is a, you know, this is kind of the wrapper around it say here is the stuff again and notice here the arguments correspond exactly to what we had with a read system call.
So we have, you know, we say, this is basically saying the name of the system call. Here's the, you know, notice the arguments are in a weird format because this is a weird macro.
So it's getting rewritten but basically you can see, this is an integer. That's the file, you know file descriptor Rfd, there's a pointer to user space which is the buffer.
And there's account.
And you see that we now, so now we're just calling cases read. So this is the same thing here. And note what is the thing that does, is good you know so I'm getting to the offset part.
We all suffer and then we'll get we'll get to the, you know, you know, close process. So, notice what reads doing here is it takes in an integer here, and now we have to process this out so what is it doing with fd first What does struct FDF get position
so what's the struct fd, that's interesting.
struct fd is this.
Okay, so this is struct fd is a files and flags.
So this is, this is what we get, you know, half the get position.
So what's this fd get position here.
Now we get so this is here after you get positions or get this, because that's fd get position or.
is often the underscores and basically for I don't know that's, that is defined here as a function.
So basically you're all so okay so here's the thing that's. Ah, here we go struck file.
And it's, you know, it's looking it up.
So.
So the important thing to understand about this file struct. So, I was looking for is hoping to see it referred to current, because it has to get these
words, let's see. So here we're getting fd POS of fd F dot php file.
So here's the offset coming
doing multiple assignments.
Oh, I just say you know if if if PP o 's then position, nothing is equal to that. And that does this that cause vff right so it gets so basically it's extracting the position from the file struct.
So let me see if I can show that to you so struct file.
Soon awesome.
what,
that's where.
Here's the file structure, this is what's happening. Okay, I'm losing you guys so,
so.
so,
so I'm not expecting you to be able to read C code and understand it in depth. But
what I do want you to understand is
wow the script door
that I do want you understand.
process I use it.
So you found structures have an offset associated with it so yes exactly so the offset.
So, when you have a file that's open implicitly there's always a position in the file in which it's open, that is has to be represented explicitly in the kernel.
And if you look at the file structure, we can see the
talk I'm getting confused with them so let's go back here. So, this takes a file descriptor. This goes here VFS read. Okay so that this is a function I want to talk to a file.
Let's go. Look at that. So VHS read when we see.
there's many implementations of file systems, and this we have to. So let me go here, this is where VFS read this is what actually does the actual reading.
And if you look in there, it takes a file struct.
And in that file struct. There is now there's a weird thing here that there's an offset here passed in as an argument.
But that is also in the structure itself. I'm not quite sure why they don't just, I think it's for concurrency purposes.
But see the offset T, we have this position in the file struct that's you know that's where we are. We also have owner file mode like all these things are just it's just data in the kernel and.
And so when we go here to do a read the big thing to know is what read is really doing is it has to look up the file in the file, there's a file operation struct.
So, which basically it's a structure representing what are all the this is the operations, basically, how do I how do I work, what are the operations at work on this file.
So that's file operations here. And so we have to look in that struct and say okay for this file, the file operations read. That's the function I actually have to call to do the actual read because it will vary based on the file.
If it's a special file, it will have its own file operations. If it's a file system, it will have one shared across all the files on the file system, but one of the cases, you have to use that specific version of read, because otherwise it means nothing.
Maybe it's reading from a disk, maybe it's going to a network server, maybe it's just reading data structures in memory you don't know. But that's where it's obstructed as a function there.
And so then we just know visiting if that exists, call it.
Yes, he's like the file so operations for a file map to the file systems.
So I'm confused example why different file systems, you know we have lots of file systems, you know, remember we say
these are all the file systems of my system. So just as a basic thing exd for those 6362 they're different ones, the fat that's a Windows File System fuse, you're doing file systems and user space like SSH Fs will use this.
If we're doing proc proc is its own file system so anytime you're in proc, you're doing things. There's a dev temp Fs when you're in Dev, its own file system, and it does stop there.
There's also sis Fs if you and this is his own thing you're in a temp directory that now this temp FSS do its own thing like slash run is that definitely jump off us.
Um, well so I mean there's just, like, there's all these things that have these different implementations, secure, you know, trace of us like this.
So we create on Fs we need to find our own file system operation. So either you either have when you create your own file system you have to define your own file operations.
Yes, you can do it as a kernel module, or you can do it using what's called a file system and user space.
So fuse.
Yes. Video software interface for you it's like computers that left non privileged users create their own file systems without editing kernel code.
So you can, so you can do this and that's, again, fuse is what's used for SSH Fs applications. So let's see, do they have. So like, so I like the NT Fs 3g is is implemented as a few thing.
Various encrypted file systems are done using not in Come on, they must lyst SSH Fs. Yeah, SSH Fs uses it. Wikipedia Fs you and edit Wikipedia articles this they're real files.
You know, so basically anything you can think of that you'd want to appear as a file system, there's, you know, all these different things so that's what I say when we talk about files.
We aren't really talking about things on this, that's one example, but really files are just a system called interface it's something.
If you can do a read, write open on it.
It's a file.
That's an API. and what's behind it can be almost anything.
But yeah, so you do have to define your own so let's see.
Yeah, I think yeah I think so what you normally do is when you are in a kernel module and you're implementing a read. So, what let's go back to the code from the tutorial.
So now here, a special file is just a file that has been implemented in the kernel, you know, a special file just means I don't have a whole file system a file operations on it.
I just have a set of file operations that just apply to this file. It really is special in that way it has to have its own code. What that code does is kind of arbitrary but they're these classes of special files for that have different infrastructure
behind them character devices act more like what you'd expect, block devices have this whole separate thing because you want to allow caching of files.
So, basically block devices are what allow caches so when you talk about things like buffer cache stuff. This is stuff that can impart of this is stuff that happens with block files, you don't do any sort of buffering with character files because it doesn't
make sense to do extensive buffering say for talking to a keyboard or a mouse or something, you just need the current data, but a file, you might want the old data.
So that's you, you cash it.
But here, so ones in so interesting, but here. Notice we manipulate here the offset, because we have to increase the offset to show we've made progress on reading from the file.
And, and I'm pretty sure what happens is, whoever calls this takes the offset that we return and modifies the file start
to Wikipedia TV to upset with it. Let's say that gives more I try to Donate to Wikipedia every year at least some because.
No, it's good stuff.
So.
Now, one thing, so you don't see this much in this code, because we're nicely abstracted.
Yeah, Yeah we don't we were nice abstracted we don't really have to do this, but if you look in other things. You'll notice that there is a lot of.
When you get down to I'm trying to find a good examples here of.
Yes, that's right.
Colonel right. So it's all things like make sure you can actually access the memory
Salesforce here.
But we will see them here.
We're new tax. So what you will see is for almost all Colonel data structures, you will see new Texas.
And you may see other things or you may see and spin locks. And so.
Okay, so.
Okay, so, So when I think busy weights.
So.
So this is
making.
Well condition.
Yeah.
Okay, well where we were waiting for the kill command in the while loop
know it's not just any loop. So note.
The.
So, okay so
that's me something though in the wild to change the condition. Yes. Well,
It's a,
it's, it's more complicated
trip. I'm spacing on a bad implementation of
my bad implementation or why walk.
Okay, so let's say
okay so.
this is what you want.
So this is what your, this is what your logically are doing, which you'd want to do this is you know you set up a lock that zero and then while it's not the lock.
You know, so basically you're assuming if anyone else has so basically if this is
why lock should be. So here, if it's one.
But if it's false, it just drops right through you set it to one and then you set it to zero.
I don't want to.
I don't want to do while I actually want a while here cuz I want to test it first and do this.
So we wait so if lock here is one, we're going to just keep waiting here and spinning, but someone else will set the lock to zero.
And then we'll continue through this so like if this was single threaded, this would just continue through you would do this year, but if there's multi threaded.
There's no concept of Boolean and see it's just representative dance. Yes. Yeah, there's no constantly be a Boolean use use use use a number.
But now.
So now here's the problem, don't ever implement something that looks like this.
You can't make this work. This will break.
And the reason why this won't work.
know what the
yeah yes she.
Why can't I just implement code where I just set it to zero, check to see if it's there then take it do something and then set it to zero. This is fundamentally unsafe.
So.
So when we talk about a race condition.
So, are there safeguards the compiler code word that's kind of code. Not in cc don't see will not warn you see will do nothing, which is one reason why doing this stuff in the sea is really bad languages like Java.
And, you know, and you know highly language, and particularly things like rust have things to help you with this but this stuff is so, so why spin locks and new text, okay so
mobile is could break at the same time basically yeah you. So you.
so.
you can't make a mute text using standard see just like you can't call a system call using standard See, you have to dip down into machine code to make use of processor specific instructions which very and.
so,
java and rust are definitely better for concurrency issue.
But the only reason Java and Ruskin Well, they're better for concurrency not necessary for internals because you have to do lots of other low level operations.
You like memory management which aren't necessary so easy and it's potentially possible doing Ross but it's not clear you can do it it's how much you can do and say for us, you can always do an unsafe for us but if you do an unsafe for us, you might as
well do it and see. But anyway, so this idea. So this is a key idea I want you to understand is, you use unique so.
So,
in law.
You tax.
So we talked about.
Concurrently, access at the same time basically a summer for is just accounting very well basically you can think of as an int, but it has exclusive access properties.
Because.
So when you say sleep so the turn off or do nothing so.
So when we say sleep. I need to explain scheduling and which is something I have neglected to do
so.
So basically how does the process and Colonel threads, share the CPU, this is a little explains, I have to explain sleeping I explained scheduling because we've talked about it we talked around it but I gotta let me explain it.
What does this actually.
When you have a process.
So we're processes running.
It has exclusive access to the core, the cores and user modes, we can't access everything, but it has full access, you know, to that core.
I'm
poor.
So.
Yeah, yeah, you can't use half a core. You can't there's no such thing as using half core.
There's like threading thing, basically, you have the core or you don't have to pour, so your shared by saying, okay, you get it from this hundreds of a second.
Now this other one gets it for a hundredth of a second.
Hyper hyper threading is technically sharing the core. Yes, but it's hyper threading from, even the iOS side looks like another core.
In fact, it just happens to be cores that will interfere with each other so if you use them both for tunes that are that are unrelated you'll get MIT, you won't work that efficiently so you really need to have two threads running on the same core as opposed
to two separate crossings with different address space.
So, here we go so like if you
saw my machine here if I look at proxy Pew info. You'll notice it goes up to
seven. I have a four core machine here, that's, you know, that my laptop has four cores, but for scheduling purposes, it acts like it has eight.
All hyper threading is is you can schedule eight things but there's things going to be slow down between them.
So,
let's face it, so the colonel sets timers, to make sure it gets back to the CPU at least everyone's. So,
Where does it set the timers up.
I'll talk, I can tell overclocking later.
That's a CPU thing.
But I can mention it but so when we set timers, all that. So all it means is is. So, What really the question is, is what
price.
So we think think of sick interrupts are kind of like signals, except they come from devices, rather than processes or the colonel.
Oh, so.
It's all more complicated reality but to a first approximation, you can think of, when you hit a key on a keyboard, it's sending an interrupt, which is basically a message to the CEO, which is a message being sent to the CPU saying hey I key has been
pressed and asked to handle it.
interfaces, hardly more
USB keyboards may use.
I'm pretty sure USB keepers, don't use polling polling is almost never used on modern systems.
As overclocking is yeah that's that's beyond the scope of the things but
mouse movement mouse movement also generates interrupts. Yes. When you move your mouse and things that is sending interrupts to something that has to service it up.
In general, most devices don't use polling anymore.
Well.
So polling is just you're asked when we say polling. It just means you're periodically asked him so if the colonel just kind of said, Do you have data.
Do you have data, do you have data, do you have data, while I'm sitting here not typing, all those requests for, do you have data, do you have data are wasted effort.
If you have interrupts instead.
The main CPU just kind of keeps going until it goes home keyboard has data, better deal with it, switch back.
Yeah.
Yeah, USB chip yeah exactly so.
So what, so this is a good question what's going on when when I keyboard, my machine is frozen and key presses aren't doing anything my mouse is moving, what's going to interrupt.
So what's happening there when your machine freezes.
No longer.
Hi. Yeah, it's a classic joke a polling is the is the is the same as an issue or them saying there's no issue until any shot. Yeah. Yeah, exactly.
Here's a.
So on virtually all Linux machines, I really can't demonstrate this year.
says request, it's a key on your keyboard system request.
It's a, it's the, um, it's basically the other function of print screen.
Yep, exactly so the if you look on standard PC keyboard right beside print screen is.
It's this request is I think you have to hit shift to get it so you like to shift all sis requests and a key so it's like it's all for keyboard for key for finger thing.
So it's not something that's easy to press, but the.
So
there's part of. So, Typically when
play.
So, like on my laptop I've had situations, on my desktop computer in situations where the display is locked up.
So it turns out we have some of the hardware now is actually delegated to a process. So like your ex server and the X Window System and Wayland I can, I can't explain them right now, but basically their programs for interacting with the display keyboard
GPU and things, those can, you know, die in various ways, those can crash and crashing the way that the keyboard won't respond to the mouse above the display will be responsive, but the colonel still running and doing stuff and processes are still running.
So, the colonel has a lower level interface so you do the old sis requesting and reboot it, or you can SSH in and you'll go like a everything's fine. And in fact, when you SSH chin.
So you can SSH chin restarting misbehaving policies and the system will be fine.
When you long press your power button as your laptop, shut down. No, that's, that's actually going to the boss.
That's that's separate from the colonel because it's a power button is going to the buyer so that's the level below the colonel. That's the stuff controlling the hardware itself.
When again freeze but
yes this request can be disabled yes this request can be disabled. Most major distributions leaving enabled like I know Ubuntu does.
But
yeah, you can also. Yeah.
You can set up. So when someone a game freezes and the keyboard presses aren't doing anything the game, both for work so the keyboard starts working again right so what you're doing is that the game has locked up the display.
And it's basically you know messing with things, but the colonel still there, it's just the game has mess things up so you have to basically interrupt the game.
And so when you switch to a virtual switch to a virtual console or do other things you can alter for I think you're switching which app.
So you can basically get control the game is has which things but the other stress the operating system is so you have to decide to switch away.
I'll de force closing gap okay so.
So yeah, I never use all that for
is that Windows, I think, alt f4 his clothes on Windows I don't sure what does a Linux, but it might work also alpha for, okay.
I think it might have something like that, I don't know, I'm nice place have.
Yeah, it's a PR program basis yeah exactly so um
Oh am I here so.
So we have long pressing the button, that's a separate thing, although if you just press the power button that can be that can be intercepted by the operating system and that's where I can put the system to sleep.
So hard pressing long pressing that's just bypassing things you can't you can't stop that with the operating system.
Anyway stepping back what I'm trying to get this idea is used to this mental model of a process has control of a core.
going into, you know, saying, I'm done working do this operation for me.
And it won't get control of the core.
So I'm using obviously use process but process and Colonel threatening of the same thing. It's really, really from a Colonel's perspective it's a task, and the only difference is whether it shares memory or not, schedule will thing is the process is the
task.
So it was it.
So yeah so so yeah Eugenia you're exactly right. So when you, when you hit when Control Shift V or something which affects the graphic drivers acknowledge that the colonel, it's seen as an interrupted immediately does what I asked.
Exactly, that's exactly what it is.
So does the colonel have an array of tasks that it schedules on the CPU. Yes, exactly.
So it's it's a web link list.
It's actually I think it might be a heat but if there's actually lots of.
Traditionally, you could think of it just as an array.
But in modern systems is a lot more complicated because they want to be efficient they need to be able to find a process to run next, and things so but but the idea is that so the question how expensive the schedule.
So, um,
yeah.
So, so when you're talking about how Look how it decides what to run. If you notice here we have these priority values.
So, if you look at these are telling the scheduler what to run.
Yes, yeah so yeah so, um, is there something that like a not responding out for which, in FIFO is the schedule handling things whereas we're running we're deciding when things are run with your taxes.
So getting back to that so.
So this is the basic idea of the new text versus spin lock is that if it's a short way, you're holding on to the CPU, you're not letting anyone else what the core You're not going anywhere else have that core.
But if it's going to be a longer wait, why, hold on to that course so what else can be doing something useful. So you go to sleep, someone else will get scheduled on to that core and will run.
And then you'll eventually get run at some point.
Exactly. the process leads, not the core.
There are no processes on your system that are, you know, ready to run state. So every process you know there's all these states or process can be in like if it's blocked, it's, you know, can't run the, the textbook has a good discussion of process states.
But, if any process is not ready to run your CPU has nothing to do. And so we'll just go into an idle low power state. That's what you know that's how you would use power consumption model with modern systems.
In fact that modern systems CPUs are sleeping a lot, because a lot of times there's nothing to do because they're just waiting on us to do stuff. And when your fans spin up is because the CPU is, or they know the GPU is has stuff to do all the time.
So yeah, so it's Yeah exactly. Well it
could be doing my project for me. Okay.
So when you call them you text lock that it put it will put it to sleep with. So when you call them you text lock does that put the process to sleep. It will put it to sleep.
If the lock is taken by someone else. If it's not, you'll get it instantly, so you only sleep if you there. But,
Um, so what's so let's go back to.
So this is all the way of getting at trying to understand what's happening in tutorial eight.
So what's really happening with this code here is first of all, notice when we.
So there's a buffer. In the kernel. For mediating access between the producer consumer that's what the pipe is. And so when that buffer is full or empty the colonel automatically puts the producer the consumer to sleep, based on the corresponding read
and write system calls.
But.
yeah, if you spend locked every thread you could lock up the system entirely. Yes and no. Because remember, the colonel can always interrupt a process on a core, a core, so.
want to cooperate the multitask system.
You can't interrupt a running program running on a court, it has to basically say oh I'm done, I'm going to go to sleep.
While on a preemptively when you can be kicked off in a time.
You still have to be so.
Am I right haha hacker.
I don't classify myself that way.
I am a I do research in computer security
is Unix preemptively so. So what so notice what we're doing here is we have. So we're here, there is no buffer. This, this queue sizes just, you know, there's not even a, you know, there's only, there's no actual QN 3000 pc FIFO that's just a leftover
from this version, but here.
We're list sizes here, you know, Here we have a queue here, that's actually stated we'd all these locks here.
We're having to manage all this, the equivalent of this is in the colonel doing this exact same thing.
was managing this be a reason so it's not to say, I think the one of the big reasons why this is slower, is because the Q sizes so small.
We only have 32 entries in here, which are modern system is small, if you up this by. I suspect.
I'd be curious if anyone tries this out is that if you up this by an order of magnitude or to make this like 1024 or something. What are some bigger so I mean,
I think it would be a lot faster.
But
I haven't I haven't tested that recently. Um,
it's just because you do the real thing to see here is just because you're doing it yourself and do it manually doesn't automatically mean, it will be more efficient.
You have to optimize your implementation and there's lots of factors involved in creating an optimized implementation. It's not easy.
And the fact is, other people spend a lot of time, optimizing the Colonel's operations for accessing files and stuff. So if you use it abstraction, it's going to work pretty well I'm not saying you can't do it.
Do something faster in user space but you've got to put the effort in to optimize it and just a naive implementation is not going to be that fast. Exactly.
But now, notice
what's happened. So, one thing to realize is this, these P thread new checks up.
So this is an important point is that the advantage of doing it yourself in user space is that when you grab the law
successfully.
That doesn't involve making a system call So in principle, you're holding on to the core, where every time. Whenever you're going to put something in the queue, notice that you have to do a system called.
He advantages system calls are expensive, but it takes a lot of work to make system calls are inherently expensive, but the alternatives are also potentially expensive.
It's just not so it's not so easy to do.
So it's worth doing that. Anyway, I'm out of time.
Please come to my office hours if you've got questions.
We'll keep talking about things on on Thursday is 930 on Tuesday.
Okay.
Have a good day.
Are you holding your office hours here are you, I always do all my office hours in the office hours zoom.