Re: MSDN volatile sample



Sleep(0) is causing kernel trip anyway (lots of them in the usual case,
since it's called in a loop), compared to only 2 for WFSO/SetEvent pair. And
this loop doesn't allow to stop processor clock to reduce CPU power. When I
see an application comsuming 100%, that gives me doubts about its general
quality, and I get rid of it.

"Alex Blekhman" <tkfx.REMOVE@xxxxxxxxx> wrote in message
news:uFdF0$WSIHA.3940@xxxxxxxxxxxxxxxxxxxxxxx
"Alexander Grigoriev" wrote:
Anyway, the sample illustrates very poor synchronization practice which
should not be followed. Proper signalling using events makes volatile
qualifier unnecessary.

There is nothing wrong with this technique if it used correctly.
Synchronization with events or other kernel objects brings the high price
of user space to kernel space trip. It is not uncommon that you need to
synchronize within single process only. In these cases volatile variables
may provide adequate solution.

Alex



.



Relevant Pages

  • Re: bug in 2.6.22-rc2: loop mount limited to one single iso image
    ... > In kernel 2.6.22-rc2 the number of available loop mounts is reduced ... > Kernel 2.6.20.11 does not show that problem. ... sudo mount -o loop cd1.iso m1 ... commit 705962ccc9d21a08b74b6b6e1d3cf10f98968a67 ...
    (Linux-Kernel)
  • Re: [PATCH] loopback device cant act as its backing store
    ... Your patch addresses direct loop0-on-loop0 recursion, ... his case we simply stacked loop deveces too deep. ... While playing around with loop mounts on kernel 2.6.9 I managed to get ...
    (Linux-Kernel)
  • Re: Help with a driver im writing.
    ... Tasklets don't interfere each other on single CPU with non-preemeptable ... put it into a critical section with interrupt off anyway. ... > It's running on kernel version 2.6.14 single intel cpu, ... > My write routine is a loop in which i shift data out to the ...
    (comp.os.linux.development.system)
  • Re: [BUG] usb/core/hub.c loops forever on resume from ram due to bluetooth
    ... The oddball thing here is that on a UP machine with a UP kernel, ... After moving the drive to a dual-core machine and rebuilding ... By restricting iterations on the unbounded loop ... Greg / Marcel: any words of wisdom? ...
    (Linux-Kernel)
  • A few questions about nbd
    ... For that nbd seems like ... Later I will consider a kernel ... server on the same machine can cause deadlocks. ... while loop in the kernel. ...
    (comp.os.linux.development.system)