Methods and apparatus for speculatively locking an object are disclosed.
According to one aspect of the present invention, a method for acquiring
use of an object using a current thread includes a determination of
whether a first bit included in the object is set to indicate that the
object is speculatively owned by a speculative owner thread. When the
object is speculatively owned, the speculative owner thread is allowed to
use the object without locking the object. The method also includes
checking a stored identifier that is associated with the object and
identifies the speculative owner thread, as well as determining whether
the stored identifier identifies the current thread. When the stored
identifier identifies the current thread, the current thread already has
use of the object; i.e., the current thread is the speculative owner
thread. Finally, the method includes locking the object using the
speculative owner thread when it is determined that the stored identifier
does not identify the current thread. In one embodiment, as for example
when substantially all objects in a computing system are known to be
suitable for speculative ownership, the stored identifier is checked
before determining when the first bit associated with the object is set to
indicate that the object is associated with the speculative owner thread.
Os métodos e os instrumentos para speculatively travar um objeto são divulgados. De acordo com um aspecto da invenção atual, um método para adquirir o uso de um objeto que usa uma linha atual inclui uma determinação de se um primeiro bocado incluído no objeto está ajustado para indicar que o objeto está possuído speculatively por uma linha speculative do proprietário. Quando o objeto é possuído speculatively, a linha speculative do proprietário está permitida usar o objeto sem travar o objeto. O método inclui também verificar um identificador armazenado que seja associado com o objeto e identifique a linha speculative do proprietário, as.well.as determinar se o identificador armazenado identifica a linha atual. Quando o identificador armazenado identifica a linha atual, a linha atual tem já o uso do objeto; isto é, a linha atual é a linha speculative do proprietário. Finalmente, o método inclui travar o objeto usando a linha speculative do proprietário quando se determina que o identificador armazenado não identifica a linha atual. Em uma incorporação, quanto para ao exemplo quando substancialmente todos os objetos em um sistema computando são sabidos para ser apropriados para a posse speculative, o identificador armazenado é verificado antes de determinar quando o primeiro bocado associado com o objeto é ajustado para indicar que o objeto está associado com a linha speculative do proprietário.