SlideShare a Scribd company logo
www.ExigenServices.com
Non-blocking algorithms at traffic
conditions
Alina Ziyatova
Your Reliable IT Business Solution Provider
How to control shared resources?
Your Reliable IT Business Solution Provider
Races
A
B
value -> 7 7 + 1 -> 8 value = 8
value -> 7 7 + 1 -> 8 value = 8
Your Reliable IT Business Solution Provider
Increment operation
long i = 0;
i ++;
read
modify
set
Your Reliable IT Business Solution Provider
Guaranteed:
Visibility of changes
Atomicity of operations
Disadvantages:
Throughput
public synchronize void method() {
// reading or modification
}
Modifier synchronize
Your Reliable IT Business Solution Provider
The worst case
Deadlock
Resource 1 Resource 2
Thread 1 Thread 2
I am waiting… I am waiting too…
Your Reliable IT Business Solution Provider
Atomic package
AtomicLong i = new AtomicLong(0);
i.getAndIncrement();
read
modify
set
Your Reliable IT Business Solution Provider
Compare & Set operations
Read the value
Return false
Is it differ from expected one?
Modify
Return true
Your Reliable IT Business Solution Provider
Compare & Set operations
Read a value
of the
variable
Perform an
intermediate
computing
Read a value of the
variable again and
compare with
previous one
Has the value
changed?
Yes
No
Your Reliable IT Business Solution Provider
Non-blocking algorithms
Wait-free
Non-blocking
Lock-free
Your Reliable IT Business Solution Provider
Stack
HEAD
Last In – First Out
1 2
null3
2 3
Your Reliable IT Business Solution Provider
Treiber’s algorithm for Stack
Node
static class Node<E> {
final E item;
Node<E> next;
public Node(E item) {
this.item = item;
}
}
1 2
Your Reliable IT Business Solution Provider
Treiber’s algorithm for Stack
import java.util.concurrent.atomic.AtomicReference;
public class ConcurrentStack<E> {
AtomicReference<Node<E>> head =
new AtomicReference<Node<E>>();
//. . .
}
HEAD
1 2
Your Reliable IT Business Solution Provider
Treiber’s algorithm for Stack
HEAD
1
2
3
Push a new Node
Read reference
Update next field
CAS
. . .
1 2
2 3
1
0 1
0
Your Reliable IT Business Solution Provider
Treiber’s algorithm for Stack
Remove a Node
HEAD
1
3
Read reference to next item
CAS
. . .
Read head reference
2
2
2 3
1
2
1
Your Reliable IT Business Solution Provider
Performance comparison
0
2000000
4000000
6000000
8000000
10000000
12000000
14000000
16000000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
ConcurrentHashMap
ConcurrentSkipListMap
SynchronizedHashMap
SynchronizedTreeMap
Hashtable
Number of threads
Win7 Enterprise, Intel Core i5-2500
Add probability = 0.6, Remove probability = 0.1
Java version 1.6.0_37
Your Reliable IT Business Solution Provider
Performance comparison
Win7 Enterprise, Intel Core i5-2500
Add probability = 0.2, Remove probability = 0.6
0
5000000
10000000
15000000
20000000
25000000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
ConcurrentHashMap
ConcurrentSkipListMap
SynchronizedHashMap
SynchronizedTreeMap
Hashtable
Java version 1.6.0_37
Number of threads
Your Reliable IT Business Solution Provider
Conclusion
Choose a type of Collections
depending on your task
Non-blocking algorithms may
consume full resources of a server
Your Reliable IT Business Solution Provider
Performance comparison
Win7 Enterprise, Intel Core i5-2500
Add probability = 0.6, Remove probability = 0.1
0
5000000
10000000
15000000
20000000
25000000
30000000
35000000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Java 1.7.0
Java 1.6.0_37
ConcurrentHashMap
Number of threads
Your Reliable IT Business Solution Provider
Questions

More Related Content

Viewers also liked

Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
Return on Intelligence
 
Agile Project Grows
Agile Project GrowsAgile Project Grows
Agile Project Grows
Return on Intelligence
 
Apache Maven 2 Part 2
Apache Maven 2 Part 2Apache Maven 2 Part 2
Apache Maven 2 Part 2
Return on Intelligence
 
Time Management
Time ManagementTime Management
Time Management
Return on Intelligence
 
How to develop your creativity
How to develop your creativityHow to develop your creativity
How to develop your creativity
Return on Intelligence
 
Windows Azure: Quick start
Windows Azure: Quick startWindows Azure: Quick start
Windows Azure: Quick start
Return on Intelligence
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
Return on Intelligence
 
Large Scale Software Project
Large Scale Software ProjectLarge Scale Software Project
Large Scale Software Project
Return on Intelligence
 
Jira as a test management tool
Jira as a test management toolJira as a test management tool
Jira as a test management tool
Return on Intelligence
 
Service design principles and patterns
Service design principles and patternsService design principles and patterns
Service design principles and patterns
Return on Intelligence
 
Risk Management
Risk ManagementRisk Management
Risk Management
Return on Intelligence
 
Principles of personal effectiveness
Principles of personal effectivenessPrinciples of personal effectiveness
Principles of personal effectiveness
Return on Intelligence
 
Cross-cultural communication
Cross-cultural communicationCross-cultural communication
Cross-cultural communication
Return on Intelligence
 
Gradle
GradleGradle
Resolving conflicts
Resolving conflictsResolving conflicts
Resolving conflicts
Return on Intelligence
 
The art of project estimation
The art of project estimationThe art of project estimation
The art of project estimation
Return on Intelligence
 
Types of testing and their classification
Types of testing and their classificationTypes of testing and their classification
Types of testing and their classificationReturn on Intelligence
 
XPath локаторы в Selenium WebDriver
XPath локаторы в Selenium WebDriverXPath локаторы в Selenium WebDriver
XPath локаторы в Selenium WebDriver
Илья Кожухов
 
Introduction to Selenium Web Driver
Introduction to Selenium Web DriverIntroduction to Selenium Web Driver
Introduction to Selenium Web Driver
Return on Intelligence
 

Viewers also liked (20)

Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Agile Project Grows
Agile Project GrowsAgile Project Grows
Agile Project Grows
 
Apache Maven 2 Part 2
Apache Maven 2 Part 2Apache Maven 2 Part 2
Apache Maven 2 Part 2
 
Time Management
Time ManagementTime Management
Time Management
 
How to develop your creativity
How to develop your creativityHow to develop your creativity
How to develop your creativity
 
Windows Azure: Quick start
Windows Azure: Quick startWindows Azure: Quick start
Windows Azure: Quick start
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Large Scale Software Project
Large Scale Software ProjectLarge Scale Software Project
Large Scale Software Project
 
Jira as a test management tool
Jira as a test management toolJira as a test management tool
Jira as a test management tool
 
Service design principles and patterns
Service design principles and patternsService design principles and patterns
Service design principles and patterns
 
Risk Management
Risk ManagementRisk Management
Risk Management
 
Principles of personal effectiveness
Principles of personal effectivenessPrinciples of personal effectiveness
Principles of personal effectiveness
 
Cross-cultural communication
Cross-cultural communicationCross-cultural communication
Cross-cultural communication
 
Gradle
GradleGradle
Gradle
 
Resolving conflicts
Resolving conflictsResolving conflicts
Resolving conflicts
 
The art of project estimation
The art of project estimationThe art of project estimation
The art of project estimation
 
Types of testing and their classification
Types of testing and their classificationTypes of testing and their classification
Types of testing and their classification
 
XPath локаторы в Selenium WebDriver
XPath локаторы в Selenium WebDriverXPath локаторы в Selenium WebDriver
XPath локаторы в Selenium WebDriver
 
Introduction to Selenium Web Driver
Introduction to Selenium Web DriverIntroduction to Selenium Web Driver
Introduction to Selenium Web Driver
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 

Similar to Non Blocking Algorithms at Traffic Conditions

Vertical Recommendation Using Collaborative Filtering
Vertical Recommendation Using Collaborative FilteringVertical Recommendation Using Collaborative Filtering
Vertical Recommendation Using Collaborative Filtering
gorass
 
Solving the n + 1 query problem
Solving the n + 1 query problemSolving the n + 1 query problem
Solving the n + 1 query problem
Sebastien Pelletier
 
MySQL Router REST API
MySQL Router REST APIMySQL Router REST API
MySQL Router REST API
Frederic Descamps
 
Lambdas puzzler - Peter Lawrey
Lambdas puzzler - Peter LawreyLambdas puzzler - Peter Lawrey
Lambdas puzzler - Peter Lawrey
JAXLondon_Conference
 
dbadapters
dbadaptersdbadapters
dbadapters
XAVIERCONSULTANTS
 
Enhancements that will make your sql database roar sp1 edition sql bits 2017
Enhancements that will make your sql database roar sp1 edition sql bits 2017Enhancements that will make your sql database roar sp1 edition sql bits 2017
Enhancements that will make your sql database roar sp1 edition sql bits 2017
Bob Ward
 
