Suche senden
Hochladen
Multi thread 多執行緒程式設計(use c#)
•
Als PPTX, PDF herunterladen
•
7 gefällt mir
•
2,434 views
Gelis Wu
Folgen
介紹 C# Multi-Thread 與 平行處裡 觀念上的差異、實務上的使用的幾個例子
Weniger lesen
Mehr lesen
Software
Melden
Teilen
Melden
Teilen
1 von 20
Jetzt herunterladen
Empfohlen
Etsy Activity Feeds Architecture
Etsy Activity Feeds Architecture
Dan McKinley
From Generator to Fiber the Road to Coroutine in PHP
From Generator to Fiber the Road to Coroutine in PHP
Albert Chen
MongoDB as Message Queue
MongoDB as Message Queue
MongoDB
Git & GitLab
Git & GitLab
Gaurav Wable
Web development presentation
Web development presentation
Vaishnavi8950
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
enpit GmbH & Co. KG
Introducing GitLab (June 2018)
Introducing GitLab (June 2018)
Noa Harel
Jenkins 101: Getting Started
Jenkins 101: Getting Started
R Geoffrey Avery
Empfohlen
Etsy Activity Feeds Architecture
Etsy Activity Feeds Architecture
Dan McKinley
From Generator to Fiber the Road to Coroutine in PHP
From Generator to Fiber the Road to Coroutine in PHP
Albert Chen
MongoDB as Message Queue
MongoDB as Message Queue
MongoDB
Git & GitLab
Git & GitLab
Gaurav Wable
Web development presentation
Web development presentation
Vaishnavi8950
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
enpit GmbH & Co. KG
Introducing GitLab (June 2018)
Introducing GitLab (June 2018)
Noa Harel
Jenkins 101: Getting Started
Jenkins 101: Getting Started
R Geoffrey Avery
Lezione 11: Accesso ai RESTful Web Services in Java
Lezione 11: Accesso ai RESTful Web Services in Java
Andrea Della Corte
GitHub - Présentation
GitHub - Présentation
David RIEHL
Git flow Introduction
Git flow Introduction
David Paluy
Advanced Web Development in PHP - Understanding REST API
Advanced Web Development in PHP - Understanding REST API
Rasan Samarasinghe
Rest assured
Rest assured
Yaniv Rodenski
Git and GitHub for Documentation
Git and GitHub for Documentation
Anne Gentle
使用 Pytest 進行單元測試 (PyCon TW 2021)
使用 Pytest 進行單元測試 (PyCon TW 2021)
Max Lai
PHP Composer Basics
PHP Composer Basics
Muhammad Usman
UrbanCode Deploy course and product overview slides
UrbanCode Deploy course and product overview slides
IBM Rational software
Power shell basics day 2
Power shell basics day 2
Ashish Raj
Git Lab Introduction
Git Lab Introduction
Krunal Doshi
Decomposing Applications for Scalability and Deployability (April 2012)
Decomposing Applications for Scalability and Deployability (April 2012)
Chris Richardson
Hands on-intro to Node-RED
Hands on-intro to Node-RED
Pooja Mistry
Introduction to memcached
Introduction to memcached
Jurriaan Persyn
版本控制 使用Git & git hub
版本控制 使用Git & git hub
維佋 唐
Web Server - Internet Applications
Web Server - Internet Applications
sandra sukarieh
Intro to Azure Static Web Apps
Intro to Azure Static Web Apps
Moaid Hathot
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]
GDSC UofT Mississauga
CI/CD with Github Actions
CI/CD with Github Actions
Md. Minhazul Haque
CSS Layout Techniques
CSS Layout Techniques
Harshal Patil
课题二:Node.js那些事儿
课题二:Node.js那些事儿
Liu Allen
Nodejs & NAE
Nodejs & NAE
q3boy
Weitere ähnliche Inhalte
Was ist angesagt?
Lezione 11: Accesso ai RESTful Web Services in Java
Lezione 11: Accesso ai RESTful Web Services in Java
Andrea Della Corte
GitHub - Présentation
GitHub - Présentation
David RIEHL
Git flow Introduction
Git flow Introduction
David Paluy
Advanced Web Development in PHP - Understanding REST API
Advanced Web Development in PHP - Understanding REST API
Rasan Samarasinghe
Rest assured
Rest assured
Yaniv Rodenski
Git and GitHub for Documentation
Git and GitHub for Documentation
Anne Gentle
使用 Pytest 進行單元測試 (PyCon TW 2021)
使用 Pytest 進行單元測試 (PyCon TW 2021)
Max Lai
PHP Composer Basics
PHP Composer Basics
Muhammad Usman
UrbanCode Deploy course and product overview slides
UrbanCode Deploy course and product overview slides
IBM Rational software
Power shell basics day 2
Power shell basics day 2
Ashish Raj
Git Lab Introduction
Git Lab Introduction
Krunal Doshi
Decomposing Applications for Scalability and Deployability (April 2012)
Decomposing Applications for Scalability and Deployability (April 2012)
Chris Richardson
Hands on-intro to Node-RED
Hands on-intro to Node-RED
Pooja Mistry
Introduction to memcached
Introduction to memcached
Jurriaan Persyn
版本控制 使用Git & git hub
版本控制 使用Git & git hub
維佋 唐
Web Server - Internet Applications
Web Server - Internet Applications
sandra sukarieh
Intro to Azure Static Web Apps
Intro to Azure Static Web Apps
Moaid Hathot
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]
GDSC UofT Mississauga
CI/CD with Github Actions
CI/CD with Github Actions
Md. Minhazul Haque
CSS Layout Techniques
CSS Layout Techniques
Harshal Patil
Was ist angesagt?
(20)
Lezione 11: Accesso ai RESTful Web Services in Java
Lezione 11: Accesso ai RESTful Web Services in Java
GitHub - Présentation
GitHub - Présentation
Git flow Introduction
Git flow Introduction
Advanced Web Development in PHP - Understanding REST API
Advanced Web Development in PHP - Understanding REST API
Rest assured
Rest assured
Git and GitHub for Documentation
Git and GitHub for Documentation
使用 Pytest 進行單元測試 (PyCon TW 2021)
使用 Pytest 進行單元測試 (PyCon TW 2021)
PHP Composer Basics
PHP Composer Basics
UrbanCode Deploy course and product overview slides
UrbanCode Deploy course and product overview slides
Power shell basics day 2
Power shell basics day 2
Git Lab Introduction
Git Lab Introduction
Decomposing Applications for Scalability and Deployability (April 2012)
Decomposing Applications for Scalability and Deployability (April 2012)
Hands on-intro to Node-RED
Hands on-intro to Node-RED
Introduction to memcached
Introduction to memcached
版本控制 使用Git & git hub
版本控制 使用Git & git hub
Web Server - Internet Applications
Web Server - Internet Applications
Intro to Azure Static Web Apps
Intro to Azure Static Web Apps
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]
CI/CD with Github Actions
CI/CD with Github Actions
CSS Layout Techniques
CSS Layout Techniques
Ähnlich wie Multi thread 多執行緒程式設計(use c#)
课题二:Node.js那些事儿
课题二:Node.js那些事儿
Liu Allen
Nodejs & NAE
Nodejs & NAE
q3boy
Introduction to NodeJS
Introduction to NodeJS
TechParty@UIC
讓軟體開發與應用更自由 - 使用 Docker 技術
讓軟體開發與應用更自由 - 使用 Docker 技術
Yu Lung Shao
DEV305 - ASP.NET 5 開發攻略
DEV305 - ASP.NET 5 開發攻略
Will Huang
Full stack-development with node js
Full stack-development with node js
Xuefeng Zhang
注重实效的编程(2)
注重实效的编程(2)
Horky Chen
Asp.net core v1.0
Asp.net core v1.0
chang kuo-chao
Asp.net core v1.0
Asp.net core v1.0
國昭 張
以Code igniter為基礎的網頁前端程式設計
以Code igniter為基礎的網頁前端程式設計
Amigo 陳兆祥
EtherCodes中的HTML5
EtherCodes中的HTML5
Garry Yao
從軟體開發角度 談 Docker 的應用
從軟體開發角度 談 Docker 的應用
謝 宗穎
合久必分,分久必合
合久必分,分久必合
Qiangning Hong
李成银:前端编译平台
李成银:前端编译平台
taobao.com
前端编译平台
前端编译平台
Welefen Lee
Asp.net mvc 6 新功能初探
Asp.net mvc 6 新功能初探
Gelis Wu
Node分享 展烨
Node分享 展烨
tb-vertical-guide
ASP.NET 5 快速入門 (Getting Started ASP.NET 5)
ASP.NET 5 快速入門 (Getting Started ASP.NET 5)
Jeff Chu
Html5
Html5
cazhfe
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
Wen-Tien Chang
Ähnlich wie Multi thread 多執行緒程式設計(use c#)
(20)
课题二:Node.js那些事儿
课题二:Node.js那些事儿
Nodejs & NAE
Nodejs & NAE
Introduction to NodeJS
Introduction to NodeJS
讓軟體開發與應用更自由 - 使用 Docker 技術
讓軟體開發與應用更自由 - 使用 Docker 技術
DEV305 - ASP.NET 5 開發攻略
DEV305 - ASP.NET 5 開發攻略
Full stack-development with node js
Full stack-development with node js
注重实效的编程(2)
注重实效的编程(2)
Asp.net core v1.0
Asp.net core v1.0
Asp.net core v1.0
Asp.net core v1.0
以Code igniter為基礎的網頁前端程式設計
以Code igniter為基礎的網頁前端程式設計
EtherCodes中的HTML5
EtherCodes中的HTML5
從軟體開發角度 談 Docker 的應用
從軟體開發角度 談 Docker 的應用
合久必分,分久必合
合久必分,分久必合
李成银:前端编译平台
李成银:前端编译平台
前端编译平台
前端编译平台
Asp.net mvc 6 新功能初探
Asp.net mvc 6 新功能初探
Node分享 展烨
Node分享 展烨
ASP.NET 5 快速入門 (Getting Started ASP.NET 5)
ASP.NET 5 快速入門 (Getting Started ASP.NET 5)
Html5
Html5
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
Mehr von Gelis Wu
Blazor in NET 8 的重大改變___________________
Blazor in NET 8 的重大改變___________________
Gelis Wu
.NET 7 升級教戰手冊_V1.0.pdf
.NET 7 升級教戰手冊_V1.0.pdf
Gelis Wu
顧問養成秘技 - 顧問服務實戰.pptx
顧問養成秘技 - 顧問服務實戰.pptx
Gelis Wu
Net 6 的 blazor 開發新視界
Net 6 的 blazor 開發新視界
Gelis Wu
軟體架構設計的技術養成之路
軟體架構設計的技術養成之路
Gelis Wu
深入淺出領域驅動設計:以 .NET 5 與線上房貸申請系統為例
深入淺出領域驅動設計:以 .NET 5 與線上房貸申請系統為例
Gelis Wu
Blazor Component 開發實戰
Blazor Component 開發實戰
Gelis Wu
實踐 Clean Architecture(實作高可用性的軟件架構)
實踐 Clean Architecture(實作高可用性的軟件架構)
Gelis Wu
該準備從 .NET Framework 4.x 遷移至 .NET Core 3.0 了嗎?
該準備從 .NET Framework 4.x 遷移至 .NET Core 3.0 了嗎?
Gelis Wu
專業顧問的技能成長日記
專業顧問的技能成長日記
Gelis Wu
你的軟體架構夠敏捷嗎?
你的軟體架構夠敏捷嗎?
Gelis Wu
使用 .NET Standard 開發跨平台應用程式
使用 .NET Standard 開發跨平台應用程式
Gelis Wu
一個 ASP.NET Core 2.1 開發指南
一個 ASP.NET Core 2.1 開發指南
Gelis Wu
前端大型系統的基石 TypeScript
前端大型系統的基石 TypeScript
Gelis Wu
Dot netstandard2.0與.net的未來發展
Dot netstandard2.0與.net的未來發展
Gelis Wu
客製化的 Web api 的框架設計
客製化的 Web api 的框架設計
Gelis Wu
Asp.net identity 2.0
Asp.net identity 2.0
Gelis Wu
Asp.net mvc 基礎
Asp.net mvc 基礎
Gelis Wu
架構設計好簡單系列 設計符合團隊的範本精靈 (Project template)
架構設計好簡單系列 設計符合團隊的範本精靈 (Project template)
Gelis Wu
Azure PaaS (WebApp & SQL Database) workshop solution
Azure PaaS (WebApp & SQL Database) workshop solution
Gelis Wu
Mehr von Gelis Wu
(20)
Blazor in NET 8 的重大改變___________________
Blazor in NET 8 的重大改變___________________
.NET 7 升級教戰手冊_V1.0.pdf
.NET 7 升級教戰手冊_V1.0.pdf
顧問養成秘技 - 顧問服務實戰.pptx
顧問養成秘技 - 顧問服務實戰.pptx
Net 6 的 blazor 開發新視界
Net 6 的 blazor 開發新視界
軟體架構設計的技術養成之路
軟體架構設計的技術養成之路
深入淺出領域驅動設計:以 .NET 5 與線上房貸申請系統為例
深入淺出領域驅動設計:以 .NET 5 與線上房貸申請系統為例
Blazor Component 開發實戰
Blazor Component 開發實戰
實踐 Clean Architecture(實作高可用性的軟件架構)
實踐 Clean Architecture(實作高可用性的軟件架構)
該準備從 .NET Framework 4.x 遷移至 .NET Core 3.0 了嗎?
該準備從 .NET Framework 4.x 遷移至 .NET Core 3.0 了嗎?
專業顧問的技能成長日記
專業顧問的技能成長日記
你的軟體架構夠敏捷嗎?
你的軟體架構夠敏捷嗎?
使用 .NET Standard 開發跨平台應用程式
使用 .NET Standard 開發跨平台應用程式
一個 ASP.NET Core 2.1 開發指南
一個 ASP.NET Core 2.1 開發指南
前端大型系統的基石 TypeScript
前端大型系統的基石 TypeScript
Dot netstandard2.0與.net的未來發展
Dot netstandard2.0與.net的未來發展
客製化的 Web api 的框架設計
客製化的 Web api 的框架設計
Asp.net identity 2.0
Asp.net identity 2.0
Asp.net mvc 基礎
Asp.net mvc 基礎
架構設計好簡單系列 設計符合團隊的範本精靈 (Project template)
架構設計好簡單系列 設計符合團隊的範本精靈 (Project template)
Azure PaaS (WebApp & SQL Database) workshop solution
Azure PaaS (WebApp & SQL Database) workshop solution
Multi thread 多執行緒程式設計(use c#)
1.
集英信誠「與大師對談」系列技術論壇 Gelis Wu Multi-Thread 多執行緒程式設計 (Use
C#)
2.
Agenda • Multi-Thread 概念 •
撰寫 Thread • .NET Framework 多執行緒發展,與非同步程式設計 • Multi-Thread 的同步與鎖定 • Wait Handle • .NET 2.0 APM(Asynchronous Programming Model) • Thread Pool 概念 • .NET 4.0 Task Library • 平行運算簡介 • 實例介紹:Mxic ScheduleJob
3.
4.
Multi-Thread 概念 • 執行緒是作業系統分配處理器時間的基本單元 •
為什麼用 Multi-Thread? 善用多執行緒的技巧,減少因進行長時間動作而使UI凍結的情況 • Win32 的多工概念 • 使用 Multi-Thread 有什麼好處? • 在 Windows Form 裡使用 Multi-Thread
5.
6.
撰寫 Thread .NET 1.0
.NET 2.0
7.
撰寫 Thread .NET 3.0/3.5
.NET 4.0/4.5
8.
9.
• Thread, ThreadStart() •
AsyncCallback, IAsyncResult (非同步應用程式設計) • Thread Pool, QueueUserWorkItem() .NET Framework 多執行緒的發展
10.
11.
Multi-Thread 的同步與鎖定 • 有時,我們希望同一個時間只有一個
Thread 存取到某資源 or 變數 • 所以我們需要使用一種機制來等待上一個 Thread 是否執行完畢 • 常用手法:Wait Handle ManualResetEvent AutoResetEvent Mutex
12.
13.
APM (Asynchronous Programming
Model) • 所謂的APM非同步程式設計是以IAsyncResult 將非同步作業設計為 兩個方法BeginOperationName 及 EndOperationName • BeginOperationName 方法會開始非同步作業,並傳回實作 IAsyncResult 介面的物件 • IAsyncResult 成員如下:
14.
15.
Thread Pool 概念 •
每個執行緒需要大約1 MB的記憶體 • 為了減輕建立執行緒時所耗費的時間 • 從.NET Framework 2.0 開始,提出了Thread Pooling概念 • 當呼叫QueueUserWorkItem() 函式將 delegate 傳入時,Thread Pool會 查看目前是否有閒置的 Thread 於 Pool 中,有的話直接提取出來
16.
17.
.NET 4.0 Task
Library • ThreadPool 需要 Wait Handle來等待 Threads結束才做下一件事 • 所謂的Task Library 就是進階版的 ThreadPool • Task Library 提供許多對於Thread Pool中 執行緒的控制函式 • 再也不需要自己使用 Wait Handle 來控制 執行緒的執行順序 • 也可以讓你設定一個delegate,於執行緒 正常結束時觸發
18.
19.
什麼是平行運算?與多執行緒有什麼不同? • 執行緒是屬於行程(Process)內的東西,如果行程本身不 能跨 CPU,那執行緒也無法跨
CPU • 平行運算 (Parallel Computing) 是指把工作分散到不同 的 CPU 去做處理 • 多執行緒的CPU層級的平行技術,目的在榨出CPU最大 的運算能量, 使CPU 沒有閒置的時間 • 而平行運算是系統層級的平行技術, 目的在發揮系統中 每一顆 CPU 的運算能量
20.
謝謝您的參與及鼓勵 期待明年再相逢!!
Hinweis der Redaktion
UI 不必等待工作執行完畢
Thread Pool透過預建Thread的方式,來減少因頻繁建立/釋放 Thread而耗費的時間
Jetzt herunterladen