yyyyy@xxxxxxxxxx wrote:
> Bug report from : Ted Baker , IEEE PASC SSWG
>
> (Please direct followup comments direct to yyyyyyyyyyyyyy@xxxxxxxxxxxxx)
>
> @ page 518 line 2123 section 2.8.4 Process Scheduling (SCHED_FIFO) objection
>{interp96-1}
>
> Problem:
>
> This "aardvark" is based on IEEE STD 1003.1 Interpretation Request
> #96, which was referred by the Interpretations Committee back to
> the Sponsor (IEEE PASC) for corrective action. The proposed
> changes represent the consensus view of the members of the SSWG present
> at the San Jose PASC meeting
>
> Action:
>
> insert after line 2123:
>
> - When a running thread calls the pthread_setschedprio()
> function, the thread specified in the function call is modified to
> the priority specified by the prio argument.
>
> modify lines 2124-2125 as follows:
>
> - If a thread whose policy or priority has been modified
> other than by pthread_setschedprio() or sched_setprio()
> is a running thread or is runnable, it then becomes the tail
> of the thread list for its new priority.
>
> insert after line 2125:
>
> - If a thread whose policy or priority has been modified by
>pthread_setschedprio( )
> is a running thread or is runnable, the effect on its position in the
>thread
> list depends on the direction of the modification, as follows:
> i. if the priority is raised, the thread becomes the tail of the thread
>list;
> ii. if the priority is unchanged, the thread does not change position in
>the thread list;'
> iii. if the priority is lowered, the thread becomes the head of the thread
>list.
>
> insert the following new function description at the appropriate
> location based on the alphabetic ordering of function names:
>
> pthread_getschedprio() System Interfaces
>
> NAME
>
> pthread_getschedprio -- dynamic thread scheduling parameters
> access (REALTIME THREADS)
>
> SYNOPSIS
>
> #include <pthread.h>
> int pthread_getschedprio(pthread_t thread, int prio);
>
> DESCRIPTION
>
> The pthread_setschedprio( ) functions allow the scheduling priority of
>individual threads
> within a multi-threaded process to be retrieved
> and set. For SCHED_FIFO and SCHED_RR, the only required member of the
>sched_param
> structure is the priority sched_priority. For SCHED_OTHER, the affected
>scheduling parameters
> are implementation-defined.
There's far too much "cut and paste" here, and it's broken badly.
First, I don't see any point to a pthread_getschedprio(); you've already got
pthread_getschedparam(), and you need no new semantics there. I would almost
presume that you
didn't intend to add a pthread_getschedprio(), (partly because you failed to
prototype
pthread_setschedprio(), which was the point of the amendment), except for the
fact that the
error appears several times.
Given that there isn't a pthread_getschedprio(), we're only talking about
SETTING, not
RETRIEVING, so the description text is wrong. (And in any case,
pthread_setschedprio() doesn't
allow both retrieving and setting.)
Your prototype specifies an "int" priority, not a sched_param structure, so
talking about the
"required member" is incorrect and confusing. You also omitted mention of
SCHED_SPORADIC, but
I think that's OK because there's no need once the reference to sched_param is
removed. I would
suggest that the priority value should be specified simply as an integer within
the allowed
range for SCHED_FIFO. This is consistent with the behavior of
pthread_mutexattr_setprioceiling,
which is after all the model for this new function. The priority will be set
appropriately
regardless of the thread's policy, and no mention of individual policies is
required or useful.
> The pthread_setschedparam( ) function sets the scheduling
> priority for the thread whose thread ID is given by thread to
> the value given by prio. |
Remove that trailing "|".
> RETURN VALUE
>
> If successful, the pthread_setschedprio( ) function shall return zero;
> otherwise, an error number shall be returned to indicate the error.
>
> ERRORS
>
> The pthread_setschedprio( ) function may fail if:
>
> [EINVAL] The value of prio is invalid for the scheduling policy
> of the specified thread.
prio is invalid for SCHED_FIFO.
> [ENOTSUP] An attempt was made to set the priority to an
> unsupported value.
I don't see any point to this. (See pthread_mutexattr_setprioceiling.)
> [EPERM] The caller does not have the appropriate permission to set the
> scheduling policy of the specified thread.
That's "scheduling priority".
> [ESRCH] The value specified by thread does not refer to a existing thread.
>
> These functions shall not return an error code of [EINTR].
>
> EXAMPLES
>
> None.
>
> APPLICATION USAGE
>
> None.
>
> RATIONALE
>
> This function provides a way for an application to temporarily
> raise its priority and then lower it again, without having the
> side effect of yielding to other threads of the same priority.
> This is necessary if the application is to implement its own
> strategies for bounding priority inversion, such as priority
> inheritance or priority ceilings. This capability is especially
> important if the implementation does not support the
> _POSIX_THREAD_PRIO_PROTECT or _POSIX_THREAD__PRIO_INHERIT options,
> but even if those options are supported it is needed if the
> application is to bound priority inheritance for other resources,
> such as semaphores.
Most of this, or similar wording, should be under APPLICATION USAGE.
Specifically, the intent is
to allow "poor man's priority protection" without a yield when dropping
priority back to the
original level.
> The Sponsor working group believes that while it might be
> preferable conceptually to solve this problem by modifying the
> specification of pthread_setschedattr(), it is now too late
> to make such a change, as there may be implementations and
> tests that would need to be changed. Therefore, a new function
> is introduced.
>
> FUTURE DIRECTIONS
>
> None.
>
> SEE ALSO
>
> pthread_getschedparam(), pthread_sched_setschedparam(),
Add pthread_mutexattr_setprioceiling, pthread_mutexattr_getprioceiling,
pthread_attr_setschedparam, pthread_attr_getschedparam.
> the Base
> Definitions volume of IEEE Std 1003.1-200x, <pthread.h>, <sched.h>
/------------------[ yyyyyyyyyyyyyy@xxxxxxxxxx ]------------------\
| Compaq Computer Corporation POSIX Thread Architect |
| My book: http://www.awl.com/cseng/titles/0-201-63392-2/ |
\-----[ http://home.earthlink.net/~anneart/family/dave.html ]-----/
|