Jump to content

Funnel (concurrent computing)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Rettetast (talk | contribs) at 21:43, 9 April 2010 (External links: Uncategorized using AWB). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In Computer Science, a funnel is a synchronization primitive used in kernel development to protect system resources. First used on Digital UNIX as a way to "funnel" device driver execution onto a single processor, funnels are now used in the Mac OS X kernel to serialize access to the BSD portion of xnu. [1]

A funnel is a mutex that prevents more than one thread from accessing certain kernel resources at the same time. Each thread acquires a funnel when it enters a synchronized portion of the kernel, and releases it when it leaves. If a thread blocks (sleeps) while holding a funnel, the kernel forces the thread to automatically drop the funnel, thereby allowing other threads to enter the synchronized portion of the kernel.

Because a funnel will be automatically dropped when a thread blocks, care must be taken to insure that synchronized resources are acquired again after any blocking operation. Note that the act of acquiring a funnel can be a blocking operation, which means that if multiple funnels are needed, they should be acquired at once. This limits the utility of funnels because it increases the granularity of locking when multiple funnels need to be held at once.

Funnels in Mac OS X

There is only one funnel in OS X 10.4 and higher. Prior to version 10.4 there were two funnels: one protecting network resources, and the other protecting other BSD kernel resources. A thread was only allowed to hold one funnel at a time, and holding both would cause a kernel panic. As a result of these limitations and the lack of granularity, funnels are being phased out of Mac OS X. The networking funnel, for example, has been replaced with finer-grained locking mechanisms.

See also

Serializing tokens

Notes

For notes referring to sources, see bibliography below.

  1. ^ Singh 07, pp. 1223-1229

References

  • Singh, Amit (2007). Mac OS X Internals, A Systems Approach. Boston, Massachusetts: Addison-Wesley. ISBN 0-321-27854-2.