Thread-based or event-based?
Posted Mar 1, 2007 18:30 UTC (Thu) by
zooko (subscriber, #2589)
In reply to:
Thread-based or event-based? by bronson
Parent article:
Thread-based or event-based?
I think you are right inasmuch as you are writing in C code. If you are writing in Python it is rather easier to write your event-based code. Certainly when we rewrote Mojo Nation (a open source peer-to-peer filesharing app) from one-thread-per-connection to event-based it was easier to understand and debug afterward than before. (By the way, that's the origin of BitTorrent's use of event-based -- Bram worked at Mojo Nation and re-used the event-based architecture that we developed there when he wrote BitTorrent.)
If you are writing in Twisted Python it is easier still, and if you are writing in E it is easier still.
C++ and Java fall right between C and Python in terms of the difficulty of doing event-based -- I have written multithreaded code and event-based code in each of them.
By the way, almost all GUI toolkits use the event-based paradigm, so many programmers are already familiar with the paradigm in at least one domain.
Regards,
Zooko
(
Log in to post comments)