لطفا وارد شوید یا ثبت‌نام کنید تا به انجمن‌ها دسترسی کامل داشته باشید.



 
امتياز موضوع :
  • 0 رأي - معدل امتيازات : 0
  • 1
  • 2
  • 3
  • 4
  • 5
cpu time
2009-04-09, 09:07 AM,
ارسال : #1
cpu time
سلام
چطور میشه 20% سی پی یو رو به یک فرایند اختصاص داد؟
نقل قول این ارسال در یک پاسخ
2009-04-09, 07:37 PM,
ارسال : #2
پاسخ: cpu time
<!-- m --><a class="postlink" href="http://cpulimit.sourceforge.net/">http://cpulimit.sourceforge.net/</a><!-- m -->
کد :
Examples of use
Limit the process 'bigloop' by executable name to 40% CPU:

    cpulimit --exe bigloop --limit 40
    cpulimit --exe /usr/local/bin/bigloop --limit 40

Limit a process by PID to 55% CPU:

    cpulimit --pid 2960 --limit 55

Launch a process by command line and limit it to 40% (in development version only!):

    cpulimit --limit 40 /etc/rc.d/rc.boinc start

user_parsix
نقل قول این ارسال در یک پاسخ
2009-04-09, 08:31 PM,
ارسال : #3
پاسخ: cpu time
aya raveshe digei ham hast age hast komak konid
نقل قول این ارسال در یک پاسخ
2009-04-10, 05:04 PM,
ارسال : #4
پاسخ: cpu time
کد :
Setting process priority

In Linux, processes have a priority number between -20 and 19. The value of -20 is the highest, and 19 is the lowest priority. Process priority can be set with the nice(1) command and changed using the renice(8) command. To set a process to have the highest priority find the process ID number using the ps command. If your process name is "myprog" type:

ps -ax |grep myprog

You should get something like:

756 tty1 S 0:00 myprog

The first number on the line is your process ID. Enter the command:

renice -20 756

This will set your process (PID=756) to priority of -20. Modify the process ID number for that of your program running on your system. You can use the nice command to determine the default priority of new processes by typing "nice" on the command line. If you want to start a process with a specific priority, use the nice(1) command when you invoke the process.


<!-- m --><a class="postlink" href="http://linux.die.net/man/3/setpriority">http://linux.die.net/man/3/setpriority</a><!-- m -->

کد :
#include <sys/resource.h>

int getpriority(int which, id_t who);
int setpriority(int which, id_t who, int value);


user_parsix
نقل قول این ارسال در یک پاسخ


رفتن به انجمن :


کاربران در حال مشاهده موضوع : 2 مهمان