concurrency parallel 并发 并行 parallelism

在传统的多道程序环境下,要使作业运行,必须为它创建一个或几个进程,并为之分配必要的资源。
当进程运行结束时,立即撤销该进程,以便能及时回收该进程所占用的各类资源。进程控制的主要功能是为
作业创建进程,撤销已经结束的进程,以及控制进程在运行过程中的状态转换。在现代os中,进程控制还具有为
为一个进程创建若干个线程的功能和撤销(终止)已完成任务的线程的功能。

并发:同一时刻
并行:同一时间间隔


单处理机系统:每一时刻仅能有一道程序执行,故微观上这些程序只能是分时地交替执行;
多处理机系统:则这些可以并发执行的程序便可被分配到多个处理机上,实现并行执行;

《go语言实践》
并发:同时做很多事情
并行:同时管理很多事情

Computer Systems A Programmer's Perspective Second Edition

The general phenomenon of multiple flows executing concurrently is known as concurrency

. The notion of a process taking turns with other processes is also known as multitasking
. Each time period that a process executes a portion of its flow is called a time slice
. Thus, multitasking is also referred to as time slicing
.For example, in Figure 8.12, the flow for Process A consists of two time slices.
 
Notice that the idea of concurrent flows is independent of the number of processor cores or computers that the flows are running on. If two flows overlap
in time, then they are concurrent, even if they are running on the same processor.
However, we will sometimes find it useful to identify a proper subset of concurrent flows known as 
parallel flows
. If two flows are running concurrently on different 
processor cores or computers, then we say that they are 
parallel flows
, that they are running in parallel , and have parallel execution.
 
https://en.wikipedia.org/wiki/Concurrency_(computer_science)
https://en.wikipedia.org/wiki/Parallel_computing
 

Assume that a task has two independent parts,A and B. Part B takes roughly 25% of the time of the whole computation. By working very hard, one may be able to make this part 5 times faster, but this only reduces the time for the whole computation by a little. In contrast, one may need to perform less work to make part A be twice as fast. This will make the computation much faster than by optimizing part B, even though part B's speedup is greater by ratio, (5 times versus 2 times).

 
 
 
 
 
 
 
 
 
原文地址:https://www.cnblogs.com/rsapaper/p/6182842.html