[Vm-dev] Re: [Pharo-project] Waste of CPU Power by polling events?

Eliot Miranda eliot.miranda at gmail.com
Tue Jan 11 20:47:54 UTC 2011


On Tue, Jan 11, 2011 at 12:26 PM, Nicolas Cellier <
nicolas.cellier.aka.nice at gmail.com> wrote:

>
> 2011/1/11 Eliot Miranda <eliot.miranda at gmail.com>:
> >
> >
> >
> > 2011/1/11 Levente Uzonyi <leves at elte.hu>
> >>
> >>
> >> On Tue, 11 Jan 2011, Eliot Miranda wrote:
> >>
> >> (Pine can't quote your mail, sorry.)
> >>
> >> "The problem with linux is that the pthreads implementation doesn't
> allow a normal user-level process to create high-priroity threads so that as
> >> soon as the Vm starts to spin doing some computation the heartbeat
> thread is shut-out and if the spinning computation only interrupted when a
> delay
> >> expires it'll never get interrupted because it is blocking the very
> thread that would signal the delay.  So until linux's pthreads
> implementation
> >> supports multiple priorities we're stuck with hacks like the interval
> timer based itimer in the linux Cog VMs."
> >>
> >> What about keeping the priority of the heartbeat thread at user-level
> and decreasing the other VM threads' priority slighly?
> >
> > Linux doesn't allow more than /one/ thread priority for threads in a
> user-level process.   So one /can't/ have multiple priorities.  All threads
> run at the same priority.  This is a horrible bug in the linux pthreads
> implementation but there it is.
> > best
> > Eliot
>
> Superficial googling "setting linux pthread priority" gives me this
> thread (java)
> http://kerneltrap.org/node/6080
>
> It seems that there are different scheduling policies in linux 2.6
> kernel, realTime, and non real time (traditional unix time sharing).
> It seems that only real time threads can have their priority set.
>
> man sched_setscheduler
>
> After man 7 pthreads, it appears that the scheduling policy would be
> different for each thread.
>
> However, the functionalities of interest are provided by the NPTL
> (Native POSIX Threads Library).
> The older LinuxThreads implementation might not implement POSIX.1
> complying threads.
>
> So, some linux might work, for example, in my fresh mandriva 2010.2
> x86-32, I test
> $ getconf GNU_LIBPTHREAD_VERSION
> NPTL 2.11.1
>
> To be confirmed...
>

You don't have to confirm this.  We have confirmed this at length over the
past year at Teleplace.  realtime scheduling is /not allowed/ in
non-super-user processes.  So unless the Squeak VM is to be installed setuid
and run as root it, like all other non-setuid programs on linux, must make
do with a /single/ thread priority.

I have a _few_ test programs that you're welcome to try out if you really
don't believe me :)

best
Eliot

>
> Nicolas
>
> >>
> >> Levente
> >
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20110111/893b33ca/attachment.htm


More information about the Vm-dev mailing list