Many concurrent programs assign priorities to threads to improve responsiveness. When used in conjunction with synchronization mechanisms such as mutexes and condition variables, however, priorities can lead to priority inversions, in which high-priority threads are delayed by low-priority ones. Priority inversions in the use of mutexes are easily handled using dynamic techniques such as priority inheritance, but priority inversions in the use of condition variables are not well-studied and dynamic techniques are not suitable. In this work, we use a combination of static and dynamic techniques to prevent priority inversion in code that uses mutexes and condition variables. A type system ensures that condition variables are used safely, even while dynamic techniques change thread priorities at runtime to eliminate priority inversions in the use of mutexes. We prove the soundness of our system, using a model of priority inversions based on cost models for parallel programs. To show that the type system is practical to implement, we encode it within the type systems of Rust and C++, and show that the restrictions are not overly burdensome by writing sizeable case studies using these encodings, including porting the Memcached object server to use our C++ implementation.


翻译:许多并发程序通过为线程分配优先级来提升响应性。然而,当与互斥锁、条件变量等同步机制结合使用时,优先级可能导致优先级反转——高优先级线程被低优先级线程延迟。互斥锁使用中的优先级反转可通过优先级继承等动态技术轻松处理,但条件变量使用中的优先级反转尚未得到充分研究,且动态技术并不适用。在本工作中,我们结合静态与动态技术,防止使用互斥锁和条件变量的代码中出现优先级反转。类型系统确保条件变量的安全使用,同时运行时通过动态技术改变线程优先级以消除互斥锁使用中的优先级反转。我们基于并行程序成本模型构建优先级反转模型,并证明系统的可靠性。为展示类型系统的实际可行性,我们将其编码至Rust和C++的类型系统中,并通过编写大规模案例研究(包括将Memcached对象服务器移植至我们的C++实现)证明其限制并不过于苛重。

0
下载
关闭预览

相关内容

Meta最新WWW2022《联邦计算导论》教程,附77页ppt
专知会员服务
60+阅读 · 2022年5月5日
Linux导论,Introduction to Linux,96页ppt
专知会员服务
82+阅读 · 2020年7月26日
Transformer文本分类代码
专知会员服务
118+阅读 · 2020年2月3日
使用 Jetpack Compose 实现精美动画
谷歌开发者
0+阅读 · 2022年6月7日
VCIP 2022 Call for Demos
CCF多媒体专委会
1+阅读 · 2022年6月6日
tf.GradientTape 详解
TensorFlow
120+阅读 · 2020年2月21日
设计和实现一款轻量级的爬虫框架
架构文摘
13+阅读 · 2018年1月17日
【论文】变分推断(Variational inference)的总结
机器学习研究会
39+阅读 · 2017年11月16日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
2+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2011年12月31日
Arxiv
0+阅读 · 2023年5月26日
Arxiv
0+阅读 · 2023年5月26日
Arxiv
18+阅读 · 2019年1月16日
VIP会员
最新内容
学习数据的几何:形状空间分析数学综述
专知会员服务
7+阅读 · 6月17日
定向能反无人机系统最新发展动态
专知会员服务
8+阅读 · 6月17日
从燃煤战舰到算法战争:水面指挥的永恒要求
专知会员服务
6+阅读 · 6月17日
相关VIP内容
Meta最新WWW2022《联邦计算导论》教程,附77页ppt
专知会员服务
60+阅读 · 2022年5月5日
Linux导论,Introduction to Linux,96页ppt
专知会员服务
82+阅读 · 2020年7月26日
Transformer文本分类代码
专知会员服务
118+阅读 · 2020年2月3日
相关基金
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
2+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2011年12月31日
Top
微信扫码咨询专知VIP会员