Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I read this SO question on 'real', 'user', and 'sys' descriptions and thought I'd play a little. Can someone explain why

[root@lux ~]# time dd if=/dev/zero of=del.large bs=10K count=32768
32768+0 records in
32768+0 records out
335544320 bytes (336 MB) copied, 0.623293 seconds, 538 MB/s

real    0m0.717s
user    0m0.007s
sys     0m0.709s
[root@lux ~]# time dd if=/dev/zero of=del.large bs=100K count=32768
19838+0 records in
19838+0 records out
2031411200 bytes (2.0 GB) copied, 47.31 seconds, 42.9 MB/s

real    0m47.401s
user    0m0.009s
sys     0m3.395s

Clearly real = user + sys in the first trial. Why isn't is the same in the second test?

share|improve this question

migrated from Aug 11 '11 at 7:58

This question came from our site for professional and enthusiast programmers.

up vote 3 down vote accepted

Given the extreme drop in the reported data rate (from 538 MB/s to 42.9 MB/s), I suspect that the 336M written in your first test fit entirely into the drive's write cache, so the process just handed all the data off to the drive, which cached it and reported success immediately.

In the second test, on the other hand, the 2.0G of data didn't fit into cache, so the kernel had to send some of the data, wait for it to be written to disk (taking up wall clock time, but no CPU time), send more data, wait for the write, etc. until all the data was finally accepted by the drive. The "extra" seconds in the second test are the time that was spent waiting for I/O operations to complete.

share|improve this answer

real time does not necessarily equal user time + sys time on a multiprocessor system. User Time + Sys Time is the time spent by the CPU, while real time is the real amount of time used.

Edit: apparently its been asked before: What do 'real', 'user' and 'sys' mean in the output of time(1)?

share|improve this answer
If you didn't notice, I link to that exact question at the beginning of my post. I'm pondering why in one of my cases the relation holds true and in the other it does not where only amount of data processed with dd changes. – physicsmichael Aug 11 '11 at 6:02
Other disk effects. For example, lets say that something else is running that is of higher priority when you run the second process. Then, it will physically take more time, but that's merely because your process only got a very small cpu timeslice. – Foo Bah Aug 11 '11 at 7:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .