I Can Not Manage This Task
-
Because it is performing tasks that cannot be broken across multiple cores. You have 4 cores. For each task that cannot be broken up, the most it can use is 25%
Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix
Thank You Kindly for your assistance. At this moment Utilization is reported as 54%.
-
Thank You Kindly for your assistance. At this moment Utilization is reported as 54%.
In simple terms: There's always a *ton* of stuff going on with modern OSes, even those who designed them will have a hard time keeping it all in their heads and probably couldn't present a complete and accurate picture of what might be going in at any given time. With that out of the way: What problem are you trying to resolve? Does the exact CPU utilization figure bother you?
-
obermd wrote:
So if a thread is waiting for the disk, it's not using the CPU
Just to be difficult *cough* I/O Completion Ports *cough* Seriously though, I'm being a bit pedantic, but on modern OSs and hardware so many things are asynchronous without even using threads that a single thread can potentially be using multiple resources virtually at the same time, and when it does enter a wait state, it will be woken up by the first ready resource it's waiting on. That changes the calculus of what you say in terms of how it actually plays out, even if what you say is ... "basically" true. In essence, you're not wrong, but you're simplifying, maybe to a fault.
Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix
I'm simplifying based on what I had available (VAXBasic and Digital Command Language) to make the adjustments (6+ hours => 2 hours). This simplification is also a good high-level view of what's available in a system and the realization that a thread can only do one item at a time. Threads that spawn off asynchronous tasks are still only doing one item at a time as the spawned task always executes on another thread. It may be that that thread is a hardware resource for IO, but it is still another thread and another task that attempts to use the same resource will have to wait. IO Completion Ports use hardware signals that the OS monitors to allow applications to offload the actual IO details to an OS level thread. For commodity systems, you can have a small number of concurrent IOs occuring, and depending on the hardware and where the actual resource conflicts lie, that number can be one. From a high level, I've wrote an SQL Server based applications that had to back off on SQL errors of any sort (concurrency, timeout, etc.). The first fault (SQL error) split the task into 10 tasks to attempt concurrently. The second SQL error (double fault) used the dotNet framework's ReaderWriterLock class to force a complete back off so the erroring SQL statement would be the only insert/update query executing on the server at that time. Yes, it was a huge penalty hit but it was necessary to ensure data integrity. These threads normally set the lock to Read, but for the double fault situation the thread that was going to attempt the final insert/update/delete would set the lock to Write and wait for all the other readers to complete before attempting. Of course any new readers also waited for the Write lock to complete.
-
In large part, because your computer has multiple cores. You cannot just break a task down to use all cores. Add
2 + 2
using two threads to divide the task between two cores. You can't. So if you add 2+2 your CPU will not spike to 100. If it had two cores, the best you'd get is 50%, 4 cores - 25%, etc.Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix
honey the codewitch wrote:
Add 2 + 2 using two threads to divide the task between two cores. You can't.
What about?
1+1=A
1+1=B
A+B=Answer(Seems like a joke but I worked with a VP that seemed to think throwing threads at a problem would always solve everything.)
-
honey the codewitch wrote:
Add 2 + 2 using two threads to divide the task between two cores. You can't.
What about?
1+1=A
1+1=B
A+B=Answer(Seems like a joke but I worked with a VP that seemed to think throwing threads at a problem would always solve everything.)
Hehe
Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix
-
In simple terms: There's always a *ton* of stuff going on with modern OSes, even those who designed them will have a hard time keeping it all in their heads and probably couldn't present a complete and accurate picture of what might be going in at any given time. With that out of the way: What problem are you trying to resolve? Does the exact CPU utilization figure bother you?
Thank you for your kind reply. I am not attempting to solve any problem in particular. I merely wish to learn. In particular I am curious why CPU utilization is so low as I am inclined to naively assume it is more beneficial for the user for the CPU to utilize 100% of its resources so as to complete its tasks sooner rather than later. Would that not be the case? -Cheerios
-
There are three different major resources in a computer system: - CPU - Memory - Disk If you have files open on a network, then the network will be a fourth major resource. Each thread in the system can only be using one of these resources at a time, with multiple threads receiving time slices of that resource. So if a thread is waiting for the disk, it's not using the CPU. In fact, it's this very concept that allows virtualization to work at all. Personally, I used this concept to partition a task that was taking close to six hours to complete as a serialized task and complete it in about two hours.
Greeting Kind Regards I have no experience with threads. May I please posit an inquiry as to their use for one of my current projects. In particular I am currently running console level test code which runs autonomously needing no user interaction which is estimated to run for several days. It is of the form below. test_0(); test_1(); test_2(); ... The calls do not depend on any before and share no resource other than CPU. They merely perform integer arithmetic. They are called in sequence just as shown. No call to test_x is performed until the one prior is complete. So my inquiry is would the overall test complete sooner if each of the calls were in its own thread? Kind Regards
-
Thank you for your kind reply. I am not attempting to solve any problem in particular. I merely wish to learn. In particular I am curious why CPU utilization is so low as I am inclined to naively assume it is more beneficial for the user for the CPU to utilize 100% of its resources so as to complete its tasks sooner rather than later. Would that not be the case? -Cheerios
You're not entirely wrong...but it's all about spreading the load. Back in the single-core systems days, it was very common to see Task Manager show a single task/process use up 100% of the CPU. Windows went out of its way to remain responsive, but you *knew* that when this happened - for more than a few seconds at a time - the system started to get wonky. That's a technical term. :-) With 2 CPUs, a single-threaded process using up all the processing power it can get will be shown as using 50% of the processor. You don't get the task split up across both CPUs "for free", it has to be coded to take advantage of multi-threading. That being said, if a process can spawn 2 threads, each hitting the CPU as hard as it can, you might see CPU usage go beyond that 50% and closer to 100% (but it'll hardly ever remain exactly at 100% no matter what). The same pattern repeats for systems with 4 or 8+ cores. With 4 cores, a single-threaded process hitting the CPU hard will show 25% usage; with 8 cores, 12.5%. If the process starts spawning more threads, then you'll see the CPU usage climb. I'm oversimplifying, but I generally find most people are happy with this sort of explanation and leave it at that.
-
You're not entirely wrong...but it's all about spreading the load. Back in the single-core systems days, it was very common to see Task Manager show a single task/process use up 100% of the CPU. Windows went out of its way to remain responsive, but you *knew* that when this happened - for more than a few seconds at a time - the system started to get wonky. That's a technical term. :-) With 2 CPUs, a single-threaded process using up all the processing power it can get will be shown as using 50% of the processor. You don't get the task split up across both CPUs "for free", it has to be coded to take advantage of multi-threading. That being said, if a process can spawn 2 threads, each hitting the CPU as hard as it can, you might see CPU usage go beyond that 50% and closer to 100% (but it'll hardly ever remain exactly at 100% no matter what). The same pattern repeats for systems with 4 or 8+ cores. With 4 cores, a single-threaded process hitting the CPU hard will show 25% usage; with 8 cores, 12.5%. If the process starts spawning more threads, then you'll see the CPU usage climb. I'm oversimplifying, but I generally find most people are happy with this sort of explanation and leave it at that.
Thank you kindly. I do not fall in the happy group. If the machine were to deal w/ no more processes than cores than of course it is easy to be so happy. However such is not the case. There are tens hundreds perhaps even thousands of processes on my 4 Core machine. -Kind Regards
-
Thank you kindly. I do not fall in the happy group. If the machine were to deal w/ no more processes than cores than of course it is easy to be so happy. However such is not the case. There are tens hundreds perhaps even thousands of processes on my 4 Core machine. -Kind Regards
Right...but you won't ever get a single core dedicated to a single process, even if you could get 1:1 process:core ratio. And not all running processes have something to do all the time, so even though you have more processes than cores, and each core gets to do some work that a process needs to have taken care of...you'll hardly ever see all cores busy at 100%. In theory, if you were to add up the CPU utilization from all processes at a given time, *plus* the System Idle Process entry shown in Task Manager...you might get close to 100%. Are you thinking about this in terms of "caching is good, because unused memory is wasted memory"? I'd say it's not so with CPUs...pushing CPUs to their limit, all the time, would draw a lot of power, and generate a lot of heat.
-
Right...but you won't ever get a single core dedicated to a single process, even if you could get 1:1 process:core ratio. And not all running processes have something to do all the time, so even though you have more processes than cores, and each core gets to do some work that a process needs to have taken care of...you'll hardly ever see all cores busy at 100%. In theory, if you were to add up the CPU utilization from all processes at a given time, *plus* the System Idle Process entry shown in Task Manager...you might get close to 100%. Are you thinking about this in terms of "caching is good, because unused memory is wasted memory"? I'd say it's not so with CPUs...pushing CPUs to their limit, all the time, would draw a lot of power, and generate a lot of heat.
Yes I am thinking in terms of "if 23% is good 99.999% is better." I am aware of thermal limitations but do not know if such is the reason for the 23%. Should I assume the remaining 77% of the time the CPU is twiddling its thumbs? As for my system Task Manager at this moment shows 0% for almost all processes and a quick guess of the sum of the others is as reported id est 30%. Kind Regards
-
obermd wrote:
So if a thread is waiting for the disk, it's not using the CPU
Just to be difficult *cough* I/O Completion Ports *cough* Seriously though, I'm being a bit pedantic, but on modern OSs and hardware so many things are asynchronous without even using threads that a single thread can potentially be using multiple resources virtually at the same time, and when it does enter a wait state, it will be woken up by the first ready resource it's waiting on. That changes the calculus of what you say in terms of how it actually plays out, even if what you say is ... "basically" true. In essence, you're not wrong, but you're simplifying, maybe to a fault.
Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix
Do you know how thread waits are actually implemented in the kernel? Does the thread actually stop processing instructions, IOW, is the wait hardware based? I've heard the term used "spinning" related to threads, so I wonder if a waiting thread simply polls a value and if it's not the value it wants, it loops.
The difficult we do right away... ...the impossible takes slightly longer.
-
Do you know how thread waits are actually implemented in the kernel? Does the thread actually stop processing instructions, IOW, is the wait hardware based? I've heard the term used "spinning" related to threads, so I wonder if a waiting thread simply polls a value and if it's not the value it wants, it loops.
The difficult we do right away... ...the impossible takes slightly longer.
I mean, as far as I know, a kernel can wait and awake on a number of different conditions, some of them directly interrupt related, as in your drive finishes fetching, and it triggers a CPU interrupt, which eventually wakes up a thread to dispatch the waiting data. Another option is the scheduler puts the waiting thread to sleep, and awakens it on a software condition (such as a mutex being released) as opposed to an interrupt. When a thread waits, the scheduler does not schedule it for execution. It is effectively "asleep", not spinning a loop or anything. It does not poll. If it did, 3000 threads would quickly overwhelm the kernel.
Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix
-
Greeting Kind Regards I have no experience with threads. May I please posit an inquiry as to their use for one of my current projects. In particular I am currently running console level test code which runs autonomously needing no user interaction which is estimated to run for several days. It is of the form below. test_0(); test_1(); test_2(); ... The calls do not depend on any before and share no resource other than CPU. They merely perform integer arithmetic. They are called in sequence just as shown. No call to test_x is performed until the one prior is complete. So my inquiry is would the overall test complete sooner if each of the calls were in its own thread? Kind Regards
Up to a point, yes - that point being the number of threads being roughly equal to the number of virtual or logical "cpu cores" you have (hyperthreading effectively doubles that number on many CPUs because each core - p-core at least can run two threads). Any threads created after that are no longer truly concurrent, but may still make sense to create in some cases if they'll be waiting (I/O bound) - that's not the case with your current situation which is all CPU bound. Bottomline is if your chip has hyperthreading and 4 cores it can run 8 threads concurrently. After that it is divvying up one or more cores to do multiple tasks, which is extra overhead without extra benefit, again, in your situation. What I would do is use System.Threading.ThreadPool and simply call QueueUserWorkItem to run each of those functions. Let the ThreadPool figure out when to schedule.
Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix
-
Greetings Kind Regards May I please inquire of your kind selves who of course are much more knowledgeable than myself meaning of Task Manager CPU Utilization reported percentage. I wish to know what it is in fact a measure of. All the answers I have found on-line are along the lines of "The percentage you see (e.g., 25%) represents the proportion of the CPU’s capacity that is actively in use. It indicates how much of the CPU’s processing power is currently allocated to running tasks and processes." Web search of term "capacity" seems to result as identical to speed id est bits or perhaps instructions per second similarly for "processing power". I am motivated to this inquiry as my intel i7 reported % is usually mid 60s even whilst performing several simultaneous tasks exempli gratia a build and two console programs each running random testing. Other than not knowing what in fact is being measured I do not understand why the CPU would not run at 100% as I assume doing so would complete assigned tasks sooner rather than later. Perhaps it is a matter of temperature throttling. My temperatures are typically mid 60s. So to paraphrase inquiry if reported % is exempli gratia 50 does this mean the CPU is sitting idle half the time? If so why? Thank You Kindly
I had the same question about CPU useage, as seen through the Task Manager window, a few years back but didn't get really curious about it until I got a new computer running Windows 10. Because of the number of cores mainly and the uptick in the amount of memory I had at my disposal, I began to work on this new machine with Task Manager always open. This new view was quite an upgrade incidently; the more cores and the more memory, the more windows-in-windows ... some what of a phenomemon. Recall back in the days of using that Borland C-compiler being able to watch a debugging session (through WYSYWG perhaps/even!) after having set a few stops. All those glittering gold flashes. Very entertaining. Anyway, but it wasn't until I discovered Task Scheduler that my eyes were really opened! And to address what I think is the issue with background processes "ready" to dart into action. Notice all the tasks there in TS primed to go off. Many other shadow processes can be seen scratching their sigils on the various system folders. There's C:\Windows\temp for one. Always a side-show of files of unknown origin entraining themselves on the retina. There's AppData\Local\tmp ... for a good time tune in to that channel; what I found useful is just to delete the content of these folders now and again. Truth be told, my start-up time for Windows 10 went instantly from more than five minutes to a blazing minute or two after realizing that I could do that willy-nilly and get away with disabling some of the task scheduled by ad hoc installers, after being watchful for a while there too. [EDIT]: Let me also add that under Computer Managment Services, Stopping processes that are questionable, either by switching their Startup Types to Manual (from Running) or Disabled, doesn't always show itself accurately. For instance, when setting a service to Manual it can still start up on it's own (unknown process). And not only that but with the Computer Managment console open, the Start Type switch to Running (at the behest of the unknown process) will even ONLY show Manual. [END EDIT] So I guess my answer to the "why" is "Because it's there" :)
-
At this moment Task Manager is reporting : Utilization 23% Speed 3.84 GHz Base Speed: 3.41 GHz Cores: 4 Logical processors: 8 Processes 356 Threads 4960 Handles 189319 The graph of each of the eight logical processors shows more or less the 23%. w/ so much to do why is the CPU deciding to utilize only 23% of itself?
Many operations on the motherboard do not require direct CPU utilization. Reading/Writing to disk files (HD drives have rotational delays, SSDs have bandwidth limitations depending on read or write, Pulling data from the Internet, moving data to and from your video card.) Many use hardware DMA (Direct Memory Access) to move the data and the CPU has to go idle while the transfers are taking place. Another area that can cause CPU to idle is if you exceed your physical memory and start using virtual memory. The the operating system gets involved in swapping data to and from disk and memory to give you the illusion of more main memory. Some opcode level instructions don't like it when the data they are referencing is beyond a certain physical distance. This can cause stalls in the pre-execution decoding that the CPU does and cause flushes of opcodes that have been decoded and stacked in the execution pipeline. Same goes with generated code that has an abundance of branches. Branch prediction can falter and cause CPU stalls as it has to reload the pipeline with opcodes from the target location. Depends on what your computer is processing. Are you experiencing slow response (stuttering pointer movement, keyboard lag)? That's all I can think of "off the top of my head" I am sure there are more reasons for low CPU utilization.
-
Greetings Kind Regards May I please inquire of your kind selves who of course are much more knowledgeable than myself meaning of Task Manager CPU Utilization reported percentage. I wish to know what it is in fact a measure of. All the answers I have found on-line are along the lines of "The percentage you see (e.g., 25%) represents the proportion of the CPU’s capacity that is actively in use. It indicates how much of the CPU’s processing power is currently allocated to running tasks and processes." Web search of term "capacity" seems to result as identical to speed id est bits or perhaps instructions per second similarly for "processing power". I am motivated to this inquiry as my intel i7 reported % is usually mid 60s even whilst performing several simultaneous tasks exempli gratia a build and two console programs each running random testing. Other than not knowing what in fact is being measured I do not understand why the CPU would not run at 100% as I assume doing so would complete assigned tasks sooner rather than later. Perhaps it is a matter of temperature throttling. My temperatures are typically mid 60s. So to paraphrase inquiry if reported % is exempli gratia 50 does this mean the CPU is sitting idle half the time? If so why? Thank You Kindly
threads and cores, gentlemen, threads and cores /penguin
------------------------------------------------ If you say that getting the money is the most important thing You will spend your life completely wasting your time You will be doing things you don't like doing In order to go on living That is, to go on doing things you don't like doing Which is stupid. - Alan Watts https://www.youtube.com/watch?v=-gXTZM\_uPMY
-
Greetings Kind Regards May I please inquire of your kind selves who of course are much more knowledgeable than myself meaning of Task Manager CPU Utilization reported percentage. I wish to know what it is in fact a measure of. All the answers I have found on-line are along the lines of "The percentage you see (e.g., 25%) represents the proportion of the CPU’s capacity that is actively in use. It indicates how much of the CPU’s processing power is currently allocated to running tasks and processes." Web search of term "capacity" seems to result as identical to speed id est bits or perhaps instructions per second similarly for "processing power". I am motivated to this inquiry as my intel i7 reported % is usually mid 60s even whilst performing several simultaneous tasks exempli gratia a build and two console programs each running random testing. Other than not knowing what in fact is being measured I do not understand why the CPU would not run at 100% as I assume doing so would complete assigned tasks sooner rather than later. Perhaps it is a matter of temperature throttling. My temperatures are typically mid 60s. So to paraphrase inquiry if reported % is exempli gratia 50 does this mean the CPU is sitting idle half the time? If so why? Thank You Kindly
I might have missed the question, but if "what does N% of time in Task Manager for a task mean" This just random-(semi educated guess) - the amount of time or executions that that task is allocated in a set amount of time. again, over simplified, but A single CPU core, only runs 1 execution at a time. There is a scheduler that orders the so so many things to execute. So over 1 second it can go oh, task 123 has done 103456 executions, then some maths to say that was .2 seconds, or 20% of 1 second. The amount of time it uses I am not sure. It could be in milliseconds. Or what ever the CPU make decides for that method endpoint to give back to the windows operating system. Add on multiple cores, and the Windows main Task Manager - 100% is total across the cores. If instead you are saying you are running performance tests, and not hitting over 60. Change the performance test that you are running. The program could have 100 threads, but only able to run them across 2 cores, instead of 4. i7 does not indicate fully what the CPU is. Also can add in GPU along with the other comments on here, on what could be limiting and having the cpu waiting on. Idle is not bad. Idle is good, it means that the cpu has more head room then the application can use. Or application needs changing to utilise more, which parallel programming is hard.
-
Greetings Kind Regards May I please inquire of your kind selves who of course are much more knowledgeable than myself meaning of Task Manager CPU Utilization reported percentage. I wish to know what it is in fact a measure of. All the answers I have found on-line are along the lines of "The percentage you see (e.g., 25%) represents the proportion of the CPU’s capacity that is actively in use. It indicates how much of the CPU’s processing power is currently allocated to running tasks and processes." Web search of term "capacity" seems to result as identical to speed id est bits or perhaps instructions per second similarly for "processing power". I am motivated to this inquiry as my intel i7 reported % is usually mid 60s even whilst performing several simultaneous tasks exempli gratia a build and two console programs each running random testing. Other than not knowing what in fact is being measured I do not understand why the CPU would not run at 100% as I assume doing so would complete assigned tasks sooner rather than later. Perhaps it is a matter of temperature throttling. My temperatures are typically mid 60s. So to paraphrase inquiry if reported % is exempli gratia 50 does this mean the CPU is sitting idle half the time? If so why? Thank You Kindly
If you want to see what happens when the CPU runs at 100%, may I recommend the following tool: Free Stress Test Tool HeavyLoad | JAM Software[^] I've used it for a number of reasons, the most recent being to help answer the question "have I installed the replacement heatpipe and fan in my laptop properly, and has it made things better."
-
Greetings Kind Regards May I please inquire of your kind selves who of course are much more knowledgeable than myself meaning of Task Manager CPU Utilization reported percentage. I wish to know what it is in fact a measure of. All the answers I have found on-line are along the lines of "The percentage you see (e.g., 25%) represents the proportion of the CPU’s capacity that is actively in use. It indicates how much of the CPU’s processing power is currently allocated to running tasks and processes." Web search of term "capacity" seems to result as identical to speed id est bits or perhaps instructions per second similarly for "processing power". I am motivated to this inquiry as my intel i7 reported % is usually mid 60s even whilst performing several simultaneous tasks exempli gratia a build and two console programs each running random testing. Other than not knowing what in fact is being measured I do not understand why the CPU would not run at 100% as I assume doing so would complete assigned tasks sooner rather than later. Perhaps it is a matter of temperature throttling. My temperatures are typically mid 60s. So to paraphrase inquiry if reported % is exempli gratia 50 does this mean the CPU is sitting idle half the time? If so why? Thank You Kindly