• emergency message queue? Discuss in implementation of threads.
  • adding an element to the access list: need a lock can do a c(, existing values) as two threads might do this and the last one in may have retrieved the existing values before the other was assigned and so the first one would be lost. Do this at the evaluator manager level - i.e. not S objects!
  • How do we release the return value of an object?
  • What do we do with the .Audit file?
  • Allow functions which require a threadLock object to be given a threadLock object, a string or an integer. The last two refer to the object internally or in the search path respectively.x Use a coerce function.
  • extraction operator [ for threadGroup
  • a timed join
  • on.exit/onExit and return should behave approriately in the context of a toplevel expression within a thread.
  • allow return to be the same as exit() in a thread context.
  • getLock example. What is this about?
  • do we need to synchronize creation of threadLock. Imagine a thread that tries to access it before it is created.
  • rather than having this getLock(thread.count.lock, condition = Quote(num.threads == 0)) and not do anything with this, we could have a wait() function that evaluated the conditional inside a lock. Since it would be for variables within a threadLock, this would be relatively straightforward and clarify the semantics or use of of getLock(). See below.
  • what about variables in more than one threadLock.
         a = threadLock("a", n = 1)
         b = threadLock("b", i = 1)
          i == 0 && n == 1
         
    Even if these objects are in the same threadLock object, we might have problems. Imagine the scenario where i is retrieved and a copy returned. Then a second thread modifies i. Then n is retrieved and the condition evaluated. At this stage, we don't have consistency and the condition might/will be erroneously evaluated. Instead, we must lock access to i and n. So we lock a and b. Now this may cause grief. So we would have
          getLock(a); getLock(b)
           i == 0 && n == 1
          yieldLock(b); yieldLock(a)
         
    (Note the order in which we acquire and release the locks - a good thing in general). Consider the case where one (or more) of these conditions is false, say i == 1. Then the condition evaluates to F.

    The best way to arrange these computations is to have n and i in a single threadLock object together. Of course, if we have numerous conditions to test, each comparing partially insersecting sets of variables (e.g. {a,b}, {b,c}, {c,d}, {a,b}), then this threadLock object becomes quite large and all assignments and 'get's to it cause coarse locking. This is a performance penalty on the parallelism of the threads and might be complicated.

    Alternatively, we could have getLock(...,condition,safe=F) where the ... argument is for an arbitrary collection of threadLock objects. Then, we get the lock on all of these, and when the condition is false, we release them all and iterate. Now, in this scenario, we would code things as

        getLock(a,b, condition = Quote(i == 0 && n == 1))
    
    Now if i == 1, this is false, and so we release the lock on both a and b. Now another thread modifies n say, setting it to 3. Then we evaluate the expression again by grabbing the locks on a and b. Then, we test again. And again find this to be false. Now, suppose the other thread sets n back to 1 and "simultaneously" i to 1. Of course to do this, the other thread had to acquire the lock on both a and b. If this condition thread was waiting, it might still be waiting. Eventually, suppose it gets the locks and tests the condition. Now it is true, so it returns.

    This reeks of the same style of automatically syncrhonizing input and output variables. We can parse the conditions and see what variables are involved and put them in the relevant databases.


    Last modified: Tue Feb 11 10:36:04 1997