topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Sunday December 15, 2024, 12:47 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: IDEA: suspend/resume multiple processes within same directory only (e.g. Chrome)  (Read 6577 times)

me_7834539

  • Participant
  • Joined in 2010
  • *
  • default avatar
  • Posts: 33
    • View Profile
    • Donate to Member
(you may want to read my second post in this thread first)

Hello,

with browsers like Chrome and the new Opera browser, it has become a standard that dozens of chrome.exe/opera.exe processes are running on a system. With multiple installations, these processes do not necessarily belong to the same browser installation.

E.g. running processes:
C:\chrome 1\chrome.exe
C:\chrome 1\chrome.exe
C:\chrome 1\chrome.exe
C:\chrome 2\chrome.exe
C:\chrome 2\chrome.exe
C:\chrome 2\chrome.exe
C:\chrome 2\chrome.exe
C:\chrome 2\chrome.exe

To save battery, reduce heat and noise, and get more power out of the computer, it has proven to be very handy to suspend processes of programs (especially browsers with lots of tabs) that are not always in use but should be resumable within a millisecond. The typical user, both novice and professional, will leave their multi-tabbed browser running in the background.

The suggested program should work like this:

Either by launching/clicking a .lnk/... file with a command, and/or by means of a shortcut like e.g. Win-N, the specified processes *within the specified directory only* are all suspended/resumed. There could/should also be a toggle command suspend/resume as well as dedicated suspend/resume commands.

There are various kinds of programs out there, such as yawffer, pssuspend, nircmd with the the suspend command, BES Battle Encoder, and Process Lasso, that all feature various aspects of described program, but none is able to do what I described here. Put together, all the programs however prove it is feasible.

* yawffer cannot suspend by path, but can toggle by keystroke
* BES cannot suspend by path, but can toggle and even throttle CPU usage
* nircmd cannot suspend by path, but is lightweight command line
* pssuspend cannot suspend by path, but is lightweight command line
* Process Lasso can suspend by path, but only manually instance-by-instance (which is extremely (!) tedious), and also is heavy-weight/very complex. But PL proves the concept works.

(Also, I think some of these programs suspend *all* exes with the same name, and some just one, randomly.)

So, a common should suspend/resume all chrome.exe's running in c:\chrome 1\, but not those in chrome 2.

I think using a catchy name, the program might get some attention, e.g. hinting at Chrome (even though I personally use Opera), one could name it ChromeSuspender ... ;)

« Last Edit: October 10, 2013, 11:56 AM by me_7834539 »

me_7834539

  • Participant
  • Joined in 2010
  • *
  • default avatar
  • Posts: 33
    • View Profile
    • Donate to Member
EDIT: I just realized that all-in-all, pssuspend, even though not toggling, should suffice for most users (it suspends *all* exes), and situations with multiple browser installations with identical exes (but naturally differing path names) are an exception.

I'll still leave this suggestion here because I think it points to an important problem and details what is needed to get an one-program-solves-every-situation solution. Perhaps someone finds this useful.

Sorry for the confusion...

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Sledgehammer 0.1.0.3

What it does:
Suspends any running processes in the directory it's run from, (except itself ;) ).

Installation:
Put it in the directory of the executables you want to suspend.

How to run:
Turn the volume up and double-click it or run it from a CLI.

Run it once to suspend programs, run it again to resume programs.  It creates a .ini file, (same directory as the executable), that contains the PIDs of suspended programs - it uses this to resume them the next time it's run and then deletes it.

If the program you want to suspend has a lot of child processes, it will only suspend the parent process.  An example of this is Chrome, although I tested it using Comodo Dragon.

You can rename it to anything you like, it doesn't care.

NOTES:
  • Don't delete the .ini file after you've suspended programs.
  • Do delete the .ini file if you've crashed your computer or otherwise rebooted without resuming the programs.
  • It doesn't check whether the programs really got suspended/resumed but I didn't have any problems in my limited testing.  See here.

I'll look at doing something about this, probably by using RunOnce in the registry to delete the .ini on startup - but that involves a bit of fiddling, so it won't happen quickly, (plus I'm inherently lazy).

Oh, in case you're some kind of philistine and don't like Peter Gabriel ;D just add an argument when you run it, eg. Sledgehammer.exe 6

All the source is in the archive, feel free to turn it into something truly spectacular ... or not.

DISCLAIMER: It worked here, that doesn't automatically mean it'll work for you.

OBLIGATORY WARNING: Suspending processes that you haven't written can be BAD.  It may crash your computer.  You have been warned.  You use this program at your own risk.  Have I made myself clear?

Changes:
v0.1.0.3
Changed: Handles multiple instance processes, (eg. putty.exe run more than once).
« Last Edit: October 20, 2013, 05:54 AM by 4wd »

me_7834539

  • Participant
  • Joined in 2010
  • *
  • default avatar
  • Posts: 33
    • View Profile
    • Donate to Member
hello, thank you for looking into this. yes, to have a real advantage it will have to be able to handle multiple processes. but it's really a bit niche, for people with multiple installations of chrome/opera/ff.

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
hello, thank you for looking into this. yes, to have a real advantage it will have to be able to handle multiple processes. but it's really a bit niche, for people with multiple installations of chrome/opera/ff.

It does that now - I meant in the case of where you had one program within a single directory that allows itself to be run multiple times, (instead of just bringing an already running instance to the foreground), eg. putty.exe
« Last Edit: October 20, 2013, 05:43 AM by 4wd »

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Small update to handle multiple instances.