Skip to content

Deadlock possible with new allocator #40

Closed
@f-bro

Description

@f-bro

The new allocator uses a spin-lock to synchronize the access to the ALLOCATOR(LockedHeap).

Following sequence can result in a deadlock:

  1. ISR1 is entering the lock.
  2. ISR1 is preempted. ISR2 has higher priority and tries to access the lock. Scine the lock is already entered by ISR1, ISR2 has to wait in a loop until ISR1 has left the lock.

ISR1 and ISR2 don't make progress => Deadlock

Solution: Use the PRIMASK register on cortex m processors to synchronize the critical section by disabling interrutps.

See pull request for CortexMHeap rust-embedded/embedded-alloc#6

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions