Content deleted Content added
No edit summary |
#suggestededit-add-desc 1.0 Tags: Mobile edit Mobile app edit Android app edit |
||
(One intermediate revision by one other user not shown) | |||
Line 1:
{{Short description|CPU Instruction}}
In [[computer architecture]], the [[test-and-set]] CPU [[instruction (computer science)|instruction]] (or instruction sequence) is designed to implement
[[mutual exclusion]] in [[multiprocessor]] environments. Although a correct [[lock (computer science)|lock]] can be implemented with test-and-set, the ''test and test-and-set'' optimization lowers [[resource contention]] caused by bus locking, especially [[cache coherence | cache coherency protocol]] overhead on contended locks.
Line 32 ⟶ 33:
==Caveat==
Although this [[Optimization (computer science)|optimization]] is useful in [[system programming]], test-and-set is to be avoided in high-level [[concurrent programming]]: spinning in applications
the knowledge of who is blocking on what. Consequently, the scheduler will have to guess on how to allocate CPU time among the threads -- typically just allowing the threads to use up their timing quota. Threads will end up spinning unproductively, waiting for threads that are not scheduled.
|