Changes between Version 2 and Version 3 of kernel_synchro


Ignore:
Timestamp:
Oct 8, 2018, 12:55:41 PM (6 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • kernel_synchro

    v2 v3  
    3838 * when a reader try to access the object, it increments the readers "count" when the lock is not "taken" by a writer. It registers in the "rd_root" waiting queue, blocks, and deschedules when the lock is taken.
    3939 * when a writer try to take the rwlock, it check the "taken" field. If the lock is already taken, or if the number of readers is non zero, it registers in the "wr_root" waiting queue, blocks, and deschedules. It set "taken" otherwise.
    40  * when a reader completes its access, it decrement the readers "count", unblock the the first waiting writer if there is no other readers, and unblock all waiting readers if there no write request.
     40 * when a reader completes its access, it decrement the readers "count", unblock the first waiting writer if there is no other readers, and unblock all waiting readers if there is no write request.
    4141 * when a  writer completes its access, it reset the "taken" field, releases the first waiting writer if queue non empty, or releases all waiting readers if no writer.
    4242
    4343== E) Locks debug infra-structure ==
    4444
     45When the DEBUG_BUSYLOCK parameter is set in the kernel_config.h file, an optional debug mechanism is activated, thanks to conditional compilation.
     46
     47Each thread contains - besides the ''busylocks'' counter - an optional ''busylocks_root'' field, that is the root of the embedded xlist of (local or remote) busylocks hold by a given thread at a given time. This list is implemented by an optional ''xlist'' field in the busy lock descriptor. It  is dynamically updated by the ''busylock_acquire()'' and ''busylock_release()'' functions. The set of taken busylocks is printed in the error message, when the scheduler detects that a descheduling thread is holding one or several busylocks. This list can also be be printed through the ''idbg" interactive debugger, for any thread identified by its (pid,trdid).
     48
     49== F) Barriers ==
     50
     51The kernel initialization is done in parallel in all clusters, by the kernel idle threads, where there is one idle thread per core. These threads allocate and initialize shared and distributed data structures, such as the cluster managers, the cores schedulers, or the Virtual File System. This requires synchronization barriers.
     52
     53ALMOS-MKH implements both local barriers  and global barriers. 
     54 * The local barriers are used to synchronize all idle threads in a given cluster K. The number of expected threads is defined by the number of cores in cluster K, that is registered in the local boot_info structure.
     55 * The global barrier is used to synchronize all threads running on the first core (Core 0) of each cluster. The number of expected threads is defined by the total number of active clusters (containing one kernel instance), that is also registered in each local boot_info structure.
     56
     57These barriers being used only during kernel initialization implement a simple busy-waiting policy. They are implemented as global variables, in the kdata segment. These toggle barriers can be used several times, and don't need to be explicitly initialized. For the global barrier (''xbarrier''), the client threads use remote_read() remote_write(), & remote_atomic_add() primitives, to access the barrier located in cluster 0.   
     58 
     59
    4560
    4661