Padu wrote: > What I'm saying is that I won't use multi-threading only because it > brings better performance. Performance isn't usually the objective of multi threading. > Instead I will use it only if needed, > because it is more difficult to deal with such types of programs. The purpose of multi tasking is to make the programs easier. The main event loop architecture works nicely if you have a bunch of asynchronous events that need to be handled, and each one can be handled simply. Multi tasking looks better when some of these events require significant previous context to handle. A common example is handling commands from an input stream. Each received byte is context sensitive and can not be processed on its own. This could be implemented as a state machine, but the more complicated the state machine gets, the more it makes the code clean to use the PC as the state variable and run the state machine in its own task. The code for that task usually becomes simpler and clearer, and therefore easier to get right the first time and to maintain. The complexity is pushed to the task manager, but that is generic code written once. Once it is debugged and tested, it's not likely to need much work and probably won't be touched during maintainence. ****************************************************************** Embed Inc, Littleton Massachusetts, (978) 742-9014. #1 PIC consultant in 2004 program year. http://www.embedinc.com/products -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist