# `sync`

[MIPS Documentation](https://asm-editor.specy.app/documentation/mips.md) › [Instructions](https://asm-editor.specy.app/documentation/mips/instruction.md)

Web page: https://asm-editor.specy.app/documentation/mips/instruction/sync

**Synchronize shared memory**

Category: Atomic

Orders the loads and stores around it, so that another processor observes them in program order.

## Forms

- `sync`

- `sync imm5` · Like 'sync', but the operand selects which accesses to order. This simulator completes every access immediately, so the type is ignored and the instruction does nothing.

## Operands

- `imm5`: An unsigned 5-bit immediate, `0` to `31`, used for values such as a shift count.

## Description

This simulator runs a single processor and completes every access immediately, so there is nothing to reorder and 'sync' does nothing. It is accepted so that compiler output and real-world code assemble unchanged.

## Example

```mips
.data
.align 2
value: .word 0
.text
# Store 7, execute sync, then read value back. Inspect $t1: 7; memory still contains the little-endian bytes 07 00 00 00.
la $t2, value
li $t0, 7
sw $t0, 0($t2)
sync
lw $t1, 0($t2)
```
