[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Guidelines for using Resources

Back in 1986, we developed a fine-grained Flavors-based simulation of
the operation of circuit-switched networks. "Fine-grained" means that
every call was represented by a Flavors instance during the life of
the call; these instances had a dozen slots, referring to network
paths, hence, switch and trunk group objects. To avoid the overhead of
instance allocation and reclamation, we used a call resource. 

In early 1989, we noticed that after certain "reset" operations, our
call resource ignored the old call shells and started creating new
ones.  Yes, I did find it was our bug but I also discovered that there
was some subtlety in using resources and decided upon a simple
approach to give the programmer maximum control over resource
behavior. Below are some guidelines taken from our 1989 system
documentation. Properly generalized, they may be of value.
  When a resource manages instances of a flavor, there is some
  complexity in initializing an allocated instance.  One has defaults,
  init plists, and make-instance methods active when a new structure is
  created and always has the :initializer form of the resource itself.
  To avoid this pestilence, I have adopted this nine-point approach: (1)
  all flavor instance slots default to NIL, (2) the call flavor has a
  :CONSTRUCTOR, MAKE-CALL, with no arguments, (3) the call resource has
  no parameters, (4) the resource constructor form is (MAKE-CALL), (5)
  the resource has no :INITIALIZER, (6) its :DEINITIALIZER sets all
  instance slots to NIL, (7) the resource has no :MATCHER, (8) one
  function, REUSE-OR-CREATE-A-CALL, makes a new resource instance by
  calling ALLOCATE-RESOURCE and setting all the slot values, and (9) no
  other function invokes (ALLOCATE-RESOURCE 'CALL ... ).

-- Bud Frawley