Events

From: Gyorgy Molnar (yuri@powercom.com.sg)
Date: Thu Jun 22 2000 - 18:11:38 EST


Hi,

I'm MS-Windows programmer, please don't be so angry:-) I've
used Linux for a half a year, but very happy with it.

Currently we finished a bigger project and we decided we are
going to make the Linux version, as well.
Our program is quiet big over 30,000 lines.

My problem is I cannot find a way to make a clear event
handling under Linux. Let me explain

For example we have a thread, this thread handle the file
IO. When I'm wating for some data I can use the select
function to check it out if there is anything for me. If I
want to stop the thread during the select, I have no other
way except for the signal handlers functions.
It is not really handy, because the example above is too
simple. In our case is much more difficulter.

At the moment as we saw in an example on the Net, we are
creating pipes for the events. And we just write one single
byte into the pipe to make it signaled and delete it from
the buffer to make it unsignaled.
It is not a nice way, either, but works. Unfortunatelly we
need about 10,000 events. If I used the pipes for the
events, I would need about 20,000 file descriptor.

We made a test system with about 8000 file descriptor. It
worked fine when we rebuilt the Kernel. The only problem the
Linux is too good to make this kind of stupid programs.

I've taken a look to the Kernel. And I think we could make a
new type of file descriptor only for events.

Example:
This example just try to expalin how I tend to use the new
function. It's syntax is not correct

int i = open(....);
int j = event(.....);

switch( poll( 2, i, j))
{
        case i:
                // file event;
                break;
        case j:
                // event signaled by somebody
                break;
...

I've also check out the pthread library, but I couldn't find
usefull the implementation of the events in the pthread.
I think this kind of stuff should be in the Kernel.

My question if anybody have the same problem before and you
think it is going to be fine??
I'm going to make a patch for us. If anybody interesting in
it, I would be appreciated for any kind of help.

Have a very good day for all of you:-)

Yuri

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Jun 23 2000 - 21:00:25 EST