[700] in Pthreads mailing list archive
Re: Problems with handling signals in threads.
daemon@ATHENA.MIT.EDU (Mark Evans)
Wed Aug 6 14:35:02 1997
Date: Wed, 06 Aug 1997 12:15:03 -0600
From: Mark Evans <mevans@cti-ltd.com>
To: Sushmala Yarramreddy <ysr@cise.ufl.edu>
Cc: pthreads@MIT.EDU
Sushmala Yarramreddy wrote:
> Hi,
>
> I am working on a real time project which involves development of
> detectors for a Network Intrusion Detection System.
>
> I am using the pthreads-1_60_beta6 package on FreeBSD.
>
> I have a number of detectors, each of them running as a separate
> pthread at any point of time. Whenever I receive a packet, I send a
> signal to the appropriate pthread to take some action.
> I am facing the following problems when I'm trying to implement
> them. It would be great if I could get some help on this :
Signal handling in pthreads-1_60_beta6 is broken, although the developers
of MySQL (http://www.tcx.se) have made several patches that may have fixed
them.
>
>
> 1. The packets come in at a very fast rate (300 packets per sec) and a
> number of signals to individual pthreads are lost if I dont give an
> appropriate sleep time. I cannot afford to give this sleep time when
> I'm developing a real time system. Is there any other way I can
> overcome this?
I'm not sure that signals are really the best approach. By definition, a
signal can be lost. Have you considered using condition variables (and
possibly a light-wieght queue)? I think that would be a much better
approach.
>
>
> 2. The time taken to send a signal to each pthread is very
> long (1100usecs) if a real time system has to be developed.
>
> I would like to know if it is possible to use this approach of sending
> signals to individual threads to develop a real time intrusion detection
> system.
I don't know. It depends on how "hard" your real-time needs are. We do a
"soft" real time system based on Linux and MIT pthreads, since we queue all
of our events and short latencies are acceptable, it works fine for us.
By using user level threads, you have two layers of scheduling - the kernel
to schedule the process and the pthreads "executive" to schedule the user
thread. If you want to use Un*x for hard real-time applications, check out
the Linux RT project at: http://luz.cs.nmt.edu/~rtlinux/
>
>
> Thanks,
> sushma.
--
Mark Evans Where do I want to go?
Conservation Through Innovation Ltd. [Linux! <http://www.linux.org>]