Skip to content
Snippets Groups Projects
Commit 4d63988a authored by noraabiakar's avatar noraabiakar Committed by Sam Yates
Browse files

Cthreads: implement task queue per thread with task stealing (#528)

Cthreads classes:
- Notification queue : Manages tasks: tries or forces popping and pushing tasks.  
- Task system : manages the notifications queues; controls which queue to pop from/push to; controls spinning on queues if necessary; manages creating/joining threads. Is a singleton.
- Task group : manages synchronization on a group of tasks. 

Operation: 
- Each thread has an associated queue
- Task system _tries to_ push tasks in one of the available queues. If it is unable to acquire a lock on a queue, it tries the next in a round robin fashion. After it loops all queues if it still hasn't successfully pushed the task, it spins on a single queue until lock is acquired and task is pushed. 
- Task system _tries to_ pop a task from the calling thread's queue. If it is unable to acquire the lock, it tries to steal the task from another thread's queue, in a round robin loop. If it is still unable to pop a task, it spins on its the c...
parent bbe99176
No related branches found
No related tags found
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment