LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   user time, system time, real time .. reg (https://www.linuxquestions.org/questions/linux-newbie-8/user-time-system-time-real-time-reg-873635/)

chaitanyajun12 04-07-2011 01:54 PM

user time, system time, real time .. reg
 
1. how sum of system time and user time can be greater than real time ?
2. Even though my program is not waiting for any I/O the real time is smaller than system time as shown


root@chaitu:/home/chaitu/Desktop/Chk# time ./new

real 0m0.001s
user 0m0.000s
sys 0m0.004s

Awaiting a reply.

szboardstretcher 04-07-2011 02:08 PM

I think thats because the computer is faster than real time - 'Wall Clock Time'

For example.

Real time might be 1 minute.

But the computer can do 600 minutes of work in 1 minute. Its been a long time since I've studied this, so please correct me if I am mistaken.

chaitanyajun12 04-07-2011 02:20 PM

thanks for ur reply..
the things which I know regarding this are:

real time is the actual elapsed time(from beginning to end of the program)
user time includes time needed for executing user defined code.
System time for executing system calls(kernel time).

but I am confused as to how system time can be greater than real time. even i am not clear with it.

just waiting for someone to answer.

Chaitanya.

MTK358 04-07-2011 08:30 PM

Quote:

Originally Posted by szboardstretcher (Post 4317293)
But the computer can do 600 minutes of work in 1 minute. Its been a long time since I've studied this, so please correct me if I am mistaken.

I don't understand. What's a "minute of work", anyway? How can a computer do in 1/600 of a minute what it could do in a minute?

chaitanyajun12 04-08-2011 12:18 AM

This thing would be of great help for me.
Someone can please explain it.


--
Chaitanya

gon1332 03-14-2016 01:32 PM

It is absolutely logical that sometimes the wall clock time (real) is smaller than the sum of sys and user time.

Sys and user time is the time that CPU spends within the process. If you have an application with multithreading, then the time could be larger than that of real.

Also real time could be way larger than the sum of sys and user time, because of blocking actions like IO.

BW-userx 03-14-2016 02:58 PM

Real time on a PC with a CPU is referring to clock time of the CPU, to call and execute a function call in real time is -- "right now" without delay, this is machine language that manipulates the hardware of the system, whereas software has a delay to it due to having to go through the API or a driver therefore, not actually speaking to the hardware directly. Hence a delay in time occurs due to this effect of having to go through a proxy of sorts first before the hardware actually receives the call to do something. It is not real time programming but that other one which the name of it escapes me at this moment.

Real-time computing
Quote:

In computer science, real-time computing, or reactive computing describes hardware and software systems subject to a "real-time constraint", for example from event to system response. Real-time programs must guarantee response within specified time constraints, often referred to as "deadlines". Real-time responses are often understood to be in the order of milliseconds, and sometimes microseconds. A system not specified as operating in real time cannot usually guarantee a response within any timeframe, although actual or expected response times may be given.
therefore anything other programming will be slower then "real time" if it is not machine code assembly language.

sundialsvcs 03-14-2016 05:43 PM

Actually, the most likely explanation in this case is that your times are just too small to measure (meaningfully). When you're dealing in the realm of "0.00x seconds," 'irrelevant curiosities' (ahem...) may appear.


All times are GMT -5. The time now is 04:58 PM.