SlideShare a Scribd company logo
1 of 17
Slide 1 of 17
Code Optimization and Performance Tuning Using Intel VTune
In this session, you will learn to:
Identify the benefits of multithreading
Design applications using threads
Objectives
Slide 2 of 17
Code Optimization and Performance Tuning Using Intel VTune
Multithreading increases the performance of your application
by:
Performing multiple tasks in parallel
Better utilization of system resources
Increasing the speed of your application
Identifying the Benefits of Multithreading
Slide 3 of 17
Code Optimization and Performance Tuning Using Intel VTune
Thread is a sequential flow of control within a program.
It is a sequence of instructions executed within a program.
Every program consists of at least one thread, called the
main thread.
The main thread is responsible for initializing the programs.
Identifying the Benefits of Multithreading (Contd.)
Slide 4 of 17
Code Optimization and Performance Tuning Using Intel VTune
What is a thread?
Just a minute
Answer:
A thread is a sequential flow of control within a program.
Slide 5 of 17
Code Optimization and Performance Tuning Using Intel VTune
The main benefits of threads are:
Increased performance
Better resource utilization
Simpler communication
Identifying the Benefits of Multithreading (Contd.)
Slide 6 of 17
Code Optimization and Performance Tuning Using Intel VTune
The two inherent conditions of a multithreaded application
are:
Concurrency
Parallelism
Identifying the Benefits of Multithreading (Contd.)
Concurrency refers to a situation in
which one or more threads are in
progress simultaneously.
In this case, the processor switches
from one thread to another during the
execution of the application.
►
Parallelism refers to the simultaneous
execution of multiple tasks.
In a multithreaded application, which is
running on a multiprocessor system,
threads execute in parallel.
►
Slide 7 of 17
Code Optimization and Performance Tuning Using Intel VTune
The best time for threading an application is during its
design phase.
During the design phase, you can accommodate all the data
and code restructuring related to threading.
This reduces the overall effort during the application
development.
A program comprising of multiple independent activities can
be redesigned in such a manner so that each activity can
be defined as a separate thread.
This enables you to decompose your work into simple
independent activities and improve the functionality and
performance of your application.
Designing Applications Using Threads
Slide 8 of 17
Code Optimization and Performance Tuning Using Intel VTune
You can improve the functionality of your application by
assigning different threads to different functions of the
application.
By assigning a separate thread to each function, all the
functions can execute independent of each other.
This approach makes the application more efficient because
threading is easier than switching functions within a serial
code.
Designing Applications Using Threads (Contd.)
Slide 9 of 17
Code Optimization and Performance Tuning Using Intel VTune
Performance of an application depends upon the
combination of various factors such as speed and utilization
of system resources.
A multithreaded application running on a single processor
system leads to a better utilization of system resources.
A multithreaded application running on a multiprocessor
system leads to better utilization of system resources and
increased speed of the application.
Designing Applications Using Threads (Contd.)
Slide 10 of 17
Code Optimization and Performance Tuning Using Intel VTune
How does the use of threads improve the functionality of an
application?
Just a minute
Answer:
Threads improve the functionality of an application by
assigning different threads to different functions. This makes it
easier to control the execution of multiple functions within an
application.
Slide 11 of 17
Code Optimization and Performance Tuning Using Intel VTune
Data decomposition refers to the process of:
Breaking down a program into logical chunks or individual
tasks.
Identifying the dependencies between the tasks.
The two types of decomposition methods are:
Task decomposition
Data decomposition
Designing Applications Using Threads (Contd.)
► It refers to the process of decomposing
a program on the basis of the functions
it performs.
It is also known as functional
decomposition.
In this case, you can assign separate
threads to the independent functions in
your program.
► It refers to the process of decomposing
an application in such a way so that the
same operation is performed repeatedly
for different data.
Slide 12 of 17
Code Optimization and Performance Tuning Using Intel VTune
In a multithreaded application, you need to take care of
various complexities, which may arise during thread
interaction. These complexities are:
Race conditions
Critical region
Mutual exclusion
Synchronization
Deadlocks
Identifying the Complexities Involved in Multithreaded Applications
► Race conditions occur when the output
of the program depends upon which
thread reaches a particular block of
code first.
Race conditions lead to different
results every time a program is
executed.
► Critical region refers to those portions
of your application that access shared
variables.► Mutual exclusion allows only one
thread to be executing in a critical
region at a given time.
When a thread is executing the code
that accesses a shared resource in a
critical region, any other thread that
might desire entry to the critical region
must wait to access that region.
► Synchronization controls the relative
order of thread execution and resolves
any conflicts among threads.
Synchronization is based on the
concept of monitoring.
► Deadlock refers to a situation in which
a thread waits for a condition that can
never occur.
Deadlock halts the execution of your
application preventing it to continue
further.
Slide 13 of 17
Code Optimization and Performance Tuning Using Intel VTune
List the complexities involved in a multithreaded application.
Just a minute
Answer:
The complexities involved in a multithreaded application are as
follows:
Race conditions
Critical region
Mutual exclusion
Synchronization
Deadlocks
Slide 14 of 17
Code Optimization and Performance Tuning Using Intel VTune
Problem Statement:
John has developed a code in C# in which he acquires a lock
on two resources. However on execution, the application
comes to a halt after some time. He wants to analyze the
processor utilization on his system using the counter monitor
feature of VTune. Help John to accomplish his task.
Activity: Analyzing the Processor Activity During Deadlock
Slide 15 of 17
Code Optimization and Performance Tuning Using Intel VTune
Solution
To analyze the performance of the application, you need to
perform the following tasks:
1. Configure counter monitor using the counter monitor configuration
wizard.
2. Analyze the processor utilization on the system.
Activity: Analyzing the Processor Activity During Deadlock (Contd.)
Slide 16 of 17
Code Optimization and Performance Tuning Using Intel VTune
In this session, you learned that:
You can improve the speed of your application to a great extent
by using multiple threads in your application.
A thread is a sequential flow of control within a program.
The main benefits of threads are as follows:
Increased performance
Better resource utilization
Simpler communication
In a multithreaded application, threads run concurrently or in
parallel.
You can improve the functionality of your application by
assigning different threads to different functions of the
application. These functions may or may not be dependant on
each other.
Summary
Slide 17 of 17
Code Optimization and Performance Tuning Using Intel VTune
The threads enable you to improve the performance of your
application.
The process of breaking down a program into logical chunks or
individual tasks and identifying the dependencies between
them is referred to as decomposition.
In a multithreaded application, you need to take care of various
complexities that may arise during thread interaction. These
complexities are as follows:
Race condition
Critical region
Mutual exclusion
Synchronization
Deadlock
Summary (Contd.)

