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

  • Home
  • SEARCH
  • 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 589311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:24:39+00:00 2026-05-13T15:24:39+00:00

can anyone please explain, whether accessing an array by multiple threads, where each thread

  • 0

can anyone please explain, whether accessing an array by multiple threads, where each thread is working on a different element of the array.

so there are n elements, and n threads ==>
the nth thread is working on the nth element of the array?

can any one be kind enough to explain if this is safe or not? and why or why not?

thanks
p.s. interested in the main languages c# or java, python but I would love any other inputs from esoteric language experts

  • 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-13T15:24:39+00:00Added an answer on May 13, 2026 at 3:24 pm

    This will, in most languages, be safe (provided you’re only using any specific array element within one thread at a time) – however, it’s not a good idea.

    The main problem is one of false sharing. By writing to items on the array from multiple threads, you’ll get very, very poor performance, since you’re constantly swapping cache lines. It’s a particularly bad idea in managed languages like C# and Java. For example, in C#, the CLR does bounds checking on the array. This causes any array access to access a variable (the length) stored just before the first element of the array, which constantly causes cache misses to occur. A great demo of this was done by Igor Ostrovsky at PDC – you can see the parallel performance is many times slower than handling it serially because of this issue.

    It’s a better idea to push the work into the threads as separate data variables, and “compose” your array after the fact.

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

Sidebar

Ask A Question

Stats

  • Questions 353k
  • Answers 353k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer With Jquery $(document).ready(function () { $("#live").load("ajax.php"); var refreshId = setInterval(function… May 14, 2026 at 7:38 am
  • Editorial Team
    Editorial Team added an answer Just because it's an executable file doesn't mean it's being… May 14, 2026 at 7:38 am
  • Editorial Team
    Editorial Team added an answer You first need to define a new type that describes… May 14, 2026 at 7:38 am

Related Questions

Can anyone please explain what the following two paragraphs mean, in simple english? (Taken
Update 2013-04-25: This is a popular question that is getting more attention than it
Can anyone please explain the following HAVING clause from an Access database? How can
Can anyone please explain the usage of the character constant \000 and \xhh ie
Can anyone please explain to me why the following two queries yield different results?

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.