IBM Informix dynamic server 11 10 Cheetah Sql Features
IBM Informix dynamic server 11 10 Cheetah Sql FeaturesIBM Informix dynamic server 11 10 Cheetah Sql Features
IBM Informix dynamic server 11 10 Cheetah Sql Features
Keshav Murthy
 
Scaling asp.net websites to millions of users
Scaling asp.net websites to millions of usersScaling asp.net websites to millions of users
Scaling asp.net websites to millions of users
oazabir
 
Cloud Computing for Business - The Road to IT-as-a-Service
Cloud Computing for Business - The Road to IT-as-a-ServiceCloud Computing for Business - The Road to IT-as-a-Service
Cloud Computing for Business - The Road to IT-as-a-Service
James Urquhart
 
Distributed Stream Processing with WSO2 Stream Processor
Distributed Stream Processing with WSO2 Stream ProcessorDistributed Stream Processing with WSO2 Stream Processor
Distributed Stream Processing with WSO2 Stream Processor
WSO2
 
Agile Data Science 2.0
Agile Data Science 2.0Agile Data Science 2.0
Agile Data Science 2.0
Russell Jurney
 
Agile Data Science 2.0: Using Spark with MongoDB
Agile Data Science 2.0: Using Spark with MongoDBAgile Data Science 2.0: Using Spark with MongoDB
Agile Data Science 2.0: Using Spark with MongoDB
Russell Jurney
 
The value of reactive
The value of reactiveThe value of reactive
The value of reactive
Stéphane Maldini
 
The Value of Reactive
The Value of ReactiveThe Value of Reactive
The Value of Reactive
VMware Tanzu
 
Exploring mysql cluster 7.4
Exploring mysql cluster 7.4Exploring mysql cluster 7.4
Exploring mysql cluster 7.4
Ivan Ma
 
Lessons from running AppSync in prod
Lessons from running AppSync in prodLessons from running AppSync in prod
Lessons from running AppSync in prod
Yan Cui
 
Toub parallelism tour_oct2009
Toub parallelism tour_oct2009Toub parallelism tour_oct2009
Toub parallelism tour_oct2009nkaluva
 
PayPal merchant ecosystem using Apache Spark, Hive, Druid, and HBase
PayPal merchant ecosystem using Apache Spark, Hive, Druid, and HBase PayPal merchant ecosystem using Apache Spark, Hive, Druid, and HBase
PayPal merchant ecosystem using Apache Spark, Hive, Druid, and HBase
DataWorks Summit
 
Server side rendering with React and Symfony
Server side rendering with React and SymfonyServer side rendering with React and Symfony
Server side rendering with React and Symfony
Ignacio Martín
 

Similar to Non Blocking Algorithms at Traffic Conditions (20)

Vertical Recommendation Using Collaborative Filtering
Vertical Recommendation Using Collaborative FilteringVertical Recommendation Using Collaborative Filtering
Vertical Recommendation Using Collaborative Filtering
 
Solving the n + 1 query problem
Solving the n + 1 query problemSolving the n + 1 query problem
Solving the n + 1 query problem
 
MySQL Router REST API
MySQL Router REST APIMySQL Router REST API
MySQL Router REST API
 
XenApp Load Balancing
XenApp Load BalancingXenApp Load Balancing
XenApp Load Balancing
 
Lambdas puzzler - Peter Lawrey
Lambdas puzzler - Peter LawreyLambdas puzzler - Peter Lawrey
Lambdas puzzler - Peter Lawrey
 
dbadapters
dbadaptersdbadapters
dbadapters
 
Enhancements that will make your sql database roar sp1 edition sql bits 2017
Enhancements that will make your sql database roar sp1 edition sql bits 2017Enhancements that will make your sql database roar sp1 edition sql bits 2017
Enhancements that will make your sql database roar sp1 edition sql bits 2017
 
IBM Informix dynamic server 11 10 Cheetah Sql Features
IBM Informix dynamic server 11 10 Cheetah Sql FeaturesIBM Informix dynamic server 11 10 Cheetah Sql Features
IBM Informix dynamic server 11 10 Cheetah Sql Features
 
Scaling asp.net websites to millions of users
Scaling asp.net websites to millions of usersScaling asp.net websites to millions of users
Scaling asp.net websites to millions of users
 
