Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 03 Jun 1998 22:56:51 -0700
From:      "Richard S. Straka" <straka@home.com>
To:        current@FreeBSD.ORG
Subject:   strange behavior with signal latencies
Message-ID:  <35763722.C34EEF4E@home.com>

next in thread | raw e-mail | index | archive | help
I wrote a small test program to look at latencies of user space
processes waking up on  the delivery of signals.  The program (which is
included in this e-mail) sigsuspend's waiting for a SIGALARM which is
being delivered at 10ms.  Upon receipt of the signal, the process wakes
up and records time from the receipt of the last signal using
gettimeofday, then suspends waiting for the next signal.  This test was
run on both my P133 running current which was cvsuped on 30 May, and
also my 486-100 running 2.2.6R.  Both machines were otherwise completely
idle and the program was run using rtprio 16.

In looking at the results, I noticed that that the current box exhibited
a 2300 microsecond additional delay  every 10th signal or at 100ms
intervals.  Also, occationally a signal is missed.  I have also noticed
recently using top and systat that current has been consuming between
1.6% and 3.1% of my P133 in interrupt handling.  This seems to
correspond to the latancy I am seeing with the signal test code.  I
changed the quantum interval using sysctl to 20 ticks.  This had no
effect, the 2300 microsecond latency still appeared at 10Hz.

The results with 2.2.6R on the 486-100 box showed no signs of the
latency and appeared to always reliably wakeup on every signal.  Also,
when the machine is completely idle, the interrupt load is 0.0%,
occationally jumping to 0.4% when the disks sync.

What in the system is generating the additional processor load at 10Hz
and why am I occationally missing signals?

Regards,

Richard Straka
straka@home.com

P.S. Here are the test results and the source listing of the my code

Nominally there should be 10000 microseconds between signals.

P133 running current cvsuped on 30 May.

9923
10017
9985
9993
10003
12353     Notice the extra 2353 microseconds
7690
9963
9993
10011
9995
10085
9990
9932
9990
12343
7660
10062
9936
10007
9990
10014
9991
9994
10004
12342
7656
10007
10038
9972
20012    Here I missed a signal completely
9978
10011
9985
12357
7641
10004
9996
10014
13837
6201
9957
19988
12364
7652
10001
9988
10021
9983
10041
9965
20020  Missed another one
11174
8796
10012
10001
9994
10006
9969
10047
9945
10038
12298
7691
9957
9988
10006
9984
9995
9999
10008
9981
12336
7652
9999
9992
10002
9987
9994
10000
9991
10006
12368
7615
9997
9989
10006
9986
9994
9999
10013
9986
12349
7648
10005
9996
10032
9970
9997
10006


486-100 running 2.2.6R.

9775
10024
9921
10000
10000
10026
9974
10000
9999
10028
9978
9995
10000
10026
9974
10000
9999
10029
9972
10000
10031
9999
9970
10000
10000
10027
9973
10030
9969
10028
10054
9925
9994
10027
9973
10000
9999
10028
9973
10000
10031
9999
9970
10000
9999
10027
9974
10000
10000
10026
9979
9995
9999
10028
9973
10000
10000
10027
9973
10000
10034
10022
9945
9999
9999
10027
9974
10000
9999
10027
10005
9969
9999
10027
9974
10000
10000
10029
9989
10091
9976
9961
9953
10001
10000
10026
9974
10000
9999
10027
9979
9995
9999
10027
9974
10032
9968
10027
9972
10000


Source listing of code sigtime.c

#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/time.h>
#include <signal.h>

#define NITER    100

void sighandler();

void main(void)
{
  sigset_t sigmask;
  struct sigaction sigvec;
  struct timeval time;
  struct timeval timelast;
  int i;
  int dt;
  int dtstore[NITER];

  sigemptyset(&sigmask);
  sigvec.sa_handler = sighandler;
  sigvec.sa_mask = sigmask;
  sigvec.sa_flags = 0;

  ualarm(10000,10000);

  sigaction(SIGALRM,&sigvec,0);
  sigsuspend(&sigmask);
  gettimeofday(&time, NULL);

  for(i=0;i<NITER;i++) {
    timelast.tv_sec = time.tv_sec;
    timelast.tv_usec = time.tv_usec;
    sigsuspend(&sigmask);
    gettimeofday(&time, NULL);
    dt = (time.tv_sec-timelast.tv_sec)*1000000 +
      (time.tv_usec-timelast.tv_usec);
    dtstore[i] = dt;
  }

  for(i=0;i<NITER;i++) printf("%d\n",dtstore[i]);
}


void sighandler()
{
}



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?35763722.C34EEF4E>