Salesforce platform locks the entire group membership table to protect data integrity when we make changes to roles and groups. This locking makes it impossible to process group changes in multiple threads to increase throughput on updates. When the Granular Locking feature is enabled, the system employs additional logic to allow multiple updates to proceed simultaneously if there is no hierarchical or other relationship between the roles or groups involved in the updates.
To utilize Granular Locking feature, do role or group membership changes in a way they are not overlapping with each other hierarchy or have other relationship with each other.
Check the following article for more information
https://developer.salesforce.com/docs/atlas.en-us.draes.meta/draes/draes_group_membership_locking.htm