Thread: multithreaded reeading and writing from buffer

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    multithreaded reeading and writing from buffer

    The last years, 99% of my time I'm doing java so my C++ skills are well, erm, lets's say a bit at a low level.
    But I'm having a bit of a problem.
    I have a buffer that is accessed by two threads.
    One for reading and one for writing to the buffer (a vector).
    I'm pretty sure that I never write outside the memory allocated by the buffer.
    Due to performance issues we tryed removing 2 mutex locks and that worked CPU usage droped with 50%. We made the methods where we removed the mutex locks a bit smarter so we first check if we can safely read or not.
    That code isn't 100% safe because things can still go wrong between the check and the actual read.

    Now, about 2 or 3 times a day, we get a blue screen on Win XP and immediately after a reset of windows.
    Can this be the result of a push and pop on the same address?
    As far as I know, if I try to write beyond my allocated memory I would get an access violation message but windows wouldn't reset. Is this the same with reading and writing to the same address?

    I analysed the mini dumps from windows but that didn't give me any usefull information.

    I haven't been able to simulate it on the development machine with debuging capabilities nor am I allowed post any code.
    I also ran it with the ntsd but it hasn't crashed yet.

    Could the windows crash be related to our program or can it be a hardware fault (like a heat problem)?


    Thanks

    Maes
    Last edited by maes; 08-20-2007 at 01:39 AM.

Popular pages Recent additions subscribe to a feed