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

 

 

相關文章
相關標籤/搜索