httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: one word syncronize
Date Thu, 14 Jun 2007 16:29:22 GMT
On 14/06/07, Dmytro Fedonin <Dmytro.Fedonin@sun.com> wrote:
> Hi all,
>
> Looking through 'server/mpm/worker/worker.c' I have found such a
> combination of TODO/FIXME comments:
> 1)
> /* TODO: requests_this_child should be synchronized - aaron */
> if (requests_this_child <= 0) {
> 2)
> requests_this_child--; /* FIXME: should be synchronized - aaron */
>
> And I can not see any point here. These are one word CPU operations,
> thus there is no way to preempt inside this kind of operation. So, one
> CPU is safe by nature of basic operation. If we have several CPUs they
> will synchronize caches any way, thus we will never get inconsistent
> state here. We can only lose time trying to synchronize it in code. Am I
> not right?

The decrement operation may be handled as load, decrement, store on
some architectures, so can be pre-empted by a different CPU.

Also some hardware architectures (e.g. HP Alpha) have an unusual
memory model. One CPU may see memory updates in a different order from
another CPU. Software that relies on the updates being seen across all
CPUs must use the appropriate memory synchronisation instructions.

I don't know if these considerations apply to this code.

> PS My assumptions are several threads of the same process are dealing
> with one word of common memory.
>
> --
> Best regards,
> Dmytro
>

Mime
View raw message