User loginNavigation |
archivesPLT Scheme 4.0 releasedThe latest version of PLT Scheme, version 4.0, has just been released. It's got tons of new goodies, so I recommend that anyone interested in Scheme and/or functional programming check it out here. By Michael Vanier at 2008-06-12 08:40 | LtU Forum | login or register to post comments | other blogs | 1141 reads
Preemptive concurrency via compiler-inserted checksConsider a language that provides lightweight concurrency primitives, like JoCaml or Erlang, and which uses co-operative threads like GNU Pth for this concurrency. A co-operative thread must explicitly yield to permit other threads to execute. Has there been any research into some sort of inference for compiler-inserted yields? For instance, each co-operative thread has a "time slice" (or a "work slice"), and we would want the thread to yield after the slice has expired. In the limit, we can force each function call to decrement the "remaining slice" until it reaches zero, at which point we yield (I believe Erlang does this, or something similar). This would seem to be quite a heavy penalty though. I was wondering if there was a "smarter" way, that didn't cost a repeated test and branch on every function call. For instance, the compiler could analyze the control flow, and insert checks every X function calls, where X > 1. So is there any other way to build preemptive threading from co-operative threads, other than via timers, or the above technique of a runtime check per call? |
Browse archivesActive forum topics |