[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

memory coherence



Will the SRFI make any statements about memory coherency, or the lack
thereof?  Without such a statement, it'll either be difficult to write
portable programs that use threads, or difficult to implement the SRFI
efficiently.

Both the POSIX Threads and Java implementations make some kind of
statement to this effect.  POSIX says:

    2.3.8 memory synchronization: Applications shall ensure that
    access to any memory location by more than one thread of control
    (threads or processes) is restricted such that no thread of
    control can read or modify a memory location while another thread
    of control may be modifying it.  Such access is restricted using
    functions that synchronize thread execution and also synchronize
    memory with respect to other threads.  The following functions
    synchronize memory with respect to other threads:

    ... blah blah blah ...
    pthread_mutex_lock
    pthread_mutex_unlock

It then goes on to offer an explanation of why this restriction is
necessary.

In the Java spec, chapter 17 lays out an elaborate set of rules about
actions called "use", "assign", "load", "store", "lock", and "unlock",
that basically specify the same thing, but in a more formal way.


I think the SRFI should at least adopt the POSIX text, to warn people
that set-car! doesn't work the way they might expect.