tk_cre_res

Create Resource Group

[C Language Interface]

ID resid = tk_cre_res ( ) ;

[Parameters]

None

[Return Parameters]

ID resid Resource ID or Error Code

[Error Codes]

E_OK qNormal completion

E_LIMIT Number of resource groups exceeds the system limit

E_NOMEM Insufficient memory (memory for control block cannot be allocated)

[Description]

Creates a new resource group, assigning to it a resource control block and resource ID.

Resource IDs are assigned in common for the entire system. A separate resource control block is created for each subsystem (see Figure 4.15).



Figure 4.15: Subsystems and Resource Groups

In some cases a new subsystem will be defined when a resource group is already created. Even in such a case, it is necessary to create a resource control block of an already existing resource group for the newly registered subsystem. In other words, there may be cases where resource control block creation must be performed by tk_def_ssy. For example, if a new subsystem ID is defined in a situation like that shown in Figure 4.15, resource control blocks with resource IDs #1, #2, and #3 must automatically be created for the subsystem.

[Additional Notes]

A Resource ID is in some cases used also as a logical spacE_ID (lsid). Resource IDs should therefore be assigned values that can be used directly as logical spacE_IDs or that can easily be converted for use as logical spacE_IDs.

A system resource group always exists as a special resource group. One system resource group always exists, moreover, from the time the system boots, without waiting for creation by tk_cre_res. The system resource group cannot be deleted. Other than the requirement that it must always exist, a system resource group is no di.erent from other resource groups.

Resource control block creation might be implemented in either of the following ways.

(A) At the time of subsystem definition (tk_def_ssy), create as many resource control blocks as the maximum number of resource groups, and use tk_cre_res simply to assign them.

(B) Use tk_cre_res to create as many resource control blocks as there are subsystems and assign them.

Since the speci.cation requires clearing a resource control block to 0 when it is initially created, the timing of this clearing to 0 di.ers between methods (A) and (B). This difference should not have much of an effect; but since method (A) will have fewer cases of clearing to 0, subsystems must be implemented assuming (A). Method (A) is also recommended for the OS implementation.

Comments