Use semaphore and spinlock in tasking::Scheduler
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
CI MESSAGE: [31490037]: BUILD STARTED
CI MESSAGE: [31490386]: BUILD STARTED
CI MESSAGE: [31490037]: BUILD FAILED
CI MESSAGE: [31495691]: BUILD STARTED
CI MESSAGE: [31496995]: BUILD STARTED
CI MESSAGE: [31495691]: BUILD FAILED
CI MESSAGE: [31496995]: BUILD FAILED
CI MESSAGE: [31496995]: BUILD PASSED