Funnel (Concurrent computing)
Encyclopedia
In Computer Science
Computer science
Computer science or computing science is the study of the theoretical foundations of information and computation and of practical techniques for their implementation and application in computer systems...

, a funnel is a synchronization
Synchronization (computer science)
In computer science, synchronization refers to one of two distinct but related concepts: synchronization of processes, and synchronization of data. Process synchronization refers to the idea that multiple processes are to join up or handshake at a certain point, so as to reach an agreement or...

 primitive used in kernel
Kernel (computing)
In computing, the kernel is the main component of most computer operating systems; it is a bridge between applications and the actual data processing done at the hardware level. The kernel's responsibilities include managing the system's resources...

 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
Mac OS X
Mac OS X is a series of Unix-based operating systems and graphical user interfaces developed, marketed, and sold by Apple Inc. Since 2002, has been included with all new Macintosh computer systems...

 kernel to serialize access to the BSD portion of xnu
XNU
XNU is the computer operating system kernel that Apple Inc. acquired and developed for use in the Mac OS X operating system and released as free and open source software as part of the Darwin operating system...

.

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
Kernel panic
A kernel panic is an action taken by an operating system upon detecting an internal fatal error from which it cannot safely recover. The term is largely specific to Unix and Unix-like systems; for Microsoft Windows operating systems the equivalent term is "Bug check" .The kernel routines that...

. 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.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK