Java 8 Concurrency

posted in: Bryte Thoughts, Java | 0

Java is the New Cobol!

There is a debate that’s been going on for some time now. Java is the new Cobol! Is this true?

  • both languages are bloated with features
  • both languages are used heavily in enterprise applications
  • there are a lot of hot new functional languages that have created quite a lot of buzz i.e. Scala, Clojure, Go, Erlang, Haskell
  • TIOBE index – the ratings are based on the number of skilled engineers world-wide, courses and third party vendors. Search engines such as Google, Bing, Yahoo!, Wikipedia, Amazon, YouTube and Baidu are used to calculate the ratings.
  • stackoverflow tags vs github lines changed

Distributed Processes

There is a movement where programs are starting to going away from centralized systems to coordinated distributed systems. If you look in the database world there are all sorts of storage solutions popping up that help us to scale horizontally using distributed systems where vertical centralized scaling just wasn’t cutting it anymore. Here are some examples of this concept in the data storage world.

  • Big Table (google) /Hadoop
  • Project Voldemort (LinkedIn)
  • Cassandra
  • AWS Dynamo

This same distributed model is starting to be seen more and more in the programming world as the demand to process more and more information is growing exponentially.

Concurrency

Most of us are familiar with sequential programs that execute a series of instructions one right after another. This has gotten us pretty far and we’ve been able to accomplish a lot using this model. The alternative, concurrency, executes instructions in parallel and then synchronizes the results.

Process

Computer applications typically run in their own process–there are exceptions. If you type “tasklist” into the Windows command prompt you’ll see a list of the currently running processes on your computer. Some programs like Google Chrome use multiple processes, in this case each tab is running in it’s own process. Processes are independent and don’t share data with other processes. This is important for both reliability and security.

Thread

A thread, sometimes called a lightweight-process, Threads can access shared data with other threads running in the same process. Every thread has it’s own memory cache.

Each Java instance by default runs in it’s own process. Java now, in Java 8, supports concurrency. Before Java 8 you were able to write concurrent programs, but with great difficulty.

Streams

 

Lambda Expressions

Lambda expressions aren’t new in programming. Ruby, XYZ have had and use lambda expressions since 200X. Lamba expressions make working iterating, sorting and filtering collections much, much easier.

1
(int x, int y) -> x + y

 

Resource Links

планшеты акции

Leave a Reply