|
From: Vladimir T. <vtz...@gm...> - 2012-04-25 12:01:22
|
On 4/25/12, Don Cohen <don...@is...> 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 |