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.









Similar content being viewed by others
Notes
Recall that our goal is to schedule correct software, rather than to perform software verification.
References
Banaszak ZA, Krogh BH (1990) Deadlock avoidance in flexible manufacturing systems with concurrently competing process flows. IEEE Trans Rob Autom 6(6):724–734
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
Bodík R (2012) Compiling what to how: technical perspective. Commun ACM 55(2):102
Bryant RE (1986) Graph-based algorithms for boolean function manipulation. IEEE Transactions on Computers 35:677–691
Buttazzo GC (2004) Hard real-time computing systems: predictable scheduling algorithms and applications. Real-time systems series. Springer, Santa Clara
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
Chatterjee K, Henzinger TA (2006) Finitary winning in omega-regular games. In: TACAS, pp 257–271
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
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
Chatterjee K, Henzinger TA, Horn F (2009) Stochastic games with finitary objectives. In: MFCS, pp 34–54
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
de Alfaro L (1997) Formal verification of probabilistic systems. PhD thesis, Stanford University. Technical Report STAN-CS-TR-98-1601
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
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
Derman C (1970) Finite state Markovian decision processes. Academic Press, San Diego
Devillers R (1977) Game interpretation of the deadlock avoidance problem. Commun ACM 20(10):741–745
ecos homepage. http://ecos.sourceware.org/
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
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
Filar J, Vrieze K (1997) Competitive Markov decision processes. Springer, Berlin
Filiot E, Jin N, Raskin J-F (2010) Compositional algorithms for ltl synthesis. In: ATVA, pp 112–127
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
Gurevich Y, Harrington L (1982) Trees, automata, and games. In: Proc 14th ACM symp theory of comp. ACM, New York, pp 60–65
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
Iordache MV, Moody J, Antsaklis PJ (2002) Synthesis of deadlock prevention supervisors using petri nets. IEEE Trans on Robotics and Automation 18:59–68
Karp RM, Miller RE (1969) Parallel program schemata. J Comput Syst Sci 3(2):147–195
Kloukinas C, Yovine S (2003) Synthesis of safe, qos extendible, application specific schedulers for heterogeneous real-time systems. In: ECRTS, pp 287–294
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
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
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)
Peterson JL, Silberschatz A (1988) Operating system concepts. Addison-Wesley, Reading
Piterman N, Pnueli A (2006) Faster solutions of rabin and streett games. In: LICS, pp 275–284
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
Solar-Lezama A, Arnold G, Tancau L, Bodík R, Saraswat VA, Seshia SA (2007) Sketching stencils. In: PLDI, pp 167–178
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
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
Toshimi M (1982) Deadlock avoidance revisited. J ACM 29(4):1023–1048
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
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
Corresponding author
Rights 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
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10703-012-0170-4