Mail Archives: djgpp-workers/1998/03/13/03:11:07
Charles Sandmann wrote:
> Things which are most likely to be unique:
>
> 1) The cs selector value
> 2) The base virtual address of the cs selector
> 3) PSP
> 4) clock at startup
>
> A combination (sum? xor?) of these might be best for the PID. There may
> be a pathaloigcal 1 in a million odds with something like this, but
> get a grip.
>
> The file name should be a unique PID plus some counter or something,
> which should work fine with 8.3 names
There is one possibility of occurance that is much higher than 1/M:
When a program is terminated and started again, e.g. from a batch or
script file, all four values you gave may be the same (with the least
possibility for the last one), of course yielding the same PID value.
This chance of occurance is important enough to be avoided.
For the clock value therefore the highest resolution is needed and this
means that we need to read the PIT-timer0 directly, and I don't know
whether that is such a good idea (although the port address is extremily
standard, some flavours of DOS that run more or less as part of a
protected OS (DosEMU?, NT?, 95?, OS/2?) may like it less that we do
that). And this is the only method to get so precise, since RDTSC is not
supported by 386's, most 486's and some 586's.
--
\ Vik /-_-_-_-_-_-_/
\___/ Heyndrickx /
\ /-_-_-_-_-_-_/
- Raw text -