54
votes
Do compilers optimise in concurrency?
Asuming expensive_calc_one and expensive_calc_two are pure functions
Unfortunately, determining whether a function is pure is equivalent to solving the Halting Problem in the general case. So, you ...
42
votes
Accepted
Time Complexity of Parallel.ForEach
Time complexity is not about how long an algorithm takes to solve, it is about how much longer it takes as the input grows. That is, even the most complex (in terms of time complexity) algorithms can ...
17
votes
The difference between "concurrent" and "parallel" execution?
I believe this answer to be more correct than the existing answers and editing them would have changed their essence. I have tried to link to various sources or wikipedia pages so others can affirm ...
16
votes
Can multi-threading improve performance of an IO-bound process?
I/O performance has two aspects that you must distinguish: latency and throughput. One measures how long you have to wait for the first byte of a response, the other how long you have to wait ...
12
votes
Accepted
Immediately awaiting an asynchronous call
I think you misunderstand the await call. What async and await do is allow the thread you are executing on (not just the main thread) to continue working. The mechanism that supports this is called ...
9
votes
Do compilers optimise in concurrency?
Compilers are not generally smart enough to do this, in particular because most languages don't have a sufficiently reliable concept of a “pure function”. There can be rather subtle interactions ...
8
votes
Accepted
Definition and usage of "warp" in parallel / GPU programming
SIMT stands for Single Instruction Multiple Thread. Unlike cores on a CPU which (more or less) act independently of each other, each core on a GPU executes the same instructions, from the same program,...
7
votes
Accepted
Does "green threads" necessarily imply cooperative multitasking?
The defining feature of “green threads” is that the threads are managed in userspace, not by a kernel. Green threads are often managed cooperatively, but to some degree it is also possible to schedule ...
6
votes
Can multi-threading improve performance of an IO-bound process?
If you are truly I/O bound, such as your network link being saturated, then no matter how many processes you run you will not be able to transmit requests and receive responses any faster.
If you are ...
5
votes
Accepted
How to approach a large number of multiple, parallel HttpClient requests?
The first rule when talking about performance is to measure. The built in tools in visual studio is fairly competent, and in a pinch, adding a stopwatch or two can help reveal what part of the code is ...
5
votes
Are design principles of functional programming languages and current hardware (register-machines) contrary?
Functional programming is not inherently inefficient. There is no reason why the language semantics have to closely match the underlying execution model, although a closer match certainly makes ...
5
votes
Can multi-threading improve performance of an IO-bound process?
Let's say the application is talking with some API, and has to make various API calls. If we have multi-threading, we can make those API calls in parallel, and boost the performance.
This is correct. ...
5
votes
Diagram for Parallel processes
If your intention is to have a picture for conversation, my preference for such a scenario is a sequence diagram.
My first thought was to use a sequence diagram but it doesn't allow tracking state. ...
4
votes
Accepted
Parallel processing a Tree on GPU
It's very simple.
When you would recurse down the left child then the right child, instead start a task that recurses down the left, and continue down the right. When you are done with the right, you ...
4
votes
Accepted
My aproach to lockless concurrency
Yes, that's not entirely unreasonable. In practice, you would likely replace the (atomic) counter by a semaphore but all of that is more or less equivalent. A synchronization method that ensures no ...
4
votes
What is the best way to decouple and define the orchestration (coordination) of concurrent tasks?
This sounds like the role of workflow software such as FireWorks.
(The term "workflow management" can also refer to managing the handoffs of operations to perform between people.)
There are ...
4
votes
Accepted
Parallel execution: 1 thread pool or N thread pools?
There are two basic reasons to run a thread pool.
Creating threads as you go is expensive. With a pool, you create them only once, and re-use them as needed, saving the overhead.
The optimum number of ...
3
votes
Time Complexity of Parallel.ForEach
As a small addition to the answer above, O-Notation is still sometimes used in parallel algorithm analysis.
For example, see: https://en.wikipedia.org/wiki/Analysis_of_parallel_algorithms
Just so ...
3
votes
Docker and GPU-based computations. Feasible?
Containerization is completely orthogonal to “high load” or “parallelization”. Containerization also does not imply any virtualization, and is better interpreted as sandboxing.
So why do people use ...
3
votes
Accepted
Relation Between Flynn's Taxonomy and Concurrency
Flynn's Taxonomy generally deals with much smaller "units" than Computational Models for Parallelism. After all, the "I" stands for (single, atomic, simple) "instructions".
Also, Flynn's Taxonomy ...
3
votes
Accepted
NIC handling multiple packets at once
Depends what you mean by "simultaneously". At ground level, nothing is simultaneous. You can only send out one packet on the wire at once. You can only transfer one packet over the PCIe bus ...
3
votes
Can multi-threading improve performance of an IO-bound process?
In general, multi-threading access to a single resource (CPU, network, disk, etc.) will not improve performance. Multi-threading will improve performance when the theads access different resources.
...
3
votes
Can multi-threading improve performance of an IO-bound process?
From the CPU point of view, I/O is most of the time waiting for something to happen elsewhere (read also "Must-know numbers for every software engineer"):
The CPU could gain time by doing ...
3
votes
Diagram for Parallel processes
https://plantuml.com/sequence-diagram
Firstly, according to PlantUML's documentation, Sequence Diagrams can be used with or without activations. (Activation refers to the colored vertical bar placed ...
2
votes
Accepted
What parallelization methods can make neural nets train faster?
Well, someone upvoted this question and I guess that made it pop up for me. It's nice to know I learned something in 4 years :)
Turns out the answer to this question is, in many wonderful and general ...
2
votes
Accepted
Should I do parallel processing in RPC web service?
He's right.
Presumably, all of the processor cores on the web server are already devoted to handling user requests. If you process your hot path in parallel on the web server, the most likely ...
2
votes
Accepted
Designing a pause'able & resume'able task handler
I've seen this done with a job processing class that runs on its own thread. It looked something like this:
class JobQueue {
public:
JobQueue();
~JobQueue();
void EnqueueJob(Job newJob);
...
2
votes
two processes with same execute time
There's no way to tell from the information given. This reads like a very basic homework question or a sneaky trick question.
In the case of the basic homework question: no, A and B are separate ...
2
votes
Accepted
Serving tasks for multiple users from one queue in parallel way
One edge case which is not covered by the Stack Exchange system is the situation where one user is still working on the review task but takes a long time to do it; another user will be offered the ...
2
votes
Do compilers optimise in concurrency?
Introducing things running in parallel (not the same as concurrency, as noted in comments) is actually done quite a bit during runtime.
It sounds like what you're most interested in is instruction ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
parallelism × 95concurrency × 23
multithreading × 20
parallel-programming × 16
architecture × 6
algorithms × 5
gpu × 5
design × 4
c# × 4
design-patterns × 4
functional-programming × 4
distributed-computing × 4
java × 3
c++ × 3
programming-languages × 3
terminology × 3
compiler × 3
distributed-system × 3
cpu × 3
object-oriented × 2
database × 2
python × 2
.net × 2
c × 2
performance × 2