delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/03/13/03:11:07

Sender: vheyndri AT rug DOT ac DOT be
Message-Id: <3508E9EA.37D9@rug.ac.be>
Date: Fri, 13 Mar 1998 09:10:18 +0100
From: Vik Heyndrickx <Vik DOT Heyndrickx AT rug DOT ac DOT be>
Mime-Version: 1.0
To: Charles Sandmann <sandmann AT clio DOT rice DOT edu>
Cc: djgpp-workers AT delorie DOT com
Subject: Re: Temporary files considered unsafe
References: <9803121733 DOT AA16133 AT clio DOT rice DOT edu>

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019