- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- pthread_create fails when used with pthread_attr_s...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2007 05:33 PM
01-11-2007 05:33 PM
pthread_create fails when used with pthread_attr_setinheritsched() on HPUX
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);
The error code for a user it EPERM and for root it is EINVAL.
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 code on AIX and Solaris without any changes, it works there.
- Tags:
- pthread
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2007 08:34 AM - edited 10-21-2011 05:38 PM
01-12-2007 08:34 AM - edited 10-21-2011 05:38 PM
Re: pthread_create fails when used with pthread_attr_setinheritsched() on HP-UX
Have you called pthread_attr_init?
Why are you using {1} above? It is illegal to hardcode constants. Did you mean to use SCHED_RR?
Both EPERM and EINVAL seem to point out that your scheduling values isn't valid:
[EPERM] The caller does not have the appropriate privileges to create a thread with the scheduling policy and parameters specified in attr.
[EINVAL] The scheduling policy or scheduling attributes specified in attr are invalid.
Have you read rtsched(2)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2007 01:04 PM
01-12-2007 01:04 PM
Re: pthread_create fails when used with pthread_attr_setinheritsched() on HPUX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2007 08:57 PM
01-18-2007 08:57 PM
Re: pthread_create fails when used with pthread_attr_setinheritsched() on HPUX
pthread_attr_init()
I have also read the rtsched(2)
which gives me info about these
sched_get_priority_max()
sched_get_priority_min()
PRI_HPUX_TO_POSIX()
PRI_POSIX_TO_HPUX()
which are significant in my program i guess.
But still I am facing the problem.
I have found one more interesting thing about
sched_param structure which is something like this in HPUX
struct sched_param {
int sched_priority; /* Process execution scheduling priority. */
int sched_reserved[7]; /* Reserved fields for future expansion. */
};
and for AIX and solaris
struct sched_param
{
int sched_priority;
int sched_policy;
int sched_reserved[6];
};
on solaris
struct sched_param {
int sched_priority; /* process execution scheduling priority */
int sched_nicelim; /* nice value limit for SCHED_OTHER policy */
int sched_nice; /* nice value for SCHED_OTHER policy */
int sched_pad[6]; /* pad to the same size as pcparms_t of */
/* sys/priocntl.h */
/* sizeof(sched_priority) + */
/* sizeof(pcparms_t.pc_clparms) */
};
here as you can see i can set policy in this structure something like this
struct sched_param sched_param={1,1,1};
but in HPUX i am using sched_param sched_param={1}
this only sets the first parameter which is scheduling priority. As you have asked me whether I am setting the policy or not my answer is no, I am not setting it.
please suggest something.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2007 03:24 PM - edited 10-21-2011 05:39 PM
01-19-2007 03:24 PM - edited 10-21-2011 05:39 PM
Re: pthread_create fails when used with pthread_attr_setinheritsched() on HP-UX
>I have also read the rtsched(2) which gives me info about these
sched_get_priority_max() sched_get_priority_min()
If you read this and used SCHED_HPUX, with some fiddling, it would indicate that you can't use {1} above but you must use a value between:
Min pri: -256, max pri: -129
I needed to be root to use -129, or any other value.