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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:42:13+00:00 2026-06-17T22:42:13+00:00

Summary: There is a reader thread and a writer thread accessing same memory space

  • 0

Summary: There is a reader thread and a writer thread accessing same memory space without synchronization. Is there any run-time error( NOT logical error ) or a risk of breaking the process or threads?

I’m trying to make a simple task scheduler.

There are some worker threads and they have their own task queue.

The task scheduler push tasks to the workers’ queue.

I want the scheduler know the least busy thread, whose queue is shortest.

So I need some shared integer variables to store each queue’s length.

Each worker thread writes the length of its own queue on specific variable.

And the scheduler reads that variables to know the shortest one.

So each variable has one read and one writer.

This is R-W problem and i need a mutex.

But i don’t want any overhead and know the exact length of queues.

So I want to let the threads access the shared values without synchronization.

Is there any problem, without the inaccurate value?

  • 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-17T22:42:14+00:00Added an answer on June 17, 2026 at 10:42 pm

    There’s no law that says, for all platforms, all languages, and all standards what must happen when two threads access the same memory space without synchronization. Some platforms may allow it and add the synchronization themselves. That’s not impossible. Some may test for it in all cases and guarantee that the process will crash. That’s not impossible either.

    As generic as this question is, the answer could be anything. You might as well ask “What happens if I do something I’m not supposed to do?”

    POSIX, for example, allows the process to crash. Win32, for aligned 32-bit accesses, requires it to, at worst, give stale values. There’s no universal law.

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

Sidebar

Related Questions

Is there any way to hide Summary for CListView without loosing pagination. By summary
is there any way to get the ASP.NET validation summary control to just display
Summary : is there a way to get the unique lines from a file
Is there anyway to give text editors summary information in a tooltip for custom
Is there a tool available that can produce an HTML summary list of perl
There is a note at the end of the atomics package summary that states:
Here's my problem: there's an internal issue tracking system that has a nice summary
Summary For some reason, git commands don't work the same when I am logged
Summary I want to write a .png file as quickly as possible, without a
First time reader, first time poster (woo!) So I've been implementing my login scripts

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.