SlideShare uma empresa Scribd logo
1 de 22
Baixar para ler offline
Concurrency Problem
                                      Adriano Patrick Cunha - UDCE




quarta-feira, 10 de outubro de 2012
Evolution of processors




quarta-feira, 10 de outubro de 2012
Big Data to process




quarta-feira, 10 de outubro de 2012
What Possibilities ?




quarta-feira, 10 de outubro de 2012
Concurrence?




quarta-feira, 10 de outubro de 2012
Which options ?




quarta-feira, 10 de outubro de 2012
Functional Programming language ?




quarta-feira, 10 de outubro de 2012
API java.util.concurrent




                              5
quarta-feira, 10 de outubro de 2012
Thead-Safe




quarta-feira, 10 de outubro de 2012
Thead-Safe




      private	
  Set<String>	
  ipAddressSet	
  =	
  new	
  HashSet<String>();




quarta-feira, 10 de outubro de 2012
Thead-Safe




      private	
  Set<String>	
  ipAddressSet	
  =	
  new	
  HashSet<String>();
   	
  private	
  Set<String>	
  ipAddressSet	
  =	
  Collections.
                      	
  	
  	
  	
  	
  	
  	
  synchonizedSet(new	
  HashSet<String>());




quarta-feira, 10 de outubro de 2012
Thead-Safe




      private	
  Set<String>	
  ipAddressSet	
  =	
  new	
  HashSet<String>();
   	
  private	
  Set<String>	
  ipAddressSet	
  =	
  Collections.
                      	
  	
  	
  	
  	
  	
  	
  synchonizedSet(new	
  HashSet<String>());
private	
  BlockingQueue<String>	
  ipAddress=new	
  LinkedBlockingQueue<String>();




quarta-feira, 10 de outubro de 2012
Thead-Safe



                                          fast-fail iterators
      private	
  Set<String>	
  ipAddressSet	
  =	
  new	
  HashSet<String>();
   	
  private	
  Set<String>	
  ipAddressSet	
  =	
  Collections.
                      	
  	
  	
  	
  	
  	
  	
  synchonizedSet(new	
  HashSet<String>());
private	
  BlockingQueue<String>	
  ipAddress=new	
  LinkedBlockingQueue<String>();

                                      weakly consistent iterators




quarta-feira, 10 de outubro de 2012
Thead-Safe

            Outras	
  Coleções


                                ConcurrentHashMap,	
  CopyOnWriteArrayList	
  e	
  
                                           CopyOnWriteArraySet




quarta-feira, 10 de outubro de 2012
Executor




                                             Executor
                                          ExecutorService
                                      ScheduledExecutorService




quarta-feira, 10 de outubro de 2012
Executor



                                      (new Thread(r)).start();




quarta-feira, 10 de outubro de 2012
Executor



                                      (new Thread(r)).start();
                                           e.execute(r);




quarta-feira, 10 de outubro de 2012
Thread Pools



                 Executors.newCachedThreadPool();

                                      Executors.newFixedThreadPoll(n);

                                         Executors.newSingleThreadExecutor();




quarta-feira, 10 de outubro de 2012
Thread Pools
                                                 class Counter {
                                                     private int c = 0;

                                                         public void increment() {
                                                             c++;
                                                         }

                                                         public void decrement() {
                                                             c--;
                                                         }

                                                         public int value() {
                                                             return c;
                                                         }

                                                 }
                                                                          1.   Thread A: Retrieve c.
                                                                          2.   Thread B: Retrieve c.
                   1. Retrieve the current value of c.
                                                                          3.   Thread A: Increment retrieved value; result is 1.
                   2. Increment the retrieved value by 1.
                                                                          4.   Thread B: Decrement retrieved value; result is -1.
                   3. Store the incremented value back in c.
                                                                          5.   Thread A: Store result in c; c is now 1.
                                                                          6.   Thread B: Store result in c; c is now -1.




