DALI icon indicating copy to clipboard operation
DALI copied to clipboard

Use semaphore and spinlock in tasking::Scheduler

Open mzient opened this issue 6 months ago • 8 comments

Category:

Other (e.g. Documentation, Tests, Configuration)

Description:

Separate queue lock

Previously the scheduler featured just one mutex to guard everything. This PR adds a separate lock for the queue of ready tasks. This reduces contention when popping tasks by worker threads.

Use semaphore for queue state tracking

Prior to this change, a condition variable was used to wake up worker threads when ready tasks became available. This PR uses a semaphore which is raised when a task becomes ready and lowered before one is popped.

Additional information:

Affected modules and functionalities:

Key points relevant for the review:

dali/core/exec/tasking_test.cc

  • [X] Existing tests apply
  • [ ] New tests added
    • [ ] Python tests
    • [X] GTests
    • [ ] Benchmark
    • [ ] Other
  • [ ] N/A

Checklist

Documentation

  • [ ] Existing documentation applies
  • [ ] Documentation updated
    • [ ] Docstring
    • [ ] Doxygen
    • [ ] RST
    • [ ] Jupyter
    • [ ] Other
  • [X] N/A

DALI team only

Requirements

  • [ ] Implements new requirements
  • [ ] Affects existing requirements
  • [X] N/A

REQ IDs: N/A

JIRA TASK: N/A

mzient avatar Jul 11 '25 07:07 mzient

CI MESSAGE: [31490037]: BUILD STARTED

dali-automaton avatar Jul 11 '25 08:07 dali-automaton

CI MESSAGE: [31490386]: BUILD STARTED

dali-automaton avatar Jul 11 '25 08:07 dali-automaton

CI MESSAGE: [31490037]: BUILD FAILED

dali-automaton avatar Jul 11 '25 08:07 dali-automaton

CI MESSAGE: [31495691]: BUILD STARTED

dali-automaton avatar Jul 11 '25 10:07 dali-automaton

CI MESSAGE: [31496995]: BUILD STARTED

dali-automaton avatar Jul 11 '25 11:07 dali-automaton

CI MESSAGE: [31495691]: BUILD FAILED

dali-automaton avatar Jul 11 '25 11:07 dali-automaton

CI MESSAGE: [31496995]: BUILD FAILED

dali-automaton avatar Jul 11 '25 11:07 dali-automaton

CI MESSAGE: [31496995]: BUILD PASSED

dali-automaton avatar Jul 11 '25 15:07 dali-automaton