1
00:00:01,090 --> 00:00:02,180
Hello, welcome back.

2
00:00:02,200 --> 00:00:05,890
In this lesson, we're going to talk about the ideal task.

3
00:00:07,030 --> 00:00:15,070
So there must be at least one task in the running state at any given moment because of this, the EIDO

4
00:00:15,070 --> 00:00:19,620
task automatically moves to the running state when there is no task there.

5
00:00:20,700 --> 00:00:23,890
The EIDO task is created automatically.

6
00:00:23,910 --> 00:00:25,540
We don't create this task.

7
00:00:26,280 --> 00:00:30,310
This task is created automatically when we start a scheduler.

8
00:00:31,050 --> 00:00:33,780
The EIDO task has the lowest priority.

9
00:00:33,790 --> 00:00:40,950
This ensures that it's never prevent a higher priority application tasks from entering the run in state.

10
00:00:42,830 --> 00:00:53,300
The EIDO task has the IDU hook function, we can add application specific code directly into the IDU

11
00:00:53,300 --> 00:00:55,410
task by using the hook function.

12
00:00:55,880 --> 00:01:02,480
So if there is some cleanup, we want to perform when the when there is no application, higher priority

13
00:01:02,480 --> 00:01:07,280
task run and we can put that clean up code in the ideal work function.

14
00:01:08,210 --> 00:01:14,710
This function is called automatically by the EIDO task once per iteration of the EIDO task loop.

15
00:01:14,780 --> 00:01:22,610
So whenever the EIDO task executes the content of the task book function, just like any function would

16
00:01:22,610 --> 00:01:23,140
execute.

17
00:01:23,360 --> 00:01:30,740
Remember, just like our functions have, just like our tasks of the task functions, you can think

18
00:01:30,740 --> 00:01:39,920
of the ideal task function that we are we we have access to to be called the Idaho function is just

19
00:01:39,920 --> 00:01:44,210
like the you can think of it simply as the task function for the EIDO task.

20
00:01:44,390 --> 00:01:50,150
And if we have a piece of code that we want to execute whenever the process is ideal, we can drop it

21
00:01:50,360 --> 00:01:52,220
into the EIDO function.

22
00:01:52,610 --> 00:01:54,530
And of course, this has to be enabled.

23
00:01:54,800 --> 00:02:01,130
We enable the use of the Idaho function by setting config use Idaho to one in our free Arktos, not

24
00:02:01,130 --> 00:02:01,720
each file.

25
00:02:02,360 --> 00:02:10,010
Also, if we want to prevent the EIDO task from consuming more CPU time, we can set config EIDO should

26
00:02:10,010 --> 00:02:13,430
yield to we can set it to one.

27
00:02:13,820 --> 00:02:21,350
And what this means is in some configuration, the idato task may be allocated at times like this to

28
00:02:21,350 --> 00:02:21,680
run.

29
00:02:23,730 --> 00:02:32,490
Either that time slice will be exhausted before another higher priority task that just got woken up

30
00:02:32,490 --> 00:02:38,580
would have the chance to run, or we could just see the EIDO task shouldn't exhaust all of its time

31
00:02:38,580 --> 00:02:45,420
slice once it's executed, once issue just uit issued, there should be a contest which.

32
00:02:46,700 --> 00:02:53,840
I don't know if this is clear, but basically this is used to prevent the EIDO task from consuming more

33
00:02:53,840 --> 00:03:02,300
CPU time and that and the reason it is framed as yield is that in a particular configuration of the

34
00:03:02,300 --> 00:03:09,350
scheduler, you can have it such that each task runs for a particular amount of time.

35
00:03:09,380 --> 00:03:13,340
This is known as the time quanta or the time slice.

36
00:03:13,820 --> 00:03:18,210
So we can see each task should run for five months.

37
00:03:19,070 --> 00:03:21,170
So five times each task runs.

38
00:03:22,440 --> 00:03:31,490
OK, so then if we said this value, the ideal task would run for five months, but it could be that

39
00:03:31,530 --> 00:03:36,060
within the running of this five times a higher priority task has just been woken up.

40
00:03:37,440 --> 00:03:45,210
We can see Eido taskin yield such that the EIDO task, its run duration is now not the time, duration

41
00:03:45,210 --> 00:03:48,780
is not the amount of time, it is just a single run.

42
00:03:49,020 --> 00:03:56,130
So it runs once and then it checks for higher priority task and then he runs again rather than running.

43
00:03:56,130 --> 00:03:59,910
All of it's five minutes before it checks for higher priority tasks.

44
00:04:00,180 --> 00:04:01,920
Who want to use the process?

45
00:04:02,580 --> 00:04:04,950
So if you do not understand this, it is fine.

46
00:04:04,950 --> 00:04:06,600
We'll go to the code and write.

47
00:04:07,020 --> 00:04:10,200
We see how the EIDO task works and you can experiment.

48
00:04:10,200 --> 00:04:16,700
Once you've seen how we write the code for the idle task, you can experiment by setting IDU should

49
00:04:16,710 --> 00:04:23,460
you add one and then setting it to zero and see the difference based on the the framework of experiments

50
00:04:23,460 --> 00:04:26,630
that we said are the practical side of this lesson.

51
00:04:27,090 --> 00:04:28,020
So that's all there is.

52
00:04:28,030 --> 00:04:28,830
I'll see you later.

53
00:04:28,830 --> 00:04:33,080
If you do not understand this, of course you can leave it in the questions analysis area.

54
00:04:33,100 --> 00:04:34,350
Oh so you have a nice day.
