1. A method comprising: initiating execution of a plurality of threads to process instructions of a program that includes a barrier instruction; for each thread in the plurality of threads, determining whether the thread participates in the barrier instruction when the thread reaches the barrier instruction during execution of the thread; and serially executing each of the threads that participate in the barrier instruction to process one or more instructions of the program that follow the barrier instruction.