7 Queues Flashcards

1
Q

What is a Queue?

A

A queue is an efficient way to transferring data between tasks or interrupt handlers and tasks.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Where is a queue used?

A

A queue is used for task-tot-task, task-to-interrupt handler, or interrupt handler-to- task communication.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How many of fixed-size data items does a queue store?

A

A finite number of data items can be stored in a queue.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

A queue is also known as ‘FIFO’ what does FIFO stand for?

A

FIFO stands first in first out, meaning whatever is at the front (head) of the queue gets out (read) first.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Explain the difference between Queue by Copy and Queue by Reference?

A

Queue by copy- Sends a copy of the data byte by byte. So that both that sender and receiver have a copy of the data.
Queue by reference – Sends a pointer of the data. Used for large data items.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the Advantages to Queue by Copy?

A

Both the sender and receiver have a copy of the data so even if the sender changes or deletes the data after it’s sent the receiver still has a copy.
Can be reused.
A function can send a stack variable to a queue.
Can transfer directly without allocating a buffer.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How to create a queue?

A

QueueHandle_t timeQueue=NULL;
timeQueue=xQueueCreate(5, sizeof(uint8_t));
vQueueAddToRegistry(timeQueue, “Time Queue”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What options are there to write to a queue?

A

xQueueSend()
xQueueSendToBack()
xQueueSendToFront()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How to write and read from a queue?

A

xQueueSend()
And
xQueueReceive()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How would a queue now where the data is coming from if it is receiving from multiple sources?

A

Add an Id data field in a structure.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Where is Queue by Reference useful?

A

When sending large data that would take up a lot of memory if it was to be copied byte by byte.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What must you consider when using queue by reference?

A

Communication issues, such as if the send deletes or changes the data while to receive is reading it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly