Alex Rivera | Logout

Is multi-threading a property of a language (like java) or a property of OS?

Asked 2010-06-15T04:43:32.520
10

Is multi-threading a property of a language (like java) or a property of OS?

Edit
Report

2 Answers

4

Multi-threading does rely on hardware capabilities, but for most platforms the "heavy lifting" is done by the OS. This is essential, especially with modern multi-core systems. The OS also provide locking and monitoring capabilities.

Having said this, there have been platforms where a lot of the multi-threading capabilities, including scheduling and locking, are implemented in the virtual machine instead of the OS. These are known as Green Threads. However these have limitations in multi-core systems and are giving way to native OS threads in most imperative languages.

There are other concurrency models that handle the scheduling in the VM or runtime. These are typically in functional languages where state is immutable and therefore not susceptible to the locking issues of shared mutable state that we see in imperative languages. I'm thinking of Erlang and Haskell.

answered 2010-06-15T05:56:10.927
0

Ultimately it is a property of the hardware. Java has had threading capabilities from the beginning, but these have been made much more usable with the introduction of the java.util.concurrent packages.

Real mulltithreading is useful on modern hardware that allows for multiple threads to be executed. On older hardware especially I/O operations can be easier to understand and control when using a seperate thread that can be blocked while waiting for data.

answered 2010-06-15T06:22:21.673

Your Answer