Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does built in support for multithreading mean?

Java provides built-in support for multithreaded programming.

That is what my book says. I can do multithreaded programming in C, C++ also. So do they also provide built-in support for multithreading?

What does built in support for multithreading mean? Isn't it the OS that ACTUALLY provides support for multithreading?

Are there any programming languages that cannot support multithreading? If so why? (I am asking this question because, if the OS provides support for multithreading then why cant we do multithreaded programming on all languages that are supported on that OS?)

like image 562
pphanireddy Avatar asked Oct 20 '25 09:10

pphanireddy


1 Answers

The issue is one of language-support vs. library support for multithreading.

Java's use of the keyword synchronized for placing locks on objects is a language-level construct. Also the built-in methods on Object (wait, notify, notifyAll) are implemented directly in runtime.

There is a bit of a debate regarding whether languages should implement threading though keywords and language structures and core data types vs. having all thread capabilities in the library.

A research paper espousing the view that language-level threading is beneficial is the relatively famous http://www.hpl.hp.com/personal/Hans_Boehm/misc_slides/pldi05_threads.pdf.

In theory, any language built on a C runtime can access a library such as pthreads, and any language running on a JVM can use those threads. In short all languages that can use a library (and have the notion of function pointers) can indeed do multithreading.

like image 101
Ray Toal Avatar answered Oct 22 '25 03:10

Ray Toal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!