改变X运行的优先权
时间:2004-04-17
来源:互联网
作者: hanzixing 发布时间: 2004-04-17
作者: dreamawake 发布时间: 2004-04-17
作者: hanzixing 发布时间: 2004-04-18
renice -10 (X PID)
(X PID) 是你的X 的进程id, ps -aux|grep X 可以查。
作者: reinf 发布时间: 2004-04-19
root 1321 0.0 0.4 5348 1200 tty1 S 17:25 0:00 /bin/sh /usr/X11R6/bin/startx
root 1333 8.6 8.0 56832 20472 ? S< 17:25 0:29 X :0
root 1418 0.0 0.2 4740 708 pts/0 S 17:31 0:00 grep X
请教reinf兄,上面的的结果是问题所在吗?我应该怎样去调呢?
作者: hanzixing 发布时间: 2004-04-19
作者: 南汇水蜜桃 发布时间: 2004-04-19
> root 1333 8.6 8.0 56832 20472 ? S< 17:25 0:29 X :0
> root 1418 0.0 0.2 4740 708 pts/0 S 17:31 0:00 grep X
第二行的那个1333是X的进程号,就用:
renice -10 1333
当然每次启动那个号码会变动的。至于究竟能不能解决问题,我不敢保证,X缓慢的原因很多,只是在我的slack上还有不错的效果。
作者: reinf 发布时间: 2004-04-20
为什么以前的SLACKER没有提这个问题呢?
是不是每次开机都要调,或者有没有更好的办法?
作者: hanzixing 发布时间: 2004-04-20
代码摘自gentoo论坛,仅在我的机器上测试过。
首先,创建一个新的名为wrapper.c的文件,内容如下:
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
const char *app = "/usr/X11R6/bin/XFree86"; // the actual binary
const int root = 0; // root's uid
const int n = -10; // desired nice priority valid range -20..20.
int main(int argc, char **argv)
{
seteuid(root); // The X server must be started as root under any Linux
nice(n); // Makes it nice
execv(app, argv); // This is it!
/* Should never see this unless *app points to invalid binary */
fprintf(stderr, "Failed to execv %s with nice value of %d\n", app, n);
exit(1);
}
# gcc wrapper.c -o XFree86.wrapper
将刚才写的那个wrapper替代原来的X:
# cp XFree86.wrapper /usr/X11R6/bin
# cd /usr/X11R6/bin
# rm X
# chown root XFree86.wrapper
# chmod u+s XFree86.wrapper
# ln -s XFree86.wrapper X
作者: reinf 发布时间: 2004-04-20
作者: hanzixing 发布时间: 2004-04-20
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28