SlideShare ist ein Scribd-Unternehmen logo
1 von 14
TYPE THE SUBJECT NAME HERE
SUBJECT CODE
II III
20CSPC301
OBJECT ORIENTED PROGRAMMING
(Common to CSE, IT,CSBS)
UNIT NO V
Lambda Expressions
5.7 Parallel Processing-Reactive
Programming
OBJECT ORIENTED PROGRAMMING (Common to CSE, IT,CSBS)
20CSPC301
Parallel Processing
Definition of Parallel Processing
 Parallel processing also called parallel computing this is a type of computation
in which many execution of processes are carried out concurrently.
 In computers, parallel processing is the processing of program instructions by
dividing them among multiple processor with the objective of running a
program in less time.
 In the earliest computers, only one program ran at a time. According to research
Parallel computing is closely related to concurrent computing — they are
frequently used together, and often conflated, though the two are distinct: it is
possible to have parallelism without concurrency (such as bit-level parallelism),
and concurrency without parallelism (such as multitasking by time-sharing on a
single-core CPU).
OBJECT ORIENTED PROGRAMMING (Common to CSE, IT,CSBS)
20CSPC301
 Parallel processing makes a program run faster because there are more engines
(CPUs) running it. In practice, it is often difficult to divide a program in such a
way that separate CPUs can execute different portions without interfering with
each other.
Serial Computing
OBJECT ORIENTED PROGRAMMING (Common to CSE, IT,CSBS)
20CSPC301
Parallel Computing
OBJECT ORIENTED PROGRAMMING (Common to CSE, IT,CSBS)
20CSPC301
Advantages Parallel Processing
•Parallel computing saves time, allowing the execution of applications in a
shorter wall-clock time.
•Solve Larger Problems in a short point of time.
•Compared to serial computing, parallel computing is much better suited for
modeling, simulating and understanding complex, real-world phenomena.
•Many problems are so large that it is impossible to solve them on a single
computer, especially given limited computer memory.
•You can do many things simultaneously by using multiple computing
resources.
•Can using computer resources on the Wide Area Network(WAN) or even on
the internet.
•It can help keep you organized. If you have Internet, then communication and
social networking can be made easier.
•It has massive data storage and quick data computations.
OBJECT ORIENTED PROGRAMMING (Common to CSE, IT,CSBS)
20CSPC301
Disadvantages Parallel Processing
•Programming to target Parallel architecture is a bit difficult but with proper
understanding and practice, you are good to go.
•The use of parallel computing lets you solve computationally and data-intensive
problems using multi-core processors, but, sometimes this effect on some of our
control algorithm and does not give good results and this can also affect the
convergence of the system due to the parallel option.
•The extra cost (i.e. increased execution time) incurred are due to data transfers,
synchronization, communication, thread creation/destruction, etc. These costs can
sometimes be quite large, and may actually exceed the gains due to parallelization.
•Various code tweaking has to be performed for different target architectures for
improved performance.
•Better cooling technologies are required in case of clusters.
•Power consumption is huge by the multi-core architectures
OBJECT ORIENTED PROGRAMMING (Common to CSE, IT,CSBS)
20CSPC301
•Multiprocessing refers to a computer system’s ability to support more than one
process(program) at the same time.
•Multiprocessing operating system enable several programs to run concurrently.
UNIX is one of the most widely used multiprocessing system, but there are many
others, including OS/2 for high-end PCs. Multiprocessing systems are much more
complicated than single-process systems because the operating system must
allocate resource to competing processes in a reasonable manner.
•May also refer to the utilization of multiple CPUs in a single computer system.
•The maximum number of processes you can run at a time is limited by the number
of processors in your computer. If you don’t know how many processors are
present in the machine, the cpu_count() function in multiprocessing will show it.
import multiprocessing as mp
print("Number of processors: ", mp.cpu_count())
OBJECT ORIENTED PROGRAMMING (Common to CSE, IT,CSBS)
20CSPC301
Difference Between Synchronous and Asynchronous execution
•In parallel processing, there are two types of execution: Synchronous and
Asynchronous.
•A synchronous execution is one the processes are completed in the same order in
which it was started. This is achieved by locking the main program until the
respective processes are finished.
•Asynchronous, doesn’t involve locking. As a result, the order of results can get
mixed up but usually gets done quicker.
OBJECT ORIENTED PROGRAMMING (Common to CSE, IT,CSBS)
20CSPC301
There are 2 main objects in multiprocessing to implement parallel execution of a
function: The Pool Class and the Process Class.
1. Pool Class
2. Synchronous execution
Pool.map() and Pool.starmap()
Pool.apply()
1. Asynchronous execution
Pool.map_async() and Pool.starmap_async()
Pool.apply_async())
2. Process Class
OBJECT ORIENTED PROGRAMMING (Common to CSE, IT,CSBS)
20CSPC301
What is Reactive Programming?
•Reactive Programming is a programming language with asynchronous data
stream. Once an event will raise it will react with responsive and non-blocking
manner that’s why it named it as reactive programming.
•In a Reactive Programming context, “Everything is a Stream and acts in a non-
blocking manner when there is data in the stream.”
•This Reactive programming in java is introduced by Netflix organization with
API (Rx-Java)
Why we need Reactive Programming?
•When we have traditional way to develop application why we should go for
reactive programming,
There is four pillar to move towards Reactive Programming
Responsive
Resilient
Elastic
Message Driven
OBJECT ORIENTED PROGRAMMING (Common to CSE, IT,CSBS)
20CSPC301
Responsive:Responsive means if we are raising any events on stream it will return
response in fraction of time as message processing in highly concurrent
environments
Resilient:Resilient means Application should be responsive at the time of failure.
Normally we are integrating multiple modules and each are depend to each other
assume one module is failing so it should not be impact all, it should be propagate.
Elastic:Elastic means our system should be handle N number of request, it should
be well capability to load balance at any condition
Message Driven:Message Driven means asynchronous flow of execution, where
we no need to wait for response after send request to server , once we send request
it move to next business it shouldn’t depends on first one response , the first
request response should be handle by callback mechanism.
OBJECT ORIENTED PROGRAMMING (Common to CSE, IT,CSBS)
20CSPC301
Ideal Use Cases for Implementation of Reactive Programming
•A large number of transaction-processing services, as in the banking sector.
•Notification services of large online shopping applications, like Amazon.
•A share trading business where share prices change simultaneously.
Advantages of Reactive Programming
Improves user experience: The asynchronous nature of RP means that whatever
you program with it will offer a smoother, more responsive product for your users
to interact with.
Improves user experience: The asynchronous nature of RP means that whatever
you program with it will offer a smoother, more responsive product for your users
to interact with.
Simple to compose streams of data: Reactive programming provide the potential
for developers to create, filter, and combine streams of data which can emit a
value, error, and a completed signal, to achieve powerful objectives.
OBJECT ORIENTED PROGRAMMING (Common to CSE, IT,CSBS)
20CSPC301
A lot simpler to do async/threaded work: The method that PR allows you to work
on the data streams causes it becomes less hassle than regular threading.
Avoid “callback hell” or "pyramid of doom": Callback Hell is an anti-pattern
seen in code of asynchronous programming. It is a slang term used to describe and
unwieldy number of nested “if” statements or functions. It usually happens when
there are a lot of callback functions in the code. Developers can avoid the callback
hell with reactive programming because it depends on asynchronous data streams.
High performance in cooperation with Java: RP allows Java apps to have higher
performance with lower memory requirements. This is made possible by avoiding
blocking calls that lead to a process as well as context switches in the OS.
OBJECT ORIENTED PROGRAMMING (Common to CSE, IT,CSBS)
20CSPC301
Disadvantages of Reactive Programming
Hard to learn: RP have a reputation of being difficult since it is entirely different
compared with previous ways of working. This leads to a steep learning curve
when you start using it which may be a shock to some developers.
More memory intensive: Applications will tend to be more memory intensive due
to reactive programming relies on streams over time. This can lead to memory
leakage which could end up seriously slowing things down for users.

Weitere ähnliche Inhalte

Ähnlich wie 5.7 Parallel Processing - Reactive Programming.pdf.pptx

distributed-systemsfghjjjijoijioj-chap3.pptx
distributed-systemsfghjjjijoijioj-chap3.pptxdistributed-systemsfghjjjijoijioj-chap3.pptx
distributed-systemsfghjjjijoijioj-chap3.pptx
lencho3d
 
Software engineering
Software engineeringSoftware engineering
Software engineering
Fahe Em
 
Software engineering
Software engineeringSoftware engineering
Software engineering
Fahe Em
 
Survey of task scheduler
Survey of task schedulerSurvey of task scheduler
Survey of task scheduler
elisha25
 
System models for distributed and cloud computing
System models for distributed and cloud computingSystem models for distributed and cloud computing
System models for distributed and cloud computing
purplesea
 
Week # 1.pdf
Week # 1.pdfWeek # 1.pdf
Week # 1.pdf
giddy5
 

Ähnlich wie 5.7 Parallel Processing - Reactive Programming.pdf.pptx (20)

ICS 2410.Parallel.Sytsems.Lecture.Week 3.week5.pptx
ICS 2410.Parallel.Sytsems.Lecture.Week 3.week5.pptxICS 2410.Parallel.Sytsems.Lecture.Week 3.week5.pptx
ICS 2410.Parallel.Sytsems.Lecture.Week 3.week5.pptx
 
