main( ) {
Tid server;
int evtType, data;
Receive( &server, &evtType, ... );
// Other initialization
Reply( server, ... );
FOREVER {
data = AwaitEvent( evtType );
Send( server, &data, ... );
}
}
main( ) {
notifier = Create( HIGHEST, ... );
// other initialization
Send( notifier, &evtType, ... );
FOREVER {
Receive( &requester, &request, ... );
switch ( request.type ) {
case NOTIFIER:
data = request.data;
Reply( notifier );
break;
case CLIENT:
...
}
}
}
Related to three free choices above.
Strategy 1: Kernel does it all
movs)Return value contains the volatile data
Strategy 2: Notifier does most of it
The second disbling of interrupts seems unnecessary. Why do we do it?
int Time( )
int Delay( int ticks )
int DelayUntil( int ticks )
main( ) {
notifier = Create( HIGHEST, ... );
time = 0
Send( notifier, &evtType, ... );
FOREVER {
Receive( &requester, &request, ... );
switch ( request.type ) {
case NOTIFIER:
time++;
Reply( notifier, ... );
break;
case TIME_REQUEST:
Reply( requester, time,... )
...
}
}
}
Comments:
Return to: