Questions tagged [concurrency]

Questiont about issues of concurrency such as synchronization and deadlocks.

Use this tag for concurrent and , concurrency primitives, models of concurrency, etc.

See also , and . See these discussions for more information on differences between the terms:


Concurrency is the study of systems in which multiple threads of computation or processes execute in the same environment and at the same time. The concurrent threads may execute simultaneously on different processors or in turns. Concurrency studies how these computations are executed and how they may interact.

Of particular interest are situations when multiple threads compete for the same resources, potentially causing for instance data races or dead locks. Concurrency theory investigates how such situations can be avoided and how programs can be proven to never run into one.

295 questions
7
votes
1 answer

Why is a program with only atomics in SC-DRF but not in HRF-direct?

In the paper "Heterogeneous-Race-Free Memory Models" [1], the authors state that a program consisting only of atomic is race free in SC-DRF but it is not in HRF-direct. I am not able to understand why this is. Can anyone explain how this can…
sanatana
  • 407
  • 4
  • 7
5
votes
1 answer

Blocking because of concurrency correctness condition

I am confused about a statement in The Art of Multiprocessor Programming: Theorem 3.6.2: Let inv(m) be an invocation of a total method. If is a pending invocation in a linearizable history H, then there exists a response such…
Jess Smith
  • 191
  • 1
  • 2
4
votes
1 answer

Identifying Coffman conditions in a given situation with deadlock

Let's suppose there are N processes and we have the following code: atomic c = 0; semaphore b = 0; proc P(i){ ... if(c.getAndInc() < N - 1){ b.wait(); } else{ b.signal(); } ... } A deadlock will occur as N - 2…
Sebastián
  • 41
  • 1
4
votes
0 answers

Why use coroutines instead of mutable objects?

What scenarios would cause coroutines to be a better (i.e. more robust, easier to modify) answer than simple mutable objects? For example, in Fluent Python, the following running average example is used to show what coroutines can do: def…
MikeRand
  • 141
  • 4
3
votes
3 answers

How can an extended linearizable history G be equivalent to sequential history S?

I am undertaking a module in Concurrent Programming where some of the new content this year covers linearizability, the Java Memory Model, and sequential consistency. Our class slides are companion slides to The Art Of Multiprocessor Programming. I…
Vixxd
  • 63
  • 5
3
votes
1 answer

What is the difference between a lock convoy and lock/thread contention?

From wikipedia on lock convoy: A lock convoy occurs when multiple threads of equal priority contend repeatedly for the same lock. Unlike deadlock and livelock situations, the threads in a lock convoy do progress; however, each time a thread…
Baksel
  • 143
  • 10
2
votes
1 answer

Compute the mode of an array concurrently

As an academic exercise, I have to write a parallel algorithm that given a sorted array of $n$ integers computes the mode (i.e. the item with the highest frequency) efficiently using $p$ processors, where $p \le n$ is a constant. The model we use to…
2
votes
1 answer

Question about 'Software Transactional Memory' by Shavit and Touitou

I've been reading the paper Software Transactional Memory by Shavit and Touitou. I understand how STM works in general but I need to understand this paper as it is the founding paper of the concept. However, I'm missing something rather fundamental…
2
votes
2 answers

What is the formal statement of the dining philosopher's problem?

I've read about it in a few places and I'm not sure I get it. Are the philosopher's allowed to act simultaneously? Do they each take 1 action simultaneously, then go on to their next action?
1
vote
0 answers

interval tree clocks

I understand how vector clocks detect concurrent events, but they are designed for a fixed number of nodes, so we can't easily add and remove nodes. And with interval tree clock we can. Could you help me grasp how they work: Interval Tree Clocks: A…
koddo
  • 131
  • 4
1
vote
0 answers

Communicating Sequential Processes: SQUASH

In C.A.R Hoare's Communicating Sequential Processes (1978), he presents the SQUASH problem: Replace every pair of consecutive asterisks "**" by an upward arrow "↑". Assume that the final character input is not an asterisk. The given solution is: X…
1
vote
1 answer

Concurrency: Is it order-independability or interruptibility of tasks?

After researching concurrency I am unable to discern if it is either of these specifically or it encapsulates both? I was also wondering if someone could provide some programming applications/real world examples I am struggling to grasp the concepts…
user51692
1
vote
1 answer

Proof for Transitivity of Weak Bisimulation ≈

I have already posted this question on the other page, but I was suggested to post it here as it might be more relevant. I am currently following a course in concurrency theory and I am currently trying to prove that the Weak Bisimulation relation…
1
vote
1 answer

Build a scheduler, to simulate parallel game flow

I am building a strategy game where units can interact with each other. As input I am getting a list of actions. I need to output a scheduler, that will tell when to start each action. The goal is to find the shortest time combination of all the…
Ilya Gazman
  • 909
  • 3
  • 15
  • 33
1
vote
2 answers

Are there any programming languages that don't support concurrency out of the box?

My class had a discussion prompt that stated "Many programming languages, especially older ones, provide no language support for concurrency. C and C++ are examples of such languages." I thought C had the fork() command, maybe it's talking about an…
ganondork
  • 13
  • 2
1
2