I thought that a core was responsible for processing a single thread. Hence, what does it mean when one says a process takes up 75% of resources? Is that memory? Computing power?
Let’s use an analogy: imagine a an ambidextrous celebrity sitting at a table, signing autographs.
Here are the specs for the system (the signing event as a whole):
Now let’s examine the different kinds of scenarios that can occur.
CPU Usage and Temperature
If the line is short, then he works at a low rate (low CPU usage %) and does not get to hot because he doesn’t move at his top speed.
If the line gets long, he has to sign things faster, up to the maximum speed he is capable of, to keep up (high CPU usage) and gets hot from the extra work.
If a normal fan comes up to the table, he uses one of his hands to sign the photo for the fan and the fan leaves. If the fan wants more autographs, then he tries to accommodate, but if the line is too long, he apologizes and the fan has to go to the back of the line and wait for another turn.
If a power user comes up to the table, it is the exact same situation as with the normal fan, but because he is using both of his hands to sign, he can get more done before having to send the business person to the back of the line.
If a normal fan arrives at the signing, they have to get in line and wait their turn.
If a VIP arrives at the signing, they are allowed to cut ahead of the normal fans and wait closer to the table among the other VIPs. They may also stay at the table longer when they get there.
If a “low-ranking/priority person” (celeb’s assistant? employee? roadie?) arrives at the signing, they have to get in line, but allow normal fans ahead of them when they arrive. They also have to get rushed away to the back of the line much faster so that higher-priority people can get their autographs.
So then, what happens in your given scenario of a process using 75% of the CPU?
Well, imagine a marketing executive from the celebrity’s studio arrives at the signing with two assistants to get a whole pile of photos autographed to be given away at a publicity event. The executive is multi-threaded and high-priority.
The line isn’t too long, so the celebrity is taking his time and casually signing.
The executive sends the two assistants into the line where they cut ahead to the front of the line and arrive at the table quickly. They plop their stack of photos on the table and the celebrity promptly begins signing away with both hands.
He ramps up his signing speed to accommodate the large amount of important work that must be done, but because the line isn’t too long, he only goes up to 75% of physical ability (his maximum speed).
The assistants remain at the table for quite a while because they are important, but eventually the manager tells them to get back in line so that some of the other fans who have been waiting for a while get a turn.
It is correct that one core can only process one task, this task is your operating system. It occupies the whole CPU, all the cores, but does not really use all of its power. This unused time is distributed to the operating systems child processes.
Here something comes into play that is called scheduler, there are different approaches how the scheduler divides the processing power for the different running processes.
For a start consider 100% CPU to be sliced into several equally large time slices. Now the scheduler assigns every process one or more of those slices in which it gets processed.
How many slices each task gets is chosen by how much the task actually used of the last slice and how reactive it has to be. If you have more than one core each core gets its own set of timeslices to distribute to the different processes. This is called Round Robin Scheduling (One of the simplest schedulers).
In reality this is far more complex, because processes have to react to real time events like a keyboard press (hardware interrupts) or program faults (software interrupts). But basically that is how it works and how the percentage of the time is measured.
This relates to the amount of CPU-time that your process is taking. Multi tasking is accomplished by context-switching at a such a fast rate that the user feels that multiple programs are running simultaneously. Now, for context-switching there are several alogrithms that define how much of the processor time is allocated to a particular process. Give too little time to a process, and the context-switching overhead increases greatly, causing a lowly responding machine. A large time-slice, means one application is using a lot of the CPU-time while the others will be lagging and unresponsive. The % of resources used is the amount of CPU-time being used.