Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8382395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:55:14+00:00 2026-06-09T16:55:14+00:00

I have a queue that is constantly being filled with work items these items

  • 0

I have a queue that is constantly being filled with work items
these items need to be processed in a timely manner – so we have many different processors waiting to receive the items that are being processed

Each of these sub processors can only handle one set of data at a time and the data needs to be pushed to it so this is how i was thinking about doing it

It starts off with:

  1. A Process inserts items into the queue
  2. The queue should be unique – so that if a item is already in the queue it should not be reinserted (I am not sure at this time – but i might need to boost the priority on such an item , in which case a queue might not work)

I was thinking

  1. Dispatcher creates a object for each available processor
  2. Start Loop:
  3. Dispatcher Checks if there are items in the queue to be worked on
  4. Dispatcher looks for a processor that is not currently working
  5. Dispatcher Sends the work items to the Idle Processor
  6. Goto Start Loop:

My question is , how do i manage the threads on the Processor Objects
I am thinking of doing one of the following:

  1. When a Processor object gets tickled by the dispatcher – Create a thread and start processing on it, when the thread finishes let it die. – Obvious Cons: Creating and killing a bunch of threads (Will a thread pool alleviate this issue?)
  2. Creating a dedicated thread for each processor that will do its work and then check the processor object to see if there is any more work for it to do – Obvious Cons: 50 Processors means 50 threads , and the synchronization might get difficult
  3. There is probably a simpler way to do this

Thank you
Edit

I seem to have been unclear – the data does not have to be processed by all processors
It can be processed by ANY of the processors – however once a processor start processing data we cannot send it any new data until it has finished processing – meanwhile new data is pouring into the queue and the manager needs to keep dolling out the data as fast as it can –

So the loop is like this again

  1. Dispatcher looks to see if any of the processors are available and there are items in the queue to process
  2. Dispatcher chooses a idle processor and pops the top data from the queue and sends it to that processor to process it
  3. the dispatcher waits a little bit and pools again

at the processor side – the data is sent to an external system ( a somewhat lenghty process) and the processor waits for the external system to return and it stores the processed data – only then is the processor available to except a new set of data off of the queue

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T16:55:15+00:00Added an answer on June 9, 2026 at 4:55 pm

    The simplest way I have managed to do a similar queue management system is by using the built in Queue object in C#.

    public volatile Queue<MessageObject> q = new Queue<MessageObject>();
    

    Now the message must be sent to each thread, and if you don’t really want to deal with synchronization, lock and pop the top object off. You could spool up a thread, or use an EventHandler. If using an EventHandler, you need to synchronize on both threads but it should be faster.

    lock(q) { 
        this.nextcommand = q.Pop();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Queue that contains a collection of objects, one of these objects
I have a queue structure that is being used by several pthreads. The threads
We have a MSMQ Queue setup that receives messages and is processed by an
I have a queue that always needs to be ready to process items when
I have a single AMQ queue that receives simple messages with string body. Consider
I have something like this in my code: worker.setObject(queue.poll()); I want a queue that
I have a message handler, which consumes from a JMS queue and that sends
I have a class that uses priority queue to display 5 strings in ascending
We have an application that is essentially implementing its own messaging queue. When a
Let's say that I have a module that has a Queue in it. For

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.