Click Here
home features news forums classifieds faqs links search
5609 members 
Amiga Q&A /  Free for All /  Emulation /  Gaming / (Latest Posts)
Login

Nickname

Password

Lost Password?

Don't have an account yet?
Register now!

Support Amigaworld.net
Your support is needed and is appreciated as Amigaworld.net is primarily dependent upon the support of its users.
Donate

Menu
Main sections
Home
Features
News
Forums
Classifieds
Links
Downloads
Extras
OS4 Zone
IRC Network
AmigaWorld Radio
Newsfeed
Top Members
Amiga Dealers
Information
About Us
FAQs
Advertise
Polls
Terms of Service
Search

IRC Channel
Server: irc.amigaworld.net
Channel: #Amigaworld
Channel Policy and Guidelines

(Uses JAVA Applet and Port 1024)
Visit the Chatroom Website

Who's Online
 68 guest(s) on-line.
 2 member(s) on-line.


 K-L,  TiredofLife

You are an anonymous user.
Register Now!
 TiredofLife:  2 mins ago
 K-L:  3 mins ago
 kolla:  8 mins ago
 freak:  36 mins ago
 Argo:  1 hr 58 mins ago
 Trekiej:  2 hrs 25 mins ago
 wakido:  2 hrs 38 mins ago
 Debaser:  3 hrs 16 mins ago
 davidf215:  3 hrs 39 mins ago
 Hypex:  3 hrs 52 mins ago

/  Forum Index
   /  Amiga OS4.x \ Workbench 4.x
      /  pthread semaphore lockups
Register To Post

Goto page ( 1 | 2 Next Page )
PosterThread
broadblues 
pthread semaphore lockups
Posted on 16-Jun-2009 22:57:13
#1 ]
Amiga Developer Team
Joined: 20-Jul-2004
Posts: 4294
From: Portsmouth England

Every now and again a it seems a that a program lauching a new thread with pthreads will hang with both the prgram and thread apparently waiting on the same semaphore. I've found that if you identify the thread with Scout and send it a signal the lockup can be freed. But you must get the right thread or it crashes!!!!

I've notice this happening a few time with my blender port, but just now with the test program for OpenEXR is happened a lot.

In the blender case it happens whilst rendering animations and trying use other apps (say web browsing) at the same time. In fact I've most often noticed it when browsing with AWeb (but also OWB) whilst tesing a render sequance.

The OpenEXR test program I was just running has a routine that spawns literally 10000's of threads (not simultaneously) and every 10000 or so it would stop, and I had to release it with the signaling tecnque described above. Once the routine was other the test program thought it had passed

Some kind of race condition bug in pthreads? Or even in the systems semaphores?


THis is on AmigaOne EX G4 800 - OS4.1 (53.5)

Last edited by broadblues on 17-Jun-2009 at 02:34 PM.

_________________
BroadBlues On Blues BroadBlues On Amiga Walker Broad

 Status: Offline
Profile     Report this post  
jahc 
Re: pthread semaphore lockups
Posted on 17-Jun-2009 4:13:37
#2 ]
Elite Member
Joined: 30-May-2003
Posts: 2959
From: Auckland, New Zealand

@broadblues

I vaguely recall a post on amigans.net describing the old pthreads implementation as "broken". It has actually been updated in the newest SDK. Bean was encouraged to update Tunenet to use the newer pthread because of the problems.. but he actually removed the pthread dependency altogether. But the point is.. it had problems earlier. Please search amigans.net if you want more info.

 Status: Offline
Profile     Report this post  
Mrodfr 
Re: pthread semaphore lockups
Posted on 17-Jun-2009 5:34:58
#3 ]
Super Member
Joined: 28-Jan-2007
Posts: 1396
From: French

Hello,

Blender 2.5 got flexible.

http://vimeo.com/5137477

Sorry if not related to the thread subject, just can't resist to post the link

@broadblues

You port blender to AOS4 ???

_________________
BTW, what you have done for the amiga today ????

-A1200+Mediator+VooDoo3+060/50+96mo+SCSI-KIT
-SAM440EP-667mhz-on MapowerKC3000+AOS4.1

Amiga Docs Disks Preservation Project

 Status: Offline
