Skip to content

How much synchronization does shared object allocation do? #109

@tlively

Description

@tlively

As we've discussed before, allocation of shared objects (i.e. structs and arrays) must include whatever barriers are necessary to guarantee that other threads will not read uninitialized fields. But must these barriers provide any other guarantees?

Consider this execution where x and y are distinct and *x starts out as 0:

T1                |   T2
(A) *x = 1        |
(B) *y = new $foo |
                  | (C) r1 = (*y).bar (reads value from B)
                  | (D) r2 = *x

Is r2 allowed to be 0, or must it be 1?

Since (C) is not an acquire load, I hope that the answer is that 0 is allowed and that it would be perfectly valid to reorder (C) and (D) and/or reorder (A) and (B). @conrad-watt, is that right?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions