Threads and TCP/IP

Thomas Charron twaffle at gmail.com
Wed Nov 23 11:19:01 EST 2005


On 11/22/05, Kevin D. Clark <kevin_d_clark at comcast.net> wrote:
>
> Thomas Charron writes:
> > On 11/21/05, Cole Tuininga wrote:
> >> On Mon, 2005-11-21 at 18:18 -0500, Thomas Charron wrote:
> >> > Yes, one could say 'What about at the same time', but there really
> >> > isn't such a thing.. ;-)
> >> Even on an SMP machine?
> >   For the most part, yes. Even with multiple processors, ONE of the
> > processes is going to get to that memory first. ;-)
> On SMP machines things happen simultaneously all the time.  Things get
> intermingled a lot too.  Even on uniprocessor machines things can seem
> to be happening simultaneously.  So, you are wrong.
> I for one am really not comfortable with the cavilier manner that you
> are dispensing "advice" about threads programming.


  ...  I was being very general.  Of course things can happen 'at the same
time', but this was a VERY general question, and I was giving a VERY general
answer.  I'm not dispensing advice in the slightest, it's a brief off the
cuff conversation based on a general question.

  When dealing with someone that's may not be totally familiar with what's
happening, it's NOT exactly easy to explain what's happening with critical
sections, mutex locking, etc.  Typically, that's how I explain it.  Under
the covers, they don't.  Becouse, under the covers, they DON'T happen at the
same time.

  Cripes.  It's not right or wrong, it's not trying to say 'I know more then
you, my hard disks bigger'.

  And, if you want to get technical about it, on most x86 based systems,
there are many things that cause memory access to happen 'one at a time'.
Multiprocessor contention over memory resources can actually *BE* a limiting
factor, and why, in cases where you DO have several things accessing the
same memory it's idiotic to say 'they happen at the exact same time'.

  Cripes, if things happen 'at the same time', go ahead and explain exactly
how a Mutex works, and what happens when 2 threads attempt to lock the same
Mutex at 'the same time'.

  One of them gets it first.

  Obviously memory controllers are going to handle reads and writes, and
byte 1 may get written by thread a, and byte 2 written by thread b, then
byte 2 overwritten by thread a when the memory writes and reads are
scheduled to optimize performance.

  Effing christ..

  Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.gnhlug.org/mailman/private/gnhlug-discuss/attachments/20051123/18a2ffd1/attachment.html


More information about the gnhlug-discuss mailing list