title: Shared memory is executing so fast?
body: <p>what i am trying to do in kernel :</p>
  
  <pre><code>while (TRUE)
  {
      //DbgPrintEx(0, 0, "First loop is running \n");
      ReadSharedMemory();
  
  
          if (!(PCHAR)SharedSection == NULL &amp;&amp; strcmp((PCHAR)SharedSection, "Read") == 0)
          {
              DbgPrintEx(0, 0, "Read looping \n");
  
              RtlZeroMemory(SharedSection, sizeof(SharedSection));
              break;
          }
          else if (!(PCHAR)SharedSection == NULL &amp;&amp; strcmp((PCHAR)SharedSection, "Write") == 0)
          {
              DbgPrintEx(0, 0, "Write looping \n");
              RtlZeroMemory(SharedSection, sizeof(SharedSection));
              break;
          }
      LARGE_INTEGER Timeout;
      Timeout.QuadPart = RELATIVE(SECONDS(1));
      KeDelayExecutionThread(KernelMode, FALSE, &amp;Timeout);
  }
  </code></pre>
  
  <p>and in user mode : </p>
  
  <pre><code>    auto pBufW = (char*)MapViewOfFile(hMapFileW, FILE_MAP_WRITE, 0, 0, 4096);
  
  
  RtlCopyMemory(pBufW, "Read", 4);
  
  printf("message has been sent to kernel! \n");
  
  
  UnmapViewOfFile(pBufW);
  
  Sleep(10);
  
  auto pBfW = (char*)MapViewOfFile(hMapFileW, FILE_MAP_WRITE, 0, 0, 4096);
  
  
  RtlCopyMemory(pBfW, "Write", 5);
  
  printf("message has been sent to kernel! \n");
  
  
  UnmapViewOfFile(pBfW);
  </code></pre>
  
  <p>i can't figure it out why when i call Read and Write . only Write execute i have tried it multiple times and its always doing this + i have tried to add a sleep(1); in my user mode (thought it was executing real fast).</p>
  
  <p>basically i just need them to execute normally like Read should be executed first then Write .</p>