This document discusses resource management and control techniques in embedded systems, including critical sections, mutexes, priority inversion, and gatekeeper tasks. It explains why resource management is necessary when accessing peripherals and shared variables from multiple tasks or interrupts. It also covers using critical sections and mutexes to protect access to resources, preventing priority inversion, and implementing a gatekeeper task to provide mutual exclusion without the risks of priority issues or deadlock. Homework assignments involve using these techniques to protect UART output from multiple tasks.
2. Why we need to do this?
Accessing Peripherals
I/O operations
Outer devices
Read, Modify, Write Operations
Register operations
File operations
Non-atomic Access to Variables
The variable access can’t be finished in once.
Function Reentrancy
4. Scope
When and why resource management and
control is necessary.
What a critical section is.
What mutual exclusion means.
What it means to suspend the scheduler.
How to use a mutex.
How to create and use a gatekeeper task.
What priority inversion is, and how priority
inheritance can reduce (but not remove) its
impact.
15. Deadlock (or Deadly Embrace)
Recursive Mutexes
A task held Mutex, and call other function
need same Mutex……..Who did that stupid
things?
• A, B Task held other’s Semaphores……. I
think the programmer need to study logic.
19. Gatekeeper Tasks
Gatekeeper tasks provide a clean method
of implementing mutual exclusion without
the risk of priority inversion or deadlock.
A gatekeeper task is a task that has sole
ownership of a resource. Only the
gatekeeper task is allowed to access the
resource directly—any other task needing
to access the resource can do so only
indirectly by using the services of the
gatekeeper.
20. Homework
Create a gatekeeper task to print via
UART
Creat 2 task to send msg. into queue for
gatekeeper to print
Simulate a interrupt and send msg. to
the front of the queue.