Showing posts with label resources. Show all posts
Showing posts with label resources. Show all posts

Thursday, March 1, 2012

Windows 7: Assigning Process Priorities to Prevent Slowdowns

I had some programs that slowed down my system to the point that I could barely get any work done.  Examples included Beyond Compare (sometimes) and GoodSync (often).  These programs were not usually urgent; I would have been happy with letting them run at a slower pace, so that I could continue to use the machine in a more or less normal way.  This post describes my search for tools that would give me some control over the demands that those programs would place on my system.

The existing tool for this purpose, Windows Task Manager (available via Ctrl-Alt-Del > Start Task Manager, or via Start > Run > taskmgr.exe), would give me information about various processes.  Many other programs -- including various gadgets and other sorts of monitoring tools -- offered that.  A search led to Process Explorer and System Explorer Portable, which CNET and Softpedia portrayed as popular, highly rated replacements for Task Manager.  For basic system resource information, I was presently using (and liked) Moo0 SystemMonitor, and wasn't too interested in adding more of that right now.

What I was more interested in was actual control of processes.  Evidently it was possible to adjust process priorities manually in Task Manager, and perhaps in Process Explorer and/or System Explorer Portable; but it seemed that this would work only as long as processes were running. In other words, it seemed that the Task Manager manual setting would have to be recreated every time a program was shut down and restarted.

Further investigation led to utilities that would apparently allow me not only to adjust priorities, but to have my adjustments be remembered.  Programs I encountered at this point included Prio, Process Lasso, IO Priority, and Process Hacker. Softpedia searches indicated that Project Lasso was commercial, and had nothing for IO Priority.  I had seen a few very positive comments about Prio, so perhaps it was up and coming; but it was not a major player at either Softpedia or CNET. Those two sources also disagreed as to whether I was getting a free or trial version.  On both CNET and Softpedia, Process Hacker seemed to be the leading tool for process adjustment.

The CNET download gave me both .bin and .exe versions of Process Hacker.  I was more interested in a portable version, so I unzipped the .bin and drilled down to the appropriate .exe and ran that.  It gave me a colorful, hierarchical indication of running processes.

I decided to put it to a test.  I ran GoodSync and did a Ctrl-F in Process Hacker.  That gave me a separate list of files, processes, and threads that apparently involved GoodSync.  But where was GoodSync within the pretty list of colored processes, there in the main Process Hacker window?  I clicked on the Description heading, and that gave me an alphabetical list.  Ah, there it was.  GoodSync was currently using up to 3%, no, 5%, no, make that 10% of CPU resources.  The number kept rising.  In the amount of time it took me to write these words, it was up to 25%.  I had a quad core processor; maybe 25% was going to be the limit.  I clicked to sort on the CPU heading.  At first, GoodSync was solidly in second place as the greatest consumer of CPU resources, behind System Idle Processes.  It seemed that the latter just meant that I had a lot of idle capacity.  That seemed to be the message from Moo0 too:  the CPU was not very busy.

Process Hacker also said that GoodSync was using a steady 468MB in Private Bytes.  A StackOverflow post said that private bytes was "the current size, in bytes, of memory that this process has allocated that cannot be shared with other processes."  Another post in that thread clarified:  this value included pagefile (i.e., virtual) memory.  So it didn't necessarily mean that GoodSync was using almost a half-gig of what the RAM chips in my computer could offer.  The thread seemed to say that the most important value of that number was in whether it was growing, which would indicate a memory leak -- which apparently meant that the program in question kept asking for more and more memory, without reusing or returning what it had already requested and was no longer using.  This didn't seem to be a problem:  the Private Bytes number for GoodSync had not yet risen beyond about 480MB.

I clicked on the I/O Total Rate heading in Process Hacker.  It put GoodSync by far at the top of the list, using 22 mB/s (with variations), when the next most disk-intensive programs were generally asking for less than 20 kB/s.  This concurred with Moo0 -- it was tending to show GoodSync as the chief loader of the hard drive -- but this was giving me much more information about how GoodSync compared to the other programs running.  (I was working in the Processes tab in Process Hacker.  There were also Services and Network tabs.)  I also noticed, by this point, that the Private Bytes number did seem to be creeping upwards, now reaching 520MB.  I wondered where it would be in an hour or two.

So now, could I put the brakes on GoodSync?  I right-clicked on it, there in Process Hacker, and saw at least three relevant options:  Terminate, Suspend, and Priority.  Of these, the only one that would put on the brakes without completely ending progress was Priority.  That one was familiar; I had seen the same options elsewhere, probably in Task Manager.  The options were Real Time, High, Above Normal, Normal, Below Normal, and Idle.  Normal was the default.  I had seen somewhere that Normal was the default for everything in Windows.

