The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Pthread_create issue Hellboy High Level Programming 1 05-19-2008 03:58 AM
How Can I use pthread_create ? shvalb High Level Programming 5 03-11-2008 10:17 AM
pthread_create and scope usage jenmead High Level Programming 3 09-20-2006 01:16 PM
unresolve pthread_create etc zhshqzyc High Level Programming 3 02-13-2006 03:38 PM
pthread_create problem _rocky High Level Programming 5 03-11-2005 03:38 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 01-11-2007
Registered User
 

Join Date: Nov 2006
Posts: 16
pthread_create fails when used with pthread_attr_setinheritsched() on HPUX

I am using HPUX on Itanium and I have c program where I am doing something like this
but this pthread_create always fails at runtime
prio = PRI_MAX;
prio_low = PRI_MIN;
.
.
.
.
struct sched_param sched_param={1};
sched_param.sched_priority=prio;
thret = pthread_attr_setschedparam(&serv_attr, &sched_param);

thret = pthread_attr_setinheritsched(&serv_attr,PTHREAD_EXPLICIT_SCHED);

.
.
.
thret = pthread_create(&sthread,&serv_attr,server_main, 0);

but if i remove this line

thret = pthread_attr_setinheritsched(&serv_attr,PTHREAD_EXPLICIT_SCHED);

it works fine, can anyone suggest whats happening here. I have tried the same on AIX and Solaris, it works there.
Reply With Quote
Forum Sponsor
  #2  
Old 01-12-2007
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,616
I have never played with the scheduling calls on any unix, but I will make a guess. Look at the man page for rtsched() and notice the following routines:
sched_get_priority_max()
sched_get_priority_min()
PRI_HPUX_TO_POSIX()
PRI_POSIX_TO_HPUX()
My guess is that some combination of these routines is needed. Priorities on HP-UX are backwards. Or reversed. Or mirror-imaged. Or something like that. Anyway, it looks like a landmine waiting to be stepped on:
Quote:
These translations are necessary because the POSIX.4 standard chose larger numbers to represent stronger priorities and the existing HP-UX behavior, which must be maintained for backward compatibility, uses smaller numbers for stronger priorities.
It has never been clear to me which routines use which style of priority. I just take the OS defaults on priority so I don't really care. If you get this working, please let us know the secret.
Reply With Quote
  #3  
Old 01-17-2007
Registered User
 

Join Date: Nov 2006
Posts: 16
NAME
rtsched - execute process with real-time priority

SYNOPSIS
rtsched -s scheduler -p priority command [arguments]

rtsched [ -s scheduler ] -p priority -P pid

DESCRIPTION
Rtsched executes command with POSIX or HP-UX real-time priority, or
changes the real-time priority of currently executing process pid.
----------------------------------------------------------------------------

this is what I found when I checked the man page of the rtsched. This basically tells about the process scheduling on HP-UX.
And my program illustrated above only playing with the standard pthreads.
Can you put more focus on this.
I did not get what you wanted to suggest.
Please respond and correct me if I am wrong here.
Reply With Quote
  #4  
Old 01-17-2007
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,616
Your man page must be truncated somehow. Mine has a lot more than you quote. This includes descriptions of the functions I mentioned and that quote I have above came from the man page as well. Try this copy rtsched(2).
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 02:00 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0