Operating System - HP-UX
1829122 Members
1913 Online
109986 Solutions
New Discussion

Porting of PA_RISC applications to itanium and pthreads implication

 
SOLVED
Go to solution
Sandip Ghayal
Occasional Advisor

Porting of PA_RISC applications to itanium and pthreads implication

Hi I have an application compiled on PA_RISC platform that I am trying to run on Itanium machine. What I found was after creating 96 threads I cannot create any more threads. I get EAGAIN error. (as if I am running out of resources)
If I recompile this application on Itanium then I can create as many threads as I want. I have created a small sample for the repro that I have attached.

Sample consists of two programs.
Server.c which accepts connection from client and spawns of a thread to receive client data
Client.c this code tries to make as many connections as possible to the server.
Build.sh used to compile the above mentioned C code

Repro process:
Unzip the attachement using winzip. Then transfer the files to PA_RISC machines.

Compile Server.c and Client.c on PA_RISC machines in 32 bit mode.
Then move the binaries to itanium machine and run the code. The code should run inside 'Aries'

For Running:
# server
Server will now wait for any incomming clients
# client

And client will now start making connections to the server. server or client program will end whne one of then encounters any errors.

What I found in my case is that server code will terminate after getting 96th connection and trying to create a thread.
14 REPLIES 14
Steven E. Protter
Exalted Contributor

Re: Porting of PA_RISC applications to itanium and pthreads implication

Sounds like a tuning or patching issue to me.

IF the code is good, it should work the same way once compiled on both platforms. Perhaps a kernel/resource limit has been hit, or a patch related to threads management is missing.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Sandip Ghayal
Occasional Advisor

Re: Porting of PA_RISC applications to itanium and pthreads implication

Thanks for the reply

This code runs properly on PA_RISC m/c when compiled on PA_RISC and runs properly on Itanium machines when compiled on Itanium.

So if there is a missing patch it might be related to binary compatiability. I can't seem to find any patch for that yet.

Any suggestions ?

Cheers,

Sandip
A. Clay Stephenson
Acclaimed Contributor

Re: Porting of PA_RISC applications to itanium and pthreads implication

Check you kernel tunable, max_thread_proc.
If it ain't broke, I can fix that.
Sandip Ghayal
Occasional Advisor

Re: Porting of PA_RISC applications to itanium and pthreads implication

Thanks for the response.

Its currently set to 4000. I did try to manipulate those parameters during last 3 days but did not succeed.

I am sorry to bother you on this but will it be possible for you to run the repro ?

And if it works for you then can you provide me with other important parameters.

Cheers,

Sandip
James Murtagh
Honored Contributor

Re: Porting of PA_RISC applications to itanium and pthreads implication

I don't know of any issues of this kind with aries so I'm guessing something compiled in.....PTHREAD_THREADS_MAX perhaps?
James Murtagh
Honored Contributor
Solution

Re: Porting of PA_RISC applications to itanium and pthreads implication

Just thinking, the scope of the thread created changed on the 11.22 release due to the introduction of MxN threads. Before this it was scope_system to create kernel threads and it changed to scope_process for user threads.....is it possible your PA binary is using kernel threads and the recompiled IA binary user threads? Possibly nkthread is being hit but its unlikely as its always on 96 threads you have the problem. Don't have an IA box to test I'm afraid.
A. Clay Stephenson
Acclaimed Contributor

Re: Porting of PA_RISC applications to itanium and pthreads implication

Since this code works if you natively compile it, it has to be a problem with the ARIES emulation. You should probably submit this problem to HP but I would first apply the ARRIES Cumulative patch PHSS_29654 (if 11.22) because it does address thread problems.
If it ain't broke, I can fix that.
Sandip Ghayal
Occasional Advisor

Re: Porting of PA_RISC applications to itanium and pthreads implication

I have 11.23 but this patch is not applied not sure if I need to apply it or not. Let me check the patch and see if it works out

Thanks,

Sandip
A. Clay Stephenson
Acclaimed Contributor

Re: Porting of PA_RISC applications to itanium and pthreads implication

For 11.23, you need the equivalent patch, PHSS_29658.
If it ain't broke, I can fix that.
Mike Stroyan
Honored Contributor

Re: Porting of PA_RISC applications to itanium and pthreads implication

Even with the most current patch and a very simple program, I see a limit of 96 simultaneous threads for a 32-bit aries process and 255 threads for a 64-bit aries process.

It looks like it really is reaching some resource limit. It might be related to the extra space that is used by the emulation context for each thread.
Mike Stroyan
Honored Contributor

Re: Porting of PA_RISC applications to itanium and pthreads implication

Aries needs a larger local storage area to keep track of more simultaneous threads. You can increase that area by changing a kernel parameter and an aries configuration file.

First you need to increase the pa_maxssiz_32bit kernel parameter. (It is documented by "man pa_maxssiz_32bit". That will reserve more space for aries in each process. Changing that parameter does require a reboot.
/usr/sbin/kctune pa_maxssiz_32bit=334594048
/usr/sbin/reboot

Second you need to create a configuration file to instruct aries to use more of that space for the heap which holds thread contexts.
echo '/ -heap_ssz 20400' > /.ariesrc

That will take more of the 32-bit address space, which may interfere with the amount of data that the application wants to allocate. You can use 'chatr +q3p enable a.out' to enable third quadrant private memory for a PA-RISC application. Aries on 11.23 will map that to the new MPAS address space. The mpas mode will allow almost 4GB of total private data, more than even a PA-RISC system could give to many programs.
Sandip Ghayal
Occasional Advisor

Re: Porting of PA_RISC applications to itanium and pthreads implication

Thanks Mike,

I am going to give this a try first thing tomorrow morning

Cheers,

Sandip
Sandip Ghayal
Occasional Advisor

Re: Porting of PA_RISC applications to itanium and pthreads implication

Hi Mike,

I tried it but didn't work :-(
Still the same results

Mike Stroyan
Honored Contributor

Re: Porting of PA_RISC applications to itanium and pthreads implication

I lost a zero when posting my reply. I should have said a
heap_ssz of 204000. The number of threads allowed does increase in
proportion to the heap_ssz value. Here are three sets of values and
thread limits that I measured on a system.


pa_maxssiz_32bit heap_ssz threads
83648512 24576 97
167297024 41192 161
334594048 204156 798