Restructuring AMS to reduce synchronization overheads on android system

  • Li Chao
  • Shi Xiaohua
  • Lu Xinghai


In this paper, we present an optimization method which can be used to improve the performance of android system by reducing the synchronization overheads in the activity manager service (AMS) component. The optimization decreases the waiting time of synchronizations by dividing the original single object lock in AMS into different ones. We use an alias analysis method, i.e. escape analysis, to divide all the synchronized code blocks into different equivalence classes so that there is no intersection of objects accessed for two blocks from different equivalence classes. Then, we can use different object locks to guard these code blocks. We implemented our optimization on android 6.0, and decreased the waiting time of synchronization locks in AMS by 30.9 and 27.7% when the system starts up and runs normally. We find that the distribution of the waiting time for the synchronized lock is in accordance with the characteristics of power-law distribution.


Escape analysis Activity manager service Synchronization 



The work was supported by the National Natural Science Foundation of China under Grant No. 61272166, the State Key Laboratory of Software Development Environment of China (Grant No. SKLSDE-2016ZX-08), and Huawei Research Fund (Grant No. HIRPO-20140405-YB2015080015).


  1. 1.
    Blanchet, B.: Escape analysis for object-oriented languages: application to Java. In: ACM Sigplan Conference on Object-Oriented Programming, Systems, Languages, and Applications, pp. 20–34. ACM (1999)Google Scholar
  2. 2.
    Choi, J.D., Gupta, M., Serrano, M., et al.: Escape analysis for Java. In: Proceedings of Conference on Object Oriented Programming Systems, Languages & Applications, OOPSLA, pp. 1–19 (1999)Google Scholar
  3. 3.
    Ruf, E.: Effective synchronization removal for Java. ACM Sigplan Not. 35(5), 208–218 (2000)CrossRefGoogle Scholar
  4. 4.
    Sreedhar, V.C., Burke, M., Choi, J.D.: A framework for interprocedural optimization in the presence of dynamic class loading. ACM Sigplan Not. 35(5), 196–207 (2000)CrossRefGoogle Scholar
  5. 5.
    Shi, X., Jin, M., Wu, G., et al.: Practical escape analysis in an open world. Chin. J. Electr. 18(1), 31–36 (2009)Google Scholar
  6. 6.
    Aaron, C., Shalizi, C.R., Newman, M.E.J.: Power-law distributions in empirical data. SIAM Rev. 51(4), 661–703 (2009)MathSciNetCrossRefzbMATHGoogle Scholar
  7. 7.
    Bacon, D.F., Konuru, R., Murthy, C., et al.: Thin locks: featherweight synchronization for Java. In: ACM Sigplan 1998 Conference on Programming Language Design and Implementation, pp. 258–268. ACM (1998)Google Scholar
  8. 8.
    Bogda, J.: Removing unnecessary synchronization in Java. ACM SIGPLAN Not. 34(10), 35–46 (1999)CrossRefGoogle Scholar
  9. 9.
    Aldrich, J., Chambers, C., Sirer, E.G., et al.: Static analyses for eliminating unnecessary synchronization from Java programs. Lect. Notes Comput. Sci. 1694, 19–38 (1999)CrossRefGoogle Scholar
  10. 10.
    Choi, J.D., Gupta, M., Serrano, M.J., et al.: Stack allocation and synchronization optimizations for Java using escape analysis. ACM Trans. Program. Lang. Syst. 25(6), 876–910 (2003)CrossRefGoogle Scholar
  11. 11.
    Diniz, P., Rinard, M.: Synchronization transformations for parallel computing. ACM Sigplan-Sigact Symposium on Principles of Programming Languages, pp. 187–200. ACM (1997)Google Scholar
  12. 12.
    Diniz, P., Rinard, M.: Lock coarsening: eliminating lock overhead in automatically parallelized object-based programs. J. Parallel Distrib. Comput. 49(2), 218–244 (1998)CrossRefzbMATHGoogle Scholar
  13. 13.
    David, T., Guerraoui, R., Trigonakis, V.: Everything you always wanted to know about synchronization but were afraid to ask. In: Proceedings of the Twenty-Fourth ACM Symposium on Operating Systems Principles, pp. 33–48. ACM (2013)Google Scholar
  14. 14.
    Ropars, T.: On the performance of delegation over cache-coherent shared memory. In: International Conference on Distributed Computing and Networking, p. 17. ACM (2015)Google Scholar
  15. 15.
    Klaftenegger, D., Sagonas, K., Winblad, K.: Brief announcement: queue delegation locking. ACM Symposium on Parallelism in Algorithms and Architectures, pp. 70–72. ACM (2014)Google Scholar

Copyright information

© Springer Science+Business Media, LLC, part of Springer Nature 2018

Authors and Affiliations

  1. 1.State Key Laboratory of Software Development Environment, School of Computer Science and EngineeringBeihang UniversityBeijingChina

Personalised recommendations