Make Go program set its cpu priority

796 views
Skip to first unread message

Boris Solovyov

unread,
Feb 26, 2013, 8:56:47 PM2/26/13
to golang-nuts
Hi,

In some perl programs sometimes I made a call to set priority, to lower my program's niceness so it would hopefully yield to other things on the system if it bad behaved. Can go do this? A search of http://golang.org/search?q=Setpriority makes it look like it is unimplemented.

Kyle Lemons

unread,
Feb 26, 2013, 11:06:00 PM2/26/13
to Boris Solovyov, golang-nuts
It looks like it's in "syscall" for darwin and the bsds.  You could probably rawsyscall it on linux as well.  Like daemonizing a go binary, however, it seems like this is the sort of thing you should do externally, e.g. in the script that starts your daemon.  I believe some of the newer start-stop-daemon tools (and their friends as well can set nice levels as well as things like I/O scheduling priority.


On Tue, Feb 26, 2013 at 5:56 PM, Boris Solovyov <boris.s...@gmail.com> wrote:
Hi,

In some perl programs sometimes I made a call to set priority, to lower my program's niceness so it would hopefully yield to other things on the system if it bad behaved. Can go do this? A search of http://golang.org/search?q=Setpriority makes it look like it is unimplemented.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

minux

unread,
Feb 28, 2013, 7:20:09 AM2/28/13
to Boris Solovyov, golang-nuts
On Wed, Feb 27, 2013 at 9:56 AM, Boris Solovyov <boris.s...@gmail.com> wrote:
In some perl programs sometimes I made a call to set priority, to lower my program's niceness so it would hopefully yield to other things on the system if it bad behaved. Can go do this? A search of http://golang.org/search?q=Setpriority makes it look like it is unimplemented.

Reply all
Reply to author
Forward
0 new messages