[[Open棟梁Project>http://opentouryo.osscons.jp/]] - [[マイクロソフト系技術情報 Wiki>http://techinfoofmicrosofttech.osscons.jp/]] -[[戻る>.NET開発]] * 目次 [#lc8e4fa8] #contents *概要 [#u945caf6] *非同期処理の実装史 [#z67fe1ac] **1. Thread、ThreadPool [#c79c02e2] 従来の、マルチスレッド・プログラミング。 -スレッドの並列実行はOSが裏で無意識にしてくれていた。 --タイムスライスで細切れ/ラウンドロビンで論理的に並列実行。 --CPUのコア数に応じて、物理的に並列実行。 -しかし、以下の処理は意識的に実装する必要があった。 --非同期処理をスレッド関数として分離して実装する。 --スレッド関数を作成したワーカースレッドに渡す。 --スレッド関数の結果をメインスレッドで待ち合わせる。 **2. APM、EAP (Control.Invoke、.BeginInvoke) [#x24ad95f] 「Windowsメッセージングキュー(Control.Invoke、.BeginInvoke)」による方式。 -APM(Asynchronous Programming Model)~ [[Control.Invoke>http://www.atmarkit.co.jp/ait/articles/0506/17/news111.html]] -EAP(Event-based Asynchronous Pattern)~ [[BackgroundWorker>http://www.atmarkit.co.jp/fdotnet/dotnettips/436bgworker/bgworker.html]] この非同期処理方式では、 -Foregroundスレッド(UIスレッド)からBackgroundスレッドを使用して非同期処理を実行し、 -非同期処理の実行結果をUIスレッドを使用して画面に反映させる事ができる。 Open棟梁の「[[非同期呼出フレームワーク>https://opentouryo.osscons.jp/index.php?%E9%9D%9E%E5%90%8C%E6%9C%9F%E5%91%BC%E5%87%BA%E3%83%95%E3%83%AC%E3%83%BC%E3%83%A0%E3%83%AF%E3%83%BC%E3%82%AF]]」がこの方式で実装されている。 **3. TAP ([[async/await]]) [#ae25c1af] [[async/await]]は、TAP(Task-based Asynchronous Pattern)の方式で実装されている。 ---- Tags: [[:.NET開発]]