Re: doubt on atomic increment operation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02:28 Sat 13 Sep     , Sri Ram K Vemulpali wrote:
> Hi all,
> 
> what is the difference between incb %al and incb $i. According to my
> knowledge if you have  some thing like "i++" (in c) then it is translated in
> to movw $i %ebx, incw %ebx, movw %ebx $i. My question, when I explicitly
> give variable as operand to increment in assembly like "incb $i", then will
> that instruction execution cycle involves copying the contents from memory
> to register and increment and copy back to memory. Is this hidden
> and Assembler takes care of it when writing to image file (machine codes or
> elf). Another question: Is incb %al is atomic operation, I mean, Is
> instruction execution cycle is interrupted by an event or a process.
> Thank you.

I think it is atomic as long as only one CPU accesses it. But The problem is
that on systems with more than one CPU you do not know that happens. There is
a "lock prefix" which makes some (all???) instructions atomic.
	-Michi
-- 
programing a layer 3+4 network protocol for mesh networks
see http://michaelblizek.twilightparadox.com


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux