Hello, welcome back.
In this lesson, we going to experiment with different configurations of our shetler have created a
new project here called 32 Deshler Preemption Only.
And what we're going to do over here is disable the time slicing option in our scheduler such that our
scheduler has just preemption and we want to observe the effect that would have on our program.
So this is the project.
It's empty.
There is no school here.
We are going to go to our free ARTUS configurator, followed by opening the include fuda here and if
we are to US configurator and then we'll check what we currently have.
Currently, our schedule has configures preemptions set to one.
And then config use less lead time slicing what a time slices here.
We can simply surge control F and then.
We can say slice, we can search the words slice.
OK, time slicing, it's not written here.
Let's see.
Perhaps slicing, yes, lyson is the word rather than slice.
OK, slicing the snow here, so we have config use preemption this year, if we want to have our shetler
with time slicing, we can define time slicing here, OK?
So what I'm going to do is I'm going to define configures time slicing and then I'll set it to zero
and then we see something.
OK, so over here, close to config use preemption.
I'm going to have a new define over here.
I see defined config use time slicing, and this is zero.
OK, right, so this is our main road to see far less, I did a number of a number of tasks and run
the experiment.
So we're going to have less, say, four tasks.
Each task would have its own profiler, the task profile that we created.
So I'm going to come over here and define the profile this or come over here and then the profiler.
We're simply using TYPEDEF to create a new name for this.
You intended to underscore T word and we defined an orange task profile.
I read the task profile are green and blue.
OK, so once this is done, we going to create four tasks.
We're going to have one for orange alert controller, red ality controller blue and the controller and
green the controller.
We're going to have one task for each controller such that we end up with this.
We've done this before.
This is the same as our first task creation project.
So.
What do we have here?
We have.
Task create the name of this task, task function will be orange, the controller, it has a priority
of one.
We have this one.
The name of this task function will be the controller.
It's a priority of two.
We have this other one.
The name of it will be Red Alert.
The controller is got a priority of two as well, and then green the controller.
So in summary, we have four tasks.
Two of them have a priority of two and two of them have a priority of one.
So we have two of them with a higher priority than the others.
So what are we going to do basically is just place each task profiler and each of the task functions.
So I come down here and then I'll create a task function for blue controller task.
All I'm doing is incrementing the blue task profile in incrementing the global variable.
I'm going to do exactly the same thing for the other tasks.
I'll do it for Red and then I'll do it for orange.
Over here, and then I'll do it for green.
OK, so each task is performing a simple task, which is increment a global variable.
OK, and we know that we have blue and red with the highest priority.
OK, so now what we have to do is take the task functions and declare them at the top.
So I'll declare the task functions at the top over here.
So we have our blue, red, orange, green.
OK, so back to our three Arktos config dots each file.
Our scheduler says we are using preemption by no time slicing.
OK, what we would expect without understanding how the scheduler works, what we would expect is that
OK, since we have two tasks here with the same priority, then these two tasks should be the only ones
running.
Unless they go to sleep or they get blocked before the lower priority tasks should run.
Correct.
OK, I heard you.
So let's see what we get with this.
I'll click over here to build.
It's bugden.
OK, so we've got our you at we can delete the Ewart's.
Oh, goodness.
You out in the system clock, I cleaned the prototypes, so we simply have to bring them over here.
As this clock as well as Jhpiego system clocked in A to function Prototyp.
No, I just copied System Clock, so I copied the one for you at.
And then I'll copy the one for you.
And in fact, what I'm going to do is we don't need we don't need a new article because of the letter.
The other instance I would need to put it about, because we don't need you out for this experiment.
I'm simply going to delete you at function.
OK, so if that is deleted, then we need not call you to over here.
We need not call you at as simple as that.
OK.
Dispute over here, we're going to run the experiment, just observing the debug for you, I'll click
here to build.
OK, it's built successfully.
All right, click over here, I'll go to debuggers ASTM 30 to select the current project.
I've seen OK over here.
It's opening click to switch.
And I'll come to our live expressions window, I'll clear everything over here, Live Expression's.
I see remove oh, and I'm going to add all of our task, this stuff with orange.
I'll start with and then I'll go on to read.
And then green.
And then blue.
OK, let's run and see a click here to run.
OK, so perhaps we've not started our search to see, OK, the scheduler is not started, so let's start
a scheduler and see what we get with this configuration.
So we call X task scheduler over here, click to build.
It's built successfully, like to go to the bug for you here.
Like switch.
Over here.
So a quick run.
And we have just a blue task running.
OK, so let's see, we have blue and red having the same.
Priority, but because we said time slicing is zero, because we've disabled homeslice in the time is
not shared between the two high priority task.
Only this task is running on less blue, goes to sleep or less blue is blocked before red will have
time to run.
So just to show you what I mean, we're going to set time slice into one.
In effect, we're going to enable time slicing and then we'll see what effect that would have.
So I'll come over here to a free config file and then time in here, I'm going to set it to one less
exit.
This.
OK, let's build.
It's viewed in.
And then we click here to go to The View.
Switch.
It's Lodin.
We click here to run.
You know, as you can see, we have red and blue run, and of course, these are the two tasks with
a higher priority compared to the rest, because we've enabled time slicing.
Now the time is shared between the two high priority tasks in the system.
OK, so the question becomes, how come when we disable a tiny slice in blue was the one running, why
wasn't red selected since they have the same priority over here as a first come, first serve because
Blue was created first?
That is why Blue was the only one running when time slicing was disabled.
Because blue was created before red.
OK, so this is the effect that time slicing offers to us and of course we know why the other low priority
tasks aren't running.
These ones have to go to sleep before any time will be offered to.
These was the lower priority tasks.
So that's all there is for this lesson.
I'll see you later.
Have a nice day.