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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:23:05+00:00 2026-05-15T04:23:05+00:00

A byte stream should be transferred and there is one producer thread and a

  • 0

A byte stream should be transferred and there is one producer thread and a consumer one.
Speed of producer is higher than consumer most of the time, and I need enough buffered data for QoS of my application.
I read about my problem and there are solutions like shared buffer, PipeStream .NET class …
This class is going to be instantiated many times on server so I need and optimized solution.
Is it good idea to use a Queue of ByteArray ?

If yes, I’ll use an optimization algorithm to guess the Queue size and each ByteArray capacity and theoretically it fits my case.

If no, I what’s the best approach ?

Please let me know if there’s a good lock free thread safe implementation of ByteArray Queue in C# or VB.

Thanks in advance

  • 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-15T04:23:06+00:00Added an answer on May 15, 2026 at 4:23 am

    Most important part is the design of the shared object. In my scenario reader and writer can use separate buffers (big data chunks) independently and then, only accessing a shared FIFO object like a queue should be synchronized. This way lock time is minimized and threads can complete the job in parallel. And with .NET framewok 4.0 implementation of this concept made easy :

    There’s a ConcurrentQueue(Of T) Class in System.Collections.Concurrent namespace and arrayByte is a good type to use as queue type for my scenario. There are other thread-safe collections in the namespace.

    http://msdn.microsoft.com/en-us/library/system.collections.concurrent.aspx

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

Sidebar

Related Questions

I have a byte stream I need parsed into a struct, and I also
I'm using System.IO.Stream.Read(byte[] buffer, int offset, int count) . Is there an alternative to
I want to write a raw byte/byte stream to a position in a file.
I ask because I am sending a byte stream from a C process to
When trying to display a byte stream from HLDS (Half-Life Dedicated Server) in a
What is the prefered method for creating a byte array from an input stream?
Is there a 4 byte unsigned int data type in MS SQL Server? Am
I'm reading some bytes out of a byte stream and they look like this:
The default implementation on Stream creates a new single-byte array and then calls Read.
int bufferSize = 8192; Byte[] buffer = new Byte[bufferSize]; I need to read from

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.