Changes between Version 1 and Version 2 of user_synchro


Ignore:
Timestamp:
Oct 9, 2018, 12:23:32 PM (6 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • user_synchro

    v1 v2  
    99== B) Mutex ==
    1010
    11  This file defines an user level POSIX compliant mutex.
    12  *
    13  * It can be used by muti-threaded user applications to synchronise user threads
    14  * running in different clusters.
    15  *
    16  * A mutex is declared by a given user process as a "pthread_mutex_t" global variable.
    17  * This user type is implemented as an unsigned long, but the value is not used by the
    18  * kernel. ALMOS-MKH uses only the mutex virtual address as an identifier.
    19  * For each user mutex, ALMOS-MKH creates a kernel "remote_mutex_t" structure,
    20  * dynamically allocated in the reference cluster by the remote_mutex_create() function,
    21  * and destroyed by the remote_mutex_destroy() function, using RPC if the calling thread
    22  * is not running in the reference cluster.
    23  *
    24  * The blocking "remote_mutex_lock()" function implements a descheduling policy when
    25  * the lock is already taken by another thread : the calling thread is registered
    26  * in a waiting queue, rooted in the mutex structure, and the the calling thread
    27  * is blocked on the THREAD_BLOCKED_MUTEX condition.
    28  * The "remote_mutex_unlock()" function unblocks the first waiting thread in the queue
    29  * without releasing the mutex if queue is not empty.
     11The user level, POSIX compliant, mutex API 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.
     12
     13It can be used by muti-threaded user applications to synchronise user threads running in different clusters.
     14
     15A mutex is declared by a given user process as a ''pthread_mutex_t'' global variable. This user type is implemented by ALMOS-MKH as an ''unsigned long'', but the value stored in user space is NOT used by the kernel. ALMOS-MKH uses only the mutex virtual address as an identifier for the mutex.
     16
     17The kernel implementation of a mutex is defined in the [https://www-soc.lip6.fr/trac/almos-mkh/browser/trunk/kernel/libk/remote_mutex.h remote_mutex.h] and [https://www-soc.lip6.fr/trac/almos-mkh/browser/trunk/kernel/libk/remote_mutex.c remote_mutex.c] files.
     18
     19For each user mutex, ALMOS-MKH creates a kernel ''remote_mutex_t'' structure, dynamically allocated in the reference cluster (i.e. in the cluster containing the reference process descriptor) by the '''remote_mutex_create()''' function, and destroyed by the '''remote_mutex_destroy()''' function, using RPC if the calling thread is not running in the reference cluster. The blocking '''remote_mutex_lock()''' function implements a descheduling policy when the lock is already taken by another thread : the calling thread is registered in a waiting queue, rooted in the ''remote_mutex_t'' structure, and the the calling thread is blocked on the THREAD_BLOCKED_MUTEX condition. The '''remote_mutex_unlock()''' function unblocks the first waiting thread in the queue without releasing the mutex if the queue is not empty.
     20
    3021
    3122== C) Condvar ==