Profile     Report this post  
AlexC 
Re: pthread semaphore lockups
Posted on 17-Jun-2009 5:41:07
#4 ]
Super Member
Joined: 22-Jan-2004
Posts: 1289
From: City of Lost Angels, California.

@broadblues

I don't know much about semaphores but if you're using the static one from SDK:local/newlib/lib/libpthread.a (5.1.2009 144,370 bytes) it should be the latest version.

If you're using the dynamic one from WB4.1:SObjs/libpthread.so (2.7.2007 155,465 bytes) that one is older.

The one in SDK:local/newlib/lib/libpthread.so (5.1.2009 148,741) is newer.

Good luck with the port and thanks for doing it, I can't wait to try it!

_________________
AlexC's free OS4 software collection

AmigaOne XE/X1000/X5000/UAE-PPC OS4 laptop/X-10 Home Automation

 Status: Offline
Profile     Report this post  
broadblues 
Re: pthread semaphore lockups
Posted on 17-Jun-2009 11:29:25
#5 ]
Amiga Developer Team
Joined: 20-Jul-2004
Posts: 4294
From: Portsmouth England

@jahc

Yes I remember the thread. I am building with the latest SDK so am using the recent version of pthreads.library so the problem (probably) doesn't come from that angle.

_________________
BroadBlues On Blues BroadBlues On Amiga Walker Broad

 Status: Offline
Profile     Report this post  
broadblues 
Re: pthread semaphore lockups
Posted on 17-Jun-2009 11:33:09
#6 ]
Amiga Developer Team
Joined: 20-Jul-2004
Posts: 4294
From: Portsmouth England

@Mrodfr

I'll have a look at that vimeo when I've got time to fire up my linux box (for the flash).

Yes, I'm porting blender, I have most things working, except a few that require depth buffer read access, which is not supported by minigl, and is not working in warp3d for radeon drivers. Basically that means no sculpt mode ;-(

I'm working on the 2.48a source. 2.5 has been rewritten so likely would require porting from scratch, although I haven't looked at the source.

[edit]
changed have to haven't!
[/edit]

Last edited by broadblues on 17-Jun-2009 at 12:35 PM.
Last edited by broadblues on 17-Jun-2009 at 11:36 AM.

_________________
BroadBlues On Blues BroadBlues On Amiga Walker Broad

 Status: Offline
Profile     Report this post  
broadblues 
Re: pthread semaphore lockups
Posted on 17-Jun-2009 11:34:54
#7 ]
Amiga Developer Team
Joined: 20-Jul-2004
Posts: 4294
From: Portsmouth England

@AlexC

Quote:

don't know much about semaphores but if you're using the static one from SDK:local/newlib/lib/libpthread.a (5.1.2009 144,370 bytes) it should be the latest version.


I'm using that version. Satically linked. although IIUC the both the staic and dynamic ones are wrapers for the pthreads.library

_________________
BroadBlues On Blues BroadBlues On Amiga Walker Broad

 Status: Offline
Profile     Report this post  
Mrodfr 
Re: pthread semaphore lockups
Posted on 17-Jun-2009 12:30:33
#8 ]
Super Member
Joined: 28-Jan-2007
Posts: 1396
From: French

@broadblues

Great news

BTW, are you in touch with Yomgui, the developper of the morphOS version ???

_________________
BTW, what you have done for the amiga today ????

-A1200+Mediator+VooDoo3+060/50+96mo+SCSI-KIT
-SAM440EP-667mhz-on MapowerKC3000+AOS4.1

Amiga Docs Disks Preservation Project

 Status: Offline
Profile     Report this post  
broadblues 
Re: pthread semaphore lockups
Posted on 17-Jun-2009 12:36:36
#9 ]
Amiga Developer Team
Joined: 20-Jul-2004
Posts: 4294
From: Portsmouth England

@Mrodfr

No. The main issues are GL related. Morphos uses a different gl implementation, so will have different bugs.

_________________
BroadBlues On Blues BroadBlues On Amiga Walker Broad

 Status: Offline
Profile     Report this post  
Mrodfr 
Re: pthread semaphore lockups
Posted on 17-Jun-2009 12:53:30
#10 ]
Super Member
Joined: 28-Jan-2007
Posts: 1396
From: French

@broadblues

OK, BTW, thanks for your development for porting blender to AOS4.x

