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 7441119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:57:39+00:00 2026-05-29T10:57:39+00:00

A typical producer-consumer problem is solved in python like below: from queue import Queue

  • 0

A typical producer-consumer problem is solved in python like below:

from queue import Queue
job_queue = Queue(maxsize=10)    

def manager():
    while i_have_some_job_do:
        job = get_data_from_somewhere()
        job_queue.put(job) #blocks only if queue is currently full

def worker():
    while True:
        data = job_queue.get() # blocks until data available
        #get things done

But I have a variant of producer/consumer problem (not one strictly speaking, so let me call it manager-worker):

The manager puts some job in a Queue, and the worker should keep getting the jobs and doing them. But when the worker get a job, it does not remove the job from the Queue(unlike Queue.get()). And it is the manager which is able to remove a job from the Queue.

So how does the worker get the job while not removing the job from the queue? Maybe get and put is OK?

How does the manager remove a particular job from 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-05-29T10:57:40+00:00Added an answer on May 29, 2026 at 10:57 am

    Perhaps your works can’t remove jobs completely, but consider letting them move them from the original queue to a different “job done” queue. The move itself should be cheap and fast, and the manager can then process the “job done” queue, removing elements it agrees are done, and moving others back to the worker queue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The typical Python threadpool will have a structure like this one: def run(self): while
I'm a bit stuck on the multiple consumer/producer problem. It appears in my lecture
I was looking at the usage example based on a typical producer-consumer scenario at:
I have typical producer-consumer application. I have BlockingCollection to provide producing-consuming mechanism. What I
Typical Event Log message looks like below. There you can find very interesting fields
I have a typical producer, consumer pattern. If the producer sends an object over
A typical code fragment obtained from the YouTube embed feature looks like this: <object
Typical way of creating a CSV string (pseudocode): Create a CSV container object (like
The typical ConfigParser generated file looks like: [Section] bar=foo [Section 2] bar2= baz Now,
The typical way of selecting data is: select * from my_table But what if

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.