Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

3 Answers

up vote 6 down vote accepted

Question

What does it mean to say that a process is using 75% of a CPU's resources?

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?

Analogy

Let’s use an analogy: imagine a an ambidextrous celebrity sitting at a table, signing autographs.

Technical Specifications

Here are the specs for the system (the signing event as a whole):

  • The celebrity (CPU) is signing autographs (doing work).

  • There is a line (queue) of fans (processes) who come up and ask him to sign (do work) photos, autograph books, shirts, bodies, etc. (memory, files, etc.)

  • The celebrity has and can write with both of his hands (cores).

  • Some fans are VIPs (higher priority) and so get to cut ahead in line and stay at the table longer.

  • Some are normal fans who stand in line for themselves (single-threaded) while some are “power users” like managers, and other business people (multi-threaded) who have several assistants (threads) standing in line with publicity materials so that they can get more done at a time (have him sign with both hands instead of just one).

  • The celebrity’s manager (scheduler) stands next to the table and decides when the celebrity has spent enough time on a fan and must move on to the next one.

Permutations

Now let’s examine the different kinds of scenarios that can occur.

CPU Usage and Temperature

High Usage

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.

Low Usage

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.

Threading

Single-threaded

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.

Multi-threaded

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.

Priority

Normal

If a normal fan arrives at the signing, they have to get in line and wait their turn.

High

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.

Low

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.

Application

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.

share|improve this answer
1  
I would take issue with the phrase "he only goes up to 75% of physical ability (his maximum speed)". A core always executes code at its maximum speed (though with dynamic clock stepping, that maximum can change over time, but that's not what you or the OP are talking about). So when a core is being utilized at 75% of its capacity, it means that on average over the last few seconds of time, the CPU literally had no work to do 25% of the time (and in fact it halts on modern systems). But when it did have work to do (the other 75% of the time), it did it as fast as it possibly could. –  Fran Jul 25 '12 at 20:25
    
+1 for creativity, this gives a nice visual to what is actually happening. –  nathpilland Jul 25 '12 at 20:53
2  
@Fran, yes, it is difficult to completely make microscopic electrical concepts easy to visualize and understand. It is like using traffic or plumbing analogies to explain electrical potential, current, and resistance. It works for the most part, but the analogy can only go so far. If you have a better way of analogizing CPU usage percentage, please let me know and I will happily change it. –  Synetech Jul 25 '12 at 21:17
    
@Synetech I don't think I could improve on your excellent analogy. My comment above was merely a minor nit. You did a fine job of explaining it in a non-technical way. –  Fran Jul 25 '12 at 23:12
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.