79b Subj : Re: pthread_create and memory To : comp.programming.threads From : Giancarlo Niccolai Date : Mon Mar 14 2005 01:10 am David Hopwood wrote: > David Schwartz wrote: >> "David Hopwood" wrote: >> >>>> And the fact that you don't have a few thousand processors. >>> >>>That's beside the point. Threads are primarily for expressing concurrent >>>program structure. Use of hardware parallelism is a bonus. >> >> No, tasks are primarily for expressing concurrent program structure. >> Threads are for keeping CPUs busy or performing asynchronous I/O. Threads >> are how you get the work done, not how describe the work. > > There doesn't need to be any distinction between threads and tasks. > The fact that there is such a distinction in most current systems is an > implementation artifact, and one that introduces unnecessary complexity. > Threads are agents. Tasks are what agents are supposed to do. Your programs will run better if you make your agent layout and operational attitudes to match the ones of the physical hardware they have to use to perform the tasks. Code may be often de-complexified if the developer is abstracting the final architecture, but in many occasions agents ARE MEANT to exploit hardware capabilities; i.e. if I am writing a thread to talk with the sound board, then that thread and the parallel support for sound boards (DMA, hardware synthethyzers, coprocessors and so on) will probably be very akin one to each other; other than multiprocessor computational power exploting, that's what DS (probably) meant. But definitely, agents are not tasks. And so, threads are not tasks. Confusing the two is incorrect: it may cause unnecessary code fuzzyness and, as I use to say, incorrect code brings bad luck. In MT context, this means you are going to have some trouble for sure. Bests, Giancarlo Niccolai. . 0