quarta-feira, 10 de outubro de 2012
Thread Pools

                                      class SynchronizedCounter {
                                          private int c = 0;

                                          public synchronized void increment() {
                                              c++;
                                          }

                                          public synchronized void decrement() {
                                              c--;
                                          }

                                          public synchronized int value() {
                                              return c;
                                          }

                                      }




quarta-feira, 10 de outubro de 2012
Thread Pools
                                      import java.util.concurrent.atomic.AtomicInteger;

                                      class AtomicCounter {
                                          private AtomicInteger c = new AtomicInteger(0);

                                          public void increment() {
                                              c.incrementAndGet();
                                          }

                                          public void decrement() {
                                              c.decrementAndGet();
                                          }

                                          public int value() {
                                              return c.get();
                                          }

                                      }




quarta-feira, 10 de outubro de 2012
Bibliografia



        Livros

        Concurrent Programming in Java, Design Principles and Patterns, Doug Lea, Addison-Wesley, 1999

        Java Concurrency In Practice, Brian Goetz, Addison-Wesley, 2006



                                                                           Links

                                                                           http://docs.oracle.com/javase/tutorial/essential/concurrency/index.html

                                                                           http://www.jcp.org/en/jsr/detail?id=166

                                                                           http://gee.cs.oswego.edu/dl/concurrency-interest/

                                                                           http://www.devmedia.com.br/websys.2/webreader.asp?cat=6&revista=javamagazine_69




quarta-feira, 10 de outubro de 2012

Mais conteúdo relacionado

Mais procurados

Box2D with SIMD in JavaScript
Box2D with SIMD in JavaScriptBox2D with SIMD in JavaScript
Box2D with SIMD in JavaScriptIntel® Software
 
4Developers 2018: Evolution of C++ Class Design (Mariusz Łapiński)
4Developers 2018: Evolution of C++ Class Design (Mariusz Łapiński)4Developers 2018: Evolution of C++ Class Design (Mariusz Łapiński)
4Developers 2018: Evolution of C++ Class Design (Mariusz Łapiński)PROIDEA
 
Gor Nishanov, C++ Coroutines – a negative overhead abstraction
Gor Nishanov,  C++ Coroutines – a negative overhead abstractionGor Nishanov,  C++ Coroutines – a negative overhead abstraction
Gor Nishanov, C++ Coroutines – a negative overhead abstractionSergey Platonov
 
03 - Qt UI Development
03 - Qt UI Development03 - Qt UI Development
03 - Qt UI DevelopmentAndreas Jakl
 
Deuce STM - CMP'09
Deuce STM - CMP'09Deuce STM - CMP'09
Deuce STM - CMP'09Guy Korland
 
Qt Memory Management & Signal and Slots
Qt Memory Management & Signal and SlotsQt Memory Management & Signal and Slots
Qt Memory Management & Signal and SlotsJussi Pohjolainen
 
The Ring programming language version 1.5.3 book - Part 189 of 194
The Ring programming language version 1.5.3 book - Part 189 of 194The Ring programming language version 1.5.3 book - Part 189 of 194
The Ring programming language version 1.5.3 book - Part 189 of 194Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 92 of 196
The Ring programming language version 1.7 book - Part 92 of 196The Ring programming language version 1.7 book - Part 92 of 196
The Ring programming language version 1.7 book - Part 92 of 196Mahmoud Samir Fayed
 
Beginning direct3d gameprogrammingcpp02_20160324_jintaeks
Beginning direct3d gameprogrammingcpp02_20160324_jintaeksBeginning direct3d gameprogrammingcpp02_20160324_jintaeks
Beginning direct3d gameprogrammingcpp02_20160324_jintaeksJinTaek Seo
 
A Brief Introduction to the Qt Application Framework
A Brief Introduction to the Qt Application FrameworkA Brief Introduction to the Qt Application Framework
A Brief Introduction to the Qt Application FrameworkZachary Blair
 
