← Questions
Per-key ordered task executor on a thread pool
0
I was asked this
No reports yet. Sign in to say where you were asked it.
Build a component that takes a maximum concurrency and an existing thread-pool executor and exposes submit(key, task). Tasks with the same key must run one at a time in the order they were submitted; tasks with different keys may run in parallel, but never more than the limit at once. Many threads call submit concurrently. Explain your locking, how a key's queue is cleaned up when it drains, what happens when a task throws, and how you would test it.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding
