Questions tagged [concurrency]

Concurrency is a property of systems in which several processes are executing at the same time.

Concurrency is a property of systems in which several processes are executing at the same time.

368 questions
129
votes
9 answers

The difference between "concurrent" and "parallel" execution?

What is the difference between the terms concurrent and parallel execution? I've never quite been able to grasp the distinction. The tag defines concurrency as a manner of running two processes simultaneously, but I thought parallelism was exactly…
Louis Thibault
  • 2,178
  • 3
  • 16
  • 17
91
votes
10 answers

How to explain why multi-threading is difficult

I am a fairly good programmer, my boss is also a fairly good programmer. Though he seems to underestimate some tasks such as multi-threading and how difficult it can be (I find it very difficult for anything more than running a few threads, waiting…
Mr Shoubs
  • 841
  • 1
  • 8
  • 12
83
votes
2 answers

Why are concurrent writes not allowed on an SQLite database?

I am doing database programming using Java with SQLite. I have found that only one connection at a time to the database has write capabilities, while many connections at once have read capability. Why was the architecture of SQLite designed like…
SteelToe
  • 1,539
  • 3
  • 13
  • 22
78
votes
1 answer

Is there a difference between fibers, coroutines and green threads and if that is so what is it?

Today I was reading several articles on the Internet about fibers, coroutines and green threads, and it seems like these concepts have very much in common, but there are slight differences, especially when we talk about fibers and coroutines. Is…
DejanLekic
  • 913
  • 1
  • 7
  • 8
64
votes
10 answers

How do I mitigate a scenario where a user goes to pay, but the price is changed mid-request?

This is kind of similar to the Two Generals' Problem, but not quite. I think there is a name for it, but I just can't remember it right now. I am working on my website's payment flow. Scenario Alice wants to pay Bob for a service. Bob has quoted…
turnip
  • 1,657
  • 2
  • 15
  • 21
63
votes
6 answers

Is object pooling a deprecated technique?

I am very familiar with the concept of object pooling and I always try to use it as much as possible. Additionally I always thought that object pooling is the standard norm as I have observed that Java itself as well as the other frameworks use…
user10326
  • 1,834
  • 3
  • 17
  • 18
62
votes
1 answer

Are go-langs goroutine pools just green threads?

The commentator here offers the following criticism of green threads: I was initially sold on the N:M model as a means of having event driven programming without the callback hell. You can write code that looks like pain old procedural code but…
hawkeye
  • 4,819
  • 3
  • 24
  • 35
61
votes
10 answers

Does it ever make sense to use more concurrent processes than processor cores?

I've got some process in Go. Here's an example counting lines in text, though the question is meant to be far more general than this particular example: func lineCount(s string) int { count := 0 for _, c := range s { if c == '\n' { …
TheEnvironmentalist
  • 1,159
  • 1
  • 8
  • 14
47
votes
5 answers

How does a movie theater seat booking system prevent multiple users from reserving the same seats?

In the movie theatre I go to they have ticket kiosks that allow you to select the seats you want; they also have a website that does the same (the website also has a countdown timer of like 30 secs in which you must choose a seat). While I…
mbwasi
  • 581
  • 1
  • 4
  • 5
42
votes
16 answers

Modern programming language with intuitive concurrent programming abstractions

I am interested in learning concurrent programming, focusing on the application/user level (not system programming). I am looking for a modern high level programming language that provides intuitive abstractions for writing concurrent applications.…
sakisk
  • 3,377
  • 2
  • 24
  • 24
39
votes
2 answers

How does Rust diverge from the concurrency facilities of C++?

Questions I am trying to understand whether Rust fundamentally and sufficiently improves upon the concurrency facilities of C++ so that to decide if I should spend the time to learn Rust. Specifically, how does idiomatic Rust improve upon, or at any…
thb
  • 747
  • 5
  • 12
39
votes
11 answers

Concurrency: How do you approach the design and debug the implementation?

I've been developing concurrent systems for several years now, and I have a pretty good grasp on the subject despite my lack of formal training (i.e. no degree). There's a few new languages that have become popular to at least talk about lately…
Berin Loritsch
  • 45,784
  • 7
  • 87
  • 160
39
votes
3 answers

Why not Green Threads?

Whilst I know questions on this have been covered already (e.g. https://stackoverflow.com/questions/5713142/green-threads-vs-non-green-threads), I don't feel like I've got a satisfactory answer. The question is: why don't JVM's support green threads…
redjamjar
  • 819
  • 1
  • 7
  • 10
37
votes
7 answers

Are there deprecated practices for multithread and multiprocessor programming that I should no longer use?

In the early days of FORTRAN and BASIC, essentially all programs were written with GOTO statements. The result was spaghetti code and the solution was structured programming. Similarly, pointers can have difficult to control characteristics in our…
DeveloperDon
  • 4,958
  • 1
  • 26
  • 53
32
votes
3 answers

UML Diagrams of Multi-Threaded Applications

For single-threaded applications I like to use class diagrams to get an overview of the architecture of that application. This type of diagram, however, hasn’t been very helpful when trying to understand heavily multi-threaded/concurrent…
PersonalNexus
  • 2,989
  • 5
  • 27
  • 42
1
2 3
24 25