Ting Wang, Michihiro Horie, Kazunori Ogata, Hao Chen Gui, Xiaohong Guo, Yang Liu
{"title":"针对不频繁的锁争用,增强了OpenJDK的偏锁","authors":"Ting Wang, Michihiro Horie, Kazunori Ogata, Hao Chen Gui, Xiaohong Guo, Yang Liu","doi":"10.1145/3397537.3397562","DOIUrl":null,"url":null,"abstract":"Java has a built-in synchronization mechanism and there are many research works to optimize the mechanism by reducing use of costly operations, such as OS monitors and atomic operations. OpenJDK implements biased locking to eliminate all synchronization-related atomic operations for uncontended locks. However, atomic operations are still observed in Hadoop map tasks even though a map task is single-threaded. This paper presents a scenario where a map task causes infrequent lock contentions and an enhancement to help biased locking work better in such situation. Our enhancement includes a new mechanism to profile lock usages, new transitions to enforce those high profiled locks to continue benefit from biased locking, and a mechanism to bypass lock state transition during deoptimization. It accelerated TPC-DS queries execution by 5% on average. We also verified it reduced lock-related atomic operations by up to 50% for map task.","PeriodicalId":373173,"journal":{"name":"Companion Proceedings of the 4th International Conference on Art, Science, and Engineering of Programming","volume":"50 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2020-03-23","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"Enhancement of OpenJDK biased locking for infrequent lock contention\",\"authors\":\"Ting Wang, Michihiro Horie, Kazunori Ogata, Hao Chen Gui, Xiaohong Guo, Yang Liu\",\"doi\":\"10.1145/3397537.3397562\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"Java has a built-in synchronization mechanism and there are many research works to optimize the mechanism by reducing use of costly operations, such as OS monitors and atomic operations. OpenJDK implements biased locking to eliminate all synchronization-related atomic operations for uncontended locks. However, atomic operations are still observed in Hadoop map tasks even though a map task is single-threaded. This paper presents a scenario where a map task causes infrequent lock contentions and an enhancement to help biased locking work better in such situation. Our enhancement includes a new mechanism to profile lock usages, new transitions to enforce those high profiled locks to continue benefit from biased locking, and a mechanism to bypass lock state transition during deoptimization. It accelerated TPC-DS queries execution by 5% on average. We also verified it reduced lock-related atomic operations by up to 50% for map task.\",\"PeriodicalId\":373173,\"journal\":{\"name\":\"Companion Proceedings of the 4th International Conference on Art, Science, and Engineering of Programming\",\"volume\":\"50 1\",\"pages\":\"0\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2020-03-23\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Companion Proceedings of the 4th International Conference on Art, Science, and Engineering of Programming\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.1145/3397537.3397562\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"Companion Proceedings of the 4th International Conference on Art, Science, and Engineering of Programming","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/3397537.3397562","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
Enhancement of OpenJDK biased locking for infrequent lock contention
Java has a built-in synchronization mechanism and there are many research works to optimize the mechanism by reducing use of costly operations, such as OS monitors and atomic operations. OpenJDK implements biased locking to eliminate all synchronization-related atomic operations for uncontended locks. However, atomic operations are still observed in Hadoop map tasks even though a map task is single-threaded. This paper presents a scenario where a map task causes infrequent lock contentions and an enhancement to help biased locking work better in such situation. Our enhancement includes a new mechanism to profile lock usages, new transitions to enforce those high profiled locks to continue benefit from biased locking, and a mechanism to bypass lock state transition during deoptimization. It accelerated TPC-DS queries execution by 5% on average. We also verified it reduced lock-related atomic operations by up to 50% for map task.