From: sandmann AT clio DOT rice DOT edu (Charles Sandmann) Message-Id: <10108141649.AA14707@clio.rice.edu> Subject: Re: Selector Exhaustion To: pavenis AT lanet DOT lv Date: Tue, 14 Aug 2001 11:49:52 -0500 (CDT) Cc: djgpp-workers AT delorie DOT com In-Reply-To: <3B797671.5443.399C9F@localhost> from "pavenis@lanet.lv" at Aug 14, 2001 07:05:21 PM X-Mailer: ELM [version 2.5 PL2] Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > I tested that on PIII 700 (about 2ms to scan descriptors twice and 10 > ms to run a executable) and on a slow 486DX2 66 (about 15ms and > 170 ms). So if we can cut the number we scan by some rule (I'm sure we can cut it by a factor of 100 or so) then it's negligible. > Tried to put LAR into loop (inline assembler) and got time down from > 1 ms to about 0.75 ms Not worth it then. > Perhaps we could use _my_ds() % 7 as start value That or the return value from the idea below. > We can also allocate 2 descriptors before and after spawning > executable and free all between that was free before spawning > (it's more safe as doing it blindly) This was exactly my thoughts, but we don't know how far to go for the map (I'd like to avoid the entire 8192 calls). How's this: 1) Allocate a selector 2) Scan the values higher than this value, create a map. (only if not NT, maybe other tests). 3) Do the exec call 4) Allocate selector 2 5) If map: If selector 2 in map range wonderful. If not increase size of adjustable number for next time. Free selectors via map. If no map: free selectors between the two allocated values. Other things I've found: You can use get_descriptor on WinNT and 2K to get the entire thing (I planned to do a full map scan of the 8192 and log all diffs to try and find if there is a leakage of selectors for allocation of DOS memory blocks as a diagnostic/learning test) WinNT and 2K show selectors not present if they have never been used (so you can get an idea of the upper limit touched and don't need to waste time going higher).