|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Apr 2000
Messaggi: 382
|
Comando *NIX per poter settare la percentuale di processore per un processo
Salve a tutti,
dopo una ricerca in internet e tra il man di freeBSD alla voce nice, renice ed affini, non sono stato in grado di trovare il comando che mi interessa. In pratica vorrei assegnare ad un determinato processo al massimo XX percentuale di processore. Come posso fare? In attesa di un vostro aiuto, un saluto. Simone Ultima modifica di SimonJ : 23-03-2007 alle 00:21. |
|
|
|
|
|
#2 |
|
Member
Iscritto dal: Jul 2002
Città: Treviso
Messaggi: 234
|
Cerchi "renice" ?
Dai un'occhiata quì http://www.opengroup.org/onlinepubs/...cu/renice.html . Se guardi anche il man del comando noti che impostando un valore basso aumenta la priorità del processo. I valori dovrebbero essere compresi tra -20 e (+) 20 ; ma da come leggo su una guida cartacea solo l'amministratore (root) può impostare valori i negativi. Ciao. Edit: Ho toppato
__________________
Ultima modifica di jimmazzo : 24-03-2007 alle 16:37. |
|
|
|
|
|
#3 | |
|
Senior Member
Iscritto dal: Dec 2004
Messaggi: 3573
|
Quote:
__________________
Debian amd64 | Gentoo amd64 | AMD Athlon64 3800+ X2@2701Mhz vcore 1.49V | Placing an unpatched Windows computer directly onto the Internet in the hope that it downloads the patches faster than it gets exploited are odds that you wouldn't bet on in Vegas | e-mail+jabber: darkbasic|a.t|linuxsystems|d.o.t|it | www.linuxsystems.it |
|
|
|
|
|
|
#4 | |
|
Member
Iscritto dal: Jul 2002
Città: Treviso
Messaggi: 234
|
Quote:
La usi da molto questa patch? Il sistema oltre ad essere performante è anche stabile? Grazie della dritta Darkbasic, credo che la proverò
__________________
|
|
|
|
|
|
|
#5 |
|
Senior Member
Iscritto dal: Dec 2004
Messaggi: 3573
|
No, soltanto da pochi mesi.
Stabilissimo, inoltre con schedtool e SCHED_IDLEPRIO posso ricompilare il kernel e giocare a quake4 senza cali di framerate, oppure con SCHED_ISO posso settare una priorità molto alta ad amarok (senza bisogno dei privilegi di root) per continuare a sentire la musica senza il benchè minimo salto dell'audio mentre codifico un xvid etc.. etc.. Ti consiglio di provarla, non te ne pentirari
__________________
Debian amd64 | Gentoo amd64 | AMD Athlon64 3800+ X2@2701Mhz vcore 1.49V | Placing an unpatched Windows computer directly onto the Internet in the hope that it downloads the patches faster than it gets exploited are odds that you wouldn't bet on in Vegas | e-mail+jabber: darkbasic|a.t|linuxsystems|d.o.t|it | www.linuxsystems.it |
|
|
|
|
|
#6 |
|
Senior Member
Iscritto dal: Apr 2000
Messaggi: 382
|
Vi ringrazio per i suggerimenti e per i post.
Mi interesserebbe tale comando per poter realizzare la seguente cosa: studiando con un portatile in biblioteca avrei la necessità di eseguire dei processi limitando il "consumo" di cpu per evitare che la temperatura aumenti con una conseguente aumento della velocità delle ventole, evitando così disturbo agli altri utenti. Simone |
|
|
|
|
|
#7 | |
|
Senior Member
Iscritto dal: Apr 2000
Città: Roma
Messaggi: 15625
|
Quote:
Una possibile alternativa - molto hackish - è eseguire uno script che arresta e riavvia il processo ciclicamente: Codice:
#!/bin/bash
PROCNAME="nome del tuo processo"
PID=`pidof $PROCNAME`
if [ "$PID" == "" ]; then
echo Processo $PROCNAME non in esecuzione
exit
fi
while kill -0 $PID; do
sleep 1
kill -STOP $PID
sleep 1
kill -CONT $PID
done
echo Processo $PROCNAME terminato.
Con sleep puoi solo impostare una granularità nell'ordine del secondo, accettabile solo per alcuni processi eseguiti in background. Per processi interattivi, devi sostituire la sleep con qualcosa in grado di "dormire" con granularità inferiori; se hai una minima conoscenza di c puoi farti ad esempio un programma "msleep".
__________________
0: or %edi, %ecx; adc %eax, (%edx); popf; je 0b-22; pop %ebx; fadds 0x56(%ecx); lds 0x56(%ebx), %esp; mov %al, %al andeqs pc, r1, #147456; blpl 0xff8dd280; ldrgtb r4, [r6, #-472]; addgt r5, r8, r3, ror #12 |
|
|
|
|
|
|
#8 |
|
Senior Member
Iscritto dal: Feb 2004
Messaggi: 1209
|
che mi dite rigurdo cpulimit? Lo usato poco quindi nn ne conosco la stabilita' . Lo usavo x giocare a scacchi perche' il gioco usava troppo cpu e mi partiva il ventolone a manetta e in ufficio nn era il massimo
__________________
...Ordunque... |
|
|
|
|
|
#9 | |
|
Senior Member
Iscritto dal: Dec 2004
Messaggi: 3573
|
Quote:
Codice:
#!/bin/sh
> ~/ALARM
soglia=58
quit="false"
while [ $quit != "true" ]; do
sleep 10
temp=`cat /proc/acpi/thermal_zone/THRM/temperature | awk '{ print $2 }'`
if [ $temp -ge $soglia ]; then
processo=`ps aux | sort -rk 3 | sed -n -e 2p`
pid=`echo $processo | awk '{ print $2 }'`
echo $processo >> ~/ALARM
echo -e "Date: "`date`" Temp: "$temp" Uptime: "`uptime | awk '{ print $3 }'` >> ~/ALARM; echo -e "\a"
kill -19 $pid
sleep 5
temp=`cat /proc/acpi/thermal_zone/THRM/temperature | awk '{ print $2 }'`
if [ $temp -ge $soglia ]; then
quit="true"
echo "ATTENZIONE: la temperatura (ora pari a "$temp" °C) non accenna a diminuire. Shutdown in corso..." >> ~/ALARM
ps aux >> ~/ALARM
echo -e "\n\n\n" >> ~/ALARM
else
echo -e "La temperatura si è stabilizzata a "$temp" °C. Il processo verrà messo nuovamente in esecuzione...\n\n" >> ~/ALARM
kill -18 $pid
fi
fi
done
shutdown -h now
__________________
Debian amd64 | Gentoo amd64 | AMD Athlon64 3800+ X2@2701Mhz vcore 1.49V | Placing an unpatched Windows computer directly onto the Internet in the hope that it downloads the patches faster than it gets exploited are odds that you wouldn't bet on in Vegas | e-mail+jabber: darkbasic|a.t|linuxsystems|d.o.t|it | www.linuxsystems.it Ultima modifica di darkbasic : 26-03-2007 alle 17:45. |
|
|
|
|
|
|
#10 |
|
Senior Member
Iscritto dal: Apr 2000
Città: Roma
Messaggi: 15625
|
Non so se è compatibile con freeBSD...
__________________
0: or %edi, %ecx; adc %eax, (%edx); popf; je 0b-22; pop %ebx; fadds 0x56(%ecx); lds 0x56(%ebx), %esp; mov %al, %al andeqs pc, r1, #147456; blpl 0xff8dd280; ldrgtb r4, [r6, #-472]; addgt r5, r8, r3, ror #12 |
|
|
|
|
|
#11 | |
|
Senior Member
Iscritto dal: Dec 2005
Città: Istanbul
Messaggi: 1817
|
Quote:
Se e' un problema di ventole, potresti aggirare il problema forzando la cpu ad una frequenza bassa. Per prima cosa verifica le frequenze supportate dal tuo processore: Codice:
sysctl dev.cpu.0.freq_levels Codice:
dev.cpu.0.freq_levels: 1743/-1 1525/-1 1307/-1 1089/-1 871/-1 653/-1 435/-1 217/-1 Codice:
sysctl dev.cpu.0.freq=435
__________________
One of the conclusions that we reached was that the "object" need not be a primitive notion in a programming language; one can build objects and their behaviour from little more than assignable value cells and good old lambda expressions. —Guy Steele |
|
|
|
|
|
|
#12 | |
|
Bannato
Iscritto dal: Jun 2006
Città: Roma
Messaggi: 1993
|
Quote:
in che modo setti la priorità di un processo con SCHED_ISO ? mi potresti fare un esempio grazie spesso con amarok salta il suono e ora sono curioso di provare questo pachset per non avere più di questi problemi |
|
|
|
|
|
|
#13 |
|
Senior Member
Iscritto dal: Dec 2004
Messaggi: 3573
|
Codice:
schedtool -I -e applicazione Codice:
schedtool -D -e applicazione
__________________
Debian amd64 | Gentoo amd64 | AMD Athlon64 3800+ X2@2701Mhz vcore 1.49V | Placing an unpatched Windows computer directly onto the Internet in the hope that it downloads the patches faster than it gets exploited are odds that you wouldn't bet on in Vegas | e-mail+jabber: darkbasic|a.t|linuxsystems|d.o.t|it | www.linuxsystems.it |
|
|
|
|
|
#14 |
|
Bannato
Iscritto dal: Jun 2006
Città: Roma
Messaggi: 1993
|
|
|
|
|
|
|
#15 |
|
Senior Member
Iscritto dal: Dec 2004
Messaggi: 3573
|
sì
__________________
Debian amd64 | Gentoo amd64 | AMD Athlon64 3800+ X2@2701Mhz vcore 1.49V | Placing an unpatched Windows computer directly onto the Internet in the hope that it downloads the patches faster than it gets exploited are odds that you wouldn't bet on in Vegas | e-mail+jabber: darkbasic|a.t|linuxsystems|d.o.t|it | www.linuxsystems.it |
|
|
|
|
|
#16 |
|
Senior Member
Iscritto dal: Apr 2000
Messaggi: 382
|
Mi complimento con voi per le vostre conoscenze.
Per caso su Mac OSX è possibile? Oppure sono presenti sempre queste limitazioni? |
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 05:11.




















