delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/03/13/05:09:39

Date: Fri, 13 Mar 1998 12:02:19 +0200 (EET)
From: Andris Pavenis <pavenis AT latnet DOT lv>
To: Vik Heyndrickx <Vik DOT Heyndrickx AT rug DOT ac DOT be>
cc: Charles Sandmann <sandmann AT clio DOT rice DOT edu>, djgpp-workers AT delorie DOT com
Subject: Re: Temporary files considered unsafe
In-Reply-To: <3508E9EA.37D9@rug.ac.be>
Message-ID: <Pine.GSO.3.96.980313115217.11303B-100000@sisenis>
MIME-Version: 1.0


On Fri, 13 Mar 1998, Vik Heyndrickx wrote:

> 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.
> 

About reading PIT timer0. It's very easy to mess it up if interrupts
are not disabled while reading. I have experienced such problem
when this is done concurrently from IRQ handler in TSR and user program.
Under Win95 or DOS it works Ok if I disable interrupts while reading timer
counter. How it will be under Windows NT and under DOSEMU in Linux? 
Will user have acceess to PIT ports in these systems. Perhaps
allowing direct access to these ports under Linux is dangerous
especially if such Linux kernel modification as RT-Linux is being
used, which extensively uses PIT timer (I'm using this modification).
Unfortunatelly I don't have currently DOSEMU installed under Linux so I cannot
test it immediatelly.

Andris Pavenis

- Raw text -


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