More Related Content

Viewers also liked

16 asp.net session23
16 asp.net session2316 asp.net session23
16 asp.net session23Vivek chan
 
12 asp.net session17
12 asp.net session1712 asp.net session17
12 asp.net session17Vivek chan
 
07 intel v_tune_session_10
07 intel v_tune_session_1007 intel v_tune_session_10
07 intel v_tune_session_10Vivek chan
 
03 asp.net session04
03 asp.net session0403 asp.net session04
03 asp.net session04Vivek chan
 
Vivek Chan | Technology Consultant
Vivek Chan | Technology Consultant Vivek Chan | Technology Consultant
Vivek Chan | Technology Consultant Vivek chan
 
Vivek Chan | Technology Consultant
Vivek Chan | Technology Consultant Vivek Chan | Technology Consultant
Vivek Chan | Technology Consultant Vivek chan
 
Net framework session01
Net framework session01Net framework session01
Net framework session01Vivek chan
 
05 asp.net session07
05 asp.net session0705 asp.net session07
05 asp.net session07Vivek chan
 
14 asp.net session20
14 asp.net session2014 asp.net session20
14 asp.net session20Vivek chan
 
08 asp.net session11
08 asp.net session1108 asp.net session11
08 asp.net session11Vivek chan
 
Wireless Communication via Mobile Phone Using DTMF
Wireless Communication via Mobile Phone Using DTMF Wireless Communication via Mobile Phone Using DTMF
Wireless Communication via Mobile Phone Using DTMF Vivek chan
 
Net framework session02
Net framework session02Net framework session02
Net framework session02Vivek chan
 
Series Parallel Circuit presentation for schools and kids
Series Parallel Circuit presentation for schools and kidsSeries Parallel Circuit presentation for schools and kids
Series Parallel Circuit presentation for schools and kidsVivek chan
 
Complete C programming Language Course
Complete C programming Language CourseComplete C programming Language Course
Complete C programming Language CourseVivek chan
 
CyberLab TCP/IP and IP Addressing & Subnetting
CyberLab TCP/IP and IP Addressing & SubnettingCyberLab TCP/IP and IP Addressing & Subnetting
CyberLab TCP/IP and IP Addressing & SubnettingVivek chan
 

Viewers also liked (15)

16 asp.net session23
16 asp.net session2316 asp.net session23
16 asp.net session23
 
12 asp.net session17
12 asp.net session1712 asp.net session17
12 asp.net session17
 
07 intel v_tune_session_10
07 intel v_tune_session_1007 intel v_tune_session_10
07 intel v_tune_session_10
 
03 asp.net session04
03 asp.net session0403 asp.net session04
03 asp.net session04
 
Vivek Chan | Technology Consultant
Vivek Chan | Technology Consultant Vivek Chan | Technology Consultant
Vivek Chan | Technology Consultant
 
Vivek Chan | Technology Consultant
Vivek Chan | Technology Consultant Vivek Chan | Technology Consultant
Vivek Chan | Technology Consultant
 
Net framework session01
Net framework session01Net framework session01
Net framework session01
 
05 asp.net session07
05 asp.net session0705 asp.net session07
05 asp.net session07
 
14 asp.net session20
14 asp.net session2014 asp.net session20
14 asp.net session20
 
08 asp.net session11
08 asp.net session1108 asp.net session11
08 asp.net session11
 
Wireless Communication via Mobile Phone Using DTMF
Wireless Communication via Mobile Phone Using DTMF Wireless Communication via Mobile Phone Using DTMF
Wireless Communication via Mobile Phone Using DTMF
 
Net framework session02
Net framework session02Net framework session02
Net framework session02
 
Series Parallel Circuit presentation for schools and kids
Series Parallel Circuit presentation for schools and kidsSeries Parallel Circuit presentation for schools and kids
Series Parallel Circuit presentation for schools and kids
 
Complete C programming Language Course
Complete C programming Language CourseComplete C programming Language Course
Complete C programming Language Course
 
CyberLab TCP/IP and IP Addressing & Subnetting
CyberLab TCP/IP and IP Addressing & SubnettingCyberLab TCP/IP and IP Addressing & Subnetting
CyberLab TCP/IP and IP Addressing & Subnetting
 

Similar to 09 intel v_tune_session_13

09 intel v_tune_session_13
09 intel v_tune_session_1309 intel v_tune_session_13
09 intel v_tune_session_13Niit Care
 
07 intel v_tune_session_10
07 intel v_tune_session_1007 intel v_tune_session_10
07 intel v_tune_session_10Niit Care
 
01 intel v_tune_session_01
01 intel v_tune_session_0101 intel v_tune_session_01
01 intel v_tune_session_01Vivek chan
 
01 intel v_tune_session_01
01 intel v_tune_session_0101 intel v_tune_session_01
01 intel v_tune_session_01Niit Care
 
02 intel v_tune_session_02
02 intel v_tune_session_0202 intel v_tune_session_02
02 intel v_tune_session_02Vivek chan
 
05 intel v_tune_session_07
05 intel v_tune_session_0705 intel v_tune_session_07
05 intel v_tune_session_07Niit Care
 
Linux Assignment 3
Linux Assignment 3Linux Assignment 3
Linux Assignment 3Diane Allen
 
Lecture - 20-23.pptx
Lecture - 20-23.pptxLecture - 20-23.pptx
Lecture - 20-23.pptxFarHana74914
 
03 intel v_tune_session_04
03 intel v_tune_session_0403 intel v_tune_session_04
03 intel v_tune_session_04Vivek chan
 
SIMULATION-BASED APPLICATION SOFTWARE DEVELOPMENT IN TIME-TRIGGERED COMMUNICA...
SIMULATION-BASED APPLICATION SOFTWARE DEVELOPMENT IN TIME-TRIGGERED COMMUNICA...SIMULATION-BASED APPLICATION SOFTWARE DEVELOPMENT IN TIME-TRIGGERED COMMUNICA...
SIMULATION-BASED APPLICATION SOFTWARE DEVELOPMENT IN TIME-TRIGGERED COMMUNICA...IJSEA
 
A CASE STUDY ON EMBEDDED SYSTEM SOFTWARE STACK LAYERS
A CASE STUDY ON EMBEDDED SYSTEM SOFTWARE STACK LAYERS A CASE STUDY ON EMBEDDED SYSTEM SOFTWARE STACK LAYERS
A CASE STUDY ON EMBEDDED SYSTEM SOFTWARE STACK LAYERS MOHAMMED FURQHAN
 
Btec Business Level 3 Unit 14 M1
Btec Business Level 3 Unit 14 M1Btec Business Level 3 Unit 14 M1
Btec Business Level 3 Unit 14 M1Rachel Phillips
 
PROTOTYPE APPLICATION IN ANDROID PLATFORM FOR SYSTEM ADMINISTRATION OF HPC CL...
PROTOTYPE APPLICATION IN ANDROID PLATFORM FOR SYSTEM ADMINISTRATION OF HPC CL...PROTOTYPE APPLICATION IN ANDROID PLATFORM FOR SYSTEM ADMINISTRATION OF HPC CL...
PROTOTYPE APPLICATION IN ANDROID PLATFORM FOR SYSTEM ADMINISTRATION OF HPC CL...IJITCA Journal
 
127801976 mobile-shop-management-system-documentation
127801976 mobile-shop-management-system-documentation127801976 mobile-shop-management-system-documentation
127801976 mobile-shop-management-system-documentationNitesh Kumar
 
IRJET- Build a Secure Web based Code Editor for C Programming Language
IRJET-  	  Build a Secure Web based Code Editor for C Programming LanguageIRJET-  	  Build a Secure Web based Code Editor for C Programming Language
IRJET- Build a Secure Web based Code Editor for C Programming LanguageIRJET Journal
 
04 intel v_tune_session_05
04 intel v_tune_session_0504 intel v_tune_session_05
04 intel v_tune_session_05Vivek chan
 
Over view of software artitecture
Over view of software artitectureOver view of software artitecture
Over view of software artitectureABDEL RAHMAN KARIM
 

Similar to 09 intel v_tune_session_13 (20)

09 intel v_tune_session_13
09 intel v_tune_session_1309 intel v_tune_session_13
09 intel v_tune_session_13
 
07 intel v_tune_session_10
07 intel v_tune_session_1007 intel v_tune_session_10
07 intel v_tune_session_10
 
01 intel v_tune_session_01
01 intel v_tune_session_0101 intel v_tune_session_01
01 intel v_tune_session_01
 
01 intel v_tune_session_01
01 intel v_tune_session_0101 intel v_tune_session_01
01 intel v_tune_session_01
 
02 intel v_tune_session_02
02 intel v_tune_session_0202 intel v_tune_session_02
02 intel v_tune_session_02
 
05 intel v_tune_session_07
05 intel v_tune_session_0705 intel v_tune_session_07
05 intel v_tune_session_07
 
Linux Assignment 3
Linux Assignment 3Linux Assignment 3
Linux Assignment 3
 
Lecture - 20-23.pptx
Lecture - 20-23.pptxLecture - 20-23.pptx
Lecture - 20-23.pptx
 
03 intel v_tune_session_04
03 intel v_tune_session_0403 intel v_tune_session_04
03 intel v_tune_session_04
 
Documentation
DocumentationDocumentation
Documentation
 
SIMULATION-BASED APPLICATION SOFTWARE DEVELOPMENT IN TIME-TRIGGERED COMMUNICA...
SIMULATION-BASED APPLICATION SOFTWARE DEVELOPMENT IN TIME-TRIGGERED COMMUNICA...SIMULATION-BASED APPLICATION SOFTWARE DEVELOPMENT IN TIME-TRIGGERED COMMUNICA...
SIMULATION-BASED APPLICATION SOFTWARE DEVELOPMENT IN TIME-TRIGGERED COMMUNICA...
 
4213ijsea06
4213ijsea064213ijsea06
4213ijsea06
 
A CASE STUDY ON EMBEDDED SYSTEM SOFTWARE STACK LAYERS
A CASE STUDY ON EMBEDDED SYSTEM SOFTWARE STACK LAYERS A CASE STUDY ON EMBEDDED SYSTEM SOFTWARE STACK LAYERS
A CASE STUDY ON EMBEDDED SYSTEM SOFTWARE STACK LAYERS
 
Btec Business Level 3 Unit 14 M1
Btec Business Level 3 Unit 14 M1Btec Business Level 3 Unit 14 M1
Btec Business Level 3 Unit 14 M1
 
PROTOTYPE APPLICATION IN ANDROID PLATFORM FOR SYSTEM ADMINISTRATION OF HPC CL...
PROTOTYPE APPLICATION IN ANDROID PLATFORM FOR SYSTEM ADMINISTRATION OF HPC CL...PROTOTYPE APPLICATION IN ANDROID PLATFORM FOR SYSTEM ADMINISTRATION OF HPC CL...
PROTOTYPE APPLICATION IN ANDROID PLATFORM FOR SYSTEM ADMINISTRATION OF HPC CL...
 
127801976 mobile-shop-management-system-documentation
127801976 mobile-shop-management-system-documentation127801976 mobile-shop-management-system-documentation
127801976 mobile-shop-management-system-documentation
 
IRJET- Build a Secure Web based Code Editor for C Programming Language
IRJET-  	  Build a Secure Web based Code Editor for C Programming LanguageIRJET-  	  Build a Secure Web based Code Editor for C Programming Language
IRJET- Build a Secure Web based Code Editor for C Programming Language
 
04 intel v_tune_session_05
04 intel v_tune_session_0504 intel v_tune_session_05
04 intel v_tune_session_05
 
Enabling NFV features in kubernetes
Enabling NFV features in kubernetesEnabling NFV features in kubernetes
Enabling NFV features in kubernetes
 
Over view of software artitecture
Over view of software artitectureOver view of software artitecture
Over view of software artitecture
 

More from Vivek chan

Deceptive Marketing.pdf
Deceptive Marketing.pdfDeceptive Marketing.pdf
Deceptive Marketing.pdfVivek chan
 
brain controled wheel chair.pdf
brain controled wheel chair.pdfbrain controled wheel chair.pdf
brain controled wheel chair.pdfVivek chan
 
Mechanism of fullerene synthesis in the ARC REACTOR (Vivek Chan 2013)
Mechanism of fullerene synthesis in the ARC REACTOR (Vivek Chan 2013)Mechanism of fullerene synthesis in the ARC REACTOR (Vivek Chan 2013)
Mechanism of fullerene synthesis in the ARC REACTOR (Vivek Chan 2013)Vivek chan
 
Manav dharma shashtra tatha shashan paddati munshiram jigyasu
Manav dharma shashtra tatha shashan paddati   munshiram jigyasuManav dharma shashtra tatha shashan paddati   munshiram jigyasu
Manav dharma shashtra tatha shashan paddati munshiram jigyasuVivek chan
 
Self driving and connected cars fooling sensors and tracking drivers
Self driving and connected cars fooling sensors and tracking driversSelf driving and connected cars fooling sensors and tracking drivers
Self driving and connected cars fooling sensors and tracking driversVivek chan
 
EEG Acquisition Device to Control Wheelchair Using Thoughts
EEG Acquisition Device to Control Wheelchair Using ThoughtsEEG Acquisition Device to Control Wheelchair Using Thoughts
EEG Acquisition Device to Control Wheelchair Using ThoughtsVivek chan
 
Full Shri Ramcharitmanas in Hindi Complete With Meaning (Ramayana)
Full Shri Ramcharitmanas in Hindi Complete With Meaning (Ramayana)Full Shri Ramcharitmanas in Hindi Complete With Meaning (Ramayana)
Full Shri Ramcharitmanas in Hindi Complete With Meaning (Ramayana)Vivek chan
 
Net framework session03
Net framework session03Net framework session03
Net framework session03Vivek chan
 
02 asp.net session02
02 asp.net session0202 asp.net session02
02 asp.net session02Vivek chan
 
01 asp.net session01
01 asp.net session0101 asp.net session01
01 asp.net session01Vivek chan
 
15 asp.net session22
15 asp.net session2215 asp.net session22
15 asp.net session22Vivek chan
 
13 asp.net session19
13 asp.net session1913 asp.net session19
13 asp.net session19Vivek chan
 
11 asp.net session16
11 asp.net session1611 asp.net session16
11 asp.net session16Vivek chan
 
10 asp.net session14
10 asp.net session1410 asp.net session14
10 asp.net session14Vivek chan
 
09 asp.net session13
09 asp.net session1309 asp.net session13
09 asp.net session13Vivek chan
 
07 asp.net session10
07 asp.net session1007 asp.net session10
07 asp.net session10Vivek chan
 
06 asp.net session08
06 asp.net session0806 asp.net session08
06 asp.net session08Vivek chan
 

More from Vivek chan (17)

Deceptive Marketing.pdf
Deceptive Marketing.pdfDeceptive Marketing.pdf
Deceptive Marketing.pdf
 
brain controled wheel chair.pdf
brain controled wheel chair.pdfbrain controled wheel chair.pdf
brain controled wheel chair.pdf
 
Mechanism of fullerene synthesis in the ARC REACTOR (Vivek Chan 2013)
Mechanism of fullerene synthesis in the ARC REACTOR (Vivek Chan 2013)Mechanism of fullerene synthesis in the ARC REACTOR (Vivek Chan 2013)
Mechanism of fullerene synthesis in the ARC REACTOR (Vivek Chan 2013)
 
Manav dharma shashtra tatha shashan paddati munshiram jigyasu
Manav dharma shashtra tatha shashan paddati   munshiram jigyasuManav dharma shashtra tatha shashan paddati   munshiram jigyasu
Manav dharma shashtra tatha shashan paddati munshiram jigyasu
 
Self driving and connected cars fooling sensors and tracking drivers
Self driving and connected cars fooling sensors and tracking driversSelf driving and connected cars fooling sensors and tracking drivers
Self driving and connected cars fooling sensors and tracking drivers
 
EEG Acquisition Device to Control Wheelchair Using Thoughts
EEG Acquisition Device to Control Wheelchair Using ThoughtsEEG Acquisition Device to Control Wheelchair Using Thoughts
EEG Acquisition Device to Control Wheelchair Using Thoughts
 