Cloud Computing for Business - The Road to IT-as-a-Service
Cloud Computing for Business - The Road to IT-as-a-ServiceCloud Computing for Business - The Road to IT-as-a-Service
Cloud Computing for Business - The Road to IT-as-a-Service
 
Distributed Stream Processing with WSO2 Stream Processor
Distributed Stream Processing with WSO2 Stream ProcessorDistributed Stream Processing with WSO2 Stream Processor
Distributed Stream Processing with WSO2 Stream Processor
 
Agile Data Science 2.0
Agile Data Science 2.0Agile Data Science 2.0
Agile Data Science 2.0
 
Agile Data Science 2.0: Using Spark with MongoDB
Agile Data Science 2.0: Using Spark with MongoDBAgile Data Science 2.0: Using Spark with MongoDB
Agile Data Science 2.0: Using Spark with MongoDB
 
The value of reactive
The value of reactiveThe value of reactive
The value of reactive
 
The Value of Reactive
The Value of ReactiveThe Value of Reactive
The Value of Reactive
 
Exploring mysql cluster 7.4
Exploring mysql cluster 7.4Exploring mysql cluster 7.4
Exploring mysql cluster 7.4
 
Lessons from running AppSync in prod
Lessons from running AppSync in prodLessons from running AppSync in prod
Lessons from running AppSync in prod
 
Toub parallelism tour_oct2009
Toub parallelism tour_oct2009Toub parallelism tour_oct2009
Toub parallelism tour_oct2009
 
PayPal merchant ecosystem using Apache Spark, Hive, Druid, and HBase
PayPal merchant ecosystem using Apache Spark, Hive, Druid, and HBase PayPal merchant ecosystem using Apache Spark, Hive, Druid, and HBase
PayPal merchant ecosystem using Apache Spark, Hive, Druid, and HBase
 
Server side rendering with React and Symfony
Server side rendering with React and SymfonyServer side rendering with React and Symfony
Server side rendering with React and Symfony
 

More from Return on Intelligence

Differences between Testing in Waterfall and Agile
Differences between Testing in Waterfall and AgileDifferences between Testing in Waterfall and Agile
Differences between Testing in Waterfall and Agile
Return on Intelligence
 
Организация внутренней системы обучения
Организация внутренней системы обученияОрганизация внутренней системы обучения
Организация внутренней системы обученияReturn on Intelligence
 
Shared position in a project: testing and analysis
Shared position in a project: testing and analysisShared position in a project: testing and analysis
Shared position in a project: testing and analysis
Return on Intelligence
 
Introduction to Business Etiquette
Introduction to Business EtiquetteIntroduction to Business Etiquette
Introduction to Business Etiquette
Return on Intelligence
 
Agile Testing Process
Agile Testing ProcessAgile Testing Process
Agile Testing Process
Return on Intelligence
 
Оценка задач выполняемых по итеративной разработке
Оценка задач выполняемых по итеративной разработкеОценка задач выполняемых по итеративной разработке
Оценка задач выполняемых по итеративной разработке
Return on Intelligence
 
Meetings arranging
Meetings arrangingMeetings arranging
Meetings arranging
Return on Intelligence
 
Velocity как инструмент планирования и управления проектом
Velocity как инструмент планирования и управления проектомVelocity как инструмент планирования и управления проектом
Velocity как инструмент планирования и управления проектом
Return on Intelligence
 
Testing your code
Testing your codeTesting your code
Testing your code
Return on Intelligence
 
Business Analyst lecture
Business Analyst lectureBusiness Analyst lecture
Business Analyst lecture
Return on Intelligence
 

More from Return on Intelligence (12)

Differences between Testing in Waterfall and Agile
Differences between Testing in Waterfall and AgileDifferences between Testing in Waterfall and Agile
Differences between Testing in Waterfall and Agile
 
Windows azurequickstart
Windows azurequickstartWindows azurequickstart
Windows azurequickstart
 
Организация внутренней системы обучения
Организация внутренней системы обученияОрганизация внутренней системы обучения
Организация внутренней системы обучения
 
Shared position in a project: testing and analysis
Shared position in a project: testing and analysisShared position in a project: testing and analysis
Shared position in a project: testing and analysis
 
Introduction to Business Etiquette
Introduction to Business EtiquetteIntroduction to Business Etiquette
Introduction to Business Etiquette
 
Agile Testing Process
Agile Testing ProcessAgile Testing Process
Agile Testing Process
 
Оценка задач выполняемых по итеративной разработке
Оценка задач выполняемых по итеративной разработкеОценка задач выполняемых по итеративной разработке
Оценка задач выполняемых по итеративной разработке
 
Meetings arranging
Meetings arrangingMeetings arranging
Meetings arranging
 
Velocity как инструмент планирования и управления проектом
Velocity как инструмент планирования и управления проектомVelocity как инструмент планирования и управления проектом
Velocity как инструмент планирования и управления проектом
 
Testing your code
Testing your codeTesting your code
Testing your code
 
Reports Project
Reports ProjectReports Project
Reports Project
 
Business Analyst lecture
Business Analyst lectureBusiness Analyst lecture
Business Analyst lecture
 

Recently uploaded

20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
ThomasParaiso2
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 

Recently uploaded (20)

20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 

Non Blocking Algorithms at Traffic Conditions

  • 1. www.ExigenServices.com Non-blocking algorithms at traffic conditions Alina Ziyatova
  • 2. Your Reliable IT Business Solution Provider How to control shared resources?
  • 3. Your Reliable IT Business Solution Provider Races A B value -> 7 7 + 1 -> 8 value = 8 value -> 7 7 + 1 -> 8 value = 8
  • 4. Your Reliable IT Business Solution Provider Increment operation long i = 0; i ++; read modify set
  • 5. Your Reliable IT Business Solution Provider Guaranteed: Visibility of changes Atomicity of operations Disadvantages: Throughput public synchronize void method() { // reading or modification } Modifier synchronize
  • 6. Your Reliable IT Business Solution Provider The worst case Deadlock Resource 1 Resource 2 Thread 1 Thread 2 I am waiting… I am waiting too…
  • 7. Your Reliable IT Business Solution Provider Atomic package AtomicLong i = new AtomicLong(0); i.getAndIncrement(); read modify set
  • 8. Your Reliable IT Business Solution Provider Compare & Set operations Read the value Return false Is it differ from expected one? Modify Return true
  • 9. Your Reliable IT Business Solution Provider Compare & Set operations Read a value of the variable Perform an intermediate computing Read a value of the variable again and compare with previous one Has the value changed? Yes No
  • 10. Your Reliable IT Business Solution Provider Non-blocking algorithms Wait-free Non-blocking Lock-free
  • 11. Your Reliable IT Business Solution Provider Stack HEAD Last In – First Out 1 2 null3 2 3
  • 12. Your Reliable IT Business Solution Provider Treiber’s algorithm for Stack Node static class Node<E> { final E item; Node<E> next; public Node(E item) { this.item = item; } } 1 2
  • 13. Your Reliable IT Business Solution Provider Treiber’s algorithm for Stack import java.util.concurrent.atomic.AtomicReference; public class ConcurrentStack<E> { AtomicReference<Node<E>> head = new AtomicReference<Node<E>>(); //. . . } HEAD 1 2
  • 14. Your Reliable IT Business Solution Provider Treiber’s algorithm for Stack HEAD 1 2 3 Push a new Node Read reference Update next field CAS . . . 1 2 2 3 1 0 1 0
  • 15. Your Reliable IT Business Solution Provider Treiber’s algorithm for Stack Remove a Node HEAD 1 3 Read reference to next item CAS . . . Read head reference 2 2 2 3 1 2 1
  • 16. Your Reliable IT Business Solution Provider Performance comparison 0 2000000 4000000 6000000 8000000 10000000 12000000 14000000 16000000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ConcurrentHashMap ConcurrentSkipListMap SynchronizedHashMap SynchronizedTreeMap Hashtable Number of threads Win7 Enterprise, Intel Core i5-2500 Add probability = 0.6, Remove probability = 0.1 Java version 1.6.0_37
  • 17. Your Reliable IT Business Solution Provider Performance comparison Win7 Enterprise, Intel Core i5-2500 Add probability = 0.2, Remove probability = 0.6 0 5000000 10000000 15000000 20000000 25000000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ConcurrentHashMap ConcurrentSkipListMap SynchronizedHashMap SynchronizedTreeMap Hashtable Java version 1.6.0_37 Number of threads
  • 18. Your Reliable IT Business Solution Provider Conclusion Choose a type of Collections depending on your task Non-blocking algorithms may consume full resources of a server
  • 19. Your Reliable IT Business Solution Provider Performance comparison Win7 Enterprise, Intel Core i5-2500 Add probability = 0.6, Remove probability = 0.1 0 5000000 10000000 15000000 20000000 25000000 30000000 35000000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Java 1.7.0 Java 1.6.0_37 ConcurrentHashMap Number of threads
  • 20. Your Reliable IT Business Solution Provider Questions