McGill University
Implementation and optimization of thread-local variables for a race-free Java dialect
Abstract
dc:description.abstractDespite the popularity of Java, problems may arise from potential data-race conditionsduring execution of a Java program. Data-races are considered errors in concurrent pro-gramming languages and greatly complicate both programming and runtime optimizationefforts. A race-free version of Java is therefore desirable as a way of avoiding this com-plexity and simplifying the programming model.This thesis is part of work trying to build a race-free version of Java. It implements andoptimizes thread-local accesses and comes up with a new semantics for this language. Animportant part of implementing a language without races is to distinguish thread-local datafrom shared data because these two groups of data need to be treated differently. This iscomplex in Java because in the current Java semantics all objects are allocated on a singleheap and implicitly shared by multiple threads. Furthermore, while Java does provide amechanism for thread-local storage, it is awkward to use and inefficient.Many of the new concurrent programming languages, such as OpenMP, UPC, and D,use "sharing directives" to distinguish shared data from thread-local data, and have fea-tures that make heavy use of thread-local data. Our goal here is to apply some of theselanguage ideas to a Java context in order to provide a simpler and less error-prone pro-gramming model. When porting such features as part of a language extension to Java,however, performance can suffer due to the simple, map-based implementation of Java'sbuilt-in ThreadLocal class. We implement an optimized mechanism based on program-mer annotations that can efficiently ensure class and instance variables are only accessed bytheir owner thread. Both class and instance variables inherit values from the parent threadthrough deep copying, allowing all the reachable objects of child threads to have localcopies if syntactically specified. In particular, class variable access involves direct accessto thread-local variables through a localized heap, which is faster and easier than the defaultmap mechanism defined for ThreadLocal objects. Our design improves performance sig-nificantly over the traditional thread-local access method for class variables and providesa simplified and more appealing syntax for doing so. We further evaluate our approach bymodifying non-trivial, existing benchmarks to make better use of thread-local features, il-lustrating feasibility and allowing us to measure the performance in realistic contexts. Thiswork is intended to bring us closer to designs for a complete race-free version of Java, aswell as show how improved support for use of thread-local data could be implemented inother languages.
Degree
thesis:*- Name thesis:degree_name
- Master of Science
- Grantor dc:publisher
- McGill University
- Year dc:date.issued
- 2012
Author and committee
dc:creator, dc:contributor.*- Author dc:creator
-
- Zhang, Yi
- Advisor dc:contributor.advisor
-
- Verbrugge, Clark (Internal/Supervisor)
Subjects
dc:subject × 1Rights
dc:rights- Statement dc:rights
-
- All items in eScholarship@McGill are protected by copyright with all rights reserved unless otherwise indicated.
- Language dc:language.iso
- en
Identifiers
dc:identifier.*- OCLC
- 841562462
- Identifier URI
- https://hdl.handle.net/20.500.14905/86573
- Dc Identifier Other
- hyrax:1v53k212t