Full Shri Ramcharitmanas in Hindi Complete With Meaning (Ramayana)
Full Shri Ramcharitmanas in Hindi Complete With Meaning (Ramayana)Full Shri Ramcharitmanas in Hindi Complete With Meaning (Ramayana)
Full Shri Ramcharitmanas in Hindi Complete With Meaning (Ramayana)
 
Net framework session03
Net framework session03Net framework session03
Net framework session03
 
02 asp.net session02
02 asp.net session0202 asp.net session02
02 asp.net session02
 
01 asp.net session01
01 asp.net session0101 asp.net session01
01 asp.net session01
 
15 asp.net session22
15 asp.net session2215 asp.net session22
15 asp.net session22
 
13 asp.net session19
13 asp.net session1913 asp.net session19
13 asp.net session19
 
11 asp.net session16
11 asp.net session1611 asp.net session16
11 asp.net session16
 
10 asp.net session14
10 asp.net session1410 asp.net session14
10 asp.net session14
 
09 asp.net session13
09 asp.net session1309 asp.net session13
09 asp.net session13
 
07 asp.net session10
07 asp.net session1007 asp.net session10
07 asp.net session10
 
06 asp.net session08
06 asp.net session0806 asp.net session08
06 asp.net session08
 

Recently uploaded

Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxsqpmdrvczh
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 

Recently uploaded (20)

Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptx
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 

