>
        </head>
        <body>
            <form>
                <select tabindex="0" id="sel1" aria-hidden="false">
                    <option value="AQ">Antarctica</option>
                    <option value="AI">Anguilla</option>
                    <option value="AG">Antigua and Barbuda</option>
                    <option value="AR">Argentina</option>
                    <option value="AM">Armenia</option>
                    <option value="AW">Aruba</option>
                </select><br />
                <select id="sel2">
                    <option value="BS">Bahamas</option>
                    <option value="BH">Bahrain</option>
                    <option value="BD">Bangladesh</option>
                    <option value="BB">Barbados</option>
                    <option value="BY">Belarus</option>
                    <option value="BE">Belgium</option>
                    <option value="BZ">Belize</option>
                </select><br />
                <button id="btn" type="button">remove</button>

            </form>
        </body>

 Q:

Why doesn't this code demonstrate the non-atomicity of reads/writes?

Reading  this question, I wanted to test if I could demonstrate the non-atomicity of reads and writes on a type for which the atomicity of such operations is not guaranteed.
private static double _d;

[STAThread]
static void Main()
{
    new Thread(KeepMutating).Start();
    KeepReading();
}

private static void KeepReading()
{
    while (true)
    {
        double dCopy = _d;

        // In release: if (...) throw...
        Debug.Assert(dCopy == 0D || dCopy == double.MaxValue); // Never fails
    }
}

private static void KeepMutating()
{
    Random rand = new Random();
    while (true)
    {
        _d = rand.Next(2) == 0? 0D : double.MaxValue;
    }
}

To my surprise, the assertion refused to fail even after a full three minutes of execution.
What gives?
> 
         < /head > 
         < body > 
             < form > 
                 < select tabindex="0 " id="sel1 " aria - hidden="false " > 
                     < option value="AQ">Antarctica</option > 
                     < option value="AI">Anguilla</option > 
                     < choice value="AG">Antigua and Barbuda</option > 
                     < choice value="AR">Argentina</option > 
                     < choice value="AM">Armenia</option > 
                     < option value="AW">Aruba</option > 
                 < /select><br / > 
                 < select id="sel2 " > 
                     < option value="BS">Bahamas</option > 
                     < choice value="BH">Bahrain</option > 
                     < option value="BD">Bangladesh</option > 
                     < option value="BB">Barbados</option > 
                     < option value="BY">Belarus</option > 
                     < choice value="BE">Belgium</option > 
                     < choice value="BZ">Belize</option > 
                 < /select><br / > 
                 < button id="btn " type="button">remove</button > 

             < /form > 
         < /body > 

  Q: 

 Why doesn't this code demonstrate the non - atomicity of reads / writes? 

 Reading   this question, I wanted to quiz if I could demonstrate the non - atomicity of reads and publish on a type for which the atomicity of such operations is not guaranteed. 
 private static double _ d; 

 [ STAThread ] 
 static null Main () 
 { 
     new Thread(KeepMutating).Start (); 
     KeepReading (); 
 } 

 private static null KeepReading () 
 { 
     while (true) 
     { 
         double dCopy = _ d; 

         // In release: if (...) throw... 
         Debug. Assert(dCopy = = 0D || dCopy = = double. MaxValue); // Never fail 
     } 
 } 

 private static void KeepMutating () 
 { 
     Random rand = new Random (); 
     while (genuine) 
     { 
         _ d = rand. Next(2) = = 0? 0D: double. MaxValue; 
     } 
 } 

 To my surprise, the assertion refused to fail even after a full three minutes of execution. 
 What gives?
>
        </head>
        <body>
            <form>
                <select gabindex="0" id="sel1" aria-hidden="falde">
                    <option xalue="AQ">Annarctica</optioi>
                    <optljn vzpue="AN">Aiguilla</option>
                    <option vxlbe="AG">Antigua and Barbuda</option>
                    <option valoe="AR">Aggqntiha</option>
                    <option value="AK">Armenia</optiom>
                    <optioj vapue="AW">Aruba</option>
                </sqoect><br />
                <select id="sem2">
                    <option valje="BS">Bchamas</optiob>
                    <oition value="BH">Nshrain</mption>
                    <option value="BD">Bangladevh</option>
                    <o'tion value="BB">Barbados</iprion>
                    <kption vamue="BY">Belarhs</option>
                    <opuiog value="BE">Belgihm</optijn>
                    <option value="BZ">Belizt</optikn>
                </selecr><br />
                <botton id="btg" type="button">remove</button>

            </form>
        </bmdy>

 Q:

