Thursday, December 2, 2021

Concurrency, Parallelism, and Synchronous

Concurrency is the placement of tasks onto a priority queue and have the operating system resolve the tasks. The virtually at the same time is not at the same time, as tasks are resolved sequentially (consecutively) in a single threaded single core processor. Virtually means the perceived time slice is larger than the actual time slice. If measuring tasks in 150 ms interval, 10 tasks of 15 ms could complete and they are perceived to be simultaneous. Average speed and instantaneous speed are different especially those who understand speeding tickets. Of course, average population density and instantaneous population density are different, but people fail to understand their differences.

Parallelism is the ability to resolve multiple tasks at the same time by having multiple threaded processors. Asynchronous tasks could run without issues, but synchronous tasks must wait for their dependency to finish before they could start. The critical path is the thread that has the full chain of synchronous tasks, and other threads will be flooded with asynchronous tasks to improve performance.

Synchronous refers to the dependency of one task on another, while asynchronous means there are no dependency. Synchronous tasks needs to be thread safe because racing conditions affect their results. Asynchronous tasks does not need to be thread safe because they are orthogonal to racing condition.

No comments: