×

. GUTS's video: 1

@並行和多執行緒程式設計 (1)
光看翻譯,Concurrency (並行) 和 Parallelism (平行) 已令許多人困惑,多執行緒程式設計更是工程人員的夢魘。本講座希望帶著學員回歸本質,並透過案例分析來掌握並行程式設計。 Concurrency 指程式架構,將程式拆開成多個可獨立運作的工作,像是驅動程式都可獨立運作,但不需要平行化。Parallelism 則指程式執行,同時執行多個程式。Concurrency 可能會用到 parallelism,但不一定要用 Parallelism 才能實現 Concurrency。在 Concurrent 中,工作可拆分成「獨立執行」的部份,於是「可以」讓很多事情一起做,但「不一定」要真的同時做。但 Parallelism 著重規劃, 將能夠並行的程式,分配給不同硬體單元,使其同時執行。 接著 Synchronization (同步處理) 則確保多個執行單元運作並存取資源時,執行結果不會因為執行單元的時間先後的影響而導致錯誤。mutex 與 semaphore 的差別在於: process 使用 mutex 時,process 的運作是持有 mutex,執行 CS 來存取資源,然後釋放 mutex。換言之,mutex 就像是資源的一把鎖:解鈴還須繫鈴人。 process 使用 semaphore 時,process 總是發出信號 (signal),或者總是接收信號 (wait),同一個 process 不會先後進行 signal 與 wait。換言之,process 要不擔任 producer,要不充當 consumer 的角色,不能兩者都是。semaphore 是為了保護 process 的執行同步正確。 建立基本概念後,本講座將探討 Lock-Free Programming, lock-free 使用的 atomic 操作, memory ordering, thread pool, M:N threading model 等進階議題。

0

0
. GUTS
Subscribers
20.6K
Total Post
174
Total Views
97.2K
Avg. Views
1.9K
View Profile
This video was published on 2021-01-11 21:11:52 GMT by @.-GUTS on Youtube. . GUTS has total 20.6K subscribers on Youtube and has a total of 174 video.This video has received 0 Likes which are lower than the average likes that . GUTS gets . @.-GUTS receives an average views of 1.9K per video on Youtube.This video has received 0 comments which are lower than the average comments that . GUTS gets . Overall the views for this video was lower than the average for the profile.

Other post by @. GUTS