The Ring programming language version 1.8 book - Part 90 of 202
The Ring programming language version 1.8 book - Part 90 of 202The Ring programming language version 1.8 book - Part 90 of 202
The Ring programming language version 1.8 book - Part 90 of 202Mahmoud Samir Fayed
 
Mini-curso JavaFX Aula3 UFPB
Mini-curso JavaFX Aula3 UFPBMini-curso JavaFX Aula3 UFPB
Mini-curso JavaFX Aula3 UFPBRaphael Marques
 
How Data Flow analysis works in a static code analyzer
How Data Flow analysis works in a static code analyzerHow Data Flow analysis works in a static code analyzer
How Data Flow analysis works in a static code analyzerAndrey Karpov
 
PVS-Studio in 2021 - Error Examples
PVS-Studio in 2021 - Error ExamplesPVS-Studio in 2021 - Error Examples
PVS-Studio in 2021 - Error ExamplesAndrey Karpov
 

Mais procurados (19)

Box2D with SIMD in JavaScript
Box2D with SIMD in JavaScriptBox2D with SIMD in JavaScript
Box2D with SIMD in JavaScript
 
4Developers 2018: Evolution of C++ Class Design (Mariusz Łapiński)
4Developers 2018: Evolution of C++ Class Design (Mariusz Łapiński)4Developers 2018: Evolution of C++ Class Design (Mariusz Łapiński)
4Developers 2018: Evolution of C++ Class Design (Mariusz Łapiński)
 
Gor Nishanov, C++ Coroutines – a negative overhead abstraction
Gor Nishanov,  C++ Coroutines – a negative overhead abstractionGor Nishanov,  C++ Coroutines – a negative overhead abstraction
Gor Nishanov, C++ Coroutines – a negative overhead abstraction
 
03 - Qt UI Development
03 - Qt UI Development03 - Qt UI Development
03 - Qt UI Development
 
Deuce STM - CMP'09
Deuce STM - CMP'09Deuce STM - CMP'09
Deuce STM - CMP'09
 
Jersey Guice AOP
Jersey Guice AOPJersey Guice AOP
Jersey Guice AOP
 
Qt Memory Management & Signal and Slots
Qt Memory Management & Signal and SlotsQt Memory Management & Signal and Slots
Qt Memory Management & Signal and Slots
 
京都Gtugコンパチapi
京都Gtugコンパチapi京都Gtugコンパチapi
京都Gtugコンパチapi
 
The Ring programming language version 1.5.3 book - Part 189 of 194
The Ring programming language version 1.5.3 book - Part 189 of 194The Ring programming language version 1.5.3 book - Part 189 of 194
The Ring programming language version 1.5.3 book - Part 189 of 194
 
Return of c++
Return of c++Return of c++
Return of c++
 
02 - Basics of Qt
02 - Basics of Qt02 - Basics of Qt
02 - Basics of Qt
 
The Ring programming language version 1.7 book - Part 92 of 196
The Ring programming language version 1.7 book - Part 92 of 196The Ring programming language version 1.7 book - Part 92 of 196
The Ring programming language version 1.7 book - Part 92 of 196
 
Beginning direct3d gameprogrammingcpp02_20160324_jintaeks
Beginning direct3d gameprogrammingcpp02_20160324_jintaeksBeginning direct3d gameprogrammingcpp02_20160324_jintaeks
Beginning direct3d gameprogrammingcpp02_20160324_jintaeks
 
A Brief Introduction to the Qt Application Framework
A Brief Introduction to the Qt Application FrameworkA Brief Introduction to the Qt Application Framework
A Brief Introduction to the Qt Application Framework
 
The Ring programming language version 1.8 book - Part 90 of 202
The Ring programming language version 1.8 book - Part 90 of 202The Ring programming language version 1.8 book - Part 90 of 202
The Ring programming language version 1.8 book - Part 90 of 202
 
