о뷢չ
JOURNAL OF COMPUTER RESEARCH AND DEVELOPMENT
1999 36 5 Vol.36 No.5 1999



һ
šǭ
ժҪȱһΪǽܵϵͳʽģͣԵĿܵ˺ܴԼ.Ϊ˸ƶһܣǷֱԦ-actorģΪо.ۺַжһʽģ.ģ;ʽ壬ȿñ׼Ĳۣ˸߼ĳƷ.Ļṩһactorһ㣬֮佨任ϵ.
ؼʡԣ-㣬actorģͣ
ͼšTP311
A CALCULUS OF CONCURRENT OBJECTS
ZHANG Qian, LI Wei-Hua, FU Jian-Ming, and JIN Tao
(National Engineering Technology Research Centre for Multimedia Software,Wuhan430072)
(Open Research Laboratory for Multimedia Software under Ministry of Education,Wuhan430072)
(Software Base of Wuhan University, Wuhan430072)
AbstractThe development of concurrent object-oriented programming languages has suffered from the lack of a widely accepted formal foundation for describing the semantics of concurrent object systems. Based on the -calculus and the actor model respectively, attempts have been made to define a common semantic framework for concurrent object-oriented programming. By compromising these two approaches, a formalism that enjoys a clean formal definition is defined, which allows the reuse of standard results of the theory of concurrency, while preserving a high level object-oriented programming style. The actor algebra and the concurrent object calculus are proposed in the paper here, and the translation relationship between the two approaches is also presented.
Key wordsconcurrent object-oriented programming language, -calculus, actor model, operational semantics
GrogonoGargulָʽƵĻǦ-㣬߼ƵĻΪ߼ȱһǿΪۻļģ͡.SteinҲָʲôƻԸ־һֱ.Щࡢԭ̳͡СϢݡװ󡪡ƵĺģԼ֮ĹϵΣЩⶼڶʱڿԽġ.
ڲ˵ʽģȱ.Nierstrasz[1]̸ȱ㷺ܵĶʽڶĲԵĿܵԼ.̸ֻǻڶĲԣδ漰ࡢ̳еȵ.ʶԣͶϴ²ʽо.
ĿǰоƶһʱҪַ
1ַڦ-.-ԱǶԽ̴䣬̴ּ̬ĸڼУͨŵ˽ṹԶ̬ݻ[2].ͨΪ-Ϊģж̬ṹϵͳṩһʽ.æ-ģһ൱Ĺáࡱг.
2ַactorģ.actorģͱΪ̴ܴ任ȶ̬ԵĶصĲģ[3].-ȣactorģΪṩ˸Ĺ۲.رǣһactorнӽڶĽṹԣģͿԶƵĺĸ󡪡ֱӵıʾ.ģһ޷ʾϵͳҪĸ̳Уͬʱģ͵ۻ걸.
оĿҪһȫµķԽво.ǽۺϦ-㼰actorģ͵γһ.
1
ʽһʱ迼ǲм
(1) ʶ.ʶǶһҪԣݸԣһжڻöӦĴȡʮֱҪ.ͨÿһеַֻʵֶڶʶԵ֧.
(2) .εʵ壬ڲⲿ.
(3) .ԱָΪڶĳ󡢷󲿷ֵĺ.
(4) 첽Ϣ.첽ϢʺƵĻ.ͨṩ㹻ͬԼ첽ϢݻϿԽģͬͨ.Ƿһͬнģ첽ϢݣҪһʵԴϢĻ.
(5) ݹ.Աֹagent״̬ı.
(6) ̬.̬ζʱڴ¶Ŀ.
2Actorһ
actor԰agentһ״̬һΪ.ÿactorһصַõַʱ.actor3ԭ첽ϢݣcreateµactorssendϢactorbecomeı䵱ǰactorΪ.һactorڻԾ״̬ڿ״̬.ĳactorڿʱɽϢ3.
2.1һactor
actorһɽģactorϵͳĴ.AactorsΪactorֵĿϣabcaibiAactorsϱ仯MactorsΪϢݵļϣSactorsΪֵļϣss1s2vv1Sactorsϱ仯.actorϵͳԸĳ﷨ж壺
Actor =IdleActor|ActiveActor|Message|ActorActor|v(name)Actor|0
IdleActor =Idle,Name,Program,StatesοɽһϢ
ActiveActor =Active,Name,Program,StatesProgramΪִеĳ
Message =Recipient,Contents Recipient =Name
Name = aAactors Contents =mMactors States =sSactors
Program =become(Program,State).Program|send(Name,Contents).Program
|create(Name,Program,State).Program|E1:Progam1++En:Programn|
һactorϵͳеactorļ.
2.2
ñǩ任ϵͳģactorĲ.Ϊֲεļ㲽裻avֱʾռһϢϢĽΪaϢΪv.
 
send(b,m).PһΪmϢΪbactor.
 
become(P,s1).P佫״̬ӻԾıΪ.ĳPactorActive, P,s2ִУactorٽκϢû.
 dһµ)
create(b,P,s1).P䴴һµĿactoractor״̬Ϊs1ΪP䣬Ҿd.
 ei
ʽeiΪٵĲʽ.ʽeiΪʱѡжӦķ֧Pi.
 
 
 
 
2.3һactor
һABLABLǻactorļ򵥵ĲԣΪactor.actorģУɶΪactoragentִУÿactorԼַ.ڽյһϢʱactorԷһЩϢactorµactorsָΪ.
磬ǶһcellĶ壺

cellʵ״̬xദgetsetϢ.Ϣgetreplyadr˲ָcell״̬xֵ͵Ŀ.ϢsetnewxcellյϢʱʵΪnewx.cellһʵñʽ(let id:=create cell(1.0) in e).ñʽcellһʵeнidԼΪıʶ.
ABLһĶȫ﷨
defcl=(defclass(clnamestate-var*)body*)

action=(becomeclname(arg*))|(sendtodestmname(arg*))
|(sendtodestarg)|(letvar:=createclname(arg*)inaction*)
Уbody.ʽsendto x mһ첽Ϣmx.ϢmΪһĵԣΪһ.
3
ABL﷨ԿABLԾнϸߵĳ̶ȣ﷨ṹܹ׵ΪԱ.οۻأܹȷضԸԵоأǽһ㣬跨ABL֮佨Ӧı任ϵӶʵֶ̽.
3.1
1ܽ˲н̱ʽ﷨.ǽÿ̱ʽTyCO typed concurrent objects4ݵһЩʽӦе2ʾֶӦϵ.ڶУxڱϱ仯Pڽ̱ʽϱ仯mΪһϢν.ߵϢνͬʱִϢ.磬m12|ɼΪ
1н̱ʽ﷨

̱ʽTyCO﷨
0
Proc A x1xn=P̶
m(x1,,xn)|Pm(e1,en)ϢΪPe1/x1,en/xn
m(x1,,xn)Pm(e1,,en)ϢΪP
m1(x11,,x1n)P1 & m2(x21,,x2n)P2Ϊm1(x11,,x1n)P1m2(x21,,x2n)P2
P1|P2P1,P2
x.PvxPƴ
?P!PԼ


