Oleg Varaksin
Jan 19, 2025

I'm not sure about optimization in Scheduler chapter with PriorityBlockingQueue. The problem is that the tasks with priority will be put into the queue at the right positions. And this costs performance. This is like putting data into a tree data structure with binary search algorithm. Instead of that I would introduce 3 queues without priority and put tasks into the proper queue dependent on the task's priority. A separate consumer thread should read (poll) all 3 queues in a right order (from high important to less important). That's e.g. how I did it in my real-time project.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Oleg Varaksin
Oleg Varaksin

Written by Oleg Varaksin

Thoughts on software development. Author of “PrimeFaces Cookbook” and “Angular UI Development with PrimeNG”. My old blog: http://ovaraksin.blogspot.de

No responses yet

Write a response