资源预览内容
第1页 / 共126页
第2页 / 共126页
第3页 / 共126页
第4页 / 共126页
第5页 / 共126页
第6页 / 共126页
第7页 / 共126页
第8页 / 共126页
第9页 / 共126页
第10页 / 共126页
亲,该文档总共126页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
30 Concurrency, distribution,client-server and the Internet30 Concurreclient-serLike humanthem could oappearance oimplicitly asscontrol. We smove to concConcurrconfined to fdatabase manprestigious, community.Things habout every tyfundamentally sequential in nature. Beyond mere concurrency, our systems, whether or not SNEAK PREVIEW this discussion will not throw a pre-cooked answer at you, but instead willbuild a solution from a detailed analysis of the problem and an exploration ofWarning: SPOILER! (The nesection is 30.72, pag30.1 AAs usual,carefully client-server, must increasingly become distributed over networks, including the networkof networks the Internet. This evolution gives particular urgency to the central questionof this chapter: can we apply object-oriented ideas in a concurrent and distributed context?Not only is this possible: object technology can help us develop concurrent anddistributed applications simply and elegantly.possible aventhe techniquethat would besettle is in fabegin by examIf you haxt drama pre page sumncy, distribution, ver and the Internets, computers can team up with their peers to achieve results that none ofbtain alone; unlike humans, they can do many things at once (or with thef simultaneity), and do all of them well. So far, however, the discussion hasumed that the computation is sequential proceeds along a single thread ofhould now see what happens when this assumption no longer holds, as weurrent (also known as parallel) computation.ency is not a new subject, but for a long time interest in it remained mostlyour application areas: operating systems, networking, implementation ofagement systems, and high-speed scientific software. Although strategic andthese tasks involve only a small subset of the software developmentave changed. Concurrency is quickly becoming a required component of justpe of application, including some which had traditionally been thought of asues, including a few dead ends. Although necessary to make you understands in depth, this thoroughness might lead you to believe that they are complex; inexcusable, since the concurrency mechanism on which we will finallyct characterized by almost incredible simplicity. To avoid this risk, we willining a summary of the mechanism, without any of the rationale.te spoilers , preferring to start with the full statement of the issues and to let theoceed to its d?nouement step by step and inference by inference, ignore the one-mary that follows and skip directly to the next section.952.1The extas it can get sis this possiblexecuted on bargument a. Bmay now relymove ahead wBecausesame processintent is for awe declare x:so that calls oa declaration,new thread ofNowherwe state, throprocessors, sassignment cprocessors: a as well by a taof such a taskthe same concomputer, distask) withoConfigurationphysical resoWe need No speca separaneeds tovalue:= To obtaentity a A routinwait unt To guarrest assucharge o We mayprioritytake theThis covconcurrent anmultiple inhefor a while alCONCURRENCY, DISTRIBUTION, CLIENT-SERVER AND THE INTERNET30ension covering full-fledged concurrency and distribution will be as minimaltarting from a sequential notation: a single new keyword separate. Howe? We use the fundamental scheme of O-O computation: feature call, xlf(a),ehalf of some object O1 and calling f on the object O2 attached to x, with theut instead of a single processor that handles operations on all objects, we on different processors for O1 and O2 so that the computation on O1 canithout waiting for the call to terminate, since another processor handles it. the effect of a call now depends on whether the objects are handled by theor or different ones, the software text must tell us unambiguously what theny x. Hence the need for the new keyword: rather than just x: SOME_TYPE, separate SOME_TYPE to indicate that x is handled by a different processor,f target x can proceed in parallel with the rest of the computation. With such any creation instruction! xlmake () will spawn off a new processor a control to handle future calls on x.e in the software text should we have to specify which processor to use. Allugh the separate declaration, is that two objects are handled by differentince this radically affects the system s semantics. Actual processoran wait until run time. Nor do we settle too early on the exact nature ofprocessor can be implemented by a piece of hardware (a computer), but justsk (process) of the operating system, or, on a multithreaded OS, just a thread. Viewed by the software, processor is an abstract concept; you can executecurrent application on widely different architectures (time-sharing on onetributed network with many computers, threads within one Unix or Windowsut any change to its source text. All you will change is a Concurrency File which specifies the last-minute mapping of abstract processors tources. to specify synchronization constraints. The conventions are straightforw
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号