Mini-curso JavaFX Aula3 UFPB
Mini-curso JavaFX Aula3 UFPBMini-curso JavaFX Aula3 UFPB
Mini-curso JavaFX Aula3 UFPB
 
How Data Flow analysis works in a static code analyzer
How Data Flow analysis works in a static code analyzerHow Data Flow analysis works in a static code analyzer
How Data Flow analysis works in a static code analyzer
 
Qt Widget In-Depth
Qt Widget In-DepthQt Widget In-Depth
Qt Widget In-Depth
 
PVS-Studio in 2021 - Error Examples
PVS-Studio in 2021 - Error ExamplesPVS-Studio in 2021 - Error Examples
PVS-Studio in 2021 - Error Examples
 

Semelhante a Concurrencyproblem

My way to clean android v2 English DroidCon Spain
My way to clean android v2 English DroidCon SpainMy way to clean android v2 English DroidCon Spain
My way to clean android v2 English DroidCon SpainChristian Panadero
 
1z0 804 exam-java se 7 programmer ii
1z0 804 exam-java se 7 programmer ii1z0 804 exam-java se 7 programmer ii
1z0 804 exam-java se 7 programmer iiIsabella789
 
C++ Interface Versioning
C++ Interface VersioningC++ Interface Versioning
C++ Interface VersioningSkills Matter
 
C# 6.0 Introduction
C# 6.0 IntroductionC# 6.0 Introduction
C# 6.0 IntroductionOlav Haugen
 
OBJECTS IN Object Oriented Programming .ppt
OBJECTS IN Object Oriented Programming .pptOBJECTS IN Object Oriented Programming .ppt
OBJECTS IN Object Oriented Programming .pptSaadAsim11
 
Advance features of C++
Advance features of C++Advance features of C++
Advance features of C++vidyamittal
 
Cppt 101102014428-phpapp01
Cppt 101102014428-phpapp01Cppt 101102014428-phpapp01
Cppt 101102014428-phpapp01Getachew Ganfur
 
Dr archana dhawan bajaj - csharp fundamentals slides
Dr archana dhawan bajaj - csharp fundamentals slidesDr archana dhawan bajaj - csharp fundamentals slides
Dr archana dhawan bajaj - csharp fundamentals slidesDr-archana-dhawan-bajaj
 
CAP444-Unit-3-Polymorphism.pptx
CAP444-Unit-3-Polymorphism.pptxCAP444-Unit-3-Polymorphism.pptx
CAP444-Unit-3-Polymorphism.pptxSurajgroupsvideo
 
20100712-OTcl Command -- Getting Started
20100712-OTcl Command -- Getting Started20100712-OTcl Command -- Getting Started
20100712-OTcl Command -- Getting StartedTeerawat Issariyakul
 
Cocoa for Web Developers
Cocoa for Web DevelopersCocoa for Web Developers
Cocoa for Web Developersgeorgebrock
 

Semelhante a Concurrencyproblem (20)

Test Engine
Test EngineTest Engine
Test Engine
 
My way to clean android V2
My way to clean android V2My way to clean android V2
My way to clean android V2
 
My way to clean android v2 English DroidCon Spain
My way to clean android v2 English DroidCon SpainMy way to clean android v2 English DroidCon Spain
My way to clean android v2 English DroidCon Spain
 
Constructor and destructor
Constructor and destructorConstructor and destructor
Constructor and destructor
 
1z0 804 exam-java se 7 programmer ii
1z0 804 exam-java se 7 programmer ii1z0 804 exam-java se 7 programmer ii
1z0 804 exam-java se 7 programmer ii
 
C++ aptitude
C++ aptitudeC++ aptitude
C++ aptitude
 
C++ via C#
C++ via C#C++ via C#
C++ via C#
 
Java concurrency
Java concurrencyJava concurrency
Java concurrency
 
