# Happens-Before Relationship

> A conceptual representation of the partial order in which one operation is known to precede another.

Record: `architecture:happens-before-relationship`
Kind: model
Layer: [Causality Core](https://banes-lab.com/records/layer/causality-core.md)
Severity: contextual
Scope: concurrency, distributed events
Canonical: https://banes-lab.com/ontology#architecture-happens-before-relationship

Listed in [Architecture principles](https://banes-lab.com/api/records/architecture.md), after [Causal Consistency](https://banes-lab.com/records/architecture/causal-consistency.md) and before [Event Ordering](https://banes-lab.com/records/architecture/event-ordering.md).

## Repair

- Refactored by: Add Synchronization, Add Ordering Constraint
- Detected by: race detectors, missing synchronization
- Violated by: assuming unordered operations are ordered
- Measured by: ordering violation count
- Enforced by: concurrency tests

## Requires

- [Ordering Semantics](https://banes-lab.com/records/lexicon/ordering-semantics.md)

## Reinforces

- [Correctness](https://banes-lab.com/records/architecture/correctness.md)
- [Causal Reasoning](https://banes-lab.com/records/lexicon/causal-reasoning.md)

## Enables

- [Race Detection](https://banes-lab.com/records/lexicon/race-detection.md)

## Conflicts with

- [Race Conditions](https://banes-lab.com/records/lexicon/race-conditions.md)

## In tension with

- [Parallel Execution](https://banes-lab.com/records/lexicon/parallel-execution.md)

## Tensions

- [Happens-Before Relationship / Parallel Execution](https://banes-lab.com/records/tension/happens-before-relationship-parallel-execution.md)

## Severity

- [contextual](https://banes-lab.com/records/vocabulary/severity-contextual.md)

## Category

- [Causality / Ordering / Distributed Time](https://banes-lab.com/records/architecture-category/causality-ordering-distributed-time.md)

## Required by

- [Hybrid Logical Clocks](https://banes-lab.com/records/architecture/hybrid-logical-clocks.md)

## Linked from

- [Stating an invariant](https://banes-lab.com/disciplined-methodology/collaborate/stating-an-invariant.md)
- [Execution joins the halves](https://banes-lab.com/software-architecture/principles/execution-joins-the-halves.md)
- [Causality / Ordering / Distributed Time](https://banes-lab.com/ontology/principles/architecture-category-causality-ordering-distributed-time.md)
- [Correctness / Determinism / Verification](https://banes-lab.com/ontology/principles/architecture-category-correctness-determinism-verification.md)
- [Causality / Ordering / Distributed Time](https://banes-lab.com/ontology/lexicon/lexicon-category-causality-ordering-distributed-time.md)
- [Core Vocabulary](https://banes-lab.com/ontology/lexicon/lexicon-category-core-vocabulary.md)
- [Severity levels](https://banes-lab.com/ontology/schema/the-vocabulary-severity.md)
- [The resolutions](https://banes-lab.com/ontology/schema/the-resolutions.md)
