Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Dec 2000 07:08:25 -0700
From:      Chuck Paterson <cp@bsdi.com>
To:        Julian Elischer <julian@elischer.org>
Cc:        smp@FreeBSD.ORG
Subject:   Re: atomic increment? 
Message-ID:  <200012151408.eBFE8PF44272@berserker.bsdi.com>
In-Reply-To: Your message of "Fri, 15 Dec 2000 02:56:26 PST." <3A39F8DA.FD4CA0A5@elischer.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
Julian,

	This is not an argument against, or for, your request.

	I am sure I am starting to sound like a broken record,
but so be it. 

	Please remember that atomic ops are really expensive, at
least as expensive as acquiring a mutex.  In some cases, of which
X86 is not one, they are more expensive than just acquiring the
mutex.  Typically they are cheaper than acquiring and releasing a
mutex, in the case of X86 about half the cost.

	So, if there are more than two atomic operations and they
could have been protected by a single mutex, then the single mutex
really is slightly better alternative. At three operations the
mutex is a much better alternative.

	This is not an argument against, or for, your request.

Chuck


Julian Elischer wrote on: Fri, 15 Dec 2000 02:56:26 PST
}CAn we have an atomic increment and decrement primative?
}
}presently we get:
}
}.L565:
}        movl $1,%eax
}#APP
}        lock
}        addl %eax,4(%ebx)
}
}
}the movl is totally useless and it would be 
}an absolutly trivial addition..
}the question is;
}is there a religious reason we don't already have it?
}-- 
}      __--_|\  Julian Elischer
}     /       \ julian@elischer.org
}    (   OZ    ) World tour 2000
}---> X_.---._/  presently in:  Budapest
}            v
}
}
}To Unsubscribe: send mail to majordomo@FreeBSD.org
}with "unsubscribe freebsd-smp" in the body of the message



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-smp" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200012151408.eBFE8PF44272>