Abstract
Multi-threaded programs have traditionally fallen into one of two domains: cooperative and competitive. These two domains have traditionally remained mostly disjoint, with cooperative threading used for increasing throughput in compute-intensive applications such as scientific workloads and cooperative threading used for increasing responsiveness in interactive applications such as GUIs and games. As multicore hardware becomes increasingly mainstream, there is a need for bridging these two disjoint worlds, because many applications mix interaction and computation and would benefit from both cooperative and competitive threading.
In this paper, we present techniques for programming and reasoning about parallel interactive applications that can use both cooperative and competitive threading. Our techniques enable the programmer to write rich parallel interactive programs by creating and synchronizing with threads as needed, and by assigning threads user-defined and partially ordered priorities. To ensure important responsiveness properties, we present a modal type system analogous to S4 modal logic that precludes low-priority threads from delaying high-priority threads, thereby statically preventing a crucial set of priority-inversion bugs. We then present a cost model that allows reasoning about responsiveness and completion time of well-typed programs. The cost model extends the traditional work-span model for cooperative threading to account for competitive scheduling decisions needed to ensure responsiveness. Finally, we show that our proposed techniques are realistic by implementing them as an extension to the Standard ML language.
Supplemental Material
- Umut A. Acar, Arthur Charguéraud, and Mike Rainey. 2013. Scheduling Parallel Programs by Work Stealing with Private Deques. In PPoPP ’13. Google Scholar
Digital Library
- Arvind and K. P. Gostelow. 1978. The Id Report: An Asychronous Language and Computing Machine. Technical Report TR-114. Department of Information and Computer Science, University of California, Irvine.Google Scholar
- Guy Blelloch and John Greiner. 1995. Parallelism in sequential functional languages. In Proceedings of the 7th International Conference on Functional Programming Languages and Computer Architecture (FPCA ’95). ACM, 226–237. Google Scholar
Digital Library
- Guy E. Blelloch and John Greiner. 1996. A provable time and space efficient implementation of NESL. In Proceedings of the 1st ACM SIGPLAN International Conference on Functional Programming. ACM, 213–225. Google Scholar
Digital Library
- Guy E. Blelloch, Jonathan C. Hardwick, Jay Sipelstein, Marco Zagha, and Siddhartha Chatterjee. 1994. Implementation of a Portable Nested Data-Parallel Language. J. Parallel Distrib. Comput. 21, 1 (1994), 4–14. Google Scholar
Digital Library
- Richard P. Brent. 1974. The parallel evaluation of general arithmetic expressions. J. ACM 21, 2 (1974), 201–206. Google Scholar
Digital Library
- Manuel M. T. Chakravarty, Roman Leshchinskiy, Simon L. Peyton Jones, Gabriele Keller, and Simon Marlow. 2007. Data parallel Haskell: a status report. In Proceedings of the POPL 2007 Workshop on Declarative Aspects of Multicore Programming, DAMP 2007, Nice, France, January 16, 2007. 10–18. Google Scholar
Digital Library
- Satish Chandra, Vijay Saraswat, Vivek Sarkar, and Rastislav Bodik. 2008. Type Inference for Locality Analysis of Distributed Data Structures. In Proceedings of the 13th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (PPoPP ’08). ACM, New York, NY, USA, 11–22. Google Scholar
Digital Library
- Philippe Charles, Christian Grothoff, Vijay Saraswat, Christopher Donawa, Allan Kielstra, Kemal Ebcioglu, Christoph von Praun, and Vivek Sarkar. 2005. X10: an object-oriented approach to non-uniform cluster computing. In Proceedings of the 20th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications (OOPSLA ’05). ACM, 519–538. Google Scholar
Digital Library
- Dennis Cornhill and Lui Sha. 1987. Priority Inversion in Ada. Ada Letters VII, 7 (Nov. 1987), 30–32. Google Scholar
Digital Library
- Rowan Davies. 1996. A Temporal-Logic Approach to Binding-Time Analysis. In LICS. 184–195. Google Scholar
Digital Library
- Derek L. Eager, John Zahorjan, and Edward D. Lazowska. 1989. Speedup versus efficiency in parallel systems. IEEE Transactions on Computing 38, 3 (1989), 408–423. Google Scholar
Digital Library
- Nicolas Feltman, Carlo Angiuli, Umut A. Acar, and Kayvon Fatahalian. 2016. Automatically Splitting a Two-Stage Lambda Calculus. In Proceedings of the 25 European Symposium on Programming, ESOP. 255–281.Google Scholar
Digital Library
- C. J. Fidge. 1993. A Formal Definition of Priority in CSP. ACM Trans. Program. Lang. Syst. 15, 4 (Sept. 1993), 681–705. Google Scholar
Digital Library
- Matthew Fluet, Mike Rainey, John Reppy, and Adam Shaw. 2011. Implicitly threaded parallelism in Manticore. Journal of Functional Programming 20, 5-6 (2011), 1–40. Google Scholar
Digital Library
- Matteo Frigo, Charles E. Leiserson, and Keith H. Randall. 1998. The Implementation of the Cilk-5 Multithreaded Language. In PLDI. 212–223. Google Scholar
Digital Library
- Robert H. Halstead. 1985. MULTILISP: a language for concurrent symbolic computation. ACM Transactions on Programming Languages and Systems 7 (1985), 501–538. Google Scholar
Digital Library
- Carl Hauser, Christian Jacobi, Marvin Theimer, Brent Welch, and Mark Weiser. 1993. Using Threads in Interactive Systems: A Case Study. In Proceedings of the Fourteenth ACM Symposium on Operating Systems Principles (SOSP ’93). ACM, New York, NY, USA, 94–105. Google Scholar
Digital Library
- Suresh Jagannathan, Armand Navabi, KC Sivaramakrishnan, and Lukasz Ziarek. 2010. The Design Rationale for Multi-MLton. In ML ’10: Proceedings of the ACM SIGPLAN Workshop on ML. ACM.Google Scholar
- Limin Jia and David Walker. 2004. Modal Proofs as Distributed Programs. In 13th European Symposium on Programming, ESOP 2004, David Schmidt (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg, 219–233.Google Scholar
Cross Ref
- Gabriele Keller, Manuel M.T. Chakravarty, Roman Leshchinskiy, Simon Peyton Jones, and Ben Lippmeier. 2010. Regular, shape-polymorphic, parallel arrays in Haskell. In Proceedings of the 15th ACM SIGPLAN international conference on Functional programming (ICFP ’10). 261–272. Google Scholar
Digital Library
- Butler W. Lampson and David D. Redell. 1980. Experience with Processes and Monitors in Mesa. Commun. ACM 23, 2 (1980), 105–117. Google Scholar
Digital Library
- G. Levine. 1988. The Control of Priority Inversion in Ada. Ada Lett. VIII, 6 (Nov. 1988), 53–56. Google Scholar
Digital Library
- Jonathan Moody. 2003. Modal Logic as a Basis for Distributed Computation. Technical Report CMU-CS-03-194. School of Computer Science, Carnegie Mellon University.Google Scholar
- Stefan Muller, Umut A. Acar, and Robert Harper. 2018. Competitive Parallelism: Getting Your Priorities Right. ArXiv e-prints (July 2018). arXiv: cs.PL/1807.03703Google Scholar
- Stefan K. Muller and Umut A. Acar. 2016. Latency-Hiding Work Stealing: Scheduling Interacting Parallel Computations with Work Stealing. In Proceedings of the 28th ACM Symposium on Parallelism in Algorithms and Architectures, SPAA 2016, Asilomar State Beach/Pacific Grove, CA, USA, July 11-13, 2016. 71–82. Google Scholar
Digital Library
- Stefan K. Muller, Umut A. Acar, and Robert Harper. 2017. Responsive Parallel Computation: Bridging Competitive and Cooperative Threading. In Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2017). ACM, New York, NY, USA, 677–692. Google Scholar
Digital Library
- Tom Murphy, VII, Karl Crary, Robert Harper, and Frank Pfenning. 2004. A symmetric modal lambda calculus for distributed computing. In Proceedings of the 19th IEEE Symposium on Logic in Computer Science (LICS). IEEE Press, 286–295. Google Scholar
Digital Library
- Tom Murphy, VII. 2008. Modal Types for Mobile Code. Ph.D. Dissertation. Carnegie Mellon. Available as technical report CMU-CS-08-126. Google Scholar
Digital Library
- Tom Murphy, VII, Karl Crary, and Robert Harper. 2007. Type-safe Distributed Programming with ML5. In Trustworthy Global Computing 2007. Google Scholar
Digital Library
- Frank Pfenning and Rowan Davies. 2001. A Judgmental Reconstruction of Modal Logic. Mathematical Structures in Computer Science 11 (2001), 511–540. Google Scholar
Digital Library
- Ram Raghunathan, Stefan K. Muller, Umut A. Acar, and Guy Blelloch. 2016. Hierarchical Memory Management for Parallel Programs. In Proceedings of the 21st ACM SIGPLAN International Conference on Functional Programming (ICFP 2016). ACM, New York, NY, USA, 392–406. Google Scholar
Digital Library
- John H. Reppy. 1999. Concurrent Programming in ML. Cambridge University Press, New York, NY, USA. Google Scholar
Digital Library
- Mads Rosendahl. 1989. Automatic complexity analysis. In FPCA ’89: Functional Programming Languages and Computer Architecture. ACM, 144–156. Google Scholar
Digital Library
- David Sands. 1990. Complexity Analysis for a Lazy Higher-Order Language. In ESOP ’90: Proceedings of the 3rd European Symposium on Programming. Springer-Verlag, London, UK, 361–376. Google Scholar
Digital Library
- David Canfield Smith, Charles Irby, Ralph Kimball, Bill Verplank, and Eric Harslem. 1982. Designing the Star User Interface. BYTE Magazine 7, 4 (1982), 242–282.Google Scholar
- Daniel Spoonhower. 2009. Scheduling Deterministic Parallel Programs. Ph.D. Dissertation. Carnegie Mellon University, Pittsburgh, PA, USA. Google Scholar
Digital Library
- Daniel Spoonhower, Guy E. Blelloch, Robert Harper, and Phillip B. Gibbons. 2008. Space Profiling for Parallel Functional Programs. In International Conference on Functional Programming. Google Scholar
Digital Library
- Daniel C. Swinehart, Polle T. Zellweger, Richard J. Beach, and Robert B. Hagmann. 1986. A Structural View of the Cedar Programming Environment. ACM Trans. Program. Lang. Syst. 8, 4 (Aug. 1986), 419–490. Google Scholar
Digital Library
- J.D. Ullman. 1975. NP-complete scheduling problems. J. Comput. System Sci. 10, 3 (1975), 384 – 393. Google Scholar
Digital Library
- Kathy Yelick, Luigi Semenzato, Geoff Pike, Carleton Miyamoto, Ben Liblit, Arvind Krishnamurthy, Paul Hilfinger, Susan Graham, David Gay, Phil Colella, and Alex Aiken. 1998. Titanium: A high-performance Java dialect. In In ACM 1998 Workshop on Java for High-Performance Network Computing (New. ACM, Ed., ACM Press.Google Scholar
Cross Ref
Index Terms
Competitive parallelism: getting your priorities right
Recommendations
Fairness in responsive parallelism
Research on parallel computing has historically revolved around compute-intensive applications drawn from traditional areas such as high-performance computing. With the growing availability and usage of multicore chips, applications of parallel ...
Massive atomics for massive parallelism on GPUs
ISMM '14One important type of parallelism exploited in many applications is reduction type parallelism. In these applications, the order of the read-modify-write updates to one shared data object can be arbitrary as long as there is an imposed order for the ...
Concurrent programming with revisions and isolation types
OOPSLA '10: Proceedings of the ACM international conference on Object oriented programming systems languages and applicationsBuilding applications that are responsive and can exploit parallel hardware while remaining simple to write, understand, test, and maintain, poses an important challenge for developers. In particular, it is often desirable to enable various tasks to ...






Comments