Concurrency Programming in Java - 01 - Introduction to Concurrency Programming
Concurrency Programming in Java - 01 - Introduction to Concurrency ProgrammingConcurrency Programming in Java - 01 - Introduction to Concurrency Programming
Concurrency Programming in Java - 01 - Introduction to Concurrency Programming
 
GCF
GCFGCF
GCF
 
distributed-systemsfghjjjijoijioj-chap3.pptx
distributed-systemsfghjjjijoijioj-chap3.pptxdistributed-systemsfghjjjijoijioj-chap3.pptx
distributed-systemsfghjjjijoijioj-chap3.pptx
 
Load balancing in Distributed Systems
Load balancing in Distributed SystemsLoad balancing in Distributed Systems
Load balancing in Distributed Systems
 
Hardware-Software Codesign
Hardware-Software CodesignHardware-Software Codesign
Hardware-Software Codesign
 
Chap 2 classification of parralel architecture and introduction to parllel p...
Chap 2  classification of parralel architecture and introduction to parllel p...Chap 2  classification of parralel architecture and introduction to parllel p...
Chap 2 classification of parralel architecture and introduction to parllel p...
 
Software engineering
Software engineeringSoftware engineering
Software engineering
 
Software engineering
Software engineeringSoftware engineering
Software engineering
 
Parallel processing
Parallel processingParallel processing
Parallel processing
 
Concurrency and parallel in .net
Concurrency and parallel in .netConcurrency and parallel in .net
Concurrency and parallel in .net
 
Massively Scalable Applications - TechFerry
Massively Scalable Applications - TechFerryMassively Scalable Applications - TechFerry
Massively Scalable Applications - TechFerry
 
Migration To Multi Core - Parallel Programming Models
Migration To Multi Core - Parallel Programming ModelsMigration To Multi Core - Parallel Programming Models
Migration To Multi Core - Parallel Programming Models
 
Survey of task scheduler
Survey of task schedulerSurvey of task scheduler
Survey of task scheduler
 
Is Multicore Hardware For General-Purpose Parallel Processing Broken? : Notes
Is Multicore Hardware For General-Purpose Parallel Processing Broken? : NotesIs Multicore Hardware For General-Purpose Parallel Processing Broken? : Notes
Is Multicore Hardware For General-Purpose Parallel Processing Broken? : Notes
 
A REVIEW ON PARALLEL COMPUTING
A REVIEW ON PARALLEL COMPUTINGA REVIEW ON PARALLEL COMPUTING
A REVIEW ON PARALLEL COMPUTING
 
Software architecture for data applications
Software architecture for data applicationsSoftware architecture for data applications
Software architecture for data applications
 
E5 05 ijcite august 2014
E5 05 ijcite august 2014E5 05 ijcite august 2014
E5 05 ijcite august 2014
 
System models for distributed and cloud computing
System models for distributed and cloud computingSystem models for distributed and cloud computing
System models for distributed and cloud computing
 