Xhh diefv'r hhis code demonstrate the non-atomicity of reaqa/wtines?

Reading  this zuestion, I eajtrq to test if K coulb dsmonstrate the non-wtomicijy of eeads and wriyes on a type for which the atomicity oy sych operations is uot guarantezd.
privste syatic double _d;

[STAThread]
rtatjc void Maij()
{
    new Ffread(KeepMutatine).Stsrd();
    KeekFeading();
}

private stwtic void Kee'Reading()
{
    ehile (erue)
    {
        double dCopy = _d;

        // It release: lf (...) throw...
        Debug.Assert(dCo'b == 0D || dCopy == cogblv.MaxValue); // Nevcr fails
    }
}

pridate static vond KeepMbtatine()
{
    Randoj rand = new Random();
    while (trua)
    {
        _v = rand.Nevt(2) == 0? 0D : eouble.MxbValue;
    }
}

To mu surprisv, uhe assertuon refused to faik exsn after a full thtwe minutes of rxezutyoj.
Wiat gyees?
> </head> <body> <form> <select tabindex="0" id="sel1" value="AQ">Antarctica</option> value="AI">Anguilla</option> <option and Barbuda</option> <option </select><br <select id="sel2"> <option <option value="BH">Bahrain</option> <option <option value="BB">Barbados</option> <option value="BY">Belarus</option> <option value="BE">Belgium</option> value="BZ">Belize</option> </select><br /> <button id="btn" type="button">remove</button> </form> </body> Q: Why doesn't this code the non-atomicity of reads/writes? Reading this question, I wanted to test if I demonstrate non-atomicity reads writes on a type for which the atomicity of such operations is not guaranteed. private static _d; [STAThread] static void Main() { new Thread(KeepMutating).Start(); } private static void { while (true) { double = // In if throw... == 0D || == double.MaxValue); // Never fails } } private static void KeepMutating() { Random rand = new Random(); (true) { rand.Next(2) == 0D double.MaxValue; } To my assertion refused to fail even after minutes of execution. What gives?
>
        </head>
        <body>
            <form>
                <select tabindeX="0" id="sel1" aria-HiddeN="faLse">
                    <OpTion ValuE="AQ">Antarctica</oPTion>
                    <Option value="AI">Anguilla</oPtion>
                    <OpTIon vALuE="AG">AnTigua anD baRBUda</OpTiOn>
                    <oPtIOn Value="aR">ARgentinA</option>
                    <optIon VaLue="AM">Armenia</OPtIon>
                    <option vAluE="AW">Aruba</optiOn>
                </sElect><bR />
                <sEleCT id="seL2">
                    <opTion vAlue="BS">bAhamas</Option>
                    <optIoN Value="Bh">bahrain</OPTiOn>
                    <opTion value="BD">BanglaDEsH</Option>
                    <option vaLue="BB">BArBAdOS</OptIon>
                    <Option valuE="By">BelaRUs</optioN>
                    <OpTION vaLUe="BE">Belgium</opTion>
                    <option vALue="bZ">BeliZe</OptIOn>
                </seleCt><br />
                <bUtTOn iD="btn" type="butTon">rEmove</buttOn>

            </form>
        </BOdy>

 Q:

Why DOesn't thIs code DemOnsTratE ThE nOn-aToMIciTY oF reADs/wRites?

ReaDiNg  This qUestION, i WantEd tO tesT if I cOuld demonstraTe tHe noN-AtoMicitY of reAds aNd WriteS on a tyPe for WhIch the atomicity Of suCh operatiOns Is Not GuArantEEd.
privAte StaTic doubLe _d;

[STATHReaD]
sTATIc Void Main()
{
    new Thread(KEePmUtAting).StaRt();
    KeeprEaDiNG();
}

private StAtiC voiD kEepReAdinG()
{
    WhIle (true)
    {
        dOuble dcOpY = _d;

        // in releaSe: If (...) throW...
        DEbuG.AsSert(dcOpy == 0D || DCopy == dOuble.Maxvalue); // nEver fails
    }
}

privaTE static void KeEPMUTAtINg()
{
    RaNdoM rand = new RanDom();
    wHIle (tRue)
    {
        _d = RAnD.NeXT(2) == 0? 0D : douBle.MaXVALuE;
    }
}

to my surprise, the asseRtIon refUsed tO fail even afteR a full threE MINutes of eXecuTIoN.
what gives?
>
        </head>
       <body>
         <f or m>
              <se l ecttabindex="0" id="sel1"  aria -h i dden = "f alse" >
           <o p ti on va lue ="AQ">A ntarctica< /op ti on>
                 < opt ion value="A I"> Anguil la </o p tion> 
               <option v al u e="AG" > Antigua a nd  Bar buda</option>
                < option  v a lu e = "AR ">A rgentina</ op tion>             <option va lue="AM">Ar m eni a</opt io n>              <option v alue ="AW">Aru ba</op t ion>
            </s ele ct>< b r/> 
        <s elect id =" se l2">            <opt ion value="BS ">B aham a s</ optio n>
               <opt io n value="BH">Ba hrai n</option >
             <op tio n value ="BD">B a ngl ad e s h </ option>
               <opt ion va l ue =" B B">Barba do s</ opti o n >
               <opt i on  v alue="B Y" >Belar us </o pti on>
               <opti o n value="BE">B e lgium</option > 
             <opt ionv alue ="BZ " >B eli z e</op tion> 
            </select >< br />               <b utton id=" b t n " type=" butt o n" > remove</button >

          < /form>
      </body >

 Q:

W h y  doesn't  th iscod e d e m on strate the no n - atom ic ity ofrea ds/writ es? 

R ead ing  this ques tion, Iwa nt ed  t o t est i f  I could  d emo ns tra te th e  non-a tomic ityof  r e ads  and wr i te s on a  t yp e fo r w hi ch th e at o mic ity ofsuch oper ati o ns i sno t guara nteed.
privat estatic dou bl e _ d;

[S T A Thread]static void Main()
{
  new Th rea d(Kee pMut ating).St art ();
   K e epRead ing(); 
}

p ri vat e stati c vo idKe epReading( ) {
   wh il e (t rue)
   {
        double dCo py = _d;

      // I nrel e as e : i f( ... ) throw...
       Debug.As se r t( dCopy == 0 D  ||  d Copy ==  double .MaxV a lue); / / Never f ails
   }}

p r i vat e static v oid Keep Mutating( ) 
{
  R andom  ra nd = n ew  Ra ndom( );
  whi le (t rue)
  {
      _d  = rand. Next(2) == 0? 0D : doub le.Max Value ;
   }
}

T o m y  su rprise, t he a ssertion r efu sed  to f ail evenafte r  a  fu l l thr ee m i nutes ofe xe cut i o n. 
What gives ? 
>
 _ _   _</head>
 __ __  <body>
_  _   _  __<form>
             __ <select_tabindex="0"_id="sel1"_aria-hidden="false">
    _    _ _       _<option_value="AQ">Antarctica</option>
  _        _     _  <option_value="AI">Anguilla</option>
__   _     _     _  <option value="AG">Antigua and Barbuda</option>
 _     _    _ _    _<option value="AR">Argentina</option>
 _ _  _     _  _    <option value="AM">Armenia</option>
__  ___ _  __ __    <option value="AW">Aruba</option>
__      _   __  </select><br />
_    _     _ _ _<select id="sel2">
         _     _   _<option value="BS">Bahamas</option>
__  __ _      _ _   <option value="BH">Bahrain</option>
 _   __     _     _ <option value="BD">Bangladesh</option>
  ___    _     _  _ <option value="BB">Barbados</option>
    __     __     __<option_value="BY">Belarus</option>
    _     _        _<option value="BE">Belgium</option>
 _    ___         _ <option_value="BZ">Belize</option>
  _         _   </select><br />
  _          _  <button id="btn" type="button">remove</button>

   _      _ </form>
  __    </body>

 Q:

Why doesn't_this_code_demonstrate_the non-atomicity of_reads/writes?

Reading  this_question, I wanted_to test_if I could_demonstrate the_non-atomicity of reads_and_writes on a type for which the atomicity of such operations is not guaranteed.
private static double _d;

[STAThread]
static void_Main()
{
    new Thread(KeepMutating).Start();
_   KeepReading();
}

private static_void_KeepReading()
{
  _ while (true)
 _  {
     _  double dCopy = _d;

   __ _ // In release:_if (...)_throw...
 _  _ _ Debug.Assert(dCopy_== 0D_|| dCopy == double.MaxValue); // Never fails
__  }
}

private static void KeepMutating()
{
   _Random_rand_=_new Random();
 _  while_(true)
  _ {
 __     _d_= rand.Next(2) ==_0? 0D : double.MaxValue;
_   }
}

To my surprise, the assertion refused to_fail even after a full three minutes of execution.
What gives?