Re: Multi-threading architecture



What an outstanding explaination. Have not thought of that before.

Thanks

"David Schwartz" <davids@xxxxxxxxxxxxx> wrote in message
news:dhdn31$t2s$1@xxxxxxxxxxxxxxxxxxxxx
>
> "jambu" <karthikeyan.jambulingam@xxxxxxxxx> wrote in message
> news:1127886324.081331.298240@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
>> Sorry for the late reply . I use a proper Thread pool , I make the
>> thread to wait using pthread_cond_wait function before which i change
>> its status to waiting . And when i check thread pool and find a thread
>> to be in the waiting state , the waiting state is released and the
>> request is passed to it .
>
> No, no, no! Don't pick a thread to hand the request to. Let whichever
> thread happens to run (or be running) take the request off the queue
> itself.
>
> If you have a bunch of truck drivers milling around the office, which
> is better:
>
> 1) Put a job where they can all see it and let whoever sees it first do
> it, or
>
> 2) Put the name of a truck driver on a job and let it wait until that
> particular person sees it.
>
> Imagine if thread A is working at full speed. Thread B is doing
> nothing. So you assign the job to thread B. But if there's no available
> CPU and thread B isn't scheduled, when thread A finishes the job it's
> working on, you pointlessly force a context switch to thread B before you
> let the job be worked on. Thread A could just pull it off the queue --
> it's already running. Maybe by the time thread B is scheduled there will
> be even more work for it to do.
>
> DS
>
>


.



Relevant Pages

  • Re: Multi-threading architecture
    ... And when i check thread pool and find a thread ... to be in the waiting state, the waiting state is released and the ... request is passed to it. ... processed by a single thread i.e the thread completes it process at a ...
    (comp.programming.threads)
  • Re: Multi-threading architecture
    ... Do your Muti-threading architecture work like real time executive ... >>> to be in the waiting state, the waiting state is released and the ... Don't pick a thread to hand the request to. ... >> If you have a bunch of truck drivers milling around the office, ...
    (comp.programming.threads)
  • Re: Surprising threading issue
    ... Although ASP.NET will process A and B's request in separate threads, ... I do understand your approach using the queue but maybe the static ... Using a static variable tracking time, you wind up with a queued thread pool item practically immediately for every single possible work item. ... But it seems to me it's better to throttle that work more locally (this may be less of an issue with Jon's thread pool class...I haven't looked at it, but the mere fact that it's instantiated rather than basically being a static class suggests you can get away with the more-global throttling with his...even so, I'd prefer the more direct approach, personally). ...
    (microsoft.public.dotnet.framework)
  • Re: when is the threadpool used in remoting calls?
    ... How much remoting long time requests can be ... In a context of which a thread the client request is being processed on the ... working thread or completon port thread? ... >>threads in the thread pool (ThreadPool.GetAvailableThreads, ...
    (microsoft.public.dotnet.framework.remoting)
  • Re: Thread wont start?
    ... the lifetime of a thread is tied to the process. ... a thread is not taken from the clr thread pool. ... > ASP.NET threads are not created and terminated for each request nor are ... > are drawn from the CLR thread pool to execute requests in ASP.NET. ...
    (microsoft.public.dotnet.framework.aspnet)