Week # 1.pdf
Week # 1.pdfWeek # 1.pdf
Week # 1.pdf
 

KĂźrzlich hochgeladen

Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
HenryBriggs2
 

KĂźrzlich hochgeladen (20)

💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
Introduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdfIntroduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdf
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Learn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksLearn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic Marks
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
 

5.7 Parallel Processing - Reactive Programming.pdf.pptx

  • 1. TYPE THE SUBJECT NAME HERE SUBJECT CODE II III 20CSPC301 OBJECT ORIENTED PROGRAMMING (Common to CSE, IT,CSBS) UNIT NO V Lambda Expressions 5.7 Parallel Processing-Reactive Programming
  • 2. OBJECT ORIENTED PROGRAMMING (Common to CSE, IT,CSBS) 20CSPC301 Parallel Processing Definition of Parallel Processing  Parallel processing also called parallel computing this is a type of computation in which many execution of processes are carried out concurrently.  In computers, parallel processing is the processing of program instructions by dividing them among multiple processor with the objective of running a program in less time.  In the earliest computers, only one program ran at a time. According to research Parallel computing is closely related to concurrent computing — they are frequently used together, and often conflated, though the two are distinct: it is possible to have parallelism without concurrency (such as bit-level parallelism), and concurrency without parallelism (such as multitasking by time-sharing on a single-core CPU).
  • 3. OBJECT ORIENTED PROGRAMMING (Common to CSE, IT,CSBS) 20CSPC301  Parallel processing makes a program run faster because there are more engines (CPUs) running it. In practice, it is often difficult to divide a program in such a way that separate CPUs can execute different portions without interfering with each other. Serial Computing
  • 4. OBJECT ORIENTED PROGRAMMING (Common to CSE, IT,CSBS) 20CSPC301 Parallel Computing
  • 5. OBJECT ORIENTED PROGRAMMING (Common to CSE, IT,CSBS) 20CSPC301 Advantages Parallel Processing •Parallel computing saves time, allowing the execution of applications in a shorter wall-clock time. •Solve Larger Problems in a short point of time. •Compared to serial computing, parallel computing is much better suited for modeling, simulating and understanding complex, real-world phenomena. •Many problems are so large that it is impossible to solve them on a single computer, especially given limited computer memory. •You can do many things simultaneously by using multiple computing resources. •Can using computer resources on the Wide Area Network(WAN) or even on the internet. •It can help keep you organized. If you have Internet, then communication and social networking can be made easier. •It has massive data storage and quick data computations.
  • 6. OBJECT ORIENTED PROGRAMMING (Common to CSE, IT,CSBS) 20CSPC301 Disadvantages Parallel Processing •Programming to target Parallel architecture is a bit difficult but with proper understanding and practice, you are good to go. •The use of parallel computing lets you solve computationally and data-intensive problems using multi-core processors, but, sometimes this effect on some of our control algorithm and does not give good results and this can also affect the convergence of the system due to the parallel option. •The extra cost (i.e. increased execution time) incurred are due to data transfers, synchronization, communication, thread creation/destruction, etc. These costs can sometimes be quite large, and may actually exceed the gains due to parallelization. •Various code tweaking has to be performed for different target architectures for improved performance. •Better cooling technologies are required in case of clusters. •Power consumption is huge by the multi-core architectures
  • 7. OBJECT ORIENTED PROGRAMMING (Common to CSE, IT,CSBS) 20CSPC301 •Multiprocessing refers to a computer system’s ability to support more than one process(program) at the same time. •Multiprocessing operating system enable several programs to run concurrently. UNIX is one of the most widely used multiprocessing system, but there are many others, including OS/2 for high-end PCs. Multiprocessing systems are much more complicated than single-process systems because the operating system must allocate resource to competing processes in a reasonable manner. •May also refer to the utilization of multiple CPUs in a single computer system. •The maximum number of processes you can run at a time is limited by the number of processors in your computer. If you don’t know how many processors are present in the machine, the cpu_count() function in multiprocessing will show it. import multiprocessing as mp print("Number of processors: ", mp.cpu_count())
  • 8. OBJECT ORIENTED PROGRAMMING (Common to CSE, IT,CSBS) 20CSPC301 Difference Between Synchronous and Asynchronous execution •In parallel processing, there are two types of execution: Synchronous and Asynchronous. •A synchronous execution is one the processes are completed in the same order in which it was started. This is achieved by locking the main program until the respective processes are finished. •Asynchronous, doesn’t involve locking. As a result, the order of results can get mixed up but usually gets done quicker.
  • 9. OBJECT ORIENTED PROGRAMMING (Common to CSE, IT,CSBS) 20CSPC301 There are 2 main objects in multiprocessing to implement parallel execution of a function: The Pool Class and the Process Class. 1. Pool Class 2. Synchronous execution Pool.map() and Pool.starmap() Pool.apply() 1. Asynchronous execution Pool.map_async() and Pool.starmap_async() Pool.apply_async()) 2. Process Class
  • 10. OBJECT ORIENTED PROGRAMMING (Common to CSE, IT,CSBS) 20CSPC301 What is Reactive Programming? •Reactive Programming is a programming language with asynchronous data stream. Once an event will raise it will react with responsive and non-blocking manner that’s why it named it as reactive programming. •In a Reactive Programming context, “Everything is a Stream and acts in a non- blocking manner when there is data in the stream.” •This Reactive programming in java is introduced by Netflix organization with API (Rx-Java) Why we need Reactive Programming? •When we have traditional way to develop application why we should go for reactive programming, There is four pillar to move towards Reactive Programming Responsive Resilient Elastic Message Driven
  • 11. OBJECT ORIENTED PROGRAMMING (Common to CSE, IT,CSBS) 20CSPC301 Responsive:Responsive means if we are raising any events on stream it will return response in fraction of time as message processing in highly concurrent environments Resilient:Resilient means Application should be responsive at the time of failure. Normally we are integrating multiple modules and each are depend to each other assume one module is failing so it should not be impact all, it should be propagate. Elastic:Elastic means our system should be handle N number of request, it should be well capability to load balance at any condition Message Driven:Message Driven means asynchronous flow of execution, where we no need to wait for response after send request to server , once we send request it move to next business it shouldn’t depends on first one response , the first request response should be handle by callback mechanism.
  • 12. OBJECT ORIENTED PROGRAMMING (Common to CSE, IT,CSBS) 20CSPC301 Ideal Use Cases for Implementation of Reactive Programming •A large number of transaction-processing services, as in the banking sector. •Notification services of large online shopping applications, like Amazon. •A share trading business where share prices change simultaneously. Advantages of Reactive Programming Improves user experience: The asynchronous nature of RP means that whatever you program with it will offer a smoother, more responsive product for your users to interact with. Improves user experience: The asynchronous nature of RP means that whatever you program with it will offer a smoother, more responsive product for your users to interact with. Simple to compose streams of data: Reactive programming provide the potential for developers to create, filter, and combine streams of data which can emit a value, error, and a completed signal, to achieve powerful objectives.
  • 13. OBJECT ORIENTED PROGRAMMING (Common to CSE, IT,CSBS) 20CSPC301 A lot simpler to do async/threaded work: The method that PR allows you to work on the data streams causes it becomes less hassle than regular threading. Avoid “callback hell” or "pyramid of doom": Callback Hell is an anti-pattern seen in code of asynchronous programming. It is a slang term used to describe and unwieldy number of nested “if” statements or functions. It usually happens when there are a lot of callback functions in the code. Developers can avoid the callback hell with reactive programming because it depends on asynchronous data streams. High performance in cooperation with Java: RP allows Java apps to have higher performance with lower memory requirements. This is made possible by avoiding blocking calls that lead to a process as well as context switches in the OS.
  • 14. OBJECT ORIENTED PROGRAMMING (Common to CSE, IT,CSBS) 20CSPC301 Disadvantages of Reactive Programming Hard to learn: RP have a reputation of being difficult since it is entirely different compared with previous ways of working. This leads to a steep learning curve when you start using it which may be a shock to some developers. More memory intensive: Applications will tend to be more memory intensive due to reactive programming relies on streams over time. This can lead to memory leakage which could end up seriously slowing things down for users.