Changes between Version 4 and Version 5 of user_synchro
- Timestamp:
- Oct 9, 2018, 2:03:21 PM (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
user_synchro
v4 v5 15 15 == B) Mutex == 16 16 17 The user level, POSIX compliant, mutexAPI 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.17 The 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. 18 18 19 19 It can be used by a muti-threaded user application to synchronize user threads running in different clusters. It allows a given thread to exclusive access to a shared user object. … … 24 24 * The '''remote_mutex_create()''' function allocates and initializes a mutex, using an RPC if if the calling thread is not running in the reference cluster. 25 25 * The '''remote_mutex_destroy()''' function destroys a given mutex, using RPC if the calling thread is not running in the reference cluster. 26 * 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 the waiting queue, rooted in the ''remote_mutex_t'' structure, and the the calling thread is blocked on the THREAD_BLOCKED_USERSYNC condition.27 * The '''remote_mutex_unlock()''' function unblocks the first waiting thread in the queue without releasing the mutexif the queue is not empty.26 * The blocking '''remote_mutex_lock()''' function implements a descheduling policy when the mutex is already taken by another thread : the calling thread registers in the mutex waiting queue, and blocks on THREAD_BLOCKED_USERSYNC. 27 * The '''remote_mutex_unlock()''' function unblocks the first waiting thread in the queue, without releasing the mutex, if the queue is not empty. 28 28 29 29 == C) Condvar == 30 30 31 The user level, POSIX compliant, condvarAPI 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.31 The user level, POSIX compliant, '''condvar''' 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. 32 32 33 33 It can be used by a muti-threaded user application to synchronize user threads running in different clusters. It allows a given thread to efficiently wait for a change in a shared user object. … … 39 39 * The '''remote_condvar_create()''' function allocates and initializes a condvar, using an RPC if if the calling thread is not running in the reference cluster. 40 40 * The '''remote_condvar_destroy()''' function destroys a given condvar, using RPC if the calling thread is not running in the reference cluster. 41 * The blocking '''remote_condvar_wait()''' function allows the calling thread to block on the THREAD_BLOCKED_USERSYNC condition and to register in the waiting queue attached to the ''remote_condvar_t'' structure.41 * The blocking '''remote_condvar_wait()''' function allows the calling thread to block on THREAD_BLOCKED_USERSYNC, and to register in the condvar waiting queue. 42 42 * The '''remote_condvar_signal()''' function allows (another) thread to unblock the first blocked thread waiting on a given condvar. 43 43 * The '''remote_condvar_broadcast()''' function allows (another) thread to unblock all threads waiting on a given condvar. … … 46 46 == D) Semaphore == 47 47 48 The user level, POSIX compliant, '''semaphore''' API 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. 49 50 It can be used by a muti-threaded user application to synchronize user threads running in different clusters, through the ''wait'' and ''post'' primitives. 51 52 The kernel implementation of a semaphore is defined in the [https://www-soc.lip6.fr/trac/almos-mkh/browser/trunk/kernel/libk/remote_sem.h remote_sem.h] and [https://www-soc.lip6.fr/trac/almos-mkh/browser/trunk/kernel/libk/remote_sem.c remote_sem.c] files. 53 54 For each user semaphore, ALMOS-MKH creates a kernel ''remote_sem_t'' structure, dynamically allocated in the reference cluster (i.e. in the cluster containing the reference process descriptor). 55 * The '''remote_sem_create()''' function allocates and initializes a semaphore, using an RPC if if the calling thread is not running in the reference cluster. 56 * The '''remote_sem_destroy()''' function destroys a given semaphore, using RPC if the calling thread is not running in the reference cluster. 57 * The blocking '''remote_sem_wait()''' function returns only when the semaphore has a non-zero value, and has been atomically decremented. If the semaphore has a zero value, the calling thread registers in the semaphore waiting queue, and block on THREAD_BLOCKED_USERSYNC. 58 * The '''remote_sem_post()''' function atomically increments the semaphore. If the waiting queue is not empty, it unblock all waiting threads. 59 * The '''remote_sem_get_value()''' function returns the semaphore current value, without modifying the semaphore state. 60 48 61 == E) Barrier ==