Click here to Skip to main content
15,886,919 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
PraiseRe: Utilization Pin
fgs19637-Sep-23 2:05
fgs19637-Sep-23 2:05 
GeneralRe: Utilization Pin
Kornfeld Eliyahu Peter7-Sep-23 3:10
professionalKornfeld Eliyahu Peter7-Sep-23 3:10 
GeneralRe: Utilization Pin
honey the codewitch7-Sep-23 4:12
mvahoney the codewitch7-Sep-23 4:12 
GeneralRe: Utilization Pin
Mircea Neacsu7-Sep-23 6:07
Mircea Neacsu7-Sep-23 6:07 
GeneralRe: Utilization Pin
honey the codewitch7-Sep-23 6:15
mvahoney the codewitch7-Sep-23 6:15 
GeneralRe: Utilization Pin
trønderen7-Sep-23 7:00
trønderen7-Sep-23 7:00 
GeneralRe: Utilization Pin
SeattleC++8-Sep-23 9:46
SeattleC++8-Sep-23 9:46 
GeneralRe: Utilization Pin
trønderen8-Sep-23 11:43
trønderen8-Sep-23 11:43 
SeattleC++ wrote:
Run two such programs and what you get is virtual memory page thrashing and a thousandfold decrease in performance.
If that really was the case, I would immediately throw that OS out of the window!

Of course you cannot expect 200% performance - 100% for each process. You must expect that the process (hence working set) switching take some resources. But no program uses all the memory all the time; reality is that even when you think your program is all over the place, there are plenty of untouched physical memory pages that can be used by another process. Any decent MMS hardware and OS can handle that quite well. If your program really does make use of 100%, then any 10% (or maybe even 1%) increase in the data structures of that single program would take long strides towards that "thousandfold decrease in performance".

If you keep insisting that your program actually makes use of 100% of the RAM: Take a look in Resource Monitor, the Memory tab: Is it really true that the color bar is all green, "In use", or orange, "Modified"? No dark or light blue? If you flush memory - my tool for doing that is Sysinternals RamMap; its Empty menu has commands for emptying standby lists and flushing modified pages - there is a definite chance that the color bar goes at least a little blue at the right end. Probably much more than you would expect! Let your program run, and see how long it takes before all that blue has turned green/orange. Probably much longer than you would expect!

I am of course assuming that you have a "reasonable" amount of RAM. In the old days of 16 bit minis, a memory card with a mebibyte of RAM cost around USD 10,000 (the Euro wasn't invented then); inflation would bring that to USD 50,000 today, so you didn't buy RAM that you didn't need. This one mini had an OS that would actually run (or maybe I should say 'crawl') with two 2 Ki pages of RAM available to user processes (the rest taken by the OS. "4 Ki should be enough for everybody!" Smile | :) ). The only ones actually running on 4 Ki for paging were the OS developers doing stress tests to see if practice matched theory. It did, but that configuration failed to enter the Top500 list Smile | :) . Those OS developers claimed that any system doing physical paging more than 5% of the time is heavily starved on memory. I have never encountered any production system doing that much paging. But if you regularly run two processes side by side, each with an active working set that fills all of your RAM, you really do need to buy some more RAM!

If my memory is correct, the 16-bit minis we used for interactive program development around 1980 initially had 256 Ki of RAM, that was increased to 512 Ki a year after installation. Each machine (we had three of them) served 24 interactive terminals, running screen oriented editors (although character oriented, 24 by 80, no graphics) and Pascal / Fortran compilers. That worked very well. It must be said that those machines had an MMS which was advanced for its time, and a very good interrupt handling system: The first user instruction in the interrupt handler was running 900 ns after the arrival of the interrupt signal. I guess both were essential for the machine's ability to handle lots of processes fighting for resources.

And then (and this is essential!):
As long as the 24 users were requesting RAM and CPU, the OS managed it very well. However, it had a file system design requiring a global lock to be set on the directory root before any disk operation! (Who are familiar with the Python GIL?) Fetching a file now and then is OK, but when 24 students at the call of the bell types 'logout' and raises from their chairs, a lot of file system operations lined up for the general lock. We (I was a TA) had to extend the break between lessons for the machines to be able to complete all the file system operations for the 24 user sessions.

That is the problem in lots of software: Programmers reserve a resource much earlier than needed, and release it long after the work on it has been done, e.g. in a final 'cleanup' stage. They reserve much more (e.g. the entire file system) when they actually need to reserve a small part of it (e.g. a single file). When the system runs slow as molasses, usually there is not a CPU saturation or paging bottleneck, but lots of processes waiting for some resource to become available, but the resource is locked by some process that probably could have released it long ago or not reserved it yet.

My memory goes back to the old batch oriented mainframes of the 1960s and 70s - in my student days, a few of them were still around - where you had to indicate in the job prologue which files and devices your program would refer, how much memory it would require, how many seconds of processing time you expected, how much output you expected. So the OS would pack as many programs side by side that would fit in physical memory, selecting those indicating much I/O but little CPU to run in parallel with those having high CPU requirements but little I/O, so that both classes of resources could be utilized at the same time. In our 'Algorithms' course, optimizing a job queue for maximum total utilization was one of the problems we were given to solve, and we were presented with the solutions in the OS-1100 (aka. Exec-8) OS. (We did use punched cards on the Univac with its batch OS for 'Programming 101', but after that we never touched the beast, but went to interactive terminals.)
GeneralRe: Utilization Pin
Ralf Quint8-Sep-23 18:53
Ralf Quint8-Sep-23 18:53 
GeneralRe: Utilization Pin
den2k887-Sep-23 5:03
professionalden2k887-Sep-23 5:03 
GeneralRe: Utilization Pin
honey the codewitch7-Sep-23 5:05
mvahoney the codewitch7-Sep-23 5:05 
GeneralRe: Utilization Pin
Member 133016797-Sep-23 20:29
Member 133016797-Sep-23 20:29 
GeneralRe: Utilization Pin
honey the codewitch7-Sep-23 21:46
mvahoney the codewitch7-Sep-23 21:46 
GeneralRe: Utilization Pin
jschell7-Sep-23 5:19
jschell7-Sep-23 5:19 
GeneralRe: Utilization Pin
honey the codewitch7-Sep-23 5:47
mvahoney the codewitch7-Sep-23 5:47 
GeneralRe: Utilization Pin
Gary Wheeler7-Sep-23 6:04
Gary Wheeler7-Sep-23 6:04 
GeneralRe: Utilization Pin
honey the codewitch7-Sep-23 6:22
mvahoney the codewitch7-Sep-23 6:22 
GeneralRe: Utilization Pin
Gary Wheeler7-Sep-23 6:31
Gary Wheeler7-Sep-23 6:31 
GeneralRe: Utilization Pin
honey the codewitch7-Sep-23 6:32
mvahoney the codewitch7-Sep-23 6:32 
GeneralRe: Utilization Pin
jochance8-Sep-23 4:56
jochance8-Sep-23 4:56 
GeneralRe: Utilization Pin
David On Life8-Sep-23 8:32
David On Life8-Sep-23 8:32 
GeneralRe: Utilization Pin
trønderen7-Sep-23 6:59
trønderen7-Sep-23 6:59 
GeneralRe: Utilization Pin
honey the codewitch7-Sep-23 7:10
mvahoney the codewitch7-Sep-23 7:10 
GeneralRe: Utilization Pin
dandy727-Sep-23 7:02
dandy727-Sep-23 7:02 
GeneralRe: Utilization Pin
honey the codewitch7-Sep-23 7:06
mvahoney the codewitch7-Sep-23 7:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.