<div dir="ltr">Wow!<div><br></div><div>(I'll try to start using the correct terminology "processor" for "OS thread" and "thread" for "green thread", soon.)<br><div class="gmail_extra"><br><div class="gmail_quote">2017-11-13 21:41 GMT+08:00 Marc Feeley <span dir="ltr"><<a href="mailto:feeley@iro.umontreal.ca" target="_blank">feeley@iro.umontreal.ca</a>></span>:<br><div>[..]</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">For I/O, there may be missing locks to ensure that separate processors don’t do I/O on a port at the same time.  I haven’t tested this thoroughly.<br></blockquote><div><br></div><div>(At least the user code-facing Gambit IO routines, have looked since before to me like having the locking well implemented. And I guess now those same mutex locks, are automatically SMP-safe - err, I should ask about that below. So you must mean some kind of runtime-internal locking here somehow.)</div><div><br></div><div>Is |mutex-lock!| SMP-safe now - also without costing much more now than before?</div><div><br></div><div>If the SMP-safe |mutex-lock!| is more expensive only: is there then any variant that would only work between green threads within one and the same OS thread.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">> Can I do TCP/console/file IO from any OS & green thread, or from some particular one, which and how do I ensure that?<br>
<br>
</span>Keeping all I/O in a single thread is definitely the safest scenario to avoid locking issues. Just assign these tasks to a single thread. All other threads should not do I/O.<br></blockquote><div><br></div><div>Wait - say you do console IO in one OS thread, TCP IO in one OS thread, and file IO in one OS thread - how could that be a problem?</div><div><br></div><div>Also, when you say it's best to assign the IO tasks to one thread, do you mean one OS thread or one green thread - if one OS thread, then, how do I stick and unstick a given set of green threads (ordinary thread objects) to be executed in one particular OS thread only?</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">> (<a href="http://www.iro.umontreal.ca/~gambit/doc/gambit.html#Threads" rel="noreferrer" target="_blank">http://www.iro.umontreal.ca/~<wbr>gambit/doc/gambit.html#Threads</a> says "Gambit supports the execution of multiple Scheme threads. These threads are managed entirely by Gambit’s runtime and are not related to the host operating system’s threads. Gambit’s runtime does not currently take advantage of multiprocessors (i.e. at most one thread is running).", will need update.)<br>
<br>
</span>Will update when this is no longer true.  I view --enable-smp as experimental…<br>
<br>
I need feedback from people using SMP to weed out problems.<span class="HOEnZb"><font color="#888888"><br></font></span></blockquote><div><br></div><div>Noted.</div><div><br></div><div>Thanks!</div><div><br></div></div></div></div></div>