最病 这“并发”v“面向对象” a 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 n Many attempts, e. g. active objects o Problems: inheritance anomaly a no mechanism widely accepted o In practice, low-level mechanisms on top of objec oriented language Institute of Computer Software 2021/1/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 Objectoriented language 2021/1/27 Institute of Computer Software Nanjing University 16
过“对象”.“进程” 对象 进程 ●运行时刻概念 ●运行时刻概念 ●数据、操作封装体 ●过程封装 ●按自有规律行为 主动行为 ●方法调用(消息) 消息传递 Institute of Computer Software 2021/1/27 Nanjing University
“对象” vs. “进程” 2021/1/27 Institute of Computer Software Nanjing University 17 对象 ⚫ 运行时刻概念 ⚫ 数据、操作封装体 ⚫ 按自有规律行为 ⚫ 方法调用(消息) ⚫ …… 进程 ⚫ 运行时刻概念 ⚫ 过程封装 ⚫ 主动行为 ⚫ 消息传递 ⚫ ……
最病 o Similarities n Both rely on autonomous, encapsulated modules: processes or process types(e. g Ada); classes a Like processes objects will from each activation to the next, retain the values they contain o 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 2021/1/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” 2021/1/27 Institute of Computer Software Nanjing University 18
最病 A Differences o A process has its own agenda; it relentlessly executes a certain sequence of actions D An object does not do one thing; sa 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 2021/1/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 2021/1/27 Institute of Computer Software Nanjing University 19
最病 o Impedance mismatch n OO: high-level abstraction mechanisms o Concurrency: very low-level mechanisms a semaphores, locks, critical sections, suspend Institute of Computer Software 2021/1/27 Nanjing University
Impedance mismatch OO: high-level abstraction mechanisms Concurrency: very low-level mechanisms semaphores, locks, critical sections, suspend, … 2021/1/27 Institute of Computer Software Nanjing University 20