So, sad to say, this thing wasn't going to give me fine-tuned tweaking options, like "40% of Normal" or "Run only when computer is idle" or "Try to finish this process by tomorrow morning."  I realized that not all of these possibilities might be feasible in Windows 7.  And, wow, what about RAM?  GoodSync was up to 905MB of Private Bytes now.  For that matter, Internet Explorer (where I was writing this) was at 870MB (with eight tabs open, and after 50 hours of uptime, according to Moo0).  I was using RizoneSoft MemoryBooster to keep RAM available, but it didn't have options to put restrictions on individual programs, and hitting its Optimize Memory button at this point didn't have any effect upon the Private Bytes reported by Process Hacker for GoodSync and IE.  I guessed that the situation was that memory leaks couldn't be squeezed much -- that you might basically have a choice between letting the program run or shutting it down so that memory could clear.

I dimly recalled that GoodSync might have its own internal option to throttle itself.  A look at this point reminded me:  its Auto > General tab would allow a specific sync job to slow down file copying if the average download speed exceeded a certain value.  I wasn't quite sure how that would work, but I didn't think the problem was with the speed of downloads (i.e., how quickly they would travel across the ethernet cable between computers).  What seemed most demanding about GoodSync was its use of system resources to do its calculations of what needed to be copied.  In other words, I didn't care whether it was slowing me down because of calculations, or downloads, or for some other reason; I just cared that, overall, it was slowing me down.  And at this point I was not seeing anything specifically geared toward that.  And even if I had, I'd still have a similar concern for some other programs.

Further exploration in Process Hacker indicated that I had overlooked another possible location of options.  I right-clicked on the Process Hacker line for GoodSync and chose Miscellanous.  There, I saw at least three intriguing options:  I/O Priority, Page Priority, and Reduce Working Set.  I decided to see what would happen if I changed a bunch of settings to their minimum values.  So I changed GoodSync right-click Priority from Normal to Below Normal.  I didn't see any difference, there, between Below Normal and Real Time (the highest setting).  On, then, to Miscellaneous > I/O Priority.  It was set to Normal; I set it to Very Low.  Still no obvious difference in the demands on CPU, I/O, or Private Bytes shown in Process Hacker.  Next, Miscellaneous > Page Priority.  It was at 5 (the highest possible value); I set it to 1.  Finally, Miscellaneous > Reduce Working Set.  It was just an on-or-off option.  I turned it on.  No visible difference in the numbers.  I decided to turn off Reduce Working Set, putting it back to its default setting, since I didn't know what it was.  Seems I was wrong:  it wasn't a checked, toggling option; evidently I was just reducing the working set further (whatever that meant) every time I hit it.

Well, by this point, as a correction to my impression from a moment earlier, it seemed that something had changed after all.  (It helped to see this when I changed Process Handler > View > Update Interval to a slower setting.)  Maybe this change was due to my adjustments to the settings, or maybe GoodSync had finished something it was working on, but for whatever reason it had dropped from an I/O Total Rate of 20+ mB/s to more like 3 mB/s.  I suspected that I had now given myself the equivalent of an option to "Run only when computer is idle."  With all these priorities set so low, hopefully the computer would suppress GoodSync when I had other things to do.  The risk now was, no doubt, that GoodSync would never finish its tasks.  I would have to just let it run a while and see how that went.

After closing Process Hacker and letting a few days pass (along with a reboot or two), I returned to see what was happening with GoodSync.  The system had now been up for a little over two days, and at this moment the spinning system tray icon showed that GoodSync was actively at work.  PH showed GoodSync as having 1.14GB in Private Bytes allocated to it.  Its I/O Total Rate was not exceeding about 1.5 mB/s.  It looked like my settings had persisted.  I was not actively using that machine at that point, so I couldn't say whether there would still be noticeable slowdowns.  But it seemed unlikely.  Moo0 was reporting that the CPU, RAM, and hard drives were almost never fully burdened.  And yet GoodSync did seem to be getting its tasks done.

I was not quite sure whether Process Hacker right-click settings all applied only to the specific process that I had clicked on.  Some appeared to apply to all, or at least multiple, processes.  There was more to learn.  But at least it did appear that Process Hacker had enabled me to slow down a program that was grabbing too much of system resources, without noticeably impairing that program's functioning.

Monday, January 21, 2008

China and Australia: Two Scenarios

You have a large, largely empty, resource-rich, predominantly Anglo land down under. And you have two interested parties who would like to get their hands on it. In one corner, we have the defending champion, the U.S., whose primary claim may be cultural or racial. In the other corner, we have the challenger, China, whose primary claims may be that it wants and needs the resources and the space, it is willing to pay for them, it is a next-door neighbor (relatively speaking), and (in the future) that it is militarily better positioned to take it. In one scenario, China flexes its muscles in ways that worry people. Last year's bit about knocking down a satellite -- a direct threat to the U.S. -- is an example. Enough examples like that, and it won't just be an Anglo-Aussie coalition; it'll be Russo-Anglo-Aussie. (And let's not forget the anglophone Indians.) Then China really will have to fight for Australia, and it may be hard-pressed to succeed. In another scenario, China proceeds gently. Continue putting highly educated Chinese people in various places throughout the anglophone world; continue making appreciated purchases of resources (and also of companies) in the U.S. and Australia; continue letting Chinese people be welcomed as friends in Australia. And meanwhile, continue bringing China into the modern world, with enhanced rights for its people, growing awareness of rights violations, and other quietly woven threads of restraint around its oligarchs. Then Australia is not alarmed, the U.S. is not shocked into confrontation, and the ties between the lands of the koala and the panda grow naturally. In a generation, it will seem odd that the Australians would ever have contemplated an essentially anti-China economic (never mind military) coalition with the U.S. Can the second scenario be the primary one? I'd put the odds at somewhat less than 50%.

