I think linux multithreading is inferior to windows

Source: Internet
Author: User
I think linux multithreading is not as good as windows-general Linux technology-Linux programming and kernel information. The following is a detailed description. I. Functions
WaitForSingleObject can be replaced by pthread_cond_wait in linux, but pthread_cond_wait cannot be used to wait for thread handle. To wait for thread handle, you can use pthread_join, but there is no timeout.

In linux, there is no WaitForMultipleObjects and there is no alternative implementation method. If a program is ready for cross-platform development, it is best not to use WaitForMultipleObjects for implementation on windows. You can replace WaitForSingleObject with some bool-type flags.

Ii. Performance
One IBM guy did a test and found that windows was more than twice as fast as linux when switching the context of the thread. The fastest Entry and Exit locks (critical section of windows2k and pthread_mutex of linux), windows is about five times faster than linux. Of course, this does not mean that linux is not good, and after actual programming, I think linux is more suitable for high performance server, but in the specific field of multithreading, linux is a little inferior to windows. This should be excitable. After all, the unix family comes from multi-process, while windows is from scratch multi-thread. However, I still hope that linux will continue to improve multithreading in the future.

PS: these are not official materials and are purely personal studies.

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.