Parallel vs Synchronous vs Asynchronous

[1] https://www.sohamkamani.com/blog/2016/03/14/wrapping-your-head-around-async-programming/

[2] https://codewala.net/2015/07/29/concurrency-vs-multi-threading-vs-asynchronous-programming-explained/

Parallel

Parallelism means that two or more calculations happen simultaneously.

Concurrency

Concurrency means that two or more calculations happen within the same time frame, and there is usually some sort of dependency between them

Synchronous Programming Model

1. Single Threaded

A thread is assigned to one task and starts working on it. Once the task completes then it is available for the next task. In this model, it cannot leave the executing task in mid to take up another task.

So a thread could only execute task1 and then task2 and so on.

2. Multi-threaded

A typical thread pool/execurot service has a bunch of threads and each thread will pick up one task and finish it, before taking another task.

Asynchronous Programming Model

1. Single Threaded

A thread once start executing a task, it can hold it in middle, save the current state and start executing another task.

So a thread could execute task1, then task2 and then task1 again.

2. Multi-threaded

Multiple threads could be used to work on a bunch of tasks all together. so thread 1 could execute task1, save the state and then work on task2. In the meantime, thread 2 could work on task3, save the state and then work on task1, which was worked by thread 1.

Every thread could work on one task, save the state and pickup the task that left by another thread.

Synchronous vs Asynchronous 

The whole point of asynchronous programming is to free up threads. This is especially important when we have many IO related tasks (network reading or writing, disk reading or writing). 

For a web application, even if we just have one thread serving all incoming REST request, aysnchronous programming model will let the thread delegate the waiting time to other threads and return immediately to serve other requests. Non-stopping is the whole idea of asynchronous programming.

转载于:https://www.cnblogs.com/codingforum/p/9083828.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
数字电路CMOS&TTL74系列芯片ALTIUM库(AD原理图库),包括CMOS4000和TTL74 2个系列芯片全部型号原理图库文件,共896个 Library Component Count : 896 4020 14-Stage Ripple-Carry Binary Counter 4021 8-Stage Shift Register (Asynchronous Parallel Input or Synchronous Serial Input/Serial Output) 4022 Octal Counter with 8 Decoded Outputs 4023 Triple 3-Input NAND Gate 4024 7-Stage Ripple-Carry Binary Counter 4025 Triple 3-Input NOR Gate 4027 Dual J-K Master-Slave Flip-Flop 4028 BCD to Decimal Decoder 4029 Presettable Up/Down Counter Binary or BCD Decade 4030 Quad Exclusive-OR Gate 4031 64-Stage Static Shift Register 4035 4-Stage Parallel In/Parallel Out Shift Register 4040 12-Stage Ripple-Carry Binary Counter 4041 Quad True/Complement Buffer 4042 Quad Clocked D-Latch 4043 Quad 3-State R-S Latch 4044 Quad 3-State R-S Latch 4049 Inverting Hex Buffer / Converter 4050 Non-Inverting Hex Buffer/Conver 74F14 Hex Schmitt-Trigger Inverter 74F148 8-Line to 3-Line Priority Encoder 74F151 1 of 8 Data Selector/Multiplexer 74F151A 1 of 8 Data Selector/Multiplexer 74F153 Dual 4-Line to 1-Line Data Selector/Multiplexer 74F154 4-Line to 16-Line Decoder/Demultiplexer 74F157 Quad 2-Line to 1-Line Data Selector/Multiplexer 74F157A Quad 2-Line to 1-Line Data Selector/Multiplexer 74F158 Quad 2-Line to 1-Line Data Selector/Multiplexer 74F158A Quad 2-Line to 1-Line Data Selector/Multiplexer 74F160A Synchronous 4-Bit Decade Counter with Direct Clear 74F161A Synchronous 4-Bit Binary Counter with Direct Clear 74F162A Fully Synchronous 4-Bit Decade Counter 74F163A Fully Synchronous 4-Bit Bina

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值