compare and swap vs test and set

前端 未结 2 1715
独厮守ぢ
独厮守ぢ 2021-01-30 22:41

Could someone explain to me the working and differences of above operations in multi-threading?

2条回答
  •  醉酒成梦
    2021-01-30 23:27

    Test and set operates on a bit, compare and swap operates on a 32-bit field.

    The z/TPF system favors the use of the test and set (TS) instruction because frequently, lock indicators are bits that are set to control access to critical regions of system code. The test and set (TS) instruction requires fewer registers than the compare and swap (CS) instruction and requires less execution time because only a single byte needs to be set.

    and, I found these materials from : http://www.ibm.com/support/knowledgecenter/SSB23S_1.1.0.13/gtpc3/tasinst.html

    you can learn more about TSL with the book called "Modern Operating System,Chapter 2"...

提交回复
热议问题