I have used the approximate code below many times, and since you can control 
the priority of the process, it may work for you. Of course, the Perl program 
that you launch using the scheduler would have to use the technique below to 
launch the 'real' Perl program.

Use Win32;
Use Win32::Process;

My $process = 0;  # This is where the process PID goes after launching.
My $inheritHandles = 0;
My $defaultDirectory = "c:\temp";
My $machineName = "SomeComputer";

Win32::Process::Create($process, “\\\\$machineName\\c$\\windows\\notepad.exe”, 
"notepad <arguments>", $inheritHandles, DETACHED_PROCESS || 
REALTIME_PRIORITY_CLASS, $defaultDirectory);

Note the bizarre syntax; arg 2 must be a fully qualified filespec to the 
program that you want to launch including the program's extension. Arg 3 has 
the program name again along with any arguments that you might want to pass.

Google the Win32::Process module for the priority classes as well as other 
flags, etc.

Barry Brevik

---------------------------------------------------------------------
From: perl-win32-users-boun...@listserv.activestate.com 
[mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of 
Gianvittorio Negri
Sent: Wednesday, June 20, 2012 2:05 PM
To: Perl-Win32-Users@listserv.activestate.com
Subject: New W2K8 I/O priority

 
Hi Perl guru !
 
I have a question regarding an issue that is troubling my applications. Hope 
someone could give me some advice.
 
In the new W2K8 server Microsoft introduced a new “object” in the process 
management, the I/O priority.
Docs about that are very confused and not at all useful but a thing is 
absolutely clear. If you schedule something using Task Scheduler the process 
will be spawned at Low I/O priority.
ATTENTION, I’m pointing out the I/O priority not the process priority (CPU) 
that you could set in a tricky way. I/O priority could not be modified from 
standard instrumentation.
Docs state that I/O priority is automatically adjusted by the process and it’s 
a consequence of the CPU priority, but that is not what I’ve experimented. 
 
After a lot of googling I’ve discovered that ProcessHacker.exe  (a Task manager 
substitute, very similar to procexp) have the ability to change this parameter 
but only interacting with GUI.
 
That’s very bad because my application normally process huge amount of data, so 
after migrating to W2K3 to W2K8 I’ve found myself with a dramatic loss of 
performance in my applications.
The first and simple solution is to avoid Task Scheduler and use other 
scheduling SW, but is not a very simple task because I have a lot of servers 
and my boss doesn’t want to buy me a new scheduler.
 
Anyway :
Someone could point me out a way to programmatically change the I/O priority of 
a  perl process ?
For example a process that after starting it look at his own I/O priority and 
try to adjust it, or an external process (service),looking after some processes 
and monitoring their  I/O priority, trying to 
adjust it 
 
In any case I need to know if and how to change the I/O priority  of an already 
started process programmatically.
 
Any ideas ?
Many thanks’ in advance for every hints.
 
Gianvittorio
 
 
 
--------------------------------------------------------------
Gianvittorio Negri
Sales Support 
Tel. +39 02 83134.1 ■ Fax +39 02 58113640 ■ Mobile +39 3357493424 
■ g.ne...@ita.sas.com
Skype: Gianvittorio.Negri
SAS Institute srl ■ Via Darwin, 20/22 ■ 20143, Milano
www.sas.com/italy
SAS® ... THE POWER TO KNOW®
--------------------------------------------------------------
 
Before printing, think about the Environment
 
Le informazioni contenute  in  questo  e-mail,  nonché negli eventuali allegati 
allo stesso, sono  assolutamente
riservate  e confidenziali e sono da considerarsi  per uso esclusivo della 
persona o della Società  destinatarie
del messaggio. E' vietato l'uso, la diffusione, distribuzione o riproduzione da 
parte di ogni altra persona.
Se questa comunicazione è stata ricevuta per errore si prega di contattare 
immediatamente via e-mail il mittente, 
nonché di distruggere il messaggio e gli eventuali allegati. 
 
This message, and any attachments, contains information that may be 
confidential and privileged. Unless you are 
the addressee (or authorized to receive for the addressee), you may not use, 
copy, print or disclose to anyone 
the message or any information contained in the message. If you have received 
this e-mail in error, please advise 
the sender by reply and delete the message and any attachments.
 
 
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to