What this amounts to is
Controls a resource
Provides mutual exclusion by having the only code that accesses the resource
Proprietor provides service to clients
Like a subroutine call to the client
| Monitor | Proprietor | |
| access to resource | localized | localized |
| service model | self-service | full-service |
| service structure | subroutine of client | independent task |
| priority | client | possibly different |
| address space | client | separate |
| permissions | client | possibly different |
| CPU | same | could be different |
Proprietor begins processing
Can other requests be processed? Possible strategies
Generalization of proprietor
Administrator maintains an array of records
Administrator works as he can on any one of the tasks.
Real administrators manage workers
Worker code
Worker( ) {
Initialize( );
// Find administrator Pid
// Avoid critical races
Send( administrator, requestForWork, workOrder );
FOREVER {
doWork( workOrder );
Send( administrator, workResult, workOrder );
}
}
Administrator code
Administrator( ) {
Initialize( );
// start up workers
// RegisterAs
FOREVER {
error = Receive( requester, request )
if ( request.type == CLIENT ) {
workOrder = {client = requester, request};
if ( workerAvailable ) Reply( worker, workOrder );
else enQueueWorkOrder( );
}
if ( request.type == WORKER ) {
Reply( request.client, request.result );
if ( ( client = clientWaiting( ) ) ) {
workOrder = {client, client.request};
Reply( worker = requester, workOrder );
} else putWorkerIntoUnemployedWorkerArray( );
}
}
}
Return to: