Scheduling on a crossbeam bounded channel

I hope it's OK that I'm asking for help on a design, not code.

I've got a worker taking requests from a number of clients, each of which puts work items on a finite size queue. Clients block when trying to put an item to a full queue. When the worker takes an item from the queue, it selects one of the blocked clients. I just realized that my selection algorithm is biased. I can try to figure out how to do that better, but a crossbeam bounded channel might do the selection for me.

Say that I change my code to use a MPSC bounded crossbeam channel for the queue. If a number of clients are blocked on a full channel, what happens when the worker removes an item? I'd like to select clients in the order they attempted to post items. Is that what a crossbeam bounded channel does?

I don't know, but my guess is that it is not fair. To be sure, you could ask on the crossbeam github.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.