Naveen
Naveen

Reputation: 177

uint64_t writes in 32 bit machine

When 2 process communicating via shared memory on 32 bit solaris i386 Arch

  1. Is it guaranteed that for the value of uint64_t datatype, (value < 2^32) is written in single memory location and (value > 2^32 ) is written in 2 memory location?
  2. Is the 32 bit memory read is atomic.?

Upvotes: 1

Views: 1121

Answers (1)

Oliver Charlesworth
Oliver Charlesworth

Reputation: 272772

A 64-bit value is always written into 64 bits of memory!1 The write is almost certainly not atomic (unless the architecture explicitly guarantees this).


1. Except, of course, when it's not written to memory at all (i.e. when there's no register spill. But that's beside the point.

Upvotes: 3

Related Questions