Skip to main content
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 ...
Jörg W Mittag's user avatar
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 ...
Vector Zita's user avatar
  • 2,502
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 ...
Levi Morrison's user avatar
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 ...
Kilian Foth's user avatar
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 ...
JimmyJames's user avatar
  • 30.9k
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 ...
amon's user avatar
  • 136k
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,...
Alex's user avatar
  • 3,952
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 ...
amon's user avatar
  • 136k
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 ...
pjc50's user avatar
  • 15.3k
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 ...
JonasH's user avatar
  • 6,329
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 ...
amon's user avatar
  • 136k
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. ...
JimmyJames's user avatar
  • 30.9k
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. ...
Bart van Ingen Schenau's user avatar
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 ...
Caleth's user avatar
  • 12.4k
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 ...
amon's user avatar
  • 136k
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 ...
Jerry101's user avatar
  • 5,477
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 ...
John Wu's user avatar
  • 27k
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 ...
fortuneNext's user avatar
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 ...
amon's user avatar
  • 136k
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 ...
Jörg W Mittag's user avatar
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 ...
pjc50's user avatar
  • 15.3k
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. ...
Steve Mathwig's user avatar
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 ...
Christophe's user avatar
  • 82.1k
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 ...
rwong's user avatar
  • 17.2k
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 ...
VF1's user avatar
  • 1,891
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 ...
Robert Harvey's user avatar
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); ...
user1118321's user avatar
  • 4,981
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 ...
Glen Pierce's user avatar
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 ...
Glorfindel's user avatar
  • 3,167
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 ...
user3067860's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible