You're just simulating the processes, correct? Ok:
Code:
int main ( void )
{
struct process p1, p2, p3;
init( &p1 );
init( &p2 );
init( &p3 );
while( 1 ) /*each loop is a 'time slice'*/
{
output( p1.status );
output( p2.status );
output( p3.status );
changestatus( &p1 );
changestatus( &p2 );
changestatus( &p3 );
}
return 0;
}
After all, this is just a simulation. And basicly, this is exactly how "pseudo-parallel" works. This is exactly what multi threading does. Each thread has a portion of the time slice. They're allowed to do N-time amount of work per time cycle. At the end of the timeslice, the result is visible and it looks as though it all happened at once.
Quzah.