Changes between Version 10 and Version 11 of library_locks


Ignore:
Timestamp:
Sep 27, 2015, 12:43:05 PM (10 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • library_locks

    v10 v11  
    44
    55The [source:soft/giet_vm/giet_libs/user_lock.c user_lock.c] and [source:soft/giet_vm/giet_libs/user_lock.h user_lock.h]
    6 files define two types of services:
    7  * user-level atomic access functions, to increment a shared counter.
    8  * user-level spin-locks, to obtain exclusive access to a shared resource in a parallel multi-tasks application.
    9 The proposed spin-lock implement a waiting queue service, to enforce fairness and avoid live-lock situations.
    10 Each lock (giet_lock_t object) occupies a complete 64 bytes cache line to avoid false sharing.
     6files define two types of locks:
     7 * '''user_lock_t''' : this lock uses a ticket allocation mechanism to enforce fairness and avoid live-locks. This lock is located in one single cluster, and the placement can be controlled by defining a specific vseg in the application mapping.
     8 * '''sqt_lock_t''' : this  distributed lock can be used to avoid quadratic latency, when the protected resource is shared by a large number or threads. The SQT (Synchronization Quad-Tree) is distributed on all clusters of the mesh.
    119
    12 The '''user_lock_t''' being shared by several tasks, should be defined as a global variable in the application code.
    13 It is possible to control precisely the placement of a specific lock on a specific physical memory bank by defining a specific vseg in the application mapping.
     10Each lock (user_lock_t object, or distributed sqt_lock_node_t) occupies a complete 64 bytes cache line to avoid false sharing.
    1411
    15 Distributed version are available in [source:soft/giet_vm/giet_libs/user_sqt_lock.c user_sqt_lock.c] and [source:soft/giet_vm/giet_libs/user_sqt_lock.h user_sqt_lock.h]
    16 files.
     12The '''user_lock_t''' and '''sqt_lock_t''' being shared by several threads, should be defined as a global variable in the application code.
    1713
    18  == Access functions ==
     14 == Atomic access functions ==
     15
     16Both types of locks use the atomic_increment() function, that can be directly used by the applications.
    1917
    2018 === unsigned int '''atomic_increment'''( unsigned int* shared, unsigned int increment) ===
    21 This function uses a LL/SC to atomically increment a shared variable.
     19This blocking function uses a LL/SC to atomically increment a shared variable.
    2220 * '''ptr''' : pointer on the shared variable
    2321 * '''increment''' : increment value.
     22
     23 == Simple lock access functions
    2424
    2525 === '''void lock_init'''( user_lock_t * lock ) ===
     
    3535 * '''lock''' : pointer on the user_lock_t structure.
    3636
     37 == Distributed lock access functions ==
    3738
    38  == Distributed functions ==
    39 
    40 
    41 The sqt_lock can be used in multi-clusters architectures, and is implemented as a - physically distributed - Synchronisation-Quad-Tree (SQT). The SQT topology is completely defined by the (x_size / y_size) parameters, with the following constraints:
     39The SQT topology is completely defined by the (x_size / y_size) parameters, with the following constraints:
    4240 * The involved clusters form a mesh(x_size * y_size).
    4341 * The lower left involved cluster is cluster(0,0).
    4442 * All involved clusters must contain a heap_x_y vseg declared in the mapping.
    45  * The number of involved tasks in a given cluster is the same for all involved clusters.
     43 * The number of involved tasks in a given cluster is the same for all involved clusters. 
    4644
    4745 === '''void sqt_lock_init'''( sqt_lock_t * lock ) ===
     
    5654This function releases the lock. It must be called by a task after a successful lock_acquire().
    5755 * '''lock''' : pointer on the sqt_lock_t structure.
    58