

Multithreading: C# vs. Java - jj09
http://jj09.net/multithreading-csharp-vs-java

======
keithwarren
This is a pretty bogus comparison, I am a C# coder and write multi-threaded
programs quite often and rarely use raw thread classes anymore, the task
parallel library makes the experience much cleaner and more powerful.

I use Java some so I can't speak directly to this but I would bet Java pros
are scratching their heads over the Java code being used here as well.

What is more interesting to me though; why even make the comparison? Are there
legions of programmers out there who cannot pick between these two platforms
because they cannot decide who has better a better threading approach?

------
alyx
I don't even understand the purpose of the comparison, other than syntax?

It is also a pretty bad example of C# threading capabilities.

From ThreadPool[1], Tasks[2] and more recently async/await[3], there's a lot
more than vanilla threads in C#.

[1] [http://msdn.microsoft.com/en-
us/library/3dasc8as.aspx](http://msdn.microsoft.com/en-
us/library/3dasc8as.aspx)

[2] [http://msdn.microsoft.com/en-
us/library/dd460717(v=vs.110).a...](http://msdn.microsoft.com/en-
us/library/dd460717\(v=vs.110\).aspx)

[3] [http://msdn.microsoft.com/en-
us/library/hh191443.aspx](http://msdn.microsoft.com/en-
us/library/hh191443.aspx)

------
taspeotis
I think a better comparison would be the higher level constructs that each
language's standard library provides.

For example, the Task Parallel Library is built in to the BCL [1] with some
extensions [2] shipped out of band.

Although Java's constructs seem less comprehensive than what's in .NET [3].
(Disclaimer: I'm a .NET programmer and I don't know all the Java namespaces).

[1] [http://msdn.microsoft.com/en-
us/library/dd460717(v=vs.110).a...](http://msdn.microsoft.com/en-
us/library/dd460717\(v=vs.110\).aspx)

[2] [http://msdn.microsoft.com/en-
us/library/hh228603(v=vs.110).a...](http://msdn.microsoft.com/en-
us/library/hh228603\(v=vs.110\).aspx)

[3]
[http://docs.oracle.com/javase/8/docs/api/java/util/concurren...](http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/package-
summary.html)

------
brandonbloom
No mention of WaitHandle.WaitAll (aka WaitForMultipleObjects)?? Multiplexing
is sorely missing from the JVM. CountDownLatch isn't really good enough.

------
ASneakyFox
Out dated information for both languages.. even if it was up to date.. why do
they need to be compared?

------
amadeusw
It's interesting to see how the language constructs are similar... But this
blog post is so anti-climatic! Let's see some graphs and some performance
analysis! GC analysis would be great too. jj09, looking forward to seeing part
2!