Now with my SAM, this subject (3D) and this software (a modern 3D software for AOS4.x) interest me a lot. Thanks again for your actually developped port of Blender 3D for AOS4.x.

_________________
BTW, what you have done for the amiga today ????

-A1200+Mediator+VooDoo3+060/50+96mo+SCSI-KIT
-SAM440EP-667mhz-on MapowerKC3000+AOS4.1

Amiga Docs Disks Preservation Project

 Status: Offline
Profile     Report this post  
Fab 
Re: pthread semaphore lockups
Posted on 17-Jun-2009 13:57:46
#11 ]
Super Member
Joined: 17-Mar-2004
Posts: 1178
From: Unknown

@broadblues

Do you assume the Morphos version has bugs or what? :)

 Status: Offline
Profile     Report this post  
bernd_afa 
Re: pthread semaphore lockups
Posted on 17-Jun-2009 14:19:25
#12 ]
Cult Member
Joined: 14-Apr-2006
Posts: 829
From: Unknown

>The OpenEXR test program I was just running has a routine that spawns literally >10000's of threads (not simultaneously) and every 10000 o

where is the source of it, so can compile on other systems if it work.




 Status: Offline
Profile     Report this post  
broadblues 
Re: pthread semaphore lockups
Posted on 17-Jun-2009 14:32:03
#13 ]
Amiga Developer Team
Joined: 20-Jul-2004
Posts: 4294
From: Portsmouth England

@bernd_afa

http://www.openexr.com/downloads.html

in the openEXR-1.6.1 package but you'll also need the ilmbase package too.

It built more or less out of the box, apart from the ocaasional unix filepath (in the test progs) and the fact that the configure script had default settings for amigaos built in. You'd think that would be agood thing but it assumed a 68020 cpu!

I would think this is likely a OS4 issue though, although proving that works elsewhere can't do any harm


NOTE: This issue is with amigaos semphores being used inside pthreads not with pthread semaphores as described by semaphore.h, these aren't suported by AmigaOS4 at present and so if you try and test openEXR you will need to disable semaphore.h on any system that has it, to get an similar setup.

Last edited by broadblues on 17-Jun-2009 at 03:01 PM.
Last edited by broadblues on 17-Jun-2009 at 02:35 PM.

_________________
BroadBlues On Blues BroadBlues On Amiga Walker Broad

 Status: Offline
Profile     Report this post  
bernd_afa 
Re: pthread semaphore lockups
Posted on 17-Jun-2009 17:19:22
#14 ]
Cult Member
Joined: 14-Apr-2006
Posts: 829
From: Unknown

@broadblues

>NOTE: This issue is with amigaos semphores being used inside pthreads not with >pthread semaphores as described by semaphore.h, these aren't suported by >AmigaOS4 at present and so if you try and test openEXR

i think thats not good, use amiga semaphore and pthreads, which use own task scheduling and own semaphores.because teh semaphore and tasks must fit.look in task manger of OS4.Are there when pthread is used this 1000 amiga tasks show or not ?

only when there is every amiga thread show amiga semaphore can signal the right task or you need the pthread semaphores that know about all tasks pthread create.

I see in the pthread source no amiga task create, so i think pthread use its own child task scheduler and so it need semaphore system that know about this intern create tasks

either pthread must change to use amiga tasks or must use pthread samaphore

 Status: Offline
Profile     Report this post  
Fab 
Re: pthread semaphore lockups
Posted on 17-Jun-2009 18:02:03
#15 ]
Super Member
Joined: 17-Mar-2004
Posts: 1178
From: Unknown

@bernd_afa

