1、2009-5-28 有什么纰漏烦请告知 3209 chapter1:Introduction Definition of a Distributed SysA distributed system is a collection of independent computers(Hardware) that appears to its users as a single coherent(一致的) system(Software) Four goals of DSEasily connect users to resources; Hide the fact that resources a
2、re distributed across a network; Openness(开放性); Scalability(可扩展性) Types of DSDistributed computing sys: Cluster computing sys, Grid computing sys, Transaction processing sys,Enterprise application integrationchapter2:Architectures Centralized architecturesThe simplest organization that only have two
3、 types of machines: a client machine containing only the programs implementing the user-interface level; a server machine containing the rest, the programs implementing the processing and data level Decentralized architectures : Peer-to-PeerA P2P system is a distributed collection of peer nodes, eac
4、h node is both a server and a clientuntructured P2P: Gnutella, Freenet, KaZaAstructured P2P: Chord, CAN, Tapstry, Pastr, Kademlia, SkipNet, Cycloid P2P vs client-serverAsymmetric(不对称) SymmetricGlobal knowledge Local knowledgeCentralization DecentralizationSingle point of failure RobustnessLimited sc
5、alability High scalabilityExpensive Low-cost Hybrid Architectures : Napster, BitTorrentcentral indexing; Each node registers to a central index; Each node acts as a client and central index as a server; Queries are performed to the central index; Retrieval is done from other peernodeschapter3:Interp
6、rocess Communitions What is IPC (InterProcess Communications)the ability for separate, independent processes to communicate among themselves to collaborate on a task Event Synchronizationtwo processes synchronize their operations: one side sends, then the other receives until all data has been sent
7、and received Timeouts, Threading and Deadlocksblocking operations issued in the wrong sequence can cause deadlockstimeouts: may be used to set a maximum time period for blocking; it is provided by the IPC facility; may be specified in a program with an operationthread: may be spawned by a program to
8、 issue a blocking operation; allowing the main thread to proceed with other processing; the child thread is suspended Data representation: object serialization -serialverobject serialization(对象序列化) is a mechanism that is useful in any program that wants to save the state of objects to a file and lat
9、er read those objects to reconstruct the state of the program, or to send an object over the network using sockets2009-5-28 有什么纰漏烦请告知 3209 Event diagram and sequnce diagram connection-oriented vs connectionless IPC connection-oriented IPC facilitytwo processes establish a connection; exchange data b
10、y inserting/extracting data to/from the connection; once a connection is established, there is no need to identify the sender or receiver connectionless IPC facilitydata is exchanged in independent packets; each packets needs to be addressed specifically to the receiverchapter4:the socket API the da
11、tagram socket(UDP): DatagramSocket, DatagramPacketsender:2009-5-28 有什么纰漏烦请告知 3209 receiver:DatagramSocket 还有 connect(InetAddress, int)与 disconnect()方法 the stream socket(TCP): ServerSocket, Socketserver:client:2009-5-28 有什么纰漏烦请告知 3209 chapter5:the client-server paradigm(范型) the client-server paradigm
12、Server: a server process, running on a server host, provides access to a serviceClient: a client process, running on a client host, accesses the service via the server processRequest-Reply:the interaction of the process proceeds according to aprotocol SE for a network serviceadvantages: allow each m
13、odule to be developed by people with special skills; presentation 层的改变不影响下层; application 层的改变不影响 service 层Presentation logic: DaytimeClient1Application logic: DaytimeClientHelper1 Application logic: DayServer1Service logic: MyClientDatagramSocket Service logic: MyServerDatagramSocket iterative vs co
14、ncurrent server an unthreaded connection-oriented server is said to be an iterative server a connection-oriented server can be threaded so that it can serve multiple clients concurrently. Such a server is said to be a concurrent server. stateful server and stateless server a stateful server remember
15、s client data (state) from one request to the next a stateless server keeps no state information Daytime(时间戳) : java.util.Datechapter6: group communication primitive operations Join: allow a process to join a specific multicast group Leave: allow a process to stop participating in a multicast group2
16、009-5-28 有什么纰漏烦请告知 3209 Send: allow a process to send a message to all processes currently participating in a multicast group Receive: allow a member process to receive messages sent to a multicast group classification of reliable multicast unordered(无序组播): may deliver the messages to each participa
17、nt in any order FIFO(先入先出组播 ): preserves the order of messages sent by each host Causal Order(因果次序组播): preserves happen-before relationships among the messages Atomic order(原子次序组播 ): delivers the messages to each participant in the same order InetAddress, DatagramSocket, DatagramPacket, MulticastSoc
18、ket (unreliable)s.leaveGroup(InetAddress);s.setTimeToLive(int);224 239 , IANA(国际互联网代理成员管理局) JRM Service (java 可靠组播服务)chapter 7: Distributed Object java RMI architecture rmi coding2009-5-28 有什么纰漏烦请告知 3209 2009-5-28 有什么纰漏烦请告知 3209 chapter 8: Advanced RMI stub downloading allows a stub class to be load
19、ed to an object client at runtime, thereby allowing a remote objects implementation to be modified and its stub class regenerated without affecting the software on the client host. client callback is a feature that allows an object client to register itself with a remote object server for callbacks
20、so that the server may issue a remote method invocation to the client when an awaited event occurs具体实现就是在 server 端维护一个注册了的 client 的 Vector,需要的时候调用客户端的远程方法。2009-5-28 有什么纰漏烦请告知 3209 chapter 9: CORBA Common Object Request Broker Architecture 公共对象请求代理体系结构work in heterogenous environment; language-indepe
21、ndent; interoperatable interoperability (互操作性 ) is the ability to communicate and share data across different programming languages and/or different platforms IDL (Interface Definition Language 接口定义语言编译:idlj fserver fclient Hello.idl 生成 6 个文件:HelloOperations.java Hello.javaHelloHelper.java HelloHold
22、er.javaHelloStub.java HelloPOA.java ORB : a mechanism that enable the client invoke remote method calls GIOP (General Inter-ORB Protocol) is an abstract protocol by which ORBs communicate IIOP (Internet Inter-ORB Protocol) is the implementation of GIOP for TCP/IP. IOR (Interoperable Object Reference
23、 Protocol 可互操作对象引用协议) POA (Portable Object Adapter 可移植对象适配器) CodingServer Side : servent2009-5-28 有什么纰漏烦请告知 3209 Server Side : ServerClient Side : Client2009-5-28 有什么纰漏烦请告知 3209 chapter 10,11 : Internet Applications SGML : Standard Generalized Markup Language 标准统一标记语言 HTTP is a connection-oriented,
24、stateless, request-response protocol CGI : Common Gateway Interface protocol 公共网关接口 maintain session dataclient-side: hidden form fields, cookiesserver-side: secondary storage (files or database), software objects state info maintenance is ServletServlet variables, hidden form fields, cookie, session objectHttpSession session = req.getSession();