Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming.threads > #154

Re: pthread question

Newsgroups comp.programming.threads
From Geoff Clare <geoff@clare.See-My-Signature.invalid>
Subject Re: pthread question
References (5 earlier) <4DCA9ADB.4A4E28FC@web.de> <580t98-5kb.ln1@leafnode-msgid.gclare.org.uk> <4DCBE067.143100C0@web.de> <6kmv98-kr1.ln1@leafnode-msgid.gclare.org.uk> <4DCD9BA9.93E3AC9E@web.de>
Date 2011-05-16 13:28 +0100
Message-ID <5sh7a8-jg2.ln1@leafnode-msgid.gclare.org.uk> (permalink)
Organization Zen Internet

Show all headers | View raw


Alexander Terekhov wrote:

> Geoff Clare wrote:
>> 
>> Alexander Terekhov wrote:
>> 
>> > Geoff Clare wrote:
[...]
>> >> No, it means each implementor chooses their own rules, but they must
>> >> tell you what those rules are.  . . .
>> >
>> > Well, at
>> >
>> > http://www.opengroup.org/csq/public/search.mhtml?t=XY1&sort=bycomponent
>> >
>> > I can't find anything regarding rules for scheduling allocation domains
>> > of size greater than one. Do you have a link?
>> 
>> The Open Group's CSQs don't cover everything the POSIX Conformance
>> Document (PCD) has to cover.
>> 
>> Originally I think the idea was that the PCD would be supplied with
>> the system's developer documentation.  Of course, these days it
>> would make sense for them to be provided online, but it's up to
>> each implementor how they want to provide it.  It does seem that
>> they are not easy to find online.  I was able to find one for
>> HP-UX, but it was an old one from before pthreads were added to the
>> standard. One that I did find with the relevant information is for
>> QNX:
>> 
>> www.qnx.com/developers/docs/6.5.0/topic/com.qnx.doc.neutrino_prog/posix_conformance.html
>> 
>> According to that document, this is what QNX does:
>> 
>>     For threads with scheduling allocation domains of size greater
>>     than one, the rules defined for SCHED_FIFO, SCHED_RR, and
>>     SCHED_SPORADIC are followed such that if the thread becomes the
>>     head of its thread list, the thread may become the runnable thread
>>     on any processor in its scheduling allocation domain if it has a
>>     higher priority than the running thread on one of those processors.
>> 
>>     This may in turn result in the preempted thread's becoming the
>>     running thread on a different processor if that thread also has a
>>     scheduling allocation domain of size greater than one and its
>>     priority is higher than the running thread on one of the other
>>     processors in its scheduling allocation domain.
>> 
>>     If a thread's scheduling allocation domain has a size greater than
>>     one, a runnable thread selects the processor on which it becomes
>>     the runnable thread as follows:
>> 
>>       1. For each processor in the thread's scheduling allocation domain,
>>       find the processor whose running thread has the lowest priority
>>       that is less than this thread.
>> 
>>       2. If the search identifies only one processor, select that
>>       processor and make the thread the running thread on that processor.
>> 
>>       3. If the search identifies more than one processor, select the
>>       processor on which the thread previously ran before becoming a
>>       blocked thread.
>> 
>>       4. If the thread hadn't run on any of the selected processors
>>       before becoming a blocked thread, select the first processor
>>       that was found in the search.
>
> Thanks.
>
> The thing is that (priorities aside) in the case of T threads running on
> P processors with P = T (all threads can run in parallel, priorities are
> irrelevant), sched_yield() is supposed to be a no-op, do you agree?

Yes, from the point of view of which threads run on which processors
and when.  At a more detailed level, it wouldn't be quite the same as
a "pure" no-op, as there would be some processor time used by the O/S
to check that there isn't another thread that it should run instead.

-- 
Geoff Clare <netnews@gclare.org.uk>

Back to comp.programming.threads | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

pthread question p6 c6d6 <p6c6d6@gmail.com> - 2011-05-08 21:28 -0700
  Re: pthread question Vaclav Haisman <v.haisman@sh.cvut.cz> - 2011-05-09 07:11 +0200
  Re: pthread question Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-09 11:49 -0700
    Re: pthread question David Schwartz <davids@webmaster.com> - 2011-05-09 12:24 -0700
      Re: pthread question Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-09 14:22 -0700
        Re: pthread question "Chris M. Thomasson" <cristom@charter.net> - 2011-05-09 15:33 -0700
        Re: pthread question David Schwartz <davids@webmaster.com> - 2011-05-10 01:22 -0700
    Re: pthread question Geoff Clare <geoff@clare.See-My-Signature.invalid> - 2011-05-10 13:47 +0100
      Re: pthread question Alexander Terekhov <terekhov@web.de> - 2011-05-10 17:53 +0200
        Re: pthread question Geoff Clare <geoff@clare.See-My-Signature.invalid> - 2011-05-11 13:46 +0100
          Re: pthread question Alexander Terekhov <terekhov@web.de> - 2011-05-11 16:19 +0200
            Re: pthread question Geoff Clare <geoff@clare.See-My-Signature.invalid> - 2011-05-12 13:26 +0100
              Re: pthread question Alexander Terekhov <terekhov@web.de> - 2011-05-12 15:28 +0200
                Re: pthread question Geoff Clare <geoff@clare.See-My-Signature.invalid> - 2011-05-13 14:00 +0100
                Re: pthread question Alexander Terekhov <terekhov@web.de> - 2011-05-13 22:59 +0200
                Re: pthread question Geoff Clare <geoff@clare.See-My-Signature.invalid> - 2011-05-16 13:28 +0100

csiph-web