Questions tagged [concurrency]

In computer science, concurrency is a property of systems in which multiple computations can be performed in overlapping time periods. The computations may be executing on multiple cores in the same chip, preemptively time-shared threads on the same processor, or executed on physically separated processors.

Concurrency is a property of systems in which several computations can be in progress simultaneously, and potentially interacting with each other. The computations may be executing on multiple cores in the same chip, preemptively time-shared threads on the same processor, or executed on physically separated processors.

A number of mathematical models have been developed for general concurrent computation including Petri nets, process calculi, the Parallel Random Access Machine model, the Actor model and the Reo Coordination Language.

Issues

Because computations in a concurrent system can interact with each other while they are executing, the number of possible execution paths in the system can be extremely large, and the resulting outcome can be indeterminate. Concurrent use of shared resources can be a source of indeterminacy leading to issues such as deadlock, and starvation.

Performance

A common misconception is that increasing concurrency will always improve performance. While it can improve throughput for CPU bound processes by using more CPUs, and IO bound tasks by amortising the latency of each task, there is many situation where more concurrency hurts performance. Even when it improves performance it can reduce maintainability.

Examples of where concurrency doesn't help

  • The overhead of using multiple threads, exceeds the potential improvement. e.g. You have a very short task, but it takes a long time to pass it (and the data associated with it) to another thread.
    • e.g. the cost of locking a resource exceeds the time taken in the protected operation. A single threaded task might perform much better (and be simpler)
  • You are already using a shared resource to it's maximum extent. e.g. all your CPUs, hard drives, network connection are fully utilised. In this case, the overhead can increase decreasing overall performance.
  • You don't need a performance increase, but adding concurrency increases the complexity of your application. A common argument is; you have to use all your CPUs because they are there (even if there is nothing to gain and everything to lose)

References

16 questions
0
votes
1 answer

how blockchain can handle the concurrency?

I read some pages here about concurrency but I didn't give my answer, actually I am new to Bchain, consider this scenario: There is a game contract on the blockchain for 4 Players, so far three players are registered to the game and there is only…
Azzurro94
  • 123
  • 6
0
votes
1 answer

Why doesnt Ethereum support concurrency?

Why doesnt Ethereum support concurrency? https://en.m.wikipedia.org/wiki/Concurrency_(computer_science)
Nathan Aw
  • 1,954
  • 12
  • 27
0
votes
0 answers

I need to know if the gas fees can be paid after the transfer from an investment account to my cypto.com account

I have a large amount to transfer from an investment account to my cypto.com account and can't pay the gas fees upfront. Is there any way to pay the gas fees out of the profit either before the transfer or after? Please advise.