Article
To read the full-text of this research, you can request a copy directly from the author.

Abstract

INTRODUCTION John Trono published a new exercise in concurrent programming [12] with the aim of providing educators with a more challenging problem than simple mutual exclusion: a problem with three distinct process types. His solution is rather complex, using ten semaphores and two global variables. Unfortunately, his solution is incorrect under the usual semantics of concurrent programming which require that a program be correct in any interleaving of the primitive statements of the processes [2]. Once a process has executed a semaphore instruction (either P or Q, there is nothing that requires that the process be scheduled for execution. Thus it is di#cult to get a group of processes to execute "together", which is the behavior required by the problem specification. There are semaphore algorithms that could probably be adapted to solve the problem [9], but these are extremely complex and not suitable for introductory courses in concu

No full-text available

Request Full-text Paper PDF

To read the full-text of this research,
you can request a copy directly from the author.

... The application first defines a regular Runnable class that carries the estimation of π (lines [1][2][3][4][5][6][7][8][9][10][11][12][13][14][15][16][17][18][19]. To parallelize its execution, lines 23-24 run a fork-join pattern using a set of number of points falling into the circle, which serves to approximate π . ...
... We measure the scale-up computed with respect to that fact: scale-up = T 1 /T n , where T 1 is the execution time of Listing 2 with one thread, and T n when using n threads. 6 Accordingly, scale-up = 1 means a perfect linear scale-up, i.e., the increase in the number of threads keeps up with the increase in the workload size (top line in Figure 3). The scale-up is sublinear when scale-up < 1. Non-surprisingly, the single machine solution quickly degrades when the number of threads exceeds the number of cores. ...
... This problem is a concurrent programming exercise in the vein of the dining philosophers, where processes need to coordinate in order to make progress. Common solutions employ semaphores and barriers, while others use actors [6]. In our case, we create a set of synchronization objects to implement the logic of the problem. ...
Conference Paper
Serverless computing is an emerging paradigm that greatly simplifies the usage of cloud resources and suits well to many tasks. Most notably, Function-as-a-Service (FaaS) enables programmers to develop cloud applications as individual functions that can run and scale independently. Yet, due to the disaggregation of storage and compute resources in FaaS, applications that require fine-grained support for mutable state and synchronization, such as machine learning and scientific computing, are hard to build. In this work, we present Crucial, a system to program highly-concurrent stateful applications with serverless architectures. Its programming model keeps the simplicity of FaaS and allows to port effortlessly multi-threaded algorithms to this new environment. Crucial is built upon the key insight that FaaS resembles to concurrent programming at the scale of a data center. As a consequence, a distributed shared memory layer is the right answer to the need for fine-grained state management and coordination in serverless. We validate our system with the help of micro-benchmarks and various applications. In particular, we implement two common machine learning algorithms: k-means clustering and logistic regression. For both cases, Crucial obtains superior or comparable performance to an equivalent Spark cluster.
... In particular, Polakow [24] directly embeds the linear lambda calculus in higher order abstract syntax (HOAS) [20] form, making it readily usable. However, his embedding relies on Haskell type classes and functional dependencies [12] to track the consumption of linear values; thus, it is difficult to adapt it to other programming 1 Faculty of Engineering, Gifu University, Gifu 501-1193, Japan 2 Graduate School of Mathematics, Nagoya University, Nagoya, Aichi 464-8602, Japan a) keigoi@gifu-u.ac.jp b) garrigue@math.nagoya-u.ac.jp languages. ...
... We also provide extra features for pattern matching against structured data, such as linearly typed lists, by using the syntax extension mechanism of OCaml, thus allowing much more flexible programming with linear types. As an application of our pattern matching extension, we introduce an encoding of session types [8] and show a solution to the so-called Santa Claus problem in concurrent programming [2], [27]. ...
... The Santa Claus problem [2], [27] is a problem in concurrent programming proposed by Trono, and it has served as a benchmark for concurrent features in various programming languages [18]. We quote the problem from Ref. [27]: ...
Article
This paper shows an encoding of linear types in OCaml and its applications. The encoding enables to write correct OCaml programs based on safe resource access guided by linear types. Linear types ensure that every variable is used exactly once, and, thus, they can be used to check the behavioural aspects of programs such as resource access and communication protocols in a static way. However, linear types require significant effort to be integrated into existing programming languages. Our encoding allows the vanilla OCaml typechecker to enforce linearity by using lenses and a parameterised monad. Parameterised monads are monads with a pre- and a post-condition, and we use them to track the creation and consumption of resources at the type level. Lenses, which point at parts of a data type, are used to refer to a resource in pre- and post-conditions. To handle comfortably structured data such as linearly typed lists, we further propose an extension to pattern matching based on the syntax-extension mechanism of OCaml. We show an application to static checking of communication protocols in OCaml.
... In order to compare the metric properties of the models, a simple description of a problem is explored that lends itself naturally to a concurrent solution, the Santa Claus Problem, introduced by John Trono in 1994 [7]. In addition to the Polyphonic C# [8] and Ada [9] versions, solutions to the problem have been written in Java using Java threads, Groovy using Java threads, C# using the .NET threading mechanism, C using pthreads [10], C using MPI, and Java using JCSP. ...
... As noted by Ben-ari [9], John Trono's solution using semaphores is incorrect because it incorrectly "assumes that a process released from waiting on a semaphore will necessarily be scheduled for execution." In a concurrent context, correctness refers to a system that is free from the possibility of deadlocks, livelocks, and race conditions. ...
... A solution to the problem was proposed in Ada [9] that used two constructs that were added to Ada 95 [18]. One was a construct that enables a group of processes to be collected and then released together, similar to the barriers that were presented above. ...
Conference Paper
Full-text available
The Santa Claus problem provides an excellent exercise in concurrent pro- gramming and can be used to show the simplicity or complexity of solving problems using a particular set of concurrency mechanisms and offers a comparison of these mechanisms. Shared-memory constructs, message passing constructs, and process ori- ented constructs will be used in various programming languages to solve the Santa Claus Problem. Various concurrency mechanisms available will be examined and an- alyzed as to their respective strengths and weaknesses.
... This problem is a concurrent programming exercise in the vein of the dining philosophers, where processes need to coordinate in order to make progress. Common solutions employ semaphores and barriers, while others, actors [18]. ...
... Solution. Let us now explain the design of a common solution to this problem [18]. Each entity (Santa, elves, and reindeer) is a thread. ...
Article
Serverless computing greatly simplifies the use of cloud resources. In particular, Function-as-a-Service (FaaS) platforms enable programmers to develop applications as individual functions that can run and scale independently. Unfortunately, applications that require fine-grained support for mutable state and synchronization, such as machine learning (ML) and scientific computing, are notoriously hard to build with this new paradigm. In this work, we aim at bridging this gap. We present Crucial , a system to program highly-parallel stateful serverless applications. Crucial retains the simplicity of serverless computing. It is built upon the key insight that FaaS resembles to concurrent programming at the scale of a datacenter. Accordingly, a distributed shared memory layer is the natural answer to the needs for fine-grained state management and synchronization. Crucial allows to port effortlessly a multi-threaded code base to serverless, where it can benefit from the scalability and pay-per-use model of FaaS platforms. We validate Crucial with the help of micro-benchmarks and by considering various stateful applications. Beyond classical parallel tasks (e.g., a Monte Carlo simulation), these applications include representative ML algorithms such as k -means and logistic regression. Our evaluation shows that Crucial obtains superior or comparable performance to Apache Spark at similar cost (18%–40% faster). We also use Crucial to port (part of) a state-of-the-art multi-threaded ML library to serverless. The ported application is up to 30% faster than with a dedicated high-end server. Finally, we attest that Crucial can rival in performance with a single-machine, multi-threaded implementation of a complex coordination problem. Overall, Crucial delivers all these benefits with less than 6% of changes in the code bases of the evaluated applications.
... Trono's solution is rejected in the paper How to solve the Santa Claus problem [3], though on different grounds. Ben-Ari states that semaphores are not sufficient as it assumes that any process released from waiting will automatically be scheduled again. ...
... Requirements for solutions proposed in this report 1 The system should have one Santa process. 2 The system should have nine Reindeer processes. 3 The system should have ten Elf processes. 4 No other processes should be introduced, though individual Reindeer, Elves or Santa may be made up of several processes themselves. ...
Conference Paper
Full-text available
A working solution to the Santa Claus Problem is demonstrated that operates over a distributed system. It is designed and modelled using the client/server model to maintain a deadlock and livelock free architecture. The system was developed using the JCSP library for Java and demonstrated over a network of twenty desktop PCs. Each Santa, Reindeer and Elf process is broken down into numerous sub-processes, and are each designed according to the client/server model. A novel approach to the Elves is presented using a chain-based architecture to allow non-determined subgroups to communicate and consult with Santa in sets of three.
... If both the group of the reindeers and a group of three elves are waiting for Santa, the priority is given to the reindeers. Ben-Ari [1] proposed an elegant solution based on Ada's concurrency mechanism and compares it with a (less elegant and less efficient) solution based on Java's concurrency mechanism. More recently, Benton [2] prosed a solution to the problem by using Polyphonic C♯ [3]. ...
... More recently, Benton [2] prosed a solution to the problem by using Polyphonic C♯ [3]. Benton's solution [2] in Polyphonic C♯ improves in terms of simplicity and readability over Ben-Ari's solution [1] in Ada. ...
Article
Full-text available
In this paper we present a solution to the Santa Claus prob-lem by using the state class construct. The Santa Claus problem is a programming exercise that has been used to illustrate the concurrency primitives of Ada, Java, and Polyphonic C♯.
... One popular fairness notion is the egalitarian welfare, based on the theory of distributive justice by Rawls [69,70], whose difference principle maximizes the welfare of the worst-off group of agents. The egalitarian welfare objective defines a max-min welfare optimization problem, whose indivisible variant is dubbed the Santa Claus problem [21,23,33]. Other common fairness notions studied in the literature include Nash social welfare [55,48,31,38], envy freeness [2], and Pareto efficiency [75]. ...
Preprint
Full-text available
We study a dynamic allocation problem in which T sequentially arriving divisible resources need to be allocated to n fixed agents with additive utilities. Agents' utilities are drawn stochastically from a known distribution, and decisions are made immediately and irrevocably. Most works on dynamic resource allocation aim to maximize the utilitarian welfare of the agents, which may result in unfair concentration of resources at select agents while leaving others' demands under-fulfilled. In this paper, we consider the egalitarian welfare objective instead, which aims at balancing the efficiency and fairness of the allocation. To this end, we first study a fluid-based policy derived from a deterministic approximation to the underlying problem and show that it attains a regret of order Θ(T)\Theta(\sqrt{T}) against the hindsight optimum, i.e., the optimal egalitarian allocation when all utilities are known in advance. We then propose a new policy, called Backward Infrequent Re-solving with Thresholding (BIRT\mathsf{BIRT}), which consists of re-solving the fluid problem at most O(loglogT)O(\log\log T) times. We prove the BIRT\mathsf{BIRT} policy attains O(1) regret against the hindsight optimum, independently of the time horizon length T and initial welfare. We also present numerical experiments to illustrate the significant performance improvement against several benchmark policies.
... We have written a number of nontrivial samples in Polyphonic C , including some web combinators along the lines of Cardelli and Davies [1999], an animated version of the dining philosophers, a distributed stock-dealing simulation built on .NET's remoting infrastructure, 11 a multi-threaded client for the TerraServer web service [Barclay et al. 2000;Barclay et al. 2002], and a solution [Benton 2003] to the "Santa Claus" problem [Trono 1994;Ben-Ari 1998]. In all these cases, we could rapidly, correctly and concisely express the intended concurrency and synchronization. ...
Conference Paper
Full-text available
Polyphonie C# is an extension of the C# language with new asynchronous concurrency constructs, based on the join calculus. We describe the design and implementation of the language and give examples of its use in addressing a range of concurrent programming problems.
... Over the years, solutions have been published demonstrating many approaches to concurrency (Section 7.1). The first of these solutions (using semaphores [Trono 1994]) was shown to be incorrect (by Ben-Ari et al. [Ben-Ari 1998]) and replaced by one using monitors. The fact that the first published solution was wrong is evidence that the problem is not, in fact, that simple. ...
Article
Full-text available
With the commercial development of multicore processors, the challenges of writing multithreaded programs to take advantage of these new hardware architectures are becoming more and more pertinent. Concurrent programming is necessary to achieve the performance that the hardware offers. Traditional approaches present concurrency as an advanced topic: they have proven difficult to use, reason about with confidence, and scale up to high levels of concurrency. This article reviews process-oriented design, based on Hoare's algebra of Communicating Sequential Processes (CSP), and proposes that this approach to concurrency leads to solutions that are manageable by novice programmers; that is, they are easy to design and maintain, that they are scalable for complexity, obviously correct, and relatively easy to verify using formal reasoning and/or model checkers. These solutions can be developed in conventional programming languages (through CSP libraries) or specialized ones (such as occam-π) in a manner that directly reflects their formal expression. Systems can be developed without needing specialist knowledge of the CSP formalism, since the supporting mathematics is burnt into the tools and languages supporting it. We illustrate these concepts with the Santa Claus problem, which has been used as a challenge for concurrency mechanisms since 1994. We consider this problem as an example control system, producing external signals reporting changes of internal state (that model the external world). We claim our occam-π solution is correct-by-design, but follow this up with formal verification (using the FDR model checker for CSP) that the system is free from deadlock and livelock, that the produced control signals obey crucial ordering constraints, and that the system has key liveness properties.
... As our initial experiences using Polyphonic C were positive, we have recently built a more robust, full-featured and maintainable implementation on top of an 'experimentation-friendly' C -in-C compiler being developed by another group within Microsoft. We have written a number of non-trivial samples in Polyphonic C , including some web combinators along the lines of Cardelli and Davies [1999], an animated version of the dining philosophers, a distributed stock-dealing simulation built on .NET's remoting infrastructure 11 , a multithreaded client for the TerraServer web service [Barclay et al. 2000; Barclay et al. 2002], and a solution [Benton 2003] to the " Santa Claus " problem [Trono 1994; Ben-Ari 1998]. In all these cases, we could rapidly, correctly and concisely express the intended concurrency and synchronization. ...
Conference Paper
Full-text available
this paper appears in the proceedings of ECOOP 2002 { ObjectOriented Programming, LNCS 2374, June 2002. The prototype implementation described in the paper will shortly be available from http://research.microsoft.com/~nick/polyphony/
... We have considered some classical concurrent programming problem examples, including the " Santa Claus Problem "[25,2,3,7]. However, further experience is needed in order to assess the usefulness of the state class construct and to identify idioms and features useful for writing more compact code, like, for instance, the constructs: – this!!previous, to express the transition to the previous state, – this??current, that returns the current state, – this??previous, that returns the previous state, – as, to specify that the declaration of a method in a state is " as " in other state (thus saving the programmer from duplicating the same method body in different states). ...
Article
Full-text available
The state of a concurrent object, intended as some abstraction over the values of the fields of the object, usually determines its coordination behavior. Therefore, state is always in the programmer’s mind, even though implicitly. We suggest a feature for Java-like languages, which makes the state of a concurrent object explicit and supports the expression of the object’s behavior depending on the state it is currently in. Namely, an object will be in one of the states declared in its class. The state determines the presence of fields and methods. State transition statements explicitly change the state of an object, and thus change the availability of fields and methods. When a thread calls a method which is declared in the object’s class but absent from its current state, it waits, until the state of the object changes to a state which does contain that method. This directly expresses coordination. We claim that this feature makes it easier to understand and develop concurrent programs, and substantiate our claim through the discussion of some popular examples of concurrent programs written using this feature.We develop a type and effect system, which guarantees that, during execution of a method invoked on a concurrent object o{\tt o}: (1) No attempt will be made to access fields not available in the current state of o{\tt o}, and (2) No method invoked on a receiver (syntactically) different from this{\tt this} may cause the invocation of a method on o{\tt o}. The latter guarantee helps to enforce the former and prevents a family of accidental violations of the intended coordination protocol.
... The errors which are easy to make in an attempt to solve this problem include extra elves being able to sneak into a group once Santa has started showing elves into his office, or Santa being able to go off delivering toys whilst the reindeer are still waiting in the stable. Ben-Ari [1] points out a bug (of the second kind) in Trono's initial semaphore-based solution, shows how the problem may be solved fairly neatly using Ada's concurrency primitives and compares this with a much less elegant and less efficient solution in Java. ...
Article
Full-text available
The Santa Claus problem is an interesting exercise in concurrent programming which has been used in a comparison of the concurrency mechanisms of Ada and Java. We present a simple solution to the problem in , an extension of C with new concurrency constructs based on the Join calculus.
Conference Paper
Full-text available
Finite-state verification (FSV) techniques attempt to prove properties about a model of a system by examining all pos- sible behaviors of that model. This approach suers from the state-explosion problem, where the size of the model or the analysis costs may be exponentially large with respect to the size of the system. Approaches that use symbolic data structures to represent the examined state space appear to provide an important optimization. In this paper, we inves- tigate applying two symbolic data structures, Binary Deci- sion Diagrams (BDDs) and Zero-suppressed Binary Decision Diagrams (ZDDs), in two FSV tools, LTSA and FLAVERS. We describe an experiment showing that these two symbolic approaches can improve the performance of both FSV tools and are more ecient than two other algorithms that store the state space explicitly. Moreover, the ZDD-based ap- proach often runs faster and can handle larger systems than the BDD-based approach.
Conference Paper
CSP, Hoare's Communicating Sequential Processes, is a form al language for specifying, implementing and reasoning about concurrent processes and their in- teractions. Existing software tools that deal with CSP dire ctly are largely concerned with assisting formal proofs. This paper presents an altern ative use for CSP, namely the compilation of CSP systems to executable code. The main motivation for this work is in providing a means to experiment with relatively large CSP systems, possibly con- sisting millions of concurrent processes — something that is hard to achieve with the tools currently available.
Book
Full-text available
Article
Full-text available
This article presents an exercise to be assigned whenever undergraduates are introduced to the concepts of concurrency and semaphores. It also presents several possible strategies to solve said exercise along with a "coded" solution.
Article
Full-text available
Method Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 9.4.1 Inheritance and Overriding . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 9.4.2 Overloading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 9.4.3 Examples of Abstract Method Declarations . . . . . . . . . . . . . . . 190 9.4.3.1 Example: Overriding . . . . . . . . . . . . . . . . . . . . . . . . 190 9.4.3.2 Example: Overloading . . . . . . . . . . . . . . . . . . . . . . . 191 10 Arrays. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 10.1 Array Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194 10.2 Array Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xii 10.3 Array Creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 10.4 Array Access...
Article
This paper develops Brinch-Hansen's concept of a monitor as a method of structuring an operating system. It introduces a form of synchronization, describes a possible method of implementation in terms of semaphores and gives a suitable proof rule. Illustrative examples include a single resource scheduler, a bounded buffer, an alarm clock, a buffer pool, a disk head optimizer, and a version of the problem of readers and writers.
Article
Properties : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 55 5.2 Property Value Definitions : : : : : : : : : : : : : : : : : : : : : : : : : : 57 5.3 Associations : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 58 6 Named Values 61 6.1 Name Definitions : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 62 6.2 Value Definitions : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 63 6.2.1 Function Bindings : : : : : : : : : : : : : : : : : : : : : : : : : : 65 6.2.2 Pattern Bindings : : : : : : : : : : : : : : : : : : : : : : : : : : : 69 6.3 Patterns and Pattern Matching : : : : : : : : : : : : : : : : : : : : : : : CONTENTS iii 6.4 Constraints : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 75 6.5 Equations : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 76 7 Expressions 79 7.1 Function Applications : : : : : : : : : : : : : : : : : : : : : : : : : : : : 81 7.2 Operator Applications ...
Article
A new paradigm for computing is emerging based on the Internet and the World Wide Web, accompanied by a new standard programming platform based on the Java(tm) technology recently announced by Sun Microsystems [4]. The Java technology includes the definition for a platformindependent byte code representation for small applications called applets, which allows Java-enabled Web browsers to download and execute these Java applets using a byte code interpreter. Although the Java byte-code representation was designed specifically for the new Java language, it turns out that the underlying semantic models of Ada 95 and Java are sufficiently similar that a very direct mapping from Ada 95 to Java byte codes is possible. We at Intermetrics are in the process of adapting our Ada 95 compiler front end to generate Java byte codes directly, thereby allowing the development of Java-compatible applets in Ada 95. This paper explains our approach, and provides details on the mapping fro...