研究生: |
魏淳航 |
---|---|
論文名稱: |
同步最佳化核心架構 SyncFree: An Efficient Kernel Framework for Lock-Optimized Synchronization |
指導教授: |
金仲達
Chung-Ta King |
口試委員: | |
學位類別: |
碩士 Master |
系所名稱: |
電機資訊學院 - 資訊工程學系 Computer Science |
論文出版年: | 2008 |
畢業學年度: | 96 |
語文別: | 英文 |
論文頁數: | 31 |
中文關鍵詞: | 同步 |
外文關鍵詞: | synchronization, multicore |
相關次數: | 點閱:1 下載:0 |
分享至: |
查詢本校圖書館目錄 查詢臺灣博碩士論文知識加值系統 勘誤回報 |
同步化在平行程式中佔了很大部分,尤其對於效率的影響更為明顯,而同步大多是為了保守方式地保護程式正確性,例如互斥鎖,狀態變數等,都會強制讓程式序列執行各個臨界區間,而這些臨界區間通常會並不需要彼此間互斥,但是撰寫程式者為了正確起見,會宣告一些可能不需要互斥的臨界區間,甚至是大範圍的臨界區間,因而造成效率上大大的減低。
對於這個問題的研究,過去有許多方法提出來,例如交易記憶體。而交易記憶體又分為硬體實做以及軟體實做方式,而這兩種方式各有優缺點,硬體實做部分的缺點包含成本高,彈性低,而軟體實做方式提供一個介面給使用者,但是底層也是傳統的互斥鎖,所有使用者也必須瞭解交易記憶體如何使用,進而修改撰寫程式的方法或習慣,因此對於臨界區間所造成的效率瓶頸並沒有直接的提升。另一方法則是所謂的改進鎖方式來提升臨界區間的效率,過去這些也都只有出現在硬體上面的實做,而缺點也如同上述,成本高彈性低,因此我們提出一個既具有低成本且富有彈性,容易移植等特性的方法 – 同步自由(SyncFree),而此方法實做於作業系統核心之中,且具有使用者透明化特性,程式撰寫者也不需要重新改寫程式或學習新程式寫法,在最後的實驗中可以看出我們的方法對於平行化程式的執行效率有明顯提升。
Synchronization is undoubtedly the critical and yet annoying part of parallel programming [3{5,13], especially in the performance aspect. As programmers and parallel compilers cannot statically determine whether a code block is race-free or not, synchronization primitives, such as mutex locks, barriers, and conditional variables, are applied onservatively to guarantee the correctness of parallel programs. The performance drop is then incurred because of unnecessary serialization of threads. In addition, a coarse-grained lock is often used in a shared data structure to protect all members in it. Although this kind of programming style is intuitive and easy to follow, threads are serialized unnecessarily when they updates di®erent members. In this paper, we propose SyncFree, an e±cient kernel framework or practical lock-optimized synchronization. SyncFree allows the speculative execution on conventional processors with a revised OS kernel and slightly modi‾ed user libraries.
[1] A.-R. Adl-Tabatabain, B. T. Lewis, V. Menon, B. R. Murphy, and B. Saha. Compiler
and Runtime Support for E±cient Software Transactional Memory. In Proceedings
of the 2006 ACM SIGPLAN Conference on Programming Language Design and Im-
plementation, pages 26{37, June 2006.
[2] C. S. Ananian, K. Asanovi¶c, B. C. Kuszmaul, C. E. Leiserson, and S. Lie. Unbounded
Transactional Memory. In Proceedings of the 11th International Symposium on High-
Performance Computer Architecture, pages 316{327, February 2005.
[3] J. Armstrong, R. Virding, C. Wikstrm, and M. Williams. Concurrent Programming
in Erlang. Prentice Hall, 1996.
[4] D. R. Butenhof. Programming with POSIX Threads. Addison Wesley, 1997.
[5] L. Dagum and R. Menon. OpenMP: an Industry Standard API for Shared-Memory
Programming. IEEE Computational Science and Engineering, 5(1):46{55, 1998.
[6] J. Gray. Transaction Processing: Concepts and Techniques. Morgan Kau®mann,
1992.
[7] L. Hammond, M. Willey, and K. Olukotun. Data Speculation Support for a Chip
Multiprocessor. In Proceedings of the 8th International Conference on Architectural
Support for Programming Languages and Operating Systems, pages 58{69, October
1998.
[8] L. Hammond, V. Wong, M. Chen, B. D. Carlstrom, J. D. Davis, B. Hertzberg, M. K.
Prabhu, H. Wijaya, C. Kozyrakis, and K. Olukotun. Transactional Memory Coher-
ence and Consistency. In Proceedings of the 31st Annual International Symposium
on Computer Architecture, pages 102{113, June 2004.
[9] T. Harris and K. Fraser. Language Support for Lightweight Transactions. ACM
SIGPLAN Notices, 38(11):388{402, 2003.
[10] T. Harris, S. Marlow, S. P. Jones, and M. Herlihy. Composable Memory Transactions.
In Proceedings of the 10th ACM SIGPLAN Symposium on Principles and Practice of
Parallel Programming, pages 48{60, June 2005.
[11] M. Herlihy, J. Eliot, and B. Moss. Transactional Memory: Architectural Support For
Lock-free Data Structures. In Proceedings of the 20th Annual International Sympo-
sium on Computer Architecture, pages 289{300, May 1993.
29
[12] M. Herlihy, V. Luchangco, M. Moir, and W. N. Scherer III. Software Transactional
Memory for Dynamic-Sized Data Structures. In Proceedings of the 22nd Annual ACM
Symposium on Principles of Distributed Computing, pages 92{101, July 2003.
[13] S. L. P. Jones, A. Gordon, and S. Finne. Concurrent Haskell. In Proceedings of
the 23rd ACM Symposium on Principles of Programming Languages, pages 295{308,
January 1996.
[14] H. F. Korth. Locking Primitives in a Database System. Journal of the ACM, 30(1):55{
79, 1983.
[15] J. F. Mart¶³nez and J. Torrellas. Speculative Synchronization: Applying Thread-
Level Speculation to Explicitly Parallel Applications. In Proceedings of the 10th
International Conference on Architectural Support for Programming Languages and
Operating Systems, pages 18{29, October 2002.
[16] K. E. Moore, J. Bobba, M. J. Moravan, M. D. Hill, and D. A. Wood. LogTM: Log-
based Transactional Memory. In Proceedings of the 12th International Symposium
on High-Performance Computer Architecture, pages 254{265, February 2006.
[17] R. Rajwar and J. R. Goodman. Speculative Lock Elision: Enabling Highly Concur-
rent Multithreaded Execution. In Proceedings of the 34th International Symposium
on Microarchitecture, pages 294{305, December 2001.
[18] R. Rajwar and J. R. Goodman. Transactional Lock-Free Execution of Lock-based
Programs. In Proceedings of the 10th International Conference on Architectural Sup-
port for Programming Languages and Operating Systems, pages 5{17, October 2002.
[19] R. Rajwar, M. Herlihy, and K. Lai. Virtualizing Transactional Memory. In Proceed-
ings of the 32nd Annual International Symposium on Computer Architecture, pages
494{505, June 2005.
[20] L. Sha, R. Rajkumar, S. H. Son, and C.-H. Chang. A Real-Time Locking Protocol.
IEEE Transactions on Computers, 40(7):793{800, 1991.
[21] N. Shavit and D. Touitou. Software Transactional Memory. In Proceedings of the
14th Annual ACM Symposium on Principles of Distributed Computing, pages 204{
213, August 1995.
[22] J. G. Ste®an and T. C. Mowry. The Potential for Using Thread-Level Data Specu-
lation to Facilitateautomatic Parallelization. In Proceedings of the 4th International
Symposium on High-Performance Computer Architecture, pages 2{13, February 1998.
30
[23] S. Wee, J. Casper, N. Njoroge, Y. Tesylar, D. Ge, C. Kozyrakis, and K. Olukotun.
A Practical FPGA-based Framework for Novel CMP Research. In Proceedings of the
15th ACM/SIGDA International Symposium on Field Programmable Gate Arrays,
pages 116{125, February 2007.
[24] A. Zhai, T. C. Mowry, C. B. Colohan, and J. G. Ste®an. A Scalable Approach to
Thread-Level Speculation. In Proceedings of the 27th Annual International Sympo-
sium on Computer Architecture, pages 1{12, June 2000.