Changes between Initial Version and Version 1 of library_locks


Ignore:
Timestamp:
Aug 5, 2014, 2:08:01 PM (11 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • library_locks

    v1 v1  
     1= The spin_lock library =
     2
     3The [source:soft/giet_vm/giet_libs/spin_lock.c spin_lock.c] and [source:soft/giet_vm/giet_libs/spin_lock.h spin_lock.h]
     4files define a user-level spin-lock service to obtain exclusive access to a shared resource in a parallel multi-tasks application.
     5Each lock (giet_lock_t object) occupies a complete 64 bytes cache line to avoid false sharing.
     6If the hardware architecture supports hardware cache coherence, it is recommanded to store the lock in a cachable segment architecture
     7
     8 == Lock declaration ==
     9
     10There is to ways to define a user-level lock, depending on the placement constraints:
     11
     12 * If the lock is defined as a global variable in the application code, there is no precise control on the lock placement: the lock will be stored in the application global data ''vseg".
     13
     14 * If the lock is defined as a specific ''vobj'' in the application mapping, it will be stored in the ''vseg'' specified in the mapping. The lock should not be declared as a global variable in the application code, and the lock virtual address can be obtained using the ''giet_vobj_get_vbase() system call.
     15
     16 == Access functions ==
     17
     18 * '''void lock_acquire( giet_lock_t * lock )'''
     19This blocking function uses an atomic LL/SC mechanism to take the lock, and return only when the lock has been successfully taken.
     20
     21 * '''void lock_release( giet_lock_t * lock )'''
     22This function uses a simple SW to release the lock.