Re: What is meant by fastpath and slowpath function in linux kernel?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2006-05-03 at 11:07 +0530, Manjunath Naik wrote:
> Hi All,
>  
> What is the major difference between and mutex and semaphore.

semaphore is a counter with some special actions on specific count
events, while a mutex has very strict semantics
(eg you can only release it in the process you took it for example, eg
there is a clear, identified owner)
>  
> while going through the kernel/mutext.h and kernel/mutex.c their are
> two specific keyword "fastpath" and "slowpath" functions. What is
> meant by it.

fastpath is used to indicate the common case, which in linux is designed
to be "fast", because it'll be used a lot

slowpath is used to indicate the rare case, eg "this doesn't happen most
of the time". Slowpath code is allowed to do more expensive things
because it's rare to be used, within reason of course ;)

in linux you will find many places that split things into a "simple,
common fast" part and a "slower, more complex rare part". This allows
for fast and simple normal performance while you can do the more complex
stuff without having to tweak every last cycle out of it.



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux