<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
On 11/01/2010 05:06 AM, <a class="moz-txt-link-abbreviated" href="mailto:chaitra.bhat@lakecommunications.com">chaitra.bhat@lakecommunications.com</a> wrote:
<blockquote
 cite="mid:OFE684F0B5.59CFFC36-ON802577CE.0035A9F4-802577CE.00378BCD@lakecommunications.com"
 type="cite"><br>
  <font face="sans-serif" size="2">Hi All,</font>
  <br>
  <br>
  <font face="sans-serif" size="2">We use Asterisk version 1.4.22 in
our
PBX product. But we have seen that the locking mechanism that exists in
the channel code today is highly inefficient and CPU consuming. Also,
if
not careful with the locks order, can lead to deadlocks.</font>
  <br>
  <br>
  <font face="sans-serif" size="2">So, was wondering if anything has
changed
with regard to this in the later versions of Asterisk (1.4 or 1.6).
There
were talks of introducing a reference counting mechanism - was this
implemented?</font>
  <br>
  <br>
  <font face="sans-serif" size="2">If I see channel.c and lock.h in
1.4.36,
I do not see any changes there wrt the locking mechanism. And in ver
1.6.2,
except for the RW locks, I do not see any other difference.</font>
  <br>
  <br>
  <font face="sans-serif" size="2">Can somebody tell me what changes
were
introduced in Asterisk 1.6 to manage and debug the locking of the
channels
efficiently please?</font>
  <br>
  <br>
  <font face="sans-serif" size="2">Thanks,</font>
  <br>
  <br>
  <font face="sans-serif" size="2">-Bhatc</font><br>
</blockquote>
<font size="2"><font face="sans-serif"><br>
You're not going to find any major changes to the channel structure in
the 1.6.X series. In the recently released 1.8 series, the ast_channel
structure has been converted to a reference-counted object and is
stored in a hash table instead of a linked list. The biggest gain here
is quicker lookups of channels. Regarding locking mechanisms, there's
not much change there, so you still need to be careful and respect the
defined locking order. There were a small set of cases where a channel
lock was replaced by grabbing a reference to the channel instead, but
there may be 2 or 3 cases of this total in the whole code base.<br>
<br>
Mark Michelson<br>
</font></font>
</body>
</html>