3.2ABL뵽
Ѿһֲ㣬ѾòӦTyCOĿǰTyCO͵оѾȡһĽչ4ݣԶԶĲͿòеı׼.ڹؼABL͸òܹ֮Ӧı任ϵ
ǹ۲쵽ABLԱ򵥵ر뵽.磬cellĶɱΪḺ̌ʽ&߽ϸȼ
proc cell (x) self=
self.get(replyadr)(replyadr(x)|cell(x)self) & self.set(newx)(cell(newx)self);
任ĳABLcellĶʽʮֽƣΪcellһĲselfselfԿcellĶʶABL.йزselfıҪף5ѽ˽ϸ.
һЩ任ʽ壬ǽABLжĶ任ΪеḺ̌ʽ
c(defclass(clnamestate-var*)body*)procclname(state-var*)self=b(bodys);
b()
b((methodmname(parvar*)ݡaction*)body*)
(self.mnameparvar*a(actions)) & b(script*)
a()
a((becomeclname(arg*))action*)(clnamearg*self)|a(action*)
a((sendtodestmname(arg*))action*)dest.mname(arg*)|a(action*)
a((sendtodestarg)action*)dest(arg)|a(action*)
a(letvar:=newclname(arg*)inaction*)ڡ硴var.(clnamearg*self)|a(action*)
任ԽABL뵽.任еƶϡоڲн.ѾòӦTyCOòһЩ׼.ͬʱABLͲ֮佨һ任ϵ˸߼Ʒ. 
4ع
4.1ع
ڶģ͵оĿǰҪ¼ַ.-걸ۻڶԷװԡϼ͵нģȫ漰Լͨ.ǿCCSȽԽЩ⣬ǲֱӵرʾͨͨĶ̬ͨ.
-֣ͨԼ-µԼһؽͨţ˷ȱ.ַʽ¶ĴǶصĶʶģ.˺ܶĳԣæ-ģеĲͬ.дԵİB. PiercePICT6ݣV.VasconcelosTyCO4ԼO. NierstraszOC1.Щȫ⣬ҪΪ-㲻ܽΪһʵ.
actorģܴģ͵Ķ̬ԣ̴任.ģΪṩ˳Ĺ۲3.ۻ걸.磬ΪֹactorĵȼȻûһϵĸ.
һЩԲԵо磬P.AmericaûָķJ. EngelfrietûPetriķΪһضPOOLṩ˲ͬ.ЩоĿ겻ͬϣоһڶͨòԽģactor.
4.2
оactorģ벢Ĺϵ.һactorôȾʽ壬ֻõĳƷ.һactorĸ߼Լһ㣬ָø߼ԿԱ뵽УӶͼ.ַĺôڣڲ޸ĵײ㲢㼰ϵͳǰ£벢Ƶ.
ڸһЩод.ǰоڸactorͼ̳⣻оɵıactorϵͳĵȼԣоڸactorμɲԵرͲԻ.
õҡ߼ƻ(Ŀ863-306-05-05)͹ҸУʿѧƵר.
߼飺ǭŮ19735ʿоҪоΪԡйɷֲ.У19527ڣʿʦҪоΪ˹ܡ֪ʶ̡ý弼.У19699ʿоҪоΪ֪ʶֲ̡.ΣУ19734ʿоҪоΪ֪ʶ̡ý弼.
ߵλšǭҶý̼оġ人430072
ýоʵҡ人430072
Ρ人ѧء人430072
ο
1Nierstrasz O. Towards an object calculus. In:Proc of the ECOOP91 Workshop on Object-Based Concurrent Computing,LNCS 612.Utrecht:Springer-Verlag,1992.120
2Milner R, Parrow J, Walker D. A calculus of mobile processes, Part /. Information and Computation, 1992,100(3)177
3Agha G, Mason I A, Smith S et al. Towards a theory of actor computation. In:Proc of CONCUR 92, LNCS 630. Nice:Springer-Verlag, 1992. 564579
4Vasconcelos V T. Typed concurrent objects. In: 8th European Conf on Object-Oriented Programming, LNCS 821.Berlin:Springer-Verlag, 1994. 100117
5ǭ. м̳쳣ģ͵о[ʿ], 人ѧ,人 1999.
(Zhang Qian. Research on the inheritance anomaly and the semantics model in concurrent object-oriented language(in Chinese). Wuhan University, Wuhan, 1999)
6Pierce B C, Turner D N. Pict: A programming language based on the pi-calculus. Indiana University, Tech Rep CSCI#476, 1997
ԭյڣ1998-04-24
޸ĸյڣ1999-02-01
