Java
Java

Reputation: 2489

Java Threads: On Windows & On Linux

I have chat server application which we are going to deploy on 3 servers. chat application used lot of multithreading.

Basically i have to decide which os i should for those 3 servers. so i want to know how linux and windows handles java threads distinctively. what is the difference? who creates operating system threads? what memory are they assigning ?

If in future scope scalability and clustering which option is better?

Upvotes: 0

Views: 1158

Answers (2)

A.H.
A.H.

Reputation: 66283

If in future scope scalability and clustering which option is better?

Scalability and clustering are most likely hampered by the internal design of your code not by the JVM nor by the underlying OS. And without taking a very deep look into the code every statement about this is just hot noise but not a profound statement.

But the nice thing about Java is: It will run on both platform without changing your code. So the best you can do is: Benchmark both OSes on the same hardware (but do not use any kind of virtualization!) and use the best one for your purpose.

Upvotes: 2

Tomasz Nurkiewicz
Tomasz Nurkiewicz

Reputation: 340993

how linux and windows handles java threads distinctively.

The beauty of Java is that you don't really care. They just work. But if you are really curious, modern JVMs delegate thread handling to the operating system. So it is more of an OS question rather than Java.

what is the difference?

See above. Java has little to do here. It is about how threading is implemented in the host OS.

who creates operating system threads?

JVM asks OS to create them and provides a thin wrapper between Java Thread object and native threads.

what memory are they assigning ?

Each thread gets its own stack (seee -Xss JVM option). Also all threads share the same heap space.

Upvotes: 1

Related Questions