-
Notifications
You must be signed in to change notification settings - Fork 78
Description
We should introduce a new type of work buckets (work queue) that only one thread can execute packets from it at the same time. If no worker is working on a work packet from a single threaded work bucket, we allow popping 1 work packet from the bucket. Otherwise, the bucket is (logically) considered as 'not active' and the scheduler will not pop work from it. To implement this, we would need a worker to inform the scheduler that a packet is done.
We will introduce single threaded work packets. This allows us to implement certain packets without the need and the cost for synchronization.
Types that implements Work
(work packet type) need to specify if this type is single threaded. For single threaded work packet types, the scheduler will allow only 1 packet from each single threaded packet type being worked on simultaneously. The scheduler may maintain a map between single threaded packet types and a flag to indicate if there is an active packet for them. If the flag is false, a packet can be scheduled, and the flag will be set. Otherwise, the packets of the same type need to be skipped. Once a single threaded packet is done, the flag needs to be unset.