Date post: | 26-Feb-2018 |
Category: |
Documents |
Upload: | elaine-lala |
View: | 221 times |
Download: | 0 times |
of 23
7/25/2019 Week 3 Concurrent Programming Abstraction.ppt
1/23
Concurrent Programming CT074-3-2
Concurrent ProgrammingAbstraction
7/25/2019 Week 3 Concurrent Programming Abstraction.ppt
2/23
CT074-3-2 Concurrent Programming 2
Learning Outcomes
At the end of this module, you should be able to do the
following:
1. Explain and apply the fundamental concepts of
concurrency in the design and construction of a
concurrent system using Jaa application.
!. "iscuss the safety aspects of multi threaded system
#. "iscuss the need for encapsulation in concurrent
systems
7/25/2019 Week 3 Concurrent Programming Abstraction.ppt
3/23
CT074-3-2 Concurrent Programming 3
The role of abstraction
Dictionary.com:
- the act of consiering something as a general !uality or characteristic"
a#art from concrete realities" s#ecific ob$ects" or actual instances.
- the act of ta%ing a&ay or se#arating' &ithra&al
(abstractionis a techni!ue for managing
com#le)ity of com#uter systems. *t &or%s by
establishing a le+el of com#le)ity on &hich a
#erson interacts &ith the system"su##ressing the more com#le) etails belo&
the current le+el.
7/25/2019 Week 3 Concurrent Programming Abstraction.ppt
4/23
CT074-3-2 Concurrent Programming 4
,e+els of abstraction
( ystems an libraries
/ an librariesoften calle A##lication
Program *nterfaces 1AP*efine
com#utational resources that are a+ailable to
the #rogrammer. ou can o#en a file or sen
a message by in+o%ing the #ro#er #roceure
or function call" &ithout %no&ing ho& theresource is im#lemente.
7/25/2019 Week 3 Concurrent Programming Abstraction.ppt
5/23
CT074-3-2 Concurrent Programming
,e+els of abstraction
( Programming languages
A #rogramming language enables you to
em#loy the com#utational #o&er of a
com#uter" &hile abstracting a&ay from the
etails of s#ecific architectures.
7/25/2019 Week 3 Concurrent Programming Abstraction.ppt
6/23
CT074-3-2 Concurrent Programming 5
,e+els of abstraction
( *nstruction sets
6ost com#uter manufacturers esign an buil
families of CPs &hich e)ecute the same
instruction set as seen by the assembly language#rogrammer or com#iler &riter. The members of a
family may be im#lemente in totally ifferent
&aysemulating some instructions in soft&are or
using memory for registersbut a #rogrammercan &rite a com#iler for that instruction set
&ithout %no&ing the etails of the im#lementation.
7/25/2019 Week 3 Concurrent Programming Abstraction.ppt
7/23CT074-3-2 Concurrent Programming 7
,e+els of abstraction
( logic gates an im#lementation by
semiconuctors no than%s8
( 9y;< -= electrons in chi#s
7/25/2019 Week 3 Concurrent Programming Abstraction.ppt
8/23CT074-3-2 Concurrent Programming >
oft&are abstraction.
( ?nca#sulation
( Concurrency
7/25/2019 Week 3 Concurrent Programming Abstraction.ppt
9/23CT074-3-2 Concurrent Programming @
?nca#sulation
( Data hiing
( Achie+es abstraction by i+iing a soft&are moule into a
#ublic s#ecification an a hien im#lementation.
( #ecification escribes the a+ailable o#erations on a ata
structure or real-&orl moel.
( Detaile im#lementation of the structure or moel is &ritten
&ithin a se#arate moule that is not accessible from the
outsie.
( Changes in internal ata re#resentation an algorithm &ithout
affecting the #rogramming of the rest of the system.( 6oern #rogramming languages irectly su##ort
enca#sulation.
7/25/2019 Week 3 Concurrent Programming Abstraction.ppt
10/23CT074-3-2 Concurrent Programming 0
?nca#sulation
7/25/2019 Week 3 Concurrent Programming Abstraction.ppt
11/23CT074-3-2 Concurrent Programming
Pri+ate8
publicclassEmployeeB
priateigDecimal salary newigDecimal10000.00'
publicigDecimal getalary1 B
returnsalary'
publicstatic+oi main1 B
?m#loyee e new?m#loyee1'
igDecimal sal e.getalary1'
7/25/2019 Week 3 Concurrent Programming Abstraction.ppt
12/23CT074-3-2 Concurrent Programming 2
Concurrency
( Abstraction esigne to ma%e it #ossible
to reason about the ynamic beha+ior of
#rograms.
( There are no im#ortant conce#ts of
concurrency that cannot be e)#laine at
the higher le+el of abstraction.
7/25/2019 Week 3 Concurrent Programming Abstraction.ppt
13/23CT074-3-2 Concurrent Programming 3
Concurrent e)ecution as
interlea+ing of atomic
statements
7/25/2019 Week 3 Concurrent Programming Abstraction.ppt
14/23CT074-3-2 Concurrent Programming 4
"efinition
( A concurrent #rogram consists of a finite set of
1se!uential #rocesses. The #rocesses are &ritten using
a finite set of atomic statements. The e)ecution of a
concurrent #rogram #rocees by e)ecuting a se!uence
of the atomic statements obtaine by arbitrarily
interlea+ing the atomic statements from the #rocesses. A
com#utation is an e)ecution se!uence that can occur as
a result of the interlea+ing. Com#utations are also calle
scenarios.
7/25/2019 Week 3 Concurrent Programming Abstraction.ppt
15/23CT074-3-2 Concurrent Programming
"efinition
( During a com#utation the control #ointer
of a #rocess inicates the ne)t statement
that can be e)ecute by that #rocess.
?ach #rocess has its o&n control #ointer.
Alternate terms for this conce#t are instruction
#ointer an location counter.
7/25/2019 Week 3 Concurrent Programming Abstraction.ppt
16/23CT074-3-2 Concurrent Programming 5
Process Control loc% 1PC
7/25/2019 Week 3 Concurrent Programming Abstraction.ppt
17/23CT074-3-2 Concurrent Programming 7
2 #rocesses" # an !
( # #" #2
( ! !" !2
#2 # ! !2 EE
7/25/2019 Week 3 Concurrent Programming Abstraction.ppt
18/23CT074-3-2 Concurrent Programming >
Tri+ial concurrent #rogram
Tri+ial se!uential #rogram
7/25/2019 Week 3 Concurrent Programming Abstraction.ppt
19/23
CT074-3-2 Concurrent Programming @
7/25/2019 Week 3 Concurrent Programming Abstraction.ppt
20/23
CT074-3-2 Concurrent Programming 20
Fustification of the abstraction
( The electrical signals in a com#uter tra+el at the
s#ee of light" about 2 ) 0>mGsec" an the
cloc% cycles of moern CPs are at least one
gigahert
7/25/2019 Week 3 Concurrent Programming Abstraction.ppt
21/23
CT074-3-2 Concurrent Programming 2
7/25/2019 Week 3 Concurrent Programming Abstraction.ppt
22/23
CT074-3-2 Concurrent Programming 22
Fustification of the abstraction
( Ie &ill assume that &e ha+e a JbirKs-
eyeJ +ie& of the global state of the
system" an that a statement of one
#rocess e)ecutes by itself an to
com#letion" before the e)ecution of a
statement of another #rocess
commences.
7/25/2019 Week 3 Concurrent Programming Abstraction.ppt
23/23
L M A
$uestion and Answer %ession