concurrency parallel 并发 并行 parallelism

 

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

 

 

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


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

 

《go语言实践》
并发:同时作不少事情
并行:同时管理不少事情

 

 

 

Computer Systems A Programmer's Perspective Second Editionide

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

. 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).idea

 

 

相关文章
相关标签/搜索