Janus Dam Nielsen <[EMAIL PROTECTED]> writes: > Den 08/12/2007 kl. 2.50 skrev Martin Geisler: > >> [...] As you say, it is then easy to evaluate such a graph in >> parallel as long as you keep track of the leaf nodes. By parallel I >> don't necessarily mean having multiple threads running on a single >> party -- one could also evaluate the graph in parallel by starting >> the next operations before the first was finished. > > Why not just create a thread for each, we are moving into the world > of multicore processors and it might even get easier to reason about > from a formal perspektive?
Mainly because that is how Twisted works -- Twisted is single threaded and handles several connections using non-blocking system calls. This page has an overview of this way of programming: http://twistedmatrix.com/projects/core/documentation/howto/async.html I am no expert on this, but the advantage that I've seen people claim most often by using non-blocking system calls is that it scales better than threads when you have many connections -- I believe this was why NIO was introduced into Java as well. And Twisted just seems to work really well. I enjoy programming in a single thread, knowing that I can access shared data without fearing that some other thread fiddles with it at the same time. -- Martin Geisler _______________________________________________ viff-devel mailing list (http://viff.dk/) [email protected] http://lists.viff.dk/listinfo.cgi/viff-devel-viff.dk
