Win32 comparison of thread synchronization kernel objects

Source: Internet
Author: User

The conversion of the user layer to the kernel layer on the X86 processor takes 600 CPU instruction cycles

Critical section (Critical code snippet) is not a kernel object but uses kernel resource functionality to be mutually exclusive but not cross-process when accessing the occupied resource

(quoted above from:http://www.dewen.org/q/9561)


WIN32 kernel objects are manipulated by handle


Signal Volume (Semaphore)

The wait function family decrements the access count

when and only if access count 0 o'clock no signal

ReleaseSemaphore Increment access count

Mutex (mutex)

semaphores with and only 1 access counts (two-yuan Semaphore binary semaphore)

wait function family makes no signal (principle with semaphore access count of 0)

ReleaseMutex make it signal (unblock)


Events (Event)

Automatic reset events are mutually exclusive

Manual reset event User-controlled resetevent and setevent mates

wait function family makes no signal

setevent make it signal (unblock)


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.