notify problem?

From: <cogswell_at_nospam.org>
Date: Wed Nov 09 1994 - 04:28:59 PST

I just installed VSTa yesterday in the hopes of using it for a
research project for my thesis. In the hopes of getting a feel
for the performance of the system I wrote the program attached below.

The program just starts up a pair of processes, and the processes take
turns sleeping, then being woken by a notify from the other process.
I'm basically trying to measure context switch speed.

The problem is I get a stack-overflow error, which dumps me into the
kernel debugger, virtually every time I try to run the program.
Except for some occasional hangs during booting, the system seems
really stable, so I'm at a bit of a loss as to why I'm having trouble
here.

Couple other questions:
How many people are currently using VSTa?
When will the mailing list digest next be updated on ftp.cisco.com?

-- Bryce

#include <stdio.h>
#include <std.h>
#include <sys/syscall.h>
#include <sys/proc.h>
#include <fcntl.h>
#include <time.h>

extern int notify( pid_t pid, pid_t tid, char * ev );

void event_handler( char * msg )
{
}

void go( int cnt, int id, pid_t him )
{
        if ( id )
                sleep( 1 );
        while ( --cnt >= 0 ) {
                notify( him, 0, "go" );
                sleep( 1 );
        }
}

 
int main( int argc, char * argv[] )
{
        int cnt = argc == 2 ? atoi( argv[1] ) : 0;
        struct time start, finish;
        int delta;
        int pid;
        
        if ( cnt < 1 ) {
                fprintf( stderr, "usage: %s <switches>\n", argv[0] );
                return 1;
        }

        notify_handler( event_handler );

        pid = fork();

        time_get( &start );
        if ( pid ) go( cnt, 0, pid ); /* parent */
        else go( cnt, 1, getppid() ); /* child */
        time_get( &finish );
        
        delta = 1000000*(finish.t_sec - start.t_sec)
                      + (finish.t_usec - start.t_usec);
        printf( "time = %d usec = %d usec/switch\n", delta, delta/cnt );
        
        return 0;
}
Received on Wed Nov 9 04:08:10 1994

This archive was generated by hypermail 2.1.8 : Thu Sep 22 2005 - 15:12:10 PDT