C++ Interface Versioning
C++ Interface VersioningC++ Interface Versioning
C++ Interface Versioning
 
C# 6.0 Introduction
C# 6.0 IntroductionC# 6.0 Introduction
C# 6.0 Introduction
 
OBJECTS IN Object Oriented Programming .ppt
OBJECTS IN Object Oriented Programming .pptOBJECTS IN Object Oriented Programming .ppt
OBJECTS IN Object Oriented Programming .ppt
 
Advance features of C++
Advance features of C++Advance features of C++
Advance features of C++
 
Cppt 101102014428-phpapp01
Cppt 101102014428-phpapp01Cppt 101102014428-phpapp01
Cppt 101102014428-phpapp01
 
Dr archana dhawan bajaj - csharp fundamentals slides
Dr archana dhawan bajaj - csharp fundamentals slidesDr archana dhawan bajaj - csharp fundamentals slides
Dr archana dhawan bajaj - csharp fundamentals slides
 
CSharp v1.0.2
CSharp v1.0.2CSharp v1.0.2
CSharp v1.0.2
 
Thread
ThreadThread
Thread
 
OOPS Basics With Example
OOPS Basics With ExampleOOPS Basics With Example
OOPS Basics With Example
 
CAP444-Unit-3-Polymorphism.pptx
CAP444-Unit-3-Polymorphism.pptxCAP444-Unit-3-Polymorphism.pptx
CAP444-Unit-3-Polymorphism.pptx
 
20100712-OTcl Command -- Getting Started
20100712-OTcl Command -- Getting Started20100712-OTcl Command -- Getting Started
20100712-OTcl Command -- Getting Started
 
Cocoa for Web Developers
Cocoa for Web DevelopersCocoa for Web Developers
Cocoa for Web Developers
 

Mais de Adriano Patrick Cunha (8)

Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
Desenvolvimento web e mobile ifce
Desenvolvimento web e mobile   ifceDesenvolvimento web e mobile   ifce
Desenvolvimento web e mobile ifce
 
Recuperacao Falhas em Sistemas Workflow
Recuperacao Falhas em Sistemas WorkflowRecuperacao Falhas em Sistemas Workflow
Recuperacao Falhas em Sistemas Workflow
 
ETL DW-RealTime
ETL DW-RealTimeETL DW-RealTime
ETL DW-RealTime
 
Congresso TI - Qualidade de Código.
Congresso TI - Qualidade de Código.Congresso TI - Qualidade de Código.
Congresso TI - Qualidade de Código.
 
Article K-OPT in JSSP
Article K-OPT in JSSPArticle K-OPT in JSSP
Article K-OPT in JSSP
 
Natuurweb
NatuurwebNatuurweb
Natuurweb
 
Natuur mobile
Natuur mobileNatuur mobile
Natuur mobile
 

Último

7.pdf This presentation captures many uses and the significance of the number...
7.pdf This presentation captures many uses and the significance of the number...7.pdf This presentation captures many uses and the significance of the number...
7.pdf This presentation captures many uses and the significance of the number...Paul Menig
 
Monte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSMMonte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSMRavindra Nath Shukla
 
The Coffee Bean & Tea Leaf(CBTL), Business strategy case study
The Coffee Bean & Tea Leaf(CBTL), Business strategy case studyThe Coffee Bean & Tea Leaf(CBTL), Business strategy case study
The Coffee Bean & Tea Leaf(CBTL), Business strategy case studyEthan lee
 
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...lizamodels9
 
HONOR Veterans Event Keynote by Michael Hawkins
HONOR Veterans Event Keynote by Michael HawkinsHONOR Veterans Event Keynote by Michael Hawkins
HONOR Veterans Event Keynote by Michael HawkinsMichael W. Hawkins
 
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...Dave Litwiller
 
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangaloreamitlee9823
 
Call Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine ServiceCall Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine Serviceritikaroy0888
 
