[Autogenerated] let's now examine PICO processes,
PICO processes were created for the implementation of the
Windows subsystem for Linux version one.
So first in order to use it, we have to install some kind of Linux distribution.
And so let's uh let's do that.
The first thing you need to make sure that you have this uh feature
enabled in the settings so you can look for the features,
Windows features, turn off or turn on Windows features.
It should be enabled by default these days,
but if it's not just need to make sure for that this is
enabled or enable that if you need to here,
you can see the option Windows subsystem for Linux box,
that's the one.
Once you do that we can go to the Microsoft.
That would be the easiest way to go and search for something like
Linux and hopefully find a distribution that we like and install in
the old days there was just one distribution.
But now we have many Destro's that are available so we can look
for Linux and you can definitely choose one of the Destro's that
you might feel comfortable with.
Just for fun.
Let's just grab this ubuntu version here.
Okay, so now that we have this um to offer to us,
we can click get it might take some time to install because it is
downloading a full blown Linux distribution.
So it might take time depending on your network connection
and the speed of your machine of course.
So I'm going to pause this video until the um the installation is complete.
So we need to perform some update here to Windows.
So here's the U.
R.
L.
Let me just grab it and and I've already paste it in here so
something that we need to um to download.
So let's just download that.
It's not very complex,
just a few things that you just have to do to have the
proper support for WsL version to actually.
Although PICO processes are only used in WsL version one,
but I want to demonstrate both of these things.
So let's start with installing the prerequisites and again,
it might take a little bit of time to do that.
Oh here.
It is not very uh slow for our purposes.
Let's go back to our ubuntu here and try this thing
again to open uh the distribution, see if that works now.
So now it's installing,
it will take a few uh I'm not sure it's minutes but it will
take some time going to pause the video again.
And as part of that,
you need to add your or set your name for the root user
and create some kind of password.
And so now we're essentially good to go and we are in a
Linux environment within Windows.
And you might be wondering how are all these things working?
What can we expect to find here.
So first let me just go to open another command window here to get
some details about my WsL distributions here.
So if I do w sell dash l we should be able to see the list of our distribution,
which of course now contains just one.
This uh Ubuntu distribution of 18.4.
We can add the dash V here to see the version that is
running of WsL either one or two.
So for the purpose of my first demonstration we need to use WsL version one.
Fortunately it's very easy to switch between the
versions by using WsL set version option.
So I'm going to copy here the machine.
Uh Ubuntu Well maybe I don't even need to do that, let's do that.
Well, I guess we have to provide the name which can be changed,
but for now let's just stick with that and change to version one.
It takes a few seconds, it says minutes,
but in fact it should take a few seconds to make the conversion.
So it's always possible to move between W cell one
and W sell to as you see fit now.
What's the problem with WsL one?
Why do we need PICO processes in the first place?
If you think about it when you have a Linux process process doesn't really
need anti DLL or any subsystem dealers or PBS or tbs.
These things are completely useless to Linux processes
because they have no idea they exist,
they wouldn't know what to do with them anyway.
So starting with the minimal process makes sense.
We don't need all the Windows stuff there because Linux has no idea
and will never use that stuff on the other hand,
Linux has its own binaries and they have their own system cause they need
to run so made the transition just looking here at the version to make sure
that actually works as expected and it does.
So if I do WsL one,
I'm going to launch the normal um distribution that I
have here in its current version,
which in this case would be uh version one of WsL And
the thing is that in version one, the Linux kernel is not being used,
in fact,
the Windows kernel is acting as the Linux kernel but not very easy
because of course we have to use the system calls provided by Linux
and some somehow execute them on Windows,
how can that really work?
And that can work because of the pickle provider,
the provider is the one that's actually implementing the Linux,
so to speak, by invoking Windows system calls.
Let me show you a few things about that.
So here's in my I mean my normal,
well normal compared to machine you can do and can see things like
do things like l s let me just go to uh you can see mm T c here is
where the C drive is being mounted and here we can find the Windows
and system 32 of course we have to be very mindful of uh case
because this is now Linux.
So here I am in my system 32 directory and can do things like LS dash
L and even pipe them to more showing all the files and directories in
this um in this directory of course,
except the hidden ones and just piping that tomorrow.
So I'll be able to to scroll one page or one item at a time.
So if I open task manager now with WsL one we can see,
we'll be able to see that LS is running here is the less that's the L S process,
It has a normal process,
just like any other but it is in fact the PICO process and we
know that in Linux there is no typical extension to executable
that just have these names and you can see more here as well
running at the same time.
Now obviously task manager is very limited to what it can show.
By the way,
it does have this innate processes running here which are also Linux processes
but let's look at process explore with process Explorer,
we can find LS one once again or and more as well and again we look at the,
the information here at the bottom and we don't see any handles
and we don't see any DLS and this makes sense because for one
Linux doesn't use handles as windows does,
it has a different way of talking to various aspects of its kernel and secondly,
in terms of DLS because PICO processes are based on
minimal processes there very well protected,
so Process Explorer is not able to _________ those processes.
However, if I look at system explore once again,
which we know has some greater power because it has a
kernel driver that it is not ashamed to use.
Here's ls we can right click and go to modules and here we can find that.
In fact,
there are many modules loaded into the space of of these LS process
and they're all Linux modules notice the names,
they're ending with S O short for shared object,
this is the equivalent of uh, Windows DLL,
so to speak,
just libraries and you can see there's nothing window we hear anywhere,
there's nothing here which looks like Windows and you can see that
the full path it's actually being shown here,
which is where my ubuntu system is located on my machine.
So they're both running on the same platform here,
so they have access to the same file system.
That's really the point here, it's not about running a virtual machine,
Linux virtual machine and Windows that has been possible to do for many years.
Now, that's not really the point.
The point is to have a Linux machine that has an effect on
a Windows machine and and vice versa.
So we have less here and the same idea goes for more.
Here's more, we can look at the modules of more and you can see that again,
it has its own modules that are being loaded from whatever
location the destroyer is being installed in.
They also have threats by the way.
And again, it's difficult to see details from Process Explorer,
but we can see that there's one thread in LS that is running
and this is also known as the PICO thread.
So pick a thread has is been running or is running
within a PICO process of course, because that's kind of the way things are.
And the PICO thread is very well protected, just like PICO process.
That's really the secret of how this works.
So, if you think about it,
Linux system calls a very different than Windows system calls,
for example, Linux system calls are provided the parameters.
The coin convention is different.
It's provided with six registers and you can only use
registers and no more than six parameters.
And of course these registers are different than the ones used by Windows.
But in any case, the system calls themselves are actually different.
So the pickle provider is there to perform to perform the conversion from
a Linux system called to some kind of equivalent of the Windows system
called or internal functions within the kernel.
And so to write a pickle provider,
we have to actually use the Windows capabilities which are beyond what people
have access to because you need to use internal functions and in any case the
Windows source code is currently not public.
So this was a great idea and it is working fairly well.
It's not uh it's not bulletproof,
it has some issues using Wsl version one using the pickle
provider and that's our Microsoft at some point decided to
ditch it in in favor of WsL version two,
which is currently the diversion to use and we've
we've done the switch to version one, let's switch back to version two.
And with version two there's a kind of different technology,
they're called the hybrid virtual machine where the Linux kernel is used and
is used to actually implement or use or the to be the real colonel for the
Linux because obviously Linux process has the best chance of working correctly
with the Linux kernel on the other side,
rather than a pickle provider,
Microsoft has to kind of re implement and perhaps fix and and continue to
extend based on changes in the real Linux kernels and so they have a
different mechanism for that from all intensive purposes,
it looks the same so I can do things like L.
S and use more just like previously and everything seems to be the same.
However, if you look at process Explorer task manager or whatever,
there is no L S here anywhere, there is no more,
there are no PICO processes.
That idea was abandoned and there are many benefits in terms of
performance and other aspects of Linux that are used or or actually
being um used here by W cell version two and being taken advantage of
because really the Linux kernel is the most appropriate component to
handle Linux system calls.
So, W cell to use a very different kind of technology more powerful.
It even allows us to create GUI based applications show real
Linux windows within a windows environment.
So it's something that you might want to look up
online and see how you can do that.
It's just a matter of installing certain things and you can
install in this Linux this to anything you you typically
install on a normal Linux application, a sorry system.
And so you can use the sudo app t install things like that.
If you're familiar with the Linux distributions such as ubuntu,
you can do these things without any any kind of difference compared
to real Linux distribution and in the future,
Windows 11 also support running android applications on top of WsL
two because android is really based on Linux,
so it can be used or leverage in the same way to run these things
native on Windows based on this same technology.
W cell too.
So I think it's very exciting and very,
very powerful that you now can do testing whatever you want to
do with Linux just as you do with Windows