real-time vs. user-time

real-time vs. user-time

Post by mar » Tue, 30 Apr 2002 16:03:56



hi,

if have some program for benchmarking and therefore i
limit time and memory resources from the shell (sh) using
ulimit (under Debian GNU/Linux).

i've also included some code, to give some message on
STDOUT when time limit is exceeded:

void
ntrTimeExit(
 int timeSignal )
{
 struct rlimit *tLimit = malloc( sizeof( struct rlimit ) );
 getrlimit( RLIMIT_CPU, tLimit );
 printf( "time limit %9dsec exceeded\n", (int)tLimit->rlim_cur );
 free( tLimit );
 exit( 1 );

Quote:}

to activate ntrTimeExit() i use the following function:

ntrTimeLimit()
{
 struct rlimit *tLimit = malloc( sizeof( struct rlimit ) );
 getrlimit( RLIMIT_CPU, tLimit );
 signal( SIGALRM, ntrTimeExit );
 alarm( tLimit->rlim_cur );
 free( tLimit );

Quote:}

ntrTimeLimit() is called at the very beginning of main().

now i've observed the following "mismatch" of the /usr/bin/time
command (the cpu-time limit was set to 10 minutes (ulimit -t 600)):

when i do NOT call ntrTimeLimit() on one benchmark i got the /usr/bin/time
result:

real 3641.73, user 333.16, system 268.15, user+system 601.31

that is, a real time of more than 1 hour and (user+system) time that matches
the given cpu-time limit.

when I call ntrTimeLimit() on this benchmark i got the result:

real 600.32, user 99.01, system 82.92, user+system 181.93

that is, a real time that matches the given cpu-time limit and a
(user+system) time that is far less from the cpu-time limit.

by the way, in both cases the program aborts on this benchmark.

if your question is now about the size of the process and the percentage,
than this is a good question: In both cases, the CPU percentages are about 5-10%
(yes, it's a hard problem and memory is full (about 1GB)).

but the problem is the different behaviour when i use ntrTimeLimit() and
alarm(), respectively. i was thinking that i really set the alarm function
according to the cpu-time limit given from the shell, but obviously this
is not the case.

does anyone has an explanation to this?

thanks in advance,

marc

 
 
 

real-time vs. user-time

Post by those who know me have no need of my nam » Tue, 30 Apr 2002 20:33:58



Quote:>now i've observed the following "mismatch" of the /usr/bin/time
>command (the cpu-time limit was set to 10 minutes (ulimit -t 600)):

>when i do NOT call ntrTimeLimit() on one benchmark i got the /usr/bin/time
>result:

>real 3641.73, user 333.16, system 268.15, user+system 601.31
>when I call ntrTimeLimit() on this benchmark i got the result:

>real 600.32, user 99.01, system 82.92, user+system 181.93

perhaps you need to consider what rlimit is limiting (cpu time) versus what
alarm signals (elapsed wall clock time).  note the user+system time of the
rlimit'd run and the real time of the alarm'd run.

Quote:>by the way, in both cases the program aborts on this benchmark.

aborts?  how so?

--
bringing you boring signatures for 17 years

 
 
 

1. Real-Time task vs. device driver vs. sched_setscheduler?

I'm new to the idea of real-time operations, and I notice
that Linux supports "soft" real-time via sched_setscheduler()
and "hard" real-time via the RT-Linux kernel patches.

I'd greatly appreciate if someone could discuss the tradeoffs among
using a kernel device driver, the RT-Linux extensions, and the
sched_setscheduler() calls for a given application.  How would I know
what is a good match to an application?  Or would applications use
several of those methods together?  The examples I've seen for
RT-Linux sound like things that a device driver should handle.  Why
not use device drivers instead?  Or should the suggestion given in one
of the RT-Linux papers be followed: rewrite the time-dependent device
drivers as RT tasks?

Also, has anyone measured the maximum interrupt latency for RT-Linux?

Thanks for any insights.

-Rob
--
Robert W. Brewer  

2. VisionFS and AutoCAD LT

3. real time less than user time?

4. Advanced File & Print Server

5. "Real-Time" Time Display in Console

6. need boot cd

7. Mixed Time-Share & real-Time scheduling

8. LWPs and Threads : Difference ??

9. Real-time (RT) process slipping time - any ideas?

10. Real-time user managment

11. convert UT time in local time / local time in UT time

12. time time time how can I tell the time

13. user-time,system-time