linux multithreaded? crash

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Re: linux multithreaded? crash

Postby MeltingPlastic » Thu Jan 03, 2019 6:56 pm

gdb I think
MeltingPlastic
 
Posts: 221
Joined: Fri Feb 07, 2014 11:30 pm

Re: linux multithreaded? crash

Postby Julio Jerez » Thu Jan 03, 2019 6:58 pm

wow you are a hardcore dude, I hate gdb, I am trying kgdb
Julio Jerez
Moderator
Moderator
 
Posts: 10992
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: linux multithreaded? crash

Postby MeltingPlastic » Thu Jan 03, 2019 7:04 pm

well I just say that because I think thats what qtcreator uses. Im not very good with command line debugging.
MeltingPlastic
 
Posts: 221
Joined: Fri Feb 07, 2014 11:30 pm

Re: linux multithreaded? crash

Postby Julio Jerez » Thu Jan 03, 2019 7:35 pm

what I see in multithread in Linux make no sense whatsoever it is as if the mutexes, the critical sections and all of the thread synchronization does not work at all.
Julio Jerez
Moderator
Moderator
 
Posts: 10992
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: linux multithreaded? crash

Postby Julio Jerez » Thu Jan 03, 2019 8:07 pm

ok I have it working now, for some reason in Linux function like
std::this_thread::yield(); and _mm_pause();
behave quite different than in widows systems.

I make so that In non windows system function and intead we use teh old style Semphores, and
Code: Select all
void dgThread::dgSemaphore::Wait()
{
   std::unique_lock <std::mutex> lck(m_mutex);
   while (m_count == 0)
   {
      m_sem.wait(lck);
   }
   m_count --;
}


this mean the jobs are not longer lock free in windows, I guess that is because in Linux thread do no get preempt like in windows, do you can not really count that std::this_thread::yield() will yield to a thread on the same core, or do nothing like in window.
later when I have more time I will check out how teh same can be done.
This is one case where is good to use a third party thread library instead of rolling your own.

but I have not found a reliable thread library,
Intel Building Blocks is support to be very good but is not free.

anyway I try in debug, not in release yet, please try again and tell me what you get.

edit: I now buidl the release, and it seem to work here.
It is no bad considering my laptop is an entry level amd 200 ghz ryzen with 4 cores 8 thread but who's counting.
Julio Jerez
Moderator
Moderator
 
Posts: 10992
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: linux multithreaded? crash

Postby MeltingPlastic » Mon Jan 07, 2019 2:28 pm

The multi-threading works better now. But there still seems to be a bug somewhere. I built an app that is destroying and making new rigid bodies all the time as part of some experiments with machine learning.

Here is a video showing how the app crashes when the number of threads is set to 4:
https://youtu.be/nObbtHHySj0

Edit:

Actually this could be a bug with my framework. I'll look deeper into it later.
MeltingPlastic
 
Posts: 221
Joined: Fri Feb 07, 2014 11:30 pm

Re: linux multithreaded? crash

Postby Dave Gravel » Mon Jan 07, 2019 5:43 pm

The object is recreate and destroy in a loop ?
Do you use ASync update ?
Maybe you need to call NewtonWaitForUpdateToFinish before the create,destroy object, If it is create in runtime.
If you need to create,destroy multiples bodies I think it is better to use a listener controller if i'm not wrong.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://www.facebook.com/dave.gravel1
http://orionx3d.googlepages.com/
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 712
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: linux multithreaded? crash

Postby MeltingPlastic » Mon Jan 07, 2019 9:13 pm

I'm pretty sure I am doing exactly as you say. nothing is created or destroyed untill after the threads have synced.
MeltingPlastic
 
Posts: 221
Joined: Fri Feb 07, 2014 11:30 pm

Previous

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 1 guest