1
00:00:00,690 --> 00:00:01,970
Hello, welcome back.

2
00:00:02,060 --> 00:00:04,590
It's a lesson we should talk about, queue management.

3
00:00:06,010 --> 00:00:13,840
Right, so Q's are used as Pfeifle buffers, where data is inserted at the back and removed from the

4
00:00:13,840 --> 00:00:18,880
front, Kyuss can hold a finite number of fixed data items.

5
00:00:19,420 --> 00:00:24,630
The maximum number of items AQ can hold is called the length of the queue.

6
00:00:25,780 --> 00:00:27,300
OK, parsing data.

7
00:00:27,670 --> 00:00:28,720
We have two options.

8
00:00:28,720 --> 00:00:31,750
We can pass the data by value or pass by reference.

9
00:00:32,020 --> 00:00:37,200
When we see pass by value, we simply insert that data into the queue, the actual data.

10
00:00:37,570 --> 00:00:44,080
But when we say pass by reference, this involves using Qs to transfer pointers to the data rather than

11
00:00:44,080 --> 00:00:48,220
copy the data itself into and out of the Q bite by bite.

12
00:00:48,640 --> 00:00:55,090
This is the preferred way when we are passing large data to the Q and this saves memory.

13
00:00:56,610 --> 00:01:03,660
So let's talk about Blockin with regards to Q When we're dealing with cuz we're going to be right into

14
00:01:03,660 --> 00:01:05,580
the Q or reading from the Q.

15
00:01:07,130 --> 00:01:09,740
When a task attempts to read from a Q.

16
00:01:10,630 --> 00:01:13,580
It can optionally specify a block time.

17
00:01:14,140 --> 00:01:20,140
This is the time the task will be kept in the blocked states to wait for data to be available from the

18
00:01:20,140 --> 00:01:22,170
queue if the queue is empty.

19
00:01:23,220 --> 00:01:28,980
And as soon as that data becomes available, the task automatically moves to the red state.

20
00:01:30,690 --> 00:01:37,540
The same way with regards to writing, the task is placed in the blocked state if the queue is full.

21
00:01:37,560 --> 00:01:41,130
If the queue is full, the task cannot write to the queue.

22
00:01:41,460 --> 00:01:46,750
So it is placed in the blocked state as soon as space becomes available in the queue.

23
00:01:47,130 --> 00:01:49,440
The task is moved to the ready state.

24
00:01:51,040 --> 00:01:51,610
OK.

25
00:01:52,750 --> 00:02:00,010
So let's see some commonly used APIs, we have this one called Excuse and the variations of it, we

26
00:02:00,010 --> 00:02:06,550
have the excuse and we have sent to France into back, but we'll simply be using excuse and to represent

27
00:02:06,550 --> 00:02:07,420
all of these tweets.

28
00:02:07,630 --> 00:02:10,440
And each day this takes three arguments.

29
00:02:10,810 --> 00:02:12,610
The first is the handle of the Q.

30
00:02:13,620 --> 00:02:15,720
The second is the.

31
00:02:17,090 --> 00:02:17,840
The.

32
00:02:19,120 --> 00:02:25,570
They pointed to the buffer, we want to send all the variable, we want to send its address, and then

33
00:02:25,570 --> 00:02:29,470
this is the block time, how much time we want to indicate to wait for this.

34
00:02:30,990 --> 00:02:39,270
Right, we have the Q receive this is the handle of the Q where we want to receive where we want to

35
00:02:39,270 --> 00:02:46,320
store the received data and then the amount of block time we want to wait for this.

36
00:02:47,200 --> 00:02:52,840
OK, and then we have the execute you create, this is used to create the queue, the first argument

37
00:02:52,840 --> 00:02:57,070
is the length of the queue, how many items that is going to hold.

38
00:02:57,370 --> 00:03:01,360
And then the second argument is the size of the items.

39
00:03:02,020 --> 00:03:10,540
OK, now let's see cuz it's cuz it's allow a task to receive data from more than one Q without a task

40
00:03:10,540 --> 00:03:13,210
pool HQ in turn to determine if.

41
00:03:14,340 --> 00:03:22,080
Any of the if any of the tasks, if any, of the queues as new data, so when we use queues, it's the

42
00:03:22,080 --> 00:03:28,930
task automatically receive notification that one of the queues in the queue set has new data.

43
00:03:29,490 --> 00:03:36,690
The task would need to always check is a queue one queue to walk you through with the new data that

44
00:03:37,200 --> 00:03:42,660
is not required when using queues it so queues that allow a task to receive data from more than one

45
00:03:42,660 --> 00:03:47,910
queue without the task polling HQ to determine which one contains the new data.

46
00:03:47,940 --> 00:03:55,860
So if we want to use this, we have to go to our free Arktos config file and set the config use queue

47
00:03:55,860 --> 00:03:56,730
set to one.

48
00:03:58,680 --> 00:04:04,020
Commonly use apps with regards to Cusato is the one for creating a Q set itself is called the X.

49
00:04:04,030 --> 00:04:10,170
Q Great function and this simply takes to the length of the Q.

50
00:04:11,380 --> 00:04:17,440
The length of the queue set and the length of the queue said basically dictate how many queues the queue

51
00:04:17,440 --> 00:04:22,880
sets can hold and then we have the queue to set.

52
00:04:23,110 --> 00:04:28,300
This allows us to add a queue to the queues it and we can also add semaphores to accuse it.

53
00:04:28,450 --> 00:04:32,120
So that is why the first argument is excuse or semaphore.

54
00:04:32,920 --> 00:04:35,320
So the first argument is the queue or SEMAFO.

55
00:04:35,320 --> 00:04:40,270
You want to add to the queue sits and then the second argument is the handle of the queue sits.

56
00:04:40,780 --> 00:04:45,580
The handle of the queue or semaphore you want to add is the first argument and the second argument is

57
00:04:45,580 --> 00:04:47,020
the handle of the queue set.

58
00:04:47,900 --> 00:04:54,560
OK, so that's all there is, so we shall go to our idea and see how this works practically.

59
00:04:54,770 --> 00:04:55,660
I'll see you later.
