PB3D  [2.45]
Ideal linear high-n MHD stability in 3-D
Public Member Functions | Public Attributes | List of all members
mpi_vars::lock_type Type Reference

lock type More...

Public Member Functions

procedure init => init_lock
 initialize More...
 
procedure dealloc => dealloc_lock
 deallocate More...
 

Public Attributes

integer, dimension(:), allocatable wl
 waiting list More...
 
integer wl_win
 window to waiting list More...
 
integer wu_tag
 wakeup tag More...
 
logical blocking
 is a normal blocking process More...
 

Detailed Description

lock type

There is a blocking (BL) and a nonblocking (NB) version where the former requires an exclusive lock and the latter a shared one. This is saved in the variable blocking.

NB processes that get the lock directly on request (meaning that there were no other processes in the queue) notify directly all the next NB processes after gaining access. It also sets their status to active. When a NB process gains the lock when notified after waiting, it does not have to check for other NB processes, as this has been done by the notifying process.

A BL process retains exclusive access upon receipt of the lock. Similarly to NB processes, if the receipt was direct on request, the status is set to active, but only of this NB process.

When returning the lock, all BL processes and NB that find themselves to be the last active NB process, scan the waiting list and pass the lock preferably to another BL process to notify. If not available, it searches for all the NB processes to notify together.

The advantage of prefering BL processes after finishing a process is that this way NB processes are accumulated, and then quickly finished afterwards.

Note
Every process in the waiting queue will eventually receive a notification.

Scheme:

request access gain acces return access
BL
  • add to queue
  • wait
if direct:
  • activate
  • remove from queue
  • find next BL/NB
  • notify
  • activate all
NB
  • add to queue
  • wait
if direct:
  • find next NB
for all next NB:
  • notify
  • activate
always:
  • remove from queue
if last NB:
  • find next BL/NB
  • notify
  • activate all

with preference BL > NB(s).

See also
This is based on an extension of the ideas in RossAtomicIO.

Definition at line 63 of file MPI_vars.f90.

Member Function/Subroutine Documentation

◆ dealloc()

procedure mpi_vars::lock_type::dealloc

deallocate

deallocate

Definition at line 72 of file MPI_vars.f90.

◆ init()

procedure mpi_vars::lock_type::init

initialize

initialize

Definition at line 70 of file MPI_vars.f90.

Member Data Documentation

◆ blocking

logical mpi_vars::lock_type::blocking

is a normal blocking process

Definition at line 67 of file MPI_vars.f90.

◆ wl

integer, dimension(:), allocatable mpi_vars::lock_type::wl

waiting list

Definition at line 64 of file MPI_vars.f90.

◆ wl_win

integer mpi_vars::lock_type::wl_win

window to waiting list

Definition at line 65 of file MPI_vars.f90.

◆ wu_tag

integer mpi_vars::lock_type::wu_tag

wakeup tag

Definition at line 66 of file MPI_vars.f90.


The documentation for this type was generated from the following file: