Python Manual User Manual

Page of 124
Process Identity
23
id1 = netsvc.uniqueId(netsvc.ID_SHORT_FORMAT,"$SID?")
The short format identifier is suitable for use within the context of a single process. Duplicates would
only be encounterd if the incremental count of the number of identifiers exceeded what can be stored
within a 32 bit integer value. If this were to occur, the counter would wrap around to zero and conflicts
might thus arise if the existing identifier were still active.
The short format identifier could also be used within the context of a constrained distributed applica-
tion provided that the nature of the application is such that knowlege of what the identifier is associated
with is always discarded when the process the identifier is bound to is destroyed. This would be nec-
essary, as the identifier could be reused if the process id was reused at some latter point.
If a better gaurantee of uniqueness over time is required, the long format identifier should be used. In
this case, the identifier also records the time at which the first identifier was generated by the process,
as well as a time delta as to when that particular identifier was generated. Incorporation of time infor-
mation avoids problems with the incremental counter overflowing and reuse of the same process id at
a latter point in time.
Process Identity
A further feature which is useful in distributed applications is a way of identifying specific processes.
Such an identifier can be generated by combining the name of the host and the process id into a single
string. To facilitate this, the function "
processIdentity()
" is provided.
identity = netsvc.processIdentity()