Hello, welcome back.
It's a lesson we should talk about, queue management.
Right, so Q's are used as Pfeifle buffers, where data is inserted at the back and removed from the
front, Kyuss can hold a finite number of fixed data items.
The maximum number of items AQ can hold is called the length of the queue.
OK, parsing data.
We have two options.
We can pass the data by value or pass by reference.
When we see pass by value, we simply insert that data into the queue, the actual data.
But when we say pass by reference, this involves using Qs to transfer pointers to the data rather than
copy the data itself into and out of the Q bite by bite.
This is the preferred way when we are passing large data to the Q and this saves memory.
So let's talk about Blockin with regards to Q When we're dealing with cuz we're going to be right into
the Q or reading from the Q.
When a task attempts to read from a Q.
It can optionally specify a block time.
This is the time the task will be kept in the blocked states to wait for data to be available from the
queue if the queue is empty.
And as soon as that data becomes available, the task automatically moves to the red state.
The same way with regards to writing, the task is placed in the blocked state if the queue is full.
If the queue is full, the task cannot write to the queue.
So it is placed in the blocked state as soon as space becomes available in the queue.
The task is moved to the ready state.
OK.
So let's see some commonly used APIs, we have this one called Excuse and the variations of it, we
have the excuse and we have sent to France into back, but we'll simply be using excuse and to represent
all of these tweets.
And each day this takes three arguments.
The first is the handle of the Q.
The second is the.
The.
They pointed to the buffer, we want to send all the variable, we want to send its address, and then
this is the block time, how much time we want to indicate to wait for this.
Right, we have the Q receive this is the handle of the Q where we want to receive where we want to
store the received data and then the amount of block time we want to wait for this.
OK, and then we have the execute you create, this is used to create the queue, the first argument
is the length of the queue, how many items that is going to hold.
And then the second argument is the size of the items.
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
pool HQ in turn to determine if.
Any of the if any of the tasks, if any, of the queues as new data, so when we use queues, it's the
task automatically receive notification that one of the queues in the queue set has new data.
The task would need to always check is a queue one queue to walk you through with the new data that
is not required when using queues it so queues that allow a task to receive data from more than one
queue without the task polling HQ to determine which one contains the new data.
So if we want to use this, we have to go to our free Arktos config file and set the config use queue
set to one.
Commonly use apps with regards to Cusato is the one for creating a Q set itself is called the X.
Q Great function and this simply takes to the length of the Q.
The length of the queue set and the length of the queue said basically dictate how many queues the queue
sets can hold and then we have the queue to set.
This allows us to add a queue to the queues it and we can also add semaphores to accuse it.
So that is why the first argument is excuse or semaphore.
So the first argument is the queue or SEMAFO.
You want to add to the queue sits and then the second argument is the handle of the queue sits.
The handle of the queue or semaphore you want to add is the first argument and the second argument is
the handle of the queue set.
OK, so that's all there is, so we shall go to our idea and see how this works practically.
I'll see you later.