Shuttles, Portals, and DTLBs (see
) are system
abstractions, and are able to move around. Consequently, abstract
resource containers (AbsCompResources) provide a method
make_available which uses a relocation table so that system code
may request to one of the system containers to make a particular
resource unit available at the local node. These containers use their
own identifier and a sequence number to create identifiers for
contained resource units.
They are arranged, as physical resources are, as recursive containers
being the Node the top-level container (see
figure
).
The block allocator is not given to the container (it will be given to
constructors in each subclass of AbsCompResource, instantiated for
the contained element class).
<Off system server. >= (U->)
// A system resource container.
//
class off_AbsCompResource : public off_CompResource {
private:
<Off private members for sequencing objects. >
protected:
<Off protected methods for sequencing objects. >
// Constructs a system resource container.
off_AbsCompResource(const off_Protection &p,
const off_prtl_id_t &domain,
const off_prtl_id_t &id,
const off_magic_t magic ) :
off_CompResource(p,domain,id,magic)
{
<Off initialization for sequencing objects. >
}
};
Definesoff_AbsCompResource(links are to index).
<Off system server dependencies. >= (U->) #include <klib/ids.h> // for off_prtl_id_t et al. #include <klib/prot.h> // for off_Protection et al. #include <klib/CompResource.h> // for CompResource
<Off system resource. >= (U->)
// A system resource unit. It's relocatable by nature.
//
class off_AbsResUnit : public off_ResUnit {
protected:
// Constructs and abstract resource unit.
off_AbsResUnit(const off_Protection &p, const off_prtl_id_t &domain,
const off_id_t &id, const off_magic_t magic,
off_AbsCompResource *container ) :
off_ResUnit(p,domain,id,magic,container)
{;}
// Pre-initializes an abstract resource unit.
off_AbsResUnit(const off_id_t &id,
const off_magic_t magic,
off_AbsCompResource *container ) :
off_ResUnit(id,magic,container)
{;}
// Creates an already pre-initialized abstract resource unit.
off_AbsResUnit(const off_Protection &p, const off_prtl_id_t &domain ):
off_ResUnit(p,domain)
{;}
};
Definesoff_AbsResUnit(links are to index).
<Off system resource dependencies. >= (U->) #include <klib/ids.h> // for off_id_t et al. #include <klib/prot.h> // for off_Protection #include <klib/ResUnit.h> // for off_ResUnit #include <klib/AbsCompResource.h> // for off_AbsCompResource
\subsection{Abstract resources for plain users}
The wrappers for abstract resources are so simple that we will not discuss them.
<Off system server for users. >= (U->)
class off_uAbsCompResource : public off_uCompResource {
public:
};
Definesoff_uAbsCompResource(links are to index).
<Off system resource for users. >= (U->)
class off_uAbsResUnit : public off_uResUnit {
public:
off_id_t get_id(void) const;
};
Definesoff_uAbsResUnit(links are to index).
\subsection{Abstract resources \cpp{} source files}
Container definitions can be found in klib/AbsCompResource.h and
klib/AbsCompResource.C.
<AbsCompResource.h*>= <Read the literate code instead warning. > #ifndef __OFF_ABS_COMP_RESOURCE_H #define __OFF_ABS_COMP_RESOURCE_H 1 <Off system server dependencies. > #ifdef __KERNEL__ <Off system server. > #endif // __KERNEL__ <Off system server for users. > #endif // __OFF_ABS_COMP_RESOURCE_H
<AbsCompResource.C*>= <Read the literate code instead warning. > #include <klib/AbsCompResource.h> // Exported interface
Resource units can be found at klib/AbsResUnit.h and
klib/AbsResUnit.C.
<AbsResUnit.h*>= <Read the literate code instead warning. > #ifndef __OFF_ABS_RES_UNIT_H #define __OFF_ABS_RES_UNIT_H <Off system resource dependencies. > #ifdef __KERNEL__ <Off system resource. > #endif // __KERNEL__ <Off system resource for users. > #endif // __OFF_ABS_RES_UNIT_H
<AbsResUnit.C*>= <Read the literate code instead warning. > #include <klib/AbsResUnit.h> // Exported interface