thread priorities?

View: New views
3 Messages — Rating Filter:   Alert me  

thread priorities?

by Don Cohen-14 :: Rate this Message:

| View Threaded | Show Only this Message


Does clisp currently have any way to manipulate thread priorities?
Would it be easy to support?  What are the reasons it's either harder
than it looks or not a good idea?

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
clisp-devel mailing list
clisp-devel@...
https://lists.sourceforge.net/lists/listinfo/clisp-devel

Re: thread priorities?

by Vladimir Tzankov :: Rate this Message:

| View Threaded | Show Only this Message

On 4/25/12, Don Cohen <don-sourceforge-xxzw@...> wrote:
> Does clisp currently have any way to manipulate thread priorities?
> Would it be easy to support?  What are the reasons it's either harder
> than it looks or not a good idea?

As of now - no. There is no way to specify or change threads priorities.
There are several caveats:
1. We have to unify what priority means across platforms. On Win32 we
have just SetThreadPriority. On Linux each thread is treated as a
process by kernel scheduler and can be assigned a scheduling policy
and priority. Not sure how it is on BSD variants.
2. On Linux in order process to be allowed to change scheduling
policy/priority of thread it needs CAP_SYS_NICE capability
(http://linux.die.net/man/7/capabilities). By default it is available
only to privileged (root) processes. So if you just download/build
clisp and run it as non-root you will not be able to change the
priority.
3. IMO, generally playing with threads priorities is bad idea. There
are very few cases where it makes sense (e.g. communication with
devices when protocol timing is important). Also note that garbage
collection is "stop-the-world" i.e. all threads are suspended during
GC.

Note that most CL implementation ignore (or does not support) thread
priorities (https://bugs.launchpad.net/sbcl/+bug/547030,
http://www.lispworks.com/documentation/lw60/LW/html/lw-234.htm#pgfId-896875,
http://ccl.clozure.com/manual/chapter7.7.html#f_make-process).

I am not against implementing it but i would set the task with low priority :).

Vladimir

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
clisp-devel mailing list
clisp-devel@...
https://lists.sourceforge.net/lists/listinfo/clisp-devel

Re: thread priorities?

by Don Cohen-14 :: Rate this Message:

| View Threaded | Show Only this Message


 > As of now - no. There is no way to specify or change threads priorities.
 > There are several caveats:
 > 1. We have to unify what priority means across platforms. On Win32 we
 > have just SetThreadPriority...

So far I don't know what exactly all of these things do.
But I guess the best that can be done is use what the platform
provides and put a short description and a link in the clisp doc.

 > 2. On Linux in order process to be allowed to change scheduling
 > policy/priority of thread it needs CAP_SYS_NICE capability
 > (http://linux.die.net/man/7/capabilities). By default it is available
 > only to privileged (root) processes. So if you just download/build
 > clisp and run it as non-root you will not be able to change the
 > priority.

I'd have expected that you start a process with a given priority
(and perhaps can change that from outside the process), and then
within the process you can set thread priorities up to the process
priority.

 > 3. IMO, generally playing with threads priorities is bad idea. There
 > are very few cases where it makes sense (e.g. communication with
 > devices when protocol timing is important). Also note that garbage
 > collection is "stop-the-world" i.e. all threads are suspended during
 > GC.

Yes, I see that GC is a concern.  I'd expect this to run in the
process (highest available) priority.

What I really wanted to do was start a separate thread to do a long
computation and LOWER its priority.
What I was observing is that my machine would become unresponsive
during occasional data dumps.

 > I am not against implementing it but i would set the task with low
 > priority :).

I was imagining that it would at least be easy to do.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
clisp-devel mailing list
clisp-devel@...
https://lists.sourceforge.net/lists/listinfo/clisp-devel