List:MySQL++« Previous MessageNext Message »
From:Tom Moers Date:March 7 2008 10:34am
Subject:Re: thread_start
View as plain text  
Warren Young wrote:
> Tom Moers wrote:
>>
>> +--------------------+---------------------+
>> | thread1            | thread2             |
>> +--------------------+---------------------+
>> | start              |                     |
>> | ..work..           |                     |
>> | grab (iteration 1) |                     | <-- new connection is 
>> created
>> | ..work..           | start               |
>> | release            | ..work..            |
>> | ..work..           | grab (iteration 1)  | <-- connection is reused 
>> but switched threads!
>> | grab (iteration 2) | ..work..            | <-- new connection is 
>> created
>> |                    |                     |
>>
>> Maybe I'm missing something, but I think the above is not
>> unlikely to happen.
> 
> So...you're contending that a modern computer can't start 14 threads in 
> less time than it takes to make an IPC connection and transfer some data 
> over it?
> 

Did you even look at the diagrammed scenario? My scenario locates
the issue in between the iterations of the first thread and not
in starting the other threads.

I'm contending that the diagrammed scenario is possible with
your example as it is now; not because of thread creation times,
but because of the 6 'grab, use and release connection' iterations
that each of your 14 threads make: it is possible that a connection
is created and released in one thread and then grabbed by a
different thread before the creator thread reuses it.

> Once again, I'm not saying that your scenario cannot happen.  I brought 
> this very thing up in my previous email, so I'm not sure why you went to 
> the trouble to diagram it.  What I'm saying is that it should only 
> happen if the machine takes a context switch away from creating threads 
> that lasts long enough for at least one of the threads that is created 
> to finish.  Seems unlikely to me.  I'd think we would have seen crashes 
> during testing if it ever actually happened...which it had plenty of 
> opportunity to do during development because of test/cpool.cpp.


Thread
thread_startTom Moers6 Mar
  • Re: thread_startWarren Young7 Mar
Re: thread_startTom Moers7 Mar
  • Re: thread_startWarren Young7 Mar
    • Re: thread_startTom Moers7 Mar
      • Re: thread_startWarren Young7 Mar
        • Re: thread_startTom Moers7 Mar
          • Re: thread_startWarren Young7 Mar
            • Re: thread_startWarren Young7 Mar