Re: Multiprocessor problem?
Re: Multiprocessor problem?
- Subject: Re: Multiprocessor problem?
- From: Mark Hunt <email@hidden>
- Date: Wed, 19 Mar 2003 10:38:10 +0000
Justin
I'm pretty convinced that the crash is due to the OpenGL fullscreen bug.
Re-working my code probably stopped me re-issuing all the messages in
my buffer, which would certainly affect the probability of a crash.
FWIW, the machine is too dead to "ping".
Mark
Justin
[snip]
It does seem strange, as (re-reading my original mail) it would imply
that I'm getting data before I've called recvfrom!
Is this 'app' purely user-mode, or does it have some kernel code
associated with it (that you have developed)?
I'm totally in user-land!
The code that calls "recvfrom" is in a single MPThread (based on the
BSDLLCtest sample code). The buffer array is allocated in my global
variable space.
My original code did this:
bcopy(&hdr->data[id].data, msg_queue[msg_put], count);
msg_queue[msg_put].size = count; // save packet size
msg_put += 1;
if(msg_put >= kBufferCount) msg_put = 0; // circular
buffer
I spotted that there was a brief period when msg_put could point
outside the array, so I modified it so that it uses a local variable
(idx), instead of the "live" one, and updated msg_put by a single
store:
idx = msg_put;
bcopy(&hdr->data[id].data, msg_queue[idx], count);
msg_queue[idx].size = count; // save packet size
idx += 1;
if(idx >= kBufferCount) idx = 0; // circular buffer
msg_put = idx;
The bug "seems" to have gone away, but I don't understand why this
would crash the Mac so comprehensively!
I'd be a lot happier if I knew.
As would the rest of us. Are you positive that the system locks up (no
ping response, etc)?
The client thread that takes messages from the array uses a separate
msg_get index - the only access to msg_put in this thread is to compare
msg_put and msg_get for equality. The bug should only have caused a
re-read of the array contents!
BTW, does my buffer array need to be virtual memory safe? This MPThread
is just "ordinary" code outside the recvfrom, right?
The only reason your code needs to do something special in an
MP/multithread world is that you would like it to operate correctly
regardless of the platform. Theory tells us (remember theory? That
which differs from practice, at least in practice) that your app should
not affect the rest of the system.
The following sorts of things can affect the operation of the system,
though: sharing memory between your code and other code; between
threads of your app; and between your app and the kernel. There's a
lot of sharing in Mac OS X, so it's not a slam-dunk to assure that
alles ist g|t (or something like that).
Right now, I've no clue why things would go wrong there, but I haven't
looked at your snippets for long enough to get one.
Cheers,
Justin
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.