CS452 - Real-Time Programming - Spring 2008

Lecture 26 - The Administrator


Questions & Comment

  1. Kernel hand-in

Server Structure

What this amounts to is

Proprietor

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

Proprietors versus Monitors

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

Generic Problem: Local Delay

Proprietor begins processing

Can other requests be processed? Possible strategies

  1. refusal
  2. siblings
  3. nested receive
  4. early reply

Administrator, Worker

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( );
    }
  }
}

Remote delay

      

Return to: