A data processing apparatus configured to execute a plurality of threads, the data processing apparatus comprising: a general program counter for identifying one instruction in a stream of instructions to be executed for at least a subset of the plurality of threads, wherein each thread in the subset has an associated thread program counter for identifying one instruction in the stream of instructions; a selector configured to select a selected thread of the subset of threads and to set the general program counter to the thread program counter associated with the selected thread; and a processor configured to execute an instruction identified by the general program counter for two or more of the subset of threads including the selected thread, wherein a value of the thread program counter for each of the two or more of the subset of threads matches a value of the general program counter, wherein the subset of threads is associated with at least one lock parameter for tracking which of the subset of threads has exclusive access to a shared resource; wherein the processor is configured to modify the at least one lock parameter to indicate that a thread has gained exclusive access to the shared resource in response to a first instruction executed for that thread, and to modify the at least one lock parameter associated with the thread to indicate that the thread no longer has exclusive access to the shared resource in response to a second instruction executed for that thread; and wherein the selector is configured to select the selected thread based on the at least one lock parameter wherein the selector is configured to select, as said selected thread, a first thread indicated by the at least one lock parameter as having exclusive access to the shared resource in preference to a second thread indicated by the at least one lock parameter as not having exclusive access to the shared resource. a general program counter for identifying one instruction in a stream of instructions to be executed for at least a subset of the plurality of threads, wherein each thread in the subset has an associated thread program counter for identifying one instruction in the stream of instructions; a selector configured to select a selected thread of the subset of threads and to set the general program counter to the thread program counter associated with the selected thread; and a processor configured to execute an instruction identified by the general program counter for two or more of the subset of threads including the selected thread, wherein a value of the thread program counter for each of the two or more of the subset of threads matches a value of the general program counter, wherein the subset of threads is associated with at least one lock parameter for tracking which of the subset of threads has exclusive access to a shared resource; wherein the processor is configured to modify the at least one lock parameter to indicate that a thread has gained exclusive access to the shared resource in response to a first instruction executed for that thread, and to modify the at least one lock parameter associated with the thread to indicate that the thread no longer has exclusive access to the shared resource in response to a second instruction executed for that thread; and wherein the selector is configured to select the selected thread based on the at least one lock parameter wherein the selector is configured to select, as said selected thread, a first thread indicated by the at least one lock parameter as having exclusive access to the shared resource in preference to a second thread indicated by the at least one lock parameter as not having exclusive access to the shared resource.