About the names, I see your point, but there is a case for using .
before : and unless there is a groundswell of discontent I'm going to
leave it as is.
I assume you mean how do we allow concurrent read/write to the same name
from multiple threads. I don't think simultaneous write access to
different parts of a value is called for, though it would not be
impossible (read this as "nothing is impossible if you don't have to do
it yourself.").
The usual primitives are
* readlock/writelock, where a user takes a readlock to indicate desire
to read, and a writelock to indicate desire to modify. Any number of
readlocks may be simultaneously held, but a writelock is exclusive of
all other locks.
* semaphores, where writing to a name blocks until the previous value
has been read and reading blocks until the next value has been written.
* 1-to-n semaphores, where n readers must read the value before a new
one can be written
* mutexes, which are like writelocks but yield the processor while
waiting for the lock
My great hope is that someone will point to an APL/K implementation that
shows the right way to do this. Otherwise we will have to design our own.
In the implementation, values can be modified in-place while another
thread is looking at the value. Assignments are safe: the new value
replaces the old one atomically, and tasks looking at the old value will
continue to have the old value as long as they need it.
Henry Rich
On 4/14/2022 1:43 PM, Raul Miller wrote:
Ok, that sounds consistent and viable.
Next question: how do we arrange for multiple J threads to safely
update (presumably different indices of) the same global variable?
Thanks,
--
This email has been checked for viruses by AVG.
https://www.avg.com
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm