Changes between Version 8 and Version 9 of user_synchro


Ignore:
Timestamp:
Oct 9, 2018, 7:27:21 PM (6 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • user_synchro

    v8 v9  
    4747The three  functions wait(), signal() and broadcast() must be called by a thread holding the mutex associated to the condvar.
    4848
    49 == D) Semaphore ==
     49== D) Barrier ==
     50
     51The user level, POSIX compliant, barrier is defined in the '''pthread''' library, implemented by the [https://www-soc.lip6.fr/trac/almos-mkh/browser/trunk/libs/libpthread/pthread.h pthread.h] and [https://www-soc.lip6.fr/trac/almos-mkh/browser/trunk/libs/libpthread/pthread.c pthread.c] files.
     52
     53It can be used by a muti-threaded user application to implement a "rendez-vous" for a given number of  threads running in different clusters.
     54
     55The kernel implementation of a barrier is defined in the [https://www-soc.lip6.fr/trac/almos-mkh/browser/trunk/kernel/libk/remote_barrier.h remote_barrier.h] and [https://www-soc.lip6.fr/trac/almos-mkh/browser/trunk/kernel/libk/remote_barrier.c remote_barrier.c] files.
     56
     57For each user barrier, ALMOS-MKH creates a kernel ''remote_barrier_t'' structure, dynamically allocated in the reference cluster (i.e. in the cluster containing the reference process descriptor).
     58 * The '''remote_barrier_create()''' function allocates and initializes a barrier, using an RPC if if the calling thread is not running in the reference cluster.
     59 * The '''remote_barrier_destroy()''' function destroys a given barrier, using RPC if the calling thread is not running in the reference cluster.
     60 * The blocking '''remote_barrier_wait()''' function returns only when all expected threads (defined by the remote_barrier_create() function) reach the barrier. As the implementation uses a toggle variable, this barrier can be safely called several times, as long as the number of expected threads does not change.
     61
     62== E) Semaphore ==
    5063
    5164The user level, POSIX compliant, semaphore is defined in the '''semaphore''' library, implemented by the [https://www-soc.lip6.fr/trac/almos-mkh/browser/trunk/libs/libsemaphore/semaphore.h semaphore.h] and [https://www-soc.lip6.fr/trac/almos-mkh/browser/trunk/libs/libsemaphore/semaphore.c semaphore.c] files.
     
    6174 * The '''remote_sem_post()''' function  atomically increments the semaphore. If the waiting queue is not empty, it unblock all waiting threads.
    6275 * The '''remote_sem_get_value()''' function returns the semaphore current value, without modifying the semaphore state.
    63 
    64 == E) Barrier ==
    65 
    66 The user level, POSIX compliant, barrier is defined in the '''pthread''' library, implemented by the [https://www-soc.lip6.fr/trac/almos-mkh/browser/trunk/libs/libpthread/pthread.h] and [https://www-soc.lip6.fr/trac/almos-mkh/browser/trunk/libs/libpthread/pthread.c pthread.c] files.
    67 
    68 It can be used by a muti-threaded user application to implement a "rendez-vous" for a given number of  threads running in different clusters. This toggle barrier can be used
    69 
    70 The kernel implementation of a barrier is defined in the [https://www-soc.lip6.fr/trac/almos-mkh/browser/trunk/kernel/libk/remote_barrier.h remote_barrier.h] and [https://www-soc.lip6.fr/trac/almos-mkh/browser/trunk/kernel/libk/remote_barrier.c remote_barrier.c] files.
    71 
    72 For each user barrier, ALMOS-MKH creates a kernel ''remote_barrier_t'' structure, dynamically allocated in the reference cluster (i.e. in the cluster containing the reference process descriptor).
    73  * The '''remote_barrier_create()''' function allocates and initializes a barrier, using an RPC if if the calling thread is not running in the reference cluster.
    74  * The '''remote_barrier_destroy()''' function destroys a given barrier, using RPC if the calling thread is not running in the reference cluster.
    75  * The blocking '''remote_barrier_wait()''' function returns only when the all expected threads (defined by the remote_barrier_create() function) reach the barrier. As the implementation uses a toggle variable, this barrier can be safely called several times, as long as the number of expected threads does not change.