How to Get Started in Social Media for Art League City
How to Get Started in Social Media for Art League CityHow to Get Started in Social Media for Art League City
How to Get Started in Social Media for Art League CityEric T. Tung
 
KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...
KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...
KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...Any kyc Account
 
Call Girls in Gomti Nagar - 7388211116 - With room Service
Call Girls in Gomti Nagar - 7388211116  - With room ServiceCall Girls in Gomti Nagar - 7388211116  - With room Service
Call Girls in Gomti Nagar - 7388211116 - With room Servicediscovermytutordmt
 
Famous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st CenturyFamous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st Centuryrwgiffor
 
Pharma Works Profile of Karan Communications
Pharma Works Profile of Karan CommunicationsPharma Works Profile of Karan Communications
Pharma Works Profile of Karan Communicationskarancommunications
 
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...amitlee9823
 
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdfRenandantas16
 
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesMysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesDipal Arora
 
RSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors DataRSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors DataExhibitors Data
 
Cracking the Cultural Competence Code.pptx
Cracking the Cultural Competence Code.pptxCracking the Cultural Competence Code.pptx
Cracking the Cultural Competence Code.pptxWorkforce Group
 

Último (20)

7.pdf This presentation captures many uses and the significance of the number...
7.pdf This presentation captures many uses and the significance of the number...7.pdf This presentation captures many uses and the significance of the number...
7.pdf This presentation captures many uses and the significance of the number...
 
Monte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSMMonte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSM
 
The Coffee Bean & Tea Leaf(CBTL), Business strategy case study
The Coffee Bean & Tea Leaf(CBTL), Business strategy case studyThe Coffee Bean & Tea Leaf(CBTL), Business strategy case study
The Coffee Bean & Tea Leaf(CBTL), Business strategy case study
 
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
 
HONOR Veterans Event Keynote by Michael Hawkins
HONOR Veterans Event Keynote by Michael HawkinsHONOR Veterans Event Keynote by Michael Hawkins
HONOR Veterans Event Keynote by Michael Hawkins
 
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
 
VVVIP Call Girls In Greater Kailash ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Greater Kailash ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...VVVIP Call Girls In Greater Kailash ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Greater Kailash ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
 
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
 
Call Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine ServiceCall Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine Service
 
How to Get Started in Social Media for Art League City
How to Get Started in Social Media for Art League CityHow to Get Started in Social Media for Art League City
How to Get Started in Social Media for Art League City
 
KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...
KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...
KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...
 
Call Girls in Gomti Nagar - 7388211116 - With room Service
Call Girls in Gomti Nagar - 7388211116  - With room ServiceCall Girls in Gomti Nagar - 7388211116  - With room Service
Call Girls in Gomti Nagar - 7388211116 - With room Service
 
Famous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st CenturyFamous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st Century
 
Pharma Works Profile of Karan Communications
Pharma Works Profile of Karan CommunicationsPharma Works Profile of Karan Communications
Pharma Works Profile of Karan Communications
 
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
 
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
 
Mifty kit IN Salmiya (+918133066128) Abortion pills IN Salmiyah Cytotec pills
Mifty kit IN Salmiya (+918133066128) Abortion pills IN Salmiyah Cytotec pillsMifty kit IN Salmiya (+918133066128) Abortion pills IN Salmiyah Cytotec pills
Mifty kit IN Salmiya (+918133066128) Abortion pills IN Salmiyah Cytotec pills
 
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesMysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
 
RSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors DataRSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors Data
 
Cracking the Cultural Competence Code.pptx
Cracking the Cultural Competence Code.pptxCracking the Cultural Competence Code.pptx
Cracking the Cultural Competence Code.pptx
 

