Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Limit the quantity of process created in parallel in the Task Scheduler 2008

Posted on 2010-11-08
11
Medium Priority
?
662 Views
Last Modified: 2013-11-16
Hi all!
Problem: My code create too much process.
Question: How to limit the quantity on process created in parallel.

Background: for backup zip7 and the Task Scheduler of window 2008 is used. A task performs (Action) zip of all the files in a directory. The result is 1 zip for each file (I don't want 1 zip with all the files).

the action (in the Task Scheduler) is: cmd
the arguments are:
/C FOR %i IN (*.nsf)  DO  "C:\Program Files\7-Zip\7z.exe"  -bd u "\\Server_name\Backup\%~ni.zip" "%~fi">>c:\resuZip.log

Don't care too much if you're not familiar with the syntax, it works, this is not the problem.
The problem is that FOR creates for *each* file a process (like a fork in C) and the server nearly collapses.
How could I limit the creation of parallel tasks ?

Thanks in advance.
Emmanuel
0
Comment
Question by:Emmanuel Gleizer
  • 6
  • 5
11 Comments
 
LVL 7

Assisted Solution

by:TechnoChat
TechnoChat earned 1000 total points
ID: 34091588
I don't have any Idea about parallel task, but using "start" command from command line you can set the process priority.

Eg.
start /HIGH application.exe

Diff. switch

LOW         Start application in the IDLE priority class
NORMAL      Start application in the NORMAL priority class
HIGH        Start application in the HIGH priority class
REALTIME    Start application in the REALTIME priority class
ABOVENORMAL Start application in the ABOVENORMAL priority class
BELOWNORMAL Start application in the BELOWNORMAL priority class

Thanks
Saugata
0
 
LVL 5

Author Comment

by:Emmanuel Gleizer
ID: 34093979
Well this is an idea but, I'm afraid it will not help in my case. With this option It would still *create* ~ 250 process that do ZIP: which is intensive for my server.
It would help if the process *creation* itself is done when the system is idle (which would occures when the first ZIP has ended) it would be almost sequential.
I could even accept a solution in which only ONE process is created that will care of the file one after the second.
 
0
 
LVL 7

Expert Comment

by:TechnoChat
ID: 34099146
This command line tool might help you out..

http://www.activeplus.com/Products/RunFirst

Thanks
Saugata
0
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

 
LVL 5

Author Comment

by:Emmanuel Gleizer
ID: 34100966
This solution will put (as I understand it) all the process on ONE core... well if put them in a sequence it could be a solution. But if it put them in parallel on one core well the process will nearly never end...
I'll try
0
 
LVL 7

Expert Comment

by:TechnoChat
ID: 34101500
Just give it a try, Hope for the best..

Thanks
Saugata
0
 
LVL 5

Author Comment

by:Emmanuel Gleizer
ID: 34111283
I found a better solution (I'm testing it) google for "wait for command to complete \before continuing batch file"
start /wait cmd /c .....
would post if it works
0
 
LVL 5

Author Comment

by:Emmanuel Gleizer
ID: 34111323
BTW I tried to use the Runfirst... but didn't find the syntax for "Option starup parameters"  
0
 
LVL 7

Expert Comment

by:TechnoChat
ID: 34118165
This runfirst tool only works with the executable without any Option starup parameters. But if you are on vista/w7/2008, then you can user start command for the same.

EG.
start /AFFINITY 1 notepad.exe

Thanks
Saugata
0
 
LVL 5

Accepted Solution

by:
Emmanuel Gleizer earned 0 total points
ID: 34224483
Well I must admit that I ask a question that doesn't reflect my problem.

First sorry I ran my code and discovered that it DOESN'T create many tasks as I thaught. It's sequential: each loop is one after the second.
The reason why (I think but I'm not sure) it slow down between loops is that the whole process is is low priority (since it's scheduled MS decide that IO has low priority)
Thus I fact I have to change my code to CREATE the tasks without waiting the end of the preceding loop.
BUT doing this is dangerous and I would get too many process.

I don't know what to do with this question!
I didn't get a real solution to my problem (I'm fare responsible for this since I didn't really described it)
please post your suggestions. my default would be to close it by accept my solution (wich is NOT) and reward you 2.
thanks for the help!
0
 
LVL 7

Expert Comment

by:TechnoChat
ID: 34225793
Most important thing is to solve the problem, no mater it solve by your self or by taking help from some one else. We all here to help each other, and share our knowledge to solve the problem faster, caz we can't live with our problems :)
And thanks for your comments..

Thanks
Saugata
0
 
LVL 5

Author Closing Comment

by:Emmanuel Gleizer
ID: 34272715
The main problem is that I didn't identify what the problem was: In fact NO parallel collapsing server resources… Thanks to TechnoChat for his different ideas
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
After seeing many questions for JRNL_WRAP_ERROR for replication failure, I thought it would be useful to write this article.
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question