Skip to main content
Log in

Code aware resource management

  • Published:
Formal Methods in System Design Aims and scope Submit manuscript

Abstract

Multithreaded programs coordinate their interaction through synchronization primitives like mutexes and semaphores, which are managed by an OS-provided resource manager. We propose algorithms for the automatic construction of code-aware resource managers for multithreaded embedded applications. Such managers use knowledge about the structure and resource usage (mutex and semaphore usage) of the threads to guarantee deadlock freedom and progress while managing resources in an efficient way. Our algorithms compute managers as winning strategies in certain infinite games, and produce a compact code description of these strategies. We have implemented the algorithms in the tool Cynthesis. Given a multithreaded program in C, the tool produces C code implementing a code-aware resource manager. We show in experiments that Cynthesis produces compact resource managers within a few minutes on a set of embedded benchmarks with up to 6 threads.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9

Similar content being viewed by others

Notes

  1. Recall that our goal is to schedule correct software, rather than to perform software verification.

References

  1. Banaszak ZA, Krogh BH (1990) Deadlock avoidance in flexible manufacturing systems with concurrently competing process flows. IEEE Trans Rob Autom 6(6):724–734

    Article  Google Scholar 

  2. Bloem R, Jobstmann B, Piterman N, Pnueli A, Sa’ar Y (2012) Synthesis of reactive(1) designs. J Comput Syst Sci 78(3):911–938

    Article  MathSciNet  MATH  Google Scholar 

  3. Bodík R (2012) Compiling what to how: technical perspective. Commun ACM 55(2):102

    Article  Google Scholar 

  4. Bryant RE (1986) Graph-based algorithms for boolean function manipulation. IEEE Transactions on Computers 35:677–691

    Article  MATH  Google Scholar 

  5. Buttazzo GC (2004) Hard real-time computing systems: predictable scheduling algorithms and applications. Real-time systems series. Springer, Santa Clara

    Google Scholar 

  6. Cerný P, Chatterjee K, Henzinger TA, Radhakrishna A, Singh R (2011) Quantitative synthesis for concurrent programs. In: CAV 11: proc of 23rd conf on computer aided verification, pp 243–259

    Chapter  Google Scholar 

  7. Chatterjee K, Henzinger TA (2006) Finitary winning in omega-regular games. In: TACAS, pp 257–271

    Google Scholar 

  8. Chatterjee K, de Alfaro L, Henzinger TA (2004) Trading memory for randomness. In: QEST 04: proceedings of the first international conference on quantitative evaluation of systems. IEEE Comput Soc, New York, pp 206–217

    Chapter  Google Scholar 

  9. Chatterjee K, de Alfaro L, Henzinger TA (2005) The complexity of stochastic rabin and streett games. In: Proc 32nd int colloq aut lang prog. Lect notes in comp sci, vol 3580. Springer, Berlin, pp 878–890

    Google Scholar 

  10. Chatterjee K, Henzinger TA, Horn F (2009) Stochastic games with finitary objectives. In: MFCS, pp 34–54

    Google Scholar 

  11. Clarke EM, Emerson EA (1981) Design and synthesis of synchronization skeletons using branching time temporal logic. In: Proc workshop on logic of programs. Lect notes in comp sci, vol 131. Springer, Berlin, pp 52–71

    Chapter  Google Scholar 

  12. de Alfaro L (1997) Formal verification of probabilistic systems. PhD thesis, Stanford University. Technical Report STAN-CS-TR-98-1601

  13. de Alfaro L, Henzinger TA, Kupferman O (1998) Concurrent reachability games. In: Proc 39th IEEE symp found of comp sci. IEEE Comput Soc, New York, pp 564–575

    Google Scholar 

  14. de Alfaro L, Faella M, Majumdar R, Raman V (2005) Code aware resource management. In: EMSOFT 05: 5th intl. ACM conference on embedded software. ACM, New York, pp 191–202

    Chapter  Google Scholar 

  15. Derman C (1970) Finite state Markovian decision processes. Academic Press, San Diego

    MATH  Google Scholar 

  16. Devillers R (1977) Game interpretation of the deadlock avoidance problem. Commun ACM 20(10):741–745

    Article  MATH  Google Scholar 

  17. ecos homepage. http://ecos.sourceware.org/

  18. Engler DR, Ashcraft K (2003) RacerX: effective, static detection of race conditions and deadlocks. In: SOSP 03: symposium on operating systems principles. ACM, New York, pp 237–252

    Chapter  Google Scholar 

  19. Ezpeleta J, Colom JM, Martínez J (1995) A petri net based deadlock prevention policy for flexible manufacturing systems. IEEE Transactions on Robotics and Automation, N 2(11):173–184

    Article  Google Scholar 

  20. Filar J, Vrieze K (1997) Competitive Markov decision processes. Springer, Berlin

    MATH  Google Scholar 

  21. Filiot E, Jin N, Raskin J-F (2010) Compositional algorithms for ltl synthesis. In: ATVA, pp 112–127

    Google Scholar 

  22. Golan-Gueta G, Grasso Bronson N, Aiken A, Ramalingam G, Sagiv M, Yahav E (2011) Automatic fine-grain locking using shape properties. In: 26th ACM SIGPLAN conf on object-oriented programming, systems, languages, and applications (OOPSLA), pp 225–242

    Google Scholar 

  23. Gurevich Y, Harrington L (1982) Trees, automata, and games. In: Proc 14th ACM symp theory of comp. ACM, New York, pp 60–65

    Google Scholar 

  24. Hsieh FS, Chang SC (1992) Deadlock avoidance controller synthesis for flexible manufacturing systems. In: Proc of 3rd int conf on comp integrated manufacturing, pp 252–261

    Chapter  Google Scholar 

  25. Iordache MV, Moody J, Antsaklis PJ (2002) Synthesis of deadlock prevention supervisors using petri nets. IEEE Trans on Robotics and Automation 18:59–68

    Article  Google Scholar 

  26. Karp RM, Miller RE (1969) Parallel program schemata. J Comput Syst Sci 3(2):147–195

    Article  MathSciNet  MATH  Google Scholar 

  27. Kloukinas C, Yovine S (2003) Synthesis of safe, qos extendible, application specific schedulers for heterogeneous real-time systems. In: ECRTS, pp 287–294

    Google Scholar 

  28. Kloukinas C, Nakhli C, Yovine S (2003) A methodology and tool support for generating scheduled native code for real-time java applications. In: EMSOFT, pp 274–289

    Google Scholar 

  29. Kuperstein M, Vechev MT, Yahav E (2010) Automatic inference of memory fences. In: 10th int conf on formal methods in computer-aided design (FMCAD), pp 111–119

    Google Scholar 

  30. Necula GC, McPeak S, Rahul SP, Weimer W (2002) Intermediate language and tools for analysis and transformation of C programs. In: Proceedings of conference on compiler construction (CC)

    Google Scholar 

  31. Peterson JL, Silberschatz A (1988) Operating system concepts. Addison-Wesley, Reading

    Google Scholar 

  32. Piterman N, Pnueli A (2006) Faster solutions of rabin and streett games. In: LICS, pp 275–284

    Google Scholar 

  33. Savage S, Burrows M, Nelson CG, Sobalvarro P, Anderson TA (1997) Eraser: a dynamic data race detector for multithreaded programs. ACM Transactions on Computer Systems 15(4):391–411

    Article  Google Scholar 

  34. Solar-Lezama A, Arnold G, Tancau L, Bodík R, Saraswat VA, Seshia SA (2007) Sketching stencils. In: PLDI, pp 167–178

    Google Scholar 

  35. Solar-Lezama A, Jones CG, Bodík R (2008) Sketching concurrent data structures. In: ACM SIGPLAN conf on programming language design and implementation (PLDI), pp 136–148

    Google Scholar 

  36. Thomas W (1990) Automata on infinite objects. In: van Leeuwen J (ed) Handbook of theoretical computer science, vol B. Elsevier/North-Holland, Amsterdam, pp 135–191. Chapter 4

    Google Scholar 

  37. Toshimi M (1982) Deadlock avoidance revisited. J ACM 29(4):1023–1048

    Article  MATH  Google Scholar 

  38. von Behren JR, Condit J, Zhou F, Necula GC, Brewer EA (2003) Capriccio: scalable threads for internet services. In: SOSP 03: symposium on operating systems principles. ACM, New York, pp 268–281

    Chapter  Google Scholar 

Download references

Acknowledgements

This research was supported in part by the National Science Foundation CAREER award CCR-0132780, by the ONR grant N00014-02-1-0671, by the National Science Foundation grants CCR-0427202 and CCR-0234690, and by the ARP award TO.030.MM.D.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Vishwanath Raman.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Chatterjee, K., de Alfaro, L., Faella, M. et al. Code aware resource management. Form Methods Syst Des 42, 146–174 (2013). https://doi.org/10.1007/s10703-012-0170-4

Download citation

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10703-012-0170-4

Keywords

Navigation