A Lightweight Formalism for Reference Lifetimes and Borrowing in Rust

2021 ◽  
Vol 43 (1) ◽  
pp. 1-73
Author(s):  
David J. Pearce

Rust is a relatively new programming language that has gained significant traction since its v1.0 release in 2015. Rust aims to be a systems language that competes with C/C++. A claimed advantage of Rust is a strong focus on memory safety without garbage collection. This is primarily achieved through two concepts, namely, reference lifetimes and borrowing . Both of these are well-known ideas stemming from the literature on region-based memory management and linearity / uniqueness . Rust brings both of these ideas together to form a coherent programming model. Furthermore, Rust has a strong focus on stack-allocated data and, like C/C++ but unlike Java, permits references to local variables. Type checking in Rust can be viewed as a two-phase process: First, a traditional type checker operates in a flow-insensitive fashion; second, a borrow checker enforces an ownership invariant using a flow-sensitive analysis. In this article, we present a lightweight formalism that captures these two phases using a flow-sensitive type system that enforces “ type and borrow safety .” In particular, programs that are type and borrow safe will not attempt to dereference dangling pointers. Our calculus core captures many aspects of Rust, including copy- and move-semantics, mutable borrowing, reborrowing, partial moves, and lifetimes. In particular, it remains sufficiently lightweight to be easily digested and understood and, we argue, still captures the salient aspects of reference lifetimes and borrowing. Furthermore, extensions to the core can easily add more complex features (e.g., control-flow, tuples, method invocation). We provide a soundness proof to verify our key claims of the calculus. We also provide a reference implementation in Java with which we have model checked our calculus using over 500B input programs. We have also fuzz tested the Rust compiler using our calculus against 2B programs and, to date, found one confirmed compiler bug and several other possible issues.

1993 ◽  
Vol 07 (09n10) ◽  
pp. 1997-2023
Author(s):  
TAKEHIRO KOYAGUCHI

Diversity of volcanic activities reflects various styles of magma flows. One of the most important characters of the magma flows is that they are composed of gas, liquid and solid phases (multiphase flow). Macroscopic behaviours of multiphase flows are affected by their internal microstructures including the distribution of each phase and the shape of the boundaries between the two phases. Magma segregation from partially molten rock occurs by porous flow being accompanied with compaction of the matrix rock, the macroscopic behaviours of which are governed by microscopic flows of the melt at grain boundaries and deformation of each crystal. The fluctuation of magma effusion at volcanic eruptions is explained by instability of gas-liquid two-phase flow, which depends on motion of each bubble and the ability of bubbles to coalesce. Complex features of pyroclastic flow result from a wide range of grain-size, and hence, variable settling velocities of volcanic fragments within the flow. Physical processes of these multiphase flows in magmatism are reviewed.


Author(s):  
Vishu Madaan ◽  
Aditya Roy ◽  
Charu Gupta ◽  
Prateek Agrawal ◽  
Anand Sharma ◽  
...  

AbstractCOVID-19 (also known as SARS-COV-2) pandemic has spread in the entire world. It is a contagious disease that easily spreads from one person in direct contact to another, classified by experts in five categories: asymptomatic, mild, moderate, severe, and critical. Already more than 66 million people got infected worldwide with more than 22 million active patients as of 5 December 2020 and the rate is accelerating. More than 1.5 million patients (approximately 2.5% of total reported cases) across the world lost their life. In many places, the COVID-19 detection takes place through reverse transcription polymerase chain reaction (RT-PCR) tests which may take longer than 48 h. This is one major reason of its severity and rapid spread. We propose in this paper a two-phase X-ray image classification called XCOVNet for early COVID-19 detection using convolutional neural Networks model. XCOVNet detects COVID-19 infections in chest X-ray patient images in two phases. The first phase pre-processes a dataset of 392 chest X-ray images of which half are COVID-19 positive and half are negative. The second phase trains and tunes the neural network model to achieve a 98.44% accuracy in patient classification.


2007 ◽  
Vol 129 (11) ◽  
pp. 1415-1421 ◽  
Author(s):  
Joseph Borowsky ◽  
Timothy Wei

An experimental investigation of a two-phase pipe flow was undertaken to study kinematic and dynamic parameters of the fluid and solid phases. To accomplish this, a two-color digital particle image velocimetry and accelerometry (DPIV∕DPIA) methodology was used to measure velocity and acceleration fields of the fluid phase and solid phase simultaneously. The simultaneous, two-color DPIV∕DPIA measurements provided information on the changing characteristics of two-phase flow kinematic and dynamic quantities. Analysis of kinematic terms indicated that turbulence was suppressed due to the presence of the solid phase. Dynamic considerations focused on the second and third central moments of temporal acceleration for both phases. For the condition studied, the distribution across the tube of the second central moment of acceleration indicated a higher value for the solid phase than the fluid phase; both phases had increased values near the wall. The third central moment statistic of acceleration showed a variation between the two phases with the fluid phase having an oscillatory-type profile across the tube and the solid phase having a fairly flat profile. The differences in second and third central moment profiles between the two phases are attributed to the inertia of each particle type and its response to turbulence structures. Analysis of acceleration statistics provides another approach to characterize flow fields and gives some insight into the flow structures, even for steady flows.