Thursday, October 18, 2007

Speculation on Home Prices

The real estate news is bad. Some are now saying it will be 2009, at the earliest, before property values recover. Apparently the tax base for cities is eroding because of the decline in home values and the rise in foreclosures. An ordinary house is an expensive thing. Not just in terms of what it costs, but also in terms of what we take for granted about it. In that regard, four basics are lately coming into question: financing, transportation, public services, and water. On the financial front, house prices have risen because we have had money, and have been willing to spend that money on our homes. We have had money, in the earlier years, because America was a rich country and getting richer and, in the later years, because foreign investors could make money by lending their money here. That second tenet is now failing because the value of the dollar has been falling. They say that a foreign investor -- an Asian investor, say -- who invested in the stock market in 2000 has lost money, despite the Dow's rise, because the dollars in which stocks are priced have lost so much value. The dollar fall has not stopped; indeed, it may have a ways to go. Thus, foreigners are increasingly looking to invest elsewhere. Transportation becomes an issue when people cannot afford to get to the place in question. As long as the money is there, the government can keep building highways, people can keep buying cars, and cars can keep burning gas. This piece of the puzzle is still in place. But gas is becoming more expensive as it becomes rarer for us (you don't find much oil in the Quaker State anymore). Hopefully the experts will develop vehicles that run on alternate fuels -- hopefully other than biofuels, which entail the questionable water- and (for some countries) starvation-intensive prospect of, basically, burning food. But it still costs money to build highways, and rising numbers of people still have to jostle for space on increasingly congested roads. In the long term, we would have been further ahead if we invested in mass transit. But the point here is that there are limits to urban sprawl. One, long known, is that people won't drive five hours each way to work. But another, less familiar, is that suburbs may not keep expanding outwards forever. At some point, there may be a frontier where you are essentially gentrifying -- where you are buying a piece of land that, in the past, was not used for purposes of housing your kind of people, and you are betting that it will be continue to be used for that purpose in the future. And some of those people on the fringe, in some places, may have bet wrong. The ability to build highways goes along with the ability to provide public services generally. Again, as long as the money is there, there is no problem. But cities are running into difficulty now. Their tax bases are taking a hit because of the drop in house prices and the rising number of foreclosures. Empty houses don't generate tax revenues, in which case cities can't provide everything we have gotten used to. With fewer people paying property taxes, and those taxes not rising at the expected rates, cities will have to increase fees and taxes if they are to keep providing the services we expect. For each additional $50 per month of property taxes and other service fees, there will be some people who are priced out of the housing market. So the drop in the tax base may have its own self-perpetuating dynamic to some extent: as fewer pay, costs rise, so even fewer can afford to pay. Among those public services, water is particularly worrisome. There is not enough of it, and there will be less. Even if the cities could continue to afford to supply the same levels of services, there have to be the resources for them to supply -- the water, in particular, but to an increasing extent the electricity as well, particularly during peak periods. There is no long-term plan in place, at present, for resolving the nation's (never mind the world's) shortages of water, electricity, or, for that matter, food. We have largely squandered the opportunities we have had to take leadership in such matters during the past two generations. It will be harder for us to do so in the future. China will run into extreme problems along these lines before we do, but we will have those problems too; and to the extent that China owns us, there may be some very interesting deals made in the future. Most likely wars will be fought for such things, and they will not always be wars involving uniformed armies. If you are a homeowner, you are valuable to the wealthy people only as long as you continue to be a vehicle for production of wealth. The system on which you have been that sort of vehicle is now undergoing extensive modification. Your house is becoming a less reliable way of creating transactions in which realtors, lawyers, bankers, et al. become wealthy, and that means that your own value is declining: you are no longer capable of serving as a conduit for the generation of wealth through the automatic operation of a system of rising house prices. If you are to continue to have value in this system, you must achieve it by having stable, good-paying employment and an ongoing ability to make your house payments. Of course, you may still be vulnerable to a decline in your home's value, to the point that some people will be working to make payments on a combination of mortgage and home equity loan that puts them under water. In other words, some will ask themselves why they are struggling to keep a house that's worth less than they owe on it. Regardless of your own stability, your operative assumptions will continue to mutate as your neighbors ask themselves questions of this sort. The time to buy is when nobody wants the thing you are buying -- assuming, of course, that they will want it later. The time to sell is when everyone wants the thing you are selling -- assuming that you won't then have to turn around and buy it back at a higher price later. When *everyone* was buying a house, when it was *obvious* that everyone should buy a house -- that was the time to sell. People will be buying shelter again in the future. It is not yet clear what form of shelter will be most attractive. Resource questions will likely influence this issue.