09 intel v_tune_session_13

  • 1. Slide 1 of 17 Code Optimization and Performance Tuning Using Intel VTune In this session, you will learn to: Identify the benefits of multithreading Design applications using threads Objectives
  • 2. Slide 2 of 17 Code Optimization and Performance Tuning Using Intel VTune Multithreading increases the performance of your application by: Performing multiple tasks in parallel Better utilization of system resources Increasing the speed of your application Identifying the Benefits of Multithreading
  • 3. Slide 3 of 17 Code Optimization and Performance Tuning Using Intel VTune Thread is a sequential flow of control within a program. It is a sequence of instructions executed within a program. Every program consists of at least one thread, called the main thread. The main thread is responsible for initializing the programs. Identifying the Benefits of Multithreading (Contd.)
  • 4. Slide 4 of 17 Code Optimization and Performance Tuning Using Intel VTune What is a thread? Just a minute Answer: A thread is a sequential flow of control within a program.
  • 5. Slide 5 of 17 Code Optimization and Performance Tuning Using Intel VTune The main benefits of threads are: Increased performance Better resource utilization Simpler communication Identifying the Benefits of Multithreading (Contd.)
  • 6. Slide 6 of 17 Code Optimization and Performance Tuning Using Intel VTune The two inherent conditions of a multithreaded application are: Concurrency Parallelism Identifying the Benefits of Multithreading (Contd.) Concurrency refers to a situation in which one or more threads are in progress simultaneously. In this case, the processor switches from one thread to another during the execution of the application. ► Parallelism refers to the simultaneous execution of multiple tasks. In a multithreaded application, which is running on a multiprocessor system, threads execute in parallel. ►
  • 7. Slide 7 of 17 Code Optimization and Performance Tuning Using Intel VTune The best time for threading an application is during its design phase. During the design phase, you can accommodate all the data and code restructuring related to threading. This reduces the overall effort during the application development. A program comprising of multiple independent activities can be redesigned in such a manner so that each activity can be defined as a separate thread. This enables you to decompose your work into simple independent activities and improve the functionality and performance of your application. Designing Applications Using Threads
  • 8. Slide 8 of 17 Code Optimization and Performance Tuning Using Intel VTune You can improve the functionality of your application by assigning different threads to different functions of the application. By assigning a separate thread to each function, all the functions can execute independent of each other. This approach makes the application more efficient because threading is easier than switching functions within a serial code. Designing Applications Using Threads (Contd.)
  • 9. Slide 9 of 17 Code Optimization and Performance Tuning Using Intel VTune Performance of an application depends upon the combination of various factors such as speed and utilization of system resources. A multithreaded application running on a single processor system leads to a better utilization of system resources. A multithreaded application running on a multiprocessor system leads to better utilization of system resources and increased speed of the application. Designing Applications Using Threads (Contd.)
  • 10. Slide 10 of 17 Code Optimization and Performance Tuning Using Intel VTune How does the use of threads improve the functionality of an application? Just a minute Answer: Threads improve the functionality of an application by assigning different threads to different functions. This makes it easier to control the execution of multiple functions within an application.
  • 11. Slide 11 of 17 Code Optimization and Performance Tuning Using Intel VTune Data decomposition refers to the process of: Breaking down a program into logical chunks or individual tasks. Identifying the dependencies between the tasks. The two types of decomposition methods are: Task decomposition Data decomposition Designing Applications Using Threads (Contd.) ► It refers to the process of decomposing a program on the basis of the functions it performs. It is also known as functional decomposition. In this case, you can assign separate threads to the independent functions in your program. ► It refers to the process of decomposing an application in such a way so that the same operation is performed repeatedly for different data.
  • 12. Slide 12 of 17 Code Optimization and Performance Tuning Using Intel VTune In a multithreaded application, you need to take care of various complexities, which may arise during thread interaction. These complexities are: Race conditions Critical region Mutual exclusion Synchronization Deadlocks Identifying the Complexities Involved in Multithreaded Applications ► Race conditions occur when the output of the program depends upon which thread reaches a particular block of code first. Race conditions lead to different results every time a program is executed. ► Critical region refers to those portions of your application that access shared variables.► Mutual exclusion allows only one thread to be executing in a critical region at a given time. When a thread is executing the code that accesses a shared resource in a critical region, any other thread that might desire entry to the critical region must wait to access that region. ► Synchronization controls the relative order of thread execution and resolves any conflicts among threads. Synchronization is based on the concept of monitoring. ► Deadlock refers to a situation in which a thread waits for a condition that can never occur. Deadlock halts the execution of your application preventing it to continue further.
  • 13. Slide 13 of 17 Code Optimization and Performance Tuning Using Intel VTune List the complexities involved in a multithreaded application. Just a minute Answer: The complexities involved in a multithreaded application are as follows: Race conditions Critical region Mutual exclusion Synchronization Deadlocks
  • 14. Slide 14 of 17 Code Optimization and Performance Tuning Using Intel VTune Problem Statement: John has developed a code in C# in which he acquires a lock on two resources. However on execution, the application comes to a halt after some time. He wants to analyze the processor utilization on his system using the counter monitor feature of VTune. Help John to accomplish his task. Activity: Analyzing the Processor Activity During Deadlock
  • 15. Slide 15 of 17 Code Optimization and Performance Tuning Using Intel VTune Solution To analyze the performance of the application, you need to perform the following tasks: 1. Configure counter monitor using the counter monitor configuration wizard. 2. Analyze the processor utilization on the system. Activity: Analyzing the Processor Activity During Deadlock (Contd.)
  • 16. Slide 16 of 17 Code Optimization and Performance Tuning Using Intel VTune In this session, you learned that: You can improve the speed of your application to a great extent by using multiple threads in your application. A thread is a sequential flow of control within a program. The main benefits of threads are as follows: Increased performance Better resource utilization Simpler communication In a multithreaded application, threads run concurrently or in parallel. You can improve the functionality of your application by assigning different threads to different functions of the application. These functions may or may not be dependant on each other. Summary
  • 17. Slide 17 of 17 Code Optimization and Performance Tuning Using Intel VTune The threads enable you to improve the performance of your application. The process of breaking down a program into logical chunks or individual tasks and identifying the dependencies between them is referred to as decomposition. In a multithreaded application, you need to take care of various complexities that may arise during thread interaction. These complexities are as follows: Race condition Critical region Mutual exclusion Synchronization Deadlock Summary (Contd.)