Subject: "Hyperthreading" problems
From: Stéphane Donzé <[email-masked]>
To: <[email-masked]>
Cc: <[email-masked]>
Date: Fri, 24 Dec 2004 09:01:17 +0100

Hi,

we have encountered random hangs and crashes in cygwin (see output of
cygcheck attached to this message) on a dual-processor server running
Windows Server 2003. IMHO, the so-called "hyperthreading problems" reported
recently on this mailing list just have nothing to do with hyperthreading,
but are more generally related to multi-processor issues.
I used the following test (found on this mailing list archive, posted 6 Apr
2004 by Chuck McDevitt):

<QUOTE>

#! /bin/ksh
mypath=$(pwd)
while [[ ! -z $mypath ]]
do
 mypath=$(pwd)
 if [[ -z $mypath ]]
 then
  echo "Test Failed......Path is empty"
 fi
done

in one shell, while running a large make in another, it will fail in a
variety of ways.
Under pdksh, it sometimes exits the test because "mypath" is empty, or it
core dumps, or hangs, or gives error messages.
Under bash, it hangs, crashes, or gives error messages (haven't seen it
exit the loop, but I didn't try long with bash).
By "hang", I mean the shell stops using CPU time, and become
non-responsive, and can only be stopped by killing the process.
The problem does not occur if hyperthreading is turned off.

</QUOTE>

When booting the server in single CPU (/ONECPU in boot.ini) the problem does
not appear.
More interesting, if I lock my bash session on a particular CPU by using
SetProcessAffinityMask, so that all child processes created by this shell
are locked on one CPU, the problem does not appear.
It seems that the bug has something to do with a same Cygwin process being
swapped from one CPU to another when running a piece of code that is not
locked properly (i.e. missing EnterCriticalSection or something like that).

Regards,
Stephane
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/