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

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.pptxjohnsmith96441
 
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 ProgrammingSachintha Gunasena
 
distributed-systemsfghjjjijoijioj-chap3.pptx
distributed-systemsfghjjjijoijioj-chap3.pptxdistributed-systemsfghjjjijoijioj-chap3.pptx
distributed-systemsfghjjjijoijioj-chap3.pptxlencho3d
 
Load balancing in Distributed Systems
Load balancing in Distributed SystemsLoad balancing in Distributed Systems
Load balancing in Distributed SystemsRicha Singh
 
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...Malobe Lottin Cyrille Marcel
 
Software engineering
Software engineeringSoftware engineering
Software engineeringFahe Em
 
Software engineering
Software engineeringSoftware engineering
Software engineeringFahe Em
 
Massively Scalable Applications - TechFerry
Massively Scalable Applications - TechFerryMassively Scalable Applications - TechFerry
Massively Scalable Applications - TechFerryTechFerry
 
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 ModelsZvi Avraham
 
Survey of task scheduler
Survey of task schedulerSurvey of task scheduler
Survey of task schedulerelisha25
 
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? : NotesSubhajit Sahu
 
A REVIEW ON PARALLEL COMPUTING
A REVIEW ON PARALLEL COMPUTINGA REVIEW ON PARALLEL COMPUTING
A REVIEW ON PARALLEL COMPUTINGAmy Roman
 
Software architecture for data applications
Software architecture for data applicationsSoftware architecture for data applications
Software architecture for data applicationsDing Li
 
E5 05 ijcite august 2014
E5 05 ijcite august 2014E5 05 ijcite august 2014
E5 05 ijcite august 2014ijcite
 
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 computingpurplesea
 
Week # 1.pdf
Week # 1.pdfWeek # 1.pdf
Week # 1.pdfgiddy5
 

Ä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

Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School CourseKatarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Coursebim.edu.pl
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptMadan Karki
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONjhunlian
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
 
chpater16.pptxMMMMMMMMMMMMMMMMMMMMMMMMMMM
chpater16.pptxMMMMMMMMMMMMMMMMMMMMMMMMMMMchpater16.pptxMMMMMMMMMMMMMMMMMMMMMMMMMMM
chpater16.pptxMMMMMMMMMMMMMMMMMMMMMMMMMMMNanaAgyeman13
 
Internet of things -Arshdeep Bahga .pptx
Internet of things -Arshdeep Bahga .pptxInternet of things -Arshdeep Bahga .pptx
Internet of things -Arshdeep Bahga .pptxVelmuruganTECE
 
"Exploring the Essential Functions and Design Considerations of Spillways in ...
"Exploring the Essential Functions and Design Considerations of Spillways in ..."Exploring the Essential Functions and Design Considerations of Spillways in ...
"Exploring the Essential Functions and Design Considerations of Spillways in ...Erbil Polytechnic University
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfDrew Moseley
 
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Sumanth A
 
Crystal Structure analysis and detailed information pptx
Crystal Structure analysis and detailed information pptxCrystal Structure analysis and detailed information pptx
Crystal Structure analysis and detailed information pptxachiever3003
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgsaravananr517913
 
home automation using Arduino by Aditya Prasad
home automation using Arduino by Aditya Prasadhome automation using Arduino by Aditya Prasad
home automation using Arduino by Aditya Prasadaditya806802
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
multiple access in wireless communication
multiple access in wireless communicationmultiple access in wireless communication
multiple access in wireless communicationpanditadesh123
 
List of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfList of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfisabel213075
 
DM Pillar Training Manual.ppt will be useful in deploying TPM in project
DM Pillar Training Manual.ppt will be useful in deploying TPM in projectDM Pillar Training Manual.ppt will be useful in deploying TPM in project
DM Pillar Training Manual.ppt will be useful in deploying TPM in projectssuserb6619e
 
Cooling Tower SERD pH drop issue (11 April 2024) .pptx
Cooling Tower SERD pH drop issue (11 April 2024) .pptxCooling Tower SERD pH drop issue (11 April 2024) .pptx
Cooling Tower SERD pH drop issue (11 April 2024) .pptxmamansuratman0253
 

Kürzlich hochgeladen (20)

Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School CourseKatarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Course
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.ppt
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 
chpater16.pptxMMMMMMMMMMMMMMMMMMMMMMMMMMM
chpater16.pptxMMMMMMMMMMMMMMMMMMMMMMMMMMMchpater16.pptxMMMMMMMMMMMMMMMMMMMMMMMMMMM
chpater16.pptxMMMMMMMMMMMMMMMMMMMMMMMMMMM
 
Internet of things -Arshdeep Bahga .pptx
Internet of things -Arshdeep Bahga .pptxInternet of things -Arshdeep Bahga .pptx
Internet of things -Arshdeep Bahga .pptx
 
"Exploring the Essential Functions and Design Considerations of Spillways in ...
"Exploring the Essential Functions and Design Considerations of Spillways in ..."Exploring the Essential Functions and Design Considerations of Spillways in ...
"Exploring the Essential Functions and Design Considerations of Spillways in ...
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdf
 
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
 
Crystal Structure analysis and detailed information pptx
Crystal Structure analysis and detailed information pptxCrystal Structure analysis and detailed information pptx
Crystal Structure analysis and detailed information pptx
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
 
home automation using Arduino by Aditya Prasad
home automation using Arduino by Aditya Prasadhome automation using Arduino by Aditya Prasad
home automation using Arduino by Aditya Prasad
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
Designing pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptxDesigning pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptx
 
multiple access in wireless communication
multiple access in wireless communicationmultiple access in wireless communication
multiple access in wireless communication
 
List of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfList of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdf
 
DM Pillar Training Manual.ppt will be useful in deploying TPM in project
DM Pillar Training Manual.ppt will be useful in deploying TPM in projectDM Pillar Training Manual.ppt will be useful in deploying TPM in project
DM Pillar Training Manual.ppt will be useful in deploying TPM in project
 
Cooling Tower SERD pH drop issue (11 April 2024) .pptx
Cooling Tower SERD pH drop issue (11 April 2024) .pptxCooling Tower SERD pH drop issue (11 April 2024) .pptx
Cooling Tower SERD pH drop issue (11 April 2024) .pptx
 

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.