none
Critical Section RRS feed

  • Question

  • Hi,

    I am going through the documentation and it is mentioned that Mutex is a pure Kernel Object where as Critical Section is not. Then to which module CS belongs?

    Regards,

    GSR

    Thursday, June 13, 2013 10:17 AM

All replies

  • Critical Sections run in your code.   They may be in Coredll.dll, or simply coredll.lib.

    Bruce Eitman (eMVP)
    Senior Engineer
    Bruce.Eitman AT Eurotech DOT com
    My BLOG http://geekswithblogs.net/bruceeitman

    Eurotech Inc.
    www.Eurotech.com

    Thursday, June 13, 2013 12:38 PM
    Moderator
  • Criticalsection is also the part of Kernel you can see the functions in the different name in the below file

    \WINCE600\PRIVATE\WINCEOS\COREOS\NK\KERNEL\syncobj.c

    These functions are used by the critical section APIs in the coredll which is exposed outside

    \WINCE600\PRIVATE\WINCEOS\COREOS\CORE\DLL\cscode.c


    Vinoth.R

    www.e-consystems.com

    http://vinoth-vinothblog.blogspot.com

    Thursday, June 13, 2013 4:29 PM
  • Hello Bruce Eitman and Vinoth,

    Thank You for the reply.

    I had gone through those source code files long ago, but not just before starting the discussion.

    I was reading Windows CE Fundamentals PDF in this page-95 talks about synchronization objects. 

    It is given in page-95 that "

    As opposed to a critical section, a mutex is a pure-kernel object, and therefore, when accessed by another process, regardless of blocking, the kernel is called, which results in considerable overhead"

    If Critical section is also part of kernel then what does mean by the above statement?

    Regards,

    GSR

    Friday, June 14, 2013 4:37 AM
  • you have to see the word "Pure kernel object" for Mutex. Yes it is correct. if you see the

    \WINCE600\PRIVATE\WINCEOS\COREOS\NK\KERNEL\syncobj.c

    You can see the NKCreateMutex which is directly exposed as kernel API.

    See the

    \WINCE600\PRIVATE\WINCEOS\COREOS\NK\KERNEL\kwin32.c

    But for critcal section API, it is implemented in coreDLL which call the critical section function implemented in kernel.


    Vinoth.R

    www.e-consystems.com

    http://vinoth-vinothblog.blogspot.com


    Friday, June 14, 2013 5:49 AM
  • The statement that you referred might be stressing that Mutex are costly and slower than Critical section. There is significant overhead using Mutex vs critical section. So use it appropriately.  As far as I know mutex are ~100 times slower than critical.

    Rakesh.

     


    Friday, June 14, 2013 8:23 AM