2

While I have tried to dive into both techniques it is still a bit blurry to me for which problems and situations these are used.

If I simplify this, are CPU-bound problems handled with parallel and IO-bound ones async programming?

1
  • These are not even mutually exclusive. Commented Oct 8, 2015 at 14:48

1 Answer 1

1

Perhaps a better title for this question would be 'to block or not to block?' as going parallel or asynchronous are not mutually exclusive.

I recommend using multiple threads on a problem either 1) when it is both CPU bound, and can be split up into multiple parts that do not require coordination/sharing to complete or 2) the job may stall for a long period of time on IO and we do not want to prevent other work from occurring.

Asynchronous basically means, don't block a thread waiting for something to complete. Instead rely on a callback that will notify of its completion. As such one can go asynchronous when there is only one worker thread.

Asynchronous techniques have been resurfacing recently because they scale better than blocking techniques. This is because we are limited in how many threads we can have on a single system before the overheads of managing those threads dominate.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.