10 Handling & Shared resource problem Flashcards

1
Q

What uses task priorities to decide which tasks run?

A

The scheduler uses task priorities on deciding which task to run.

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

If a task is running and an interrupt request occurs what happens?

A

As the interrupt is a hardware feature it pre-empts the software task.

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

What uses the interrupt priorities to decide which interrupt handler executes first?

A

FreeRTOS Kernel

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

What is the FreeRTOS interrupt safe API.

A

It is the use of “FROM_ISR” at the end of a API Function, e.g. xSemaphoreGiveFROM_ISR()

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

What is the functionality behind xTaskPriorityWoken?

A

Set by an interrupt safe API if a context switch is required.

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

What is the functionality behind portYIELD_FROM_ISR()?

A

Request a context switch when an interrupt handler completes execution.

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

What are some possible problems with interrupts?

A

Resource sharing problem. Interrupt request during not-atomic code. Deffered interrupt processing.

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

A binary semaphore may be given many times but may only be taken once. This can result in missed interrupt request processing if a binary semaphore is used to synchronise the interrupt handler and the interrupt processing task. What else could be used to ensure this problem doesn’t happen?

A

A counting semaphore can be used. On creation the counting semaphore is given a max count and initial count. The counting task is incremented when the semaphore is given and the counting semaphore is decremented when the semaphore is received.

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

What are some possible problem scenarios with resource protection?

A

Sharing of peripherals.
Non-Atomic code.
Use of non-re-entrant function.

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

What are some solutions for those issues?

A

Disable interrupts while task is using the resource.
Use a mutex to allow exclusive access to a resource.
Use a gatekeeper task where only one ask is allowed to change a resource.
Critical code: taskENTER_CRITICAL and taskEXIT_CRITICAL

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