Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Dec 2000 10:47:10 -0700
From:      Chuck Paterson <cp@bsdi.com>
To:        Julian Elischer <julian@elischer.org>
Cc:        smp@FreeBSD.ORG
Subject:   Re: atomic increment? 
Message-ID:  <200012151747.eBFHlAF67343@berserker.bsdi.com>
In-Reply-To: Your message of "Fri, 15 Dec 2000 08:26:24 PST." <3A3A4630.1905D5D@elischer.org> 

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

}
}> 
}>         Please remember that atomic ops are really expensive, at
}> least as expensive as acquiring a mutex.
}
}That depends on what you wnat to do with them!
}If I wnat nothing but to write a 1 to a location, and know at teh same
}time whether the previous contents was a 1 or a 0 then most machines 
}allow that to be done pretty cheaply (2 memory cycles - overlap)
}A full blown mutex is at least that.. (at a minimum).
}

2 locked memory cycles which are a huge number of ordinary instructions.
A full blown mutex enter is the same price.

}I DO NOT want to have people complaining that netgraph is too slow
}because I have to to 600,000 mtx_enters 600,000 mtx_exit's
}every second. And on top of that if there is a colision, I have to
}queue the packet on a queue that is guarded in some way, so it's probably closer
}to 
}800,000 per second. (don;t mention Gb ethernet)

I fully agree. I just don't want people thinking that using atomic operations
is a fix for this type of problem. You can't use mutices for each one, and
you can't use atomic operations either.

Chuck




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?200012151747.eBFHlAF67343>