Concurrencyproblem

  • 1. Concurrency Problem Adriano Patrick Cunha - UDCE quarta-feira, 10 de outubro de 2012
  • 3. Big Data to process quarta-feira, 10 de outubro de 2012
  • 4. What Possibilities ? quarta-feira, 10 de outubro de 2012
  • 6. Which options ? quarta-feira, 10 de outubro de 2012
  • 7. Functional Programming language ? quarta-feira, 10 de outubro de 2012
  • 8. API java.util.concurrent 5 quarta-feira, 10 de outubro de 2012
  • 10. Thead-Safe private  Set<String>  ipAddressSet  =  new  HashSet<String>(); quarta-feira, 10 de outubro de 2012
  • 11. Thead-Safe private  Set<String>  ipAddressSet  =  new  HashSet<String>();  private  Set<String>  ipAddressSet  =  Collections.              synchonizedSet(new  HashSet<String>()); quarta-feira, 10 de outubro de 2012
  • 12. Thead-Safe private  Set<String>  ipAddressSet  =  new  HashSet<String>();  private  Set<String>  ipAddressSet  =  Collections.              synchonizedSet(new  HashSet<String>()); private  BlockingQueue<String>  ipAddress=new  LinkedBlockingQueue<String>(); quarta-feira, 10 de outubro de 2012
  • 13. Thead-Safe fast-fail iterators private  Set<String>  ipAddressSet  =  new  HashSet<String>();  private  Set<String>  ipAddressSet  =  Collections.              synchonizedSet(new  HashSet<String>()); private  BlockingQueue<String>  ipAddress=new  LinkedBlockingQueue<String>(); weakly consistent iterators quarta-feira, 10 de outubro de 2012
  • 14. Thead-Safe Outras  Coleções ConcurrentHashMap,  CopyOnWriteArrayList  e   CopyOnWriteArraySet quarta-feira, 10 de outubro de 2012
  • 15. Executor Executor ExecutorService ScheduledExecutorService quarta-feira, 10 de outubro de 2012
  • 16. Executor (new Thread(r)).start(); quarta-feira, 10 de outubro de 2012
  • 17. Executor (new Thread(r)).start(); e.execute(r); quarta-feira, 10 de outubro de 2012
  • 18. Thread Pools Executors.newCachedThreadPool(); Executors.newFixedThreadPoll(n); Executors.newSingleThreadExecutor(); quarta-feira, 10 de outubro de 2012
  • 19. Thread Pools class Counter { private int c = 0; public void increment() { c++; } public void decrement() { c--; } public int value() { return c; } } 1. Thread A: Retrieve c. 2. Thread B: Retrieve c. 1. Retrieve the current value of c. 3. Thread A: Increment retrieved value; result is 1. 2. Increment the retrieved value by 1. 4. Thread B: Decrement retrieved value; result is -1. 3. Store the incremented value back in c. 5. Thread A: Store result in c; c is now 1. 6. Thread B: Store result in c; c is now -1. quarta-feira, 10 de outubro de 2012
  • 20. Thread Pools class SynchronizedCounter { private int c = 0; public synchronized void increment() { c++; } public synchronized void decrement() { c--; } public synchronized int value() { return c; } } quarta-feira, 10 de outubro de 2012
  • 21. Thread Pools import java.util.concurrent.atomic.AtomicInteger; class AtomicCounter { private AtomicInteger c = new AtomicInteger(0); public void increment() { c.incrementAndGet(); } public void decrement() { c.decrementAndGet(); } public int value() { return c.get(); } } quarta-feira, 10 de outubro de 2012
  • 22. Bibliografia Livros Concurrent Programming in Java, Design Principles and Patterns, Doug Lea, Addison-Wesley, 1999 Java Concurrency In Practice, Brian Goetz, Addison-Wesley, 2006 Links http://docs.oracle.com/javase/tutorial/essential/concurrency/index.html http://www.jcp.org/en/jsr/detail?id=166 http://gee.cs.oswego.edu/dl/concurrency-interest/ http://www.devmedia.com.br/websys.2/webreader.asp?cat=6&revista=javamagazine_69 quarta-feira, 10 de outubro de 2012