JaiswalTraining

Get the online training        


Get Best Tutorial on all major programing language


Corejava Servlet Jsp  Php  Hibernate  Ajax Web Service   Ejb2.1 Ejb3.0 Struts Struts2  JPA Spring Ibatis   JSF    JSF2.0  CoreJavaDesignPattern    Jquery  Flex J2EE-Design-Patterns  Jboss7  Maven  Contact Me                                                                                                                                                                        
            IGNOU SMU PTU Project                                           Training                                                                                                                              
              

Contact Us  0091- 9210721663         jaiswaltraining@gmail.com




Corejava
Servlet
Jsp
Php
Hibernate
Ajax
Web Service
Ejb2.1
Ejb3.0
Struts  
Struts2
JPA
Spring
Ibatis
JSF
JSF2.0
CoreJavaDesignPattern
Jquery
Flex
J2EE-Design-Patterns
Jboss7
Maven







Concuurency

Overview
  • New in Java 5: java.util.concurrent
  • Thread Pools, Task Scheduling
  • Concurrent Collections
  • Atomic variables
  • Locks, Conditions, Synchronizers
  • Enhance scalability, performance, readability and thread safety of Java applications
  • Provide richer set of concurrency building blocks
     > wait(), notify() and synchronized are too primitive
Threads
  • Threads are expensive to create, can require 500K of memory during creation
  • Your threads spend a lot of time context-switching, even if you have 10 processors
  • Whenever you want to start a thread, don’t use Threads:use Executor
Disadvantage of using Threads
  • Creating a new thread causes some performance overhead .
  • Too many threads can lead to reduced performance, as the
    CPU needs to switch between these threads.
  • You cannot easily control the number of threads, therefore you may run
    into out of memory errors due to too many threads.
Why Concurrency?
  • wait(), notify(), and synchronize are hard to use, specified at a low level, can lead to poor performance
  • Lots of wheel reinventing
  • Reduced programming effort
  • Increased performance
  • Increased reliability
    •  Eliminate threading hazards such as deadlock, starvation,
       race conditions, or excessive context switching are eliminated
  • Improved maintainability
  • Increased productivity

Goal of Concurrency
  • Do what Collections did for data structures
  • Allow development of thread-safe classes, such as servlets, built on
    concurrent building blocks (like ConcurrentHashMap)
  • Make some solved things easier.
  • Make very hard things solvable.
Concurrency Utilities
  • Task Scheduling Framework
  • Callable's and Future's
  • Synchronizers
  • Concurrent Collections
  • Atomic Variables
  • Locks
  • Nanosecond-granularity timing