“并发”vs.“面向对象 16 Robin Milner (1991 Turing Award)is said to have claimed: "I can't understand why objects [of O-O languages]are not concurrent in the first place".[Matsuoka 1993] Many attempts,e.g.active objects Problems:inheritance anomaly No mechanism widely accepted In practice,low-level mechanisms on top of Objec oriented language Institute of Computer Software 2022-2-27 Nanjing University
“并发” vs. “面向对象” Robin Milner (1991 Turing Award) is said to have claimed: "I can 't understand why objects [of O-O languages] are not concurrent in the first place ". [Matsuoka 1993] Many attempts, e.g. active objects Problems: inheritance anomaly No mechanism widely accepted In practice, low-level mechanisms on top of Object- oriented language 2022-2-27 Institute of Computer Software Nanjing University 16
&扇 对象”vs.“进程” UNIVE 17 对象 进程 。运行时刻概念 。运行时刻概念 。数据、操作封装体 。过程封装 ● 按自有规律行为 0 主动行为 。方法调用(消息) 。消息传递 Institute of Computer Software 2022-2-27 Nanjing University
“对象” vs. “进程” 2022-2-27 Institute of Computer Software Nanjing University 17 对象 l 运行时刻概念 l 数据、操作封装体 l 按自有规律行为 l 方法调用(消息) l …… 进程 l 运行时刻概念 l 过程封装 l 主动行为 l 消息传递 l ……
&扇 Similarities 102 18 Both rely on autonomous,encapsulated modules:processes or process types(e.g Ada);classes Like processes,objects will,from each activation to the next,retain the values they contain Enforce heavy restrictions on how modules can exchange information;otherwise things quickly get out of hand Basic mechanism for communication is "message passing Institute of Computer Software 2022-2-27 Nanjing University
Similarities Both rely on autonomous, encapsulated modules: processes or process types (e.g Ada); classes Like processes, objects will, from each activation to the next, retain the values they contain Enforce heavy restrictions on how modules can exchange information; otherwise things quickly get out of hand Basic mechanism for communication is “message passing” 2022-2-27 Institute of Computer Software Nanjing University 18
&扇 Differences 102 19 A process has its own agenda;it relentlessly executes a certain sequence of actions. An object does not do one thing;it is a repository of services,and just waits for the next client to solicit (request)one of those services-chosen by the client Institute of Computer Software 2022-2-27 Nanjing University
Differences A process has its own agenda; it relentlessly executes a certain sequence of actions. An object does not do one thing; it is a repository of services, and just waits for the next client to solicit (request) one of those services – chosen by the client 2022-2-27 Institute of Computer Software Nanjing University 19
&扇 Impedance mismatch 20 OO:high-level abstraction mechanisms ▣( Concurrency:very low-level mechanisms semaphores,locks,critical sections,suspend,.. Institute of Computer Software 2022-2-27 Nanjing University
Impedance mismatch OO: high-level abstraction mechanisms Concurrency: very low-level mechanisms semaphores, locks, critical sections, suspend, … 2022-2-27 Institute of Computer Software Nanjing University 20