Re: some ideas for multithreading support
Sam Steingold <[email protected]>
| Newsgroups | gmane.lisp.clisp.devel |
|---|---|
| Message-ID | <[email protected]> |
> * Don Cohen <[email protected]> [2017-12-20 20:06:46 +0000]: > > Suppose an iteration over a table starts in a state with the table > empty, and another thread performs the following operations in the > following order: > operation resulting state > add A => 1 (A=>1) > add B => 2 (A=>1,B=>2) > remove A (B=>2) > add A => 3 (B=>2,A=>3) > remove B (A=>3) > add B => 4 (A=>3,B=>4) > and now the iteration returns. > Suppose the iteration simply collects and returns a list of all the > keys and values in the order visited. > The following results from the iteration are allowable: > NIL - the iteration could have finished before the first add > all of the resulting states listed above are allowed when > interpreted as iterations results, since the entire iteration > could have been performed in that state > (A=>1,B=>4), even though the table was never in such a state, > because it could visit A right after A was added and B just > before the end) > (B=>4) is allowed because A might have been visited during the > time it was not present, and then B visited at the end. > > However (B=>4,A=>1) is NOT allowed, because after B became > related to 4, A was never related to 1. I cannot imagine how you can prevent this. Suppose the iteration collected A=>1 (after 1st or 2nd step) but, before it could terminate, the 1st thread did all its work. Now iteration sees that the key vector has length 2, it saw the 1st element and now it processes the second element which is B which points to 4. Thus iteration will collect B=>4,A=>1. Thanks. -- Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1504 http://steingoldpsychology.com http://www.childpsy.net http://www.dhimmitude.org http://americancensorship.org http://iris.org.il https://ffii.org People hear what they want to hear and discard the rest. ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ clisp-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/clisp-devel