Optimal multithread model

Marc Lehmann schmorp at schmorp.de
Mon Mar 15 17:03:36 CET 2010


On Mon, Mar 15, 2010 at 08:48:20PM +0500, mikhail maluyk <mikhail.maluyk at gmail.com> wrote:
> How do you know beforehand that processing data will take some time?

It depends on the problem domain - in many cases you do know whether a
task will take some time, for example, when it runs a database query or
does disk I/O.

Often you can delay the decision on whether to pass or not until you know,
too.

If you truly don't know, then running multiple processes is best, followed by
multiple threads running their own event loop, followed by sharing. Well,
*usually*.

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\



More information about the libev mailing list