The present invention generally relates to synchronization of multiple
threads in an out-of-order microprocessor utilizing the insertion of a
trap. In one embodiment, while synchronizing multiple running threads, an
instruction within a first running thread is identified. Upon
identification of this instruction, a trap is inserted into a second
running thread. All instructions within the instructional pipeline that
are scheduled for execution prior to this trapped instruction must retire
before the subsequent execution of the synchronizing instruction.
Following the execution of the synchronizing instruction, all
instructions within the instruction pipeline slated for execution after
the trapped instruction in the remaining threads are flushed and
refetched.