1 / 15

Software Transactional Memory による 真の並列度を持つ Python 処理系の導出

近山・田浦研究室 70407  早水 悠登. Software Transactional Memory による 真の並列度を持つ Python 処理系の導出. 研究の背景. 並列処理の重要性 Python, Ruby など動的言語の需要拡大 Daily job … 単純なテキスト処理など LARGE Application … エンタープライズ , 大規模 Web App など. 研究の背景. Problem ! – Global Lock 1 つの lock で並列制御 メンテナンスが 容易 並列性が 無い. for(;;){

gefjun
Download Presentation

Software Transactional Memory による 真の並列度を持つ Python 処理系の導出

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 近山・田浦研究室 70407  早水 悠登 Software Transactional Memoryによる真の並列度を持つPython処理系の導出

  2. 研究の背景 並列処理の重要性 • Python, Rubyなど動的言語の需要拡大 • Daily job … 単純なテキスト処理など • LARGE Application … エンタープライズ, 大規模Web App など

  3. 研究の背景 • Problem!– Global Lock • 1つのlock で並列制御 • メンテナンスが容易 • 並列性が無い for(;;){ if(--Ticker < 0){ release_lock(global_lock); /*Other threads may run now*/ acquire_lock(global_lock); } /* Virtual Machine */ /* Execution */ }

  4. 研究の背景 • Solution? – Lock の分割 • 複数のlockで並列制御 • 高い並列性 • 複雑なバグの温床

  5. 解決のアプローチ Software Transactional Memory (STM) • デッドロックがない • シングルスレッド性能は悪い Global Lock → Fine-grained Lock 橋渡しとして利用 細かく分割されたlock

  6. 本研究の対象 Python 処理系 ( CPython ) • C言語による実装 • 大規模 (Python 2.5.2 で 約43万行) • 多くの人に使われている • Global Interpreter Lock により並列度無し

  7. 関連研究 Transactional Memory ( TM ) • 一連のメモリ操作 →トランザクション • No EXPLICIT lock → No DEADLOCK • Hardware TM [Herlihy, et al. (1993)] • Software TM [Shavit, et al. (1995)] • 多種多様なアルゴリズム、実装

  8. 関連研究 – Transactional Memory Example TM_START_TRANSACTION; int x = TM_LOAD(&shared_x); x =x + 1; TM_STORE(&shared_x, x); TM_COMMIT_TRANSACTION; →トランザクション開始 → shared_xを load したと記録 → shared_xへ store したと記録 → 整合性チェック • OK … commit • NG … abort, rollback

  9. 関連研究 – Transactional Memory Example TM_START_TRANSACTION; int x = TM_LOAD(&shared_x); x =x + 1; TM_STORE(&shared_x, x); TM_COMMIT_TRANSACTION; →トランザクション開始 → shared_xを load したと記録 → shared_xへ store したと記録 → 整合性チェック • OK … commit • NG … abort, rollback メモリ操作履歴 整合性チェック、conflict 検出、、、

  10. 関連研究 – STM • トランザクション処理をソフトウェアで • まだ見ぬハードウェアに依存しない→ ポータビリティ● • load/storeをソフトウェアで記録→ パフォーマンス×→ STMに”のみ”よる並列化は性能面で難あり

  11. 研究の目的 STM処理系のメモリ操作履歴を用いて Global Lock → Fine-grained Lock を行う方法論の確立

  12. 提案手法 • STM で GlobalLock を置き換え • Test run → メモリ操作履歴の蓄積 • アクセスパターンの解析 • Transactionの縮小, lock へ置き換え Difficult: Global Lock→Fine-grained Lock Easier: Global Lock→STM→Fine-grained Lock

  13. GlobalLock → STM C言語を拡張したフロントエンドを作成 • トランザクション処理の記述を簡素化 transaction{ int x = shared_x; x += 1 shared_x = x; } STM_START; int x = STM_LOAD(&shared_x); x += 1 STM_STORE(&shared_x, x); STM_END;

  14. STM → Fine-grained Lock アクセスパターンの解析 • Python 変数に対応するデータ • Pythonで並列性制御があるはず • 実装言語( C言語 )では並列性制御が必要無い? • Contention の頻度 実験データを元に詳細な検討が必要

  15. 今後の進め方 • STMの評価 • 小さなプログラムで Lock, STM を使って比較 • メモリ履歴取得, 解析の実験 • STM拡張C言語フロントエンドの実装 Python の STM化, Fine-grained Lock化

More Related