1993 ◽  
Vol 115 (4) ◽  
pp. 781-783 ◽  
Author(s):  
Kiyoshi Minemura ◽  
Tomomi Uchiyama

This paper is concerned with the determination of the performance change in centrifugal pumps operating under two-phase flow conditions using the velocities and void fractions calculated under the assumption of an inviscid bubbly flow with slippage between the two phases. The estimated changes in the theoretical head are confirmed with experiments within the range of bubbly flow regime.


1981 ◽  
Vol 59 (1) ◽  
pp. 127-131 ◽  
Author(s):  
Alan N. Campbell

The properties named in the title have been determined by standard methods. Viscosity, molar volume, and orientation polarisation all indicate abnormalities of the nature of association between the components.The most interesting result is that of surface tension which indicates that, in the case of the binary system triethylamine–water, a surface layer of constant composition is formed over a wide range of total composition. When, by a rise in temperature of two or three degrees, this layer becomes unstable, it splits into two phases of different composition. The surface layer may then be instantaneously reformed and so on. A mechanism for the generation of a two-phase system is thus established. The data for the three-phase, isothermal, system are not so convincing, for reasons that are suggested.


1993 ◽  
Vol 8 (5) ◽  
pp. 957-961 ◽  
Author(s):  
J.C. Abele ◽  
R.L. Bristol ◽  
T.C. Nguyen ◽  
M.W. Ohmer ◽  
L.S. Wood

A model proposed by Tinkham1to explain the resistance versus temperature broadening found in highTcsuperconductors in applied magnetic fields is extended to “foot and knee”-structured data taken on polycrystalline YBa2Cu3O6+δ. The proposed extension involves a series combination of two types of superconductors. For this series combination to result, a critical ratio of the two types of superconductors must be met—a result common to both percolation and randomized cellular autonoma theory. This critical ratio is investigated via statistical computer models of a polycrystalline superconductor having two phases of crystallites—one with substantially lowerJcthan the other.


2021 ◽  
Author(s):  
Christina Mutschler ◽  
Jen Rouse ◽  
Kelly McShane ◽  
Criss Habal-Brosek

Background Psychosocial rehabilitation is a service that supports recovery from mental illness by providing opportunities for skill development, self-determination, and social interaction. One type of psychosocial rehabilitation is the Clubhouse model. The purpose of the current project was to create, test, and refine a realist theory of psychosocial rehabilitation at Progress Place, an accredited Clubhouse. Method Realist evaluation is a theory driven evaluation that uncovers contexts, mechanisms, and outcomes, in order to develop a theory as to how a program works. The current study involved two phases, encompassing four steps: Phase 1 included (1) initial theory development and (2) initial theory refinement; and Phase 2 included (3) theory testing and (4) refinement. Results The data from this two-phase approach identified three demi-regularities of recovery comprised of specific mechanisms and outcomes: the Restorative demi-regularity, the Reaffirming demi-regularity, and the Re-engaging demi-regularity. The theory derived from these demi-regularities suggests that there are various mechanisms that produce outcomes of recovery from the psychosocial rehabilitation perspective, and as such, it is necessary that programs promote a multifaceted, holistic perspective on recovery. Conclusions The realist evaluation identified that Progress Place promotes recovery for members. Additional research on the Clubhouse model should be conducted to further validate that the model initiates change and promotes recovery outcomes.


2014 ◽  
Vol 13 (01) ◽  
pp. 101-135 ◽  
Author(s):  
MUKESH KUMAR MEHLAWAT ◽  
PANKAJ GUPTA

In this paper, we develop a hybrid bi-objective credibility-based fuzzy mathematical programming model for portfolio selection under fuzzy environment. To deal with imprecise parameters, we use a hybrid credibility-based approach that combines the expected value and chance constrained programming techniques. The model simultaneously maximizes the portfolio return and minimizes the portfolio risk. We also consider an additional important criterion, namely, portfolio liquidity as a constraint in the model to make it better suited for practical applications. The proposed fuzzy optimization model is solved using a two-phase approach. An empirical study is included to demonstrate applicability of the proposed model and the solution approach in real-world applications of portfolio selection.


2003 ◽  
Vol 13 (04) ◽  
pp. 705-720 ◽  
Author(s):  
JIE WU ◽  
LI SHENG

We propose a deadlock-free routing scheme in irregular networks using prefix routing. Prefix routing is a special type of routing with a compact routing table associated with each node (processor). Basically, each outgoing channel of a node is assigned a special label and an outgoing channel is selected if its label is a prefix of the label of the destination node. Node and channel labeling in an irregular network is done through constructing a spanning tree. The routing process follows a two-phase process of going up and then down along the spanning tree, with a possible cross channel (shortcut) between two branches of the tree between two phases. We show that the proposed routing scheme is deadlock- and livelock-free. We also compare prefix routing with the existing up*/down* routing which has been widely used in irregular networks. Possible extensions are also discussed.


Sign in / Sign up

Export Citation Format

Share Document