Critical area locking method, device, terminal, and storage medium

The embodiment of the invention discloses a critical area locking method, a device, a terminal and a storage medium. The method comprises the following steps: if receiving an access instruction of anythread in a critical region to a common resource, obtaining a current value of a lock state paramete...

Ausführliche Beschreibung

Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: HE WEI, NI ZHONGJUN, CHEN ZHUO, BAO WANYU, FENG KAIWEN, DANG YUEDONG
Format: Patent
Sprache:chi ; eng
Schlagworte:
Online-Zugang:Volltext bestellen
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
Beschreibung
Zusammenfassung:The embodiment of the invention discloses a critical area locking method, a device, a terminal and a storage medium. The method comprises the following steps: if receiving an access instruction of anythread in a critical region to a common resource, obtaining a current value of a lock state parameter of the critical region; comparing whether the current value of the lock state parameter is equalto the initial value of the lock state parameter by an atomic operation mode; adjusting the value of the lock state parameter according to the comparison result; responding to the access instruction according to the comparison result; and controlling the locking state of the critical region. By adopting the technical proposal of the invention, the system performance can be improved while maintaining the consistency of the common resource data of the critical region. 本发明实施例公开了种临界区加锁方法、装置、终端及存储介质。该方法包括:若接收到临界区中任线程对共有资源的访问指令,则获取临界区的锁状态参数的当前取值;通过原子操作方式执行比较所述锁状态参数的当前取值与所述锁状态参数的初始值是否相等,以及依据比较结果调整所述锁状态参数的取值,并依据比较结果响应所述访问指令以及控