But you don't have the os4 pthread sources. I doubt it's implemented with its own task scheduler like the old ixemul one (that really doesn't work well, btw).

Last edited by Fab on 17-Jun-2009 at 06:02 PM.

 Status: Offline
Profile     Report this post  
bernd_afa 
Re: pthread semaphore lockups
Posted on 18-Jun-2009 8:30:37
#16 ]
Cult Member
Joined: 14-Apr-2006
Posts: 829
From: Unknown

@Fab

>But you don't have the os4 pthread sources. I doubt it's implemented with its own >task scheduler like the old ixemul one (that really doesn't work well, btw).

Yes, so i ask in my last Post if there are all pthread tasks show in OS4 task manager.
using for pthread amiga tasks is the best way i think only so its possible to singlestep programs with more tasks in GUI debugger and find bugs fast.

i dont know wy here often is tell that ixemul work not good.its the only lib i see that work thread safe with best Unix compatibility.

when i do a simple sdl program that start 5 tasks and every task do a SDL_Wait(10);and print out in a loop hello world\n

and link with libnix, then you can see that this is not threadsafe and between the text helloworld is writen text from other tasks.with ixemul work 100% ok

output on libnix look sometimes as this

hellhelloworldoworld

this happen when the task is switch during output.On V61 ixemul this work ok, so i dont know wy ixemul task scheduler not work well

if OS4 pthreads work well, its also possible to try this simple test.

EDIT:

pthreads is LGPL licence, so where can get the OS4 pthread sources ?

Last edited by bernd_afa on 18-Jun-2009 at 09:14 AM.

 Status: Offline
Profile     Report this post  
broadblues 
Re: pthread semaphore lockups
Posted on 18-Jun-2009 9:16:26
#17 ]
Amiga Developer Team
Joined: 20-Jul-2004
Posts: 4294
From: Portsmouth England

@bernd_afa

A task shows in scout for each active OS4 pthread

_________________
BroadBlues On Blues BroadBlues On Amiga Walker Broad

 Status: Offline
Profile     Report this post  
Zardoz 
Re: pthread semaphore lockups
Posted on 18-Jun-2009 9:22:29
#18 ]
Team Member
Joined: 13-Mar-2003
Posts: 4261
From: Unknown

@bernd_afa

Quote:
when i do a simple sdl program that start 5 tasks and every task do a SDL_Wait(10);and print out in a loop hello world\n

and link with libnix, then you can see that this is not threadsafe and between the text helloworld is writen text from other tasks.with ixemul work 100% ok


Er, if every task executes SDL_Wait(10); and then prints, then they will start printing at approximately the same time and a task switch or real multiple hardware threads will make the text a mess. You can't expect printf for instance to be aware of threads in that way on any system, if you want singular access to the console or any other resource the only way to be certain is to use some form of locking.

Quote:
pthreads is LGPL licence, so where can get the OS4 pthread sources ?


A pthreads implementation does not have to use the pthreads source code.

Last edited by Zardoz on 18-Jun-2009 at 09:42 AM.

_________________

 Status: Offline
Profile     Report this post  
abalaban 
Re: pthread semaphore lockups
Posted on 18-Jun-2009 9:50:04
#19 ]
Super Member
Joined: 1-Oct-2004
Posts: 1103
From: France

@bernd_afa

access to file descriptor is not atomic, it never was on any platform. it's up to the multi thread programmer to handle the case and do what he wants to.
If you are adding such thing both into file descriptor handling and the task scheduler than you are breaking things because it means you are preventing one task from being switched while there is ongoing output if the task is writing a huge amount of data to the file descriptor (or if the file descriptor is connected to a slow, synchronized size-limited medium - say a socket for example - then you are seriously hitting multitasking which is bad, very bad !!

_________________
AOS 4.1 : I dream it, Hyperion did it !
Now dreaming AOS 4.2...
Thank you to all devs involved for this great job !

 Status: Offline
Profile     Report this post  
Georg 
Re: pthread semaphore lockups
Posted on 18-Jun-2009 9:53:35
#20 ]
Regular Member
Joined: 14-May-2003
Posts: 435
From: Unknown

@broadblues

Quote:
Some kind of race condition bug in pthreads? Or even in the systems semaphores?


I don't know OS4, but assuming the system (Exec) semaphores work correctly, then the situation where two tasks wait for the same semaphore con only happen if A) there's a third task (maybe some helper task) which owns it, or B) something messed up SysBase->TDNestCnt (Forbid()/Permit() nesting counter) causing the semaphore internal protection/locking to fail.

 Status: Offline
Profile     Report this post  
Goto page ( 1 | 2 Next Page )

[ home ][ about us ][ privacy ] [ forums ][ classifieds ] [ links ][ news archive ] [ link to us ][ user account ]
Copyright 2000 - 2017 Amigaworld.net.

Amigaworld.net was originally founded by David Doyle