Group functions allow you to organize processes into groups so that they can be treated as a single entity.
Group
A group is a collection of related processes that share a common set of resources. A process is an identifiable unit of execution.
A group is referred to by a handle. The handle may be a pointer, offset, index or any other unique identifier of the group.
Group Member
A group member is a process, uniquely identifiable by its DE and PID combination.
The members of a group work together to perform a common task, through the use of shared resources. Being a member of a group requires participation in group activities.
Membership
In DaCS membership is by invitation only. A process cannot declare itself a member of a group; it must be added by the group creator. This works on the basis that the creator of a group resource knows which processes will be participating in the use of the resource. The member being added to a group must also cooperate by accepting membership, and must make a request to leave a group.
Group Leader/Owner
Groups can only be created on an HE. The HE, by creating a group, implicitly becomes the group owner. This does not imply membership or participation in the group. The group owner is responsible for adding and removing members from the group. It is also responsible for allocating resources to be shared with the group. When the group is no longer needed, and all members have left, the owner then has the responsibility of destroying the group.
Barriers
Certain resources require a group in order to work properly. One such resource is a barrier. Without a known and fixed set of participants barriers cannot work properly. For this reason the concept of groups is necessary.
Barriers provide synchronization of a fixed number of participants. Groups are required in order for the barrier functionality to properly track barrier quora. Barriers are an implied resource associated with being in a group; they are not allocated, initialized, shared or destroyed.
Group operations can be classified into three stages: initialization, operation and termination. An example showing the services used in these stages follows.
Owner | Members |
---|---|
Create the group:dacs_group_init( &group, flags );This creates an opaque group handle. The handle will then used by all members during group operations. |
|
Add members (identified by DE and PID) to the group,
one by one:dacs_group_add_member( de, pid, group ); |
|
Accept their addition, individually:dacs_group_accept( de, pid, group ); |
|
(Optional) Add itself to the group:dacs_group_add_member( DACS_DE_SELF, DACS_PID_SELF, group );(This does not require an accept response.) |
|
Close the initialization of the group:dacs_group_close( group ); |
Group operations are controlled by barriers. These are used to synchronize the processing by different members of the group. If it is necessary to ensure that no member enters a new stage of processing before other members are ready then each member must make a wait call. Each member will then be blocked until all members have made this call. When the last member is accounted for, all members will be released.
Owner | Members |
---|---|
Wait on barrier, individually:dacs_barrier_wait( group ); |