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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:44:13+00:00 2026-05-20T23:44:13+00:00

If I have an application that that produces data slowly but consumes it quickly,

  • 0

If I have an application that that produces data slowly but consumes it quickly, would it be a good candidate for a double buffer implementation? The basic idea would be to have the producer fill the back buffer while the consumer processes the front buffer.
I do not want the client to appear as though it is waiting for data. I want to balance out the producing and the consuming. How can I achieve this functionality? Even if I have a back buffer thread…. it will have to be synchronized with the front buffer thread so the front buffer knows when there is new data (buffers been swapped). If back buffer thread takes too long to produce its data then the front buffer will have to wait to process it.

void fill_back_buffer() {

   //wait to fill buffer
   //fill back buffer


   //swap buffers and notify other thread
}

void process_data() {

  //wait to see if buffers have been swapped


  //buffers been swapped so send data out
  //while sending data out start filling back buffer with new data
}
  • 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-20T23:44:14+00:00Added an answer on May 20, 2026 at 11:44 pm

    If your application “produces data slowly but consumes it quickly”, that’s going to limit the gains you can get from double-buffering.

    If it takes 10 seconds to produce a buffer full of data, and 1 second to consume it, double-buffering can increase your throughput 10%, but if producing and consuming both take the same amount of time, double-buffering may double your throughput.

    For example:

    • produce_time = 10 seconds
    • consume_time = 1 second
    • number of buffers = 100

    sequential processing = 100 * (10 + 1) = 1,100 seconds
    double-buffered = 100 * 10 = 1,000 seconds

    But, if we change the parameters so consume_time = 10 seconds:

    sequential processing = 100 * (10 + 10) = 2,000 seconds
    double-buffered = 100 * 10 = 1,000 seconds

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

Sidebar

Related Questions

We have a web application that produces reports. Data are taken from a database.
I have some data (produced by a legacy application) that I know is invalid
I have a C# application that calls a stored procedure that produces an xml
I have an application, built using MVC, that produces a view which delivers summary
I have a Java swing application with a button that produces a popup window
We have an application that produces a database on disk. The database is made
I have a java servlet that upon a request crunches on data and produces
I currently have some code that will produce a crash dump when my application
Background Currently, I am working on a Rails application. I have different products that
I have application that makes different queries with different results so the caching in

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.