官术网_书友最值得收藏!

Concurrency Performance

Multithreading is a very popular concept. It allows programs to run multiple tasks at the same time. These multithreaded programs may have more than one unit which can run concurrently. Every unit can handle a different task keeping the use of available resources optimal. This can be managed by multiple threads that can run in parallel.

Java 9 improved contended locking. You may be wondering what is contended locking. Let's explore. Each object has one monitor that can be owned by one thread at a time. Monitors are the basic building blocks of concurrency. In order for a thread to execute a block of code marked as synchronized on an object or a synchronized method declared by an object, it must own this object's monitor. Since there are multiple threads trying to get access to the mentioned monitor, JVM needs to orchestrate the process and only allow one thread at a time. It means the rest of threads go in a wait state. This monitor is then called contended. Because of this provision, the program wastes time in the waiting state.

Also, Java Virtual Machine (JVM) does some work orchestrating the lock contention. Additionally, it has to manage threads, so once the existing thread finishes its execution, it can allow a new thread to go in. This certainly adds overhead and affects performance adversely. Java 9 has taken a few steps to improve in this area. The provision refines the JVM's orchestration, which will ultimately result in performance improvement in highly contested code.

The following benchmarks and tests can be used to check the performance improvements of contented Java object monitors:

  • CallTimerGrid (This is more of a stress test than a benchmark)
  • Dacapo-bach (earlier dacapo2009)
  • _ avrora
  • _ batik
  • _ fop
  • _ h2
  • _ luindex
  • _ lusearch
  • _ pmd
  • _ sunflow
  • _ tomcat
  • _ tradebeans
  • _ tradesoap
  • _ xalan
  • DerbyContentionModelCounted
  • HighContentionSimulator
  • LockLoops-JSR166-Doug-Sept2009 (earlier LockLoops)
  • PointBase
  • SPECjbb2013-critical (earlier specjbb2005)
  • SPECjbb2013-max
  • specjvm2008
  • volano29 (earlier volano2509)
主站蜘蛛池模板: 古交市| 缙云县| 陵水| 龙井市| 博白县| 盱眙县| 苏尼特左旗| 崇阳县| 庐江县| 青铜峡市| 垦利县| 乌鲁木齐市| 阳山县| 彩票| 清丰县| 外汇| 辉县市| 元江| 铁岭市| 嘉鱼县| 葫芦岛市| 遂溪县| 安康市| 偏关县| 阜阳市| 湘潭市| 麻江县| 淮北市| 甘肃省| 衡阳县| 内乡县| 临猗县| 山阴县| 清水河县| 海兴县| 墨玉县| 阳朔县| 上饶县| 溧水县| 昌平区| 西和县|