<s>
In	O
Computer	B-General_Concept
science	I-General_Concept
,	O
a	O
funnel	B-Operating_System
is	O
a	O
synchronization	O
primitive	O
used	O
in	O
kernel	B-Operating_System
development	O
to	O
protect	O
system	O
resources	O
.	O
</s>
<s>
First	O
used	O
on	O
Digital	B-Operating_System
UNIX	I-Operating_System
as	O
a	O
way	O
to	O
"	O
funnel	B-Operating_System
"	O
device	O
driver	O
execution	O
onto	O
a	O
single	O
processor	O
,	O
funnels	B-Operating_System
are	O
now	O
used	O
in	O
the	O
Mac	B-Operating_System
OS	I-Operating_System
X	I-Operating_System
kernel	B-Operating_System
to	O
serialize	O
access	O
to	O
the	O
BSD	B-Operating_System
portion	O
of	O
XNU	B-Operating_System
.	O
</s>
<s>
A	O
funnel	B-Operating_System
is	O
a	O
mutual	O
exclusion	O
(	O
mutex	B-Operating_System
)	O
mechanism	O
that	O
prevents	O
more	O
than	O
one	O
thread	O
from	O
accessing	O
certain	O
kernel	B-Operating_System
resources	O
at	O
the	O
same	O
time	O
.	O
</s>
<s>
Each	O
thread	O
acquires	O
a	O
funnel	B-Operating_System
when	O
it	O
enters	O
a	O
synchronized	O
portion	O
of	O
the	O
kernel	B-Operating_System
,	O
and	O
releases	O
it	O
when	O
it	O
leaves	O
.	O
</s>
<s>
If	O
a	O
thread	O
blocks	O
(	O
sleeps	O
)	O
while	O
holding	O
a	O
funnel	B-Operating_System
,	O
the	O
kernel	B-Operating_System
forces	O
the	O
thread	O
to	O
automatically	O
drop	O
the	O
funnel	B-Operating_System
,	O
thereby	O
allowing	O
other	O
threads	O
to	O
enter	O
the	O
synchronized	O
portion	O
of	O
the	O
kernel	B-Operating_System
.	O
</s>
<s>
Because	O
a	O
funnel	B-Operating_System
is	O
automatically	O
dropped	O
when	O
a	O
thread	O
blocks	O
,	O
care	O
must	O
be	O
taken	O
to	O
ensure	O
that	O
synchronized	O
resources	O
are	O
acquired	O
again	O
after	O
any	O
blocking	O
operation	O
.	O
</s>
<s>
Specifically	O
,	O
acquiring	O
a	O
funnel	B-Operating_System
can	O
be	O
a	O
blocking	O
operation	O
,	O
so	O
if	O
multiple	O
funnels	B-Operating_System
are	O
needed	O
,	O
they	O
must	O
be	O
acquired	O
at	O
once	O
.	O
</s>
<s>
This	O
limits	O
the	O
utility	O
of	O
funnels	B-Operating_System
because	O
it	O
increases	O
the	O
granularity	O
of	O
locking	B-Operating_System
when	O
multiple	O
funnels	B-Operating_System
need	O
to	O
be	O
held	O
at	O
once	O
.	O
</s>
<s>
There	O
is	O
only	O
one	O
funnel	B-Operating_System
in	O
OS	B-Operating_System
X	I-Operating_System
10.4	O
and	O
higher	O
.	O
</s>
<s>
Prior	O
to	O
version	O
10.4	O
,	O
there	O
are	O
two	O
funnels	B-Operating_System
:	O
one	O
protects	O
network	O
resources	O
,	O
and	O
the	O
other	O
protects	O
other	O
BSD	B-Operating_System
kernel	B-Operating_System
resources	O
.	O
</s>
<s>
A	O
thread	O
was	O
only	O
allowed	O
to	O
hold	O
one	O
funnel	B-Operating_System
at	O
a	O
time	O
,	O
and	O
holding	O
both	O
would	O
cause	O
a	O
kernel	B-Operating_System
panic	I-Operating_System
.	O
</s>
<s>
As	O
a	O
result	O
of	O
these	O
limitations	O
and	O
the	O
lack	O
of	O
granularity	O
,	O
funnels	B-Operating_System
are	O
being	O
phased	O
out	O
of	O
Mac	B-Operating_System
OS	I-Operating_System
X	I-Operating_System
.	O
</s>
<s>
For	O
example	O
,	O
the	O
networking	O
funnel	B-Operating_System
has	O
been	O
replaced	O
by	O
finer-grained	O
locking	B-Operating_System
mechanisms	O
.	O
</s>
