《分布式系统概念与设计》(第5版)第一章答案
分布式系统基础考试

分布式系统基础考试(答案见尾页)一、选择题1. 分布式系统的定义是什么?A. 由多个计算机组成的系统,这些计算机通过网络进行通信和协调B. 一个提供分布式服务的计算机系统C. 一种软件技术,使得应用程序可以跨多个硬件和操作系统运行D. 一种允许多个用户同时访问和操作的系统2. 分布式系统中的“分布式”一词的含义是什么?A. 多个系统独立运行B. 数据存储在多个位置C. 系统具有高可用性和容错性D. 所有节点都可以独立完成任务3. 分布式系统的核心特性是什么?A. 并发性B. 透明性C. 可伸缩性D. 容错性4. 分布式系统中的节点可以是哪种类型?A. 服务器B. 桌面电脑C. 移动设备D. 所有这些都可能5. 分布式系统中的通信协议有哪些?A. HTTPB. TCP/IPC. UDPD. 所有这些都可能6. 分布式系统中的数据一致性是指什么?A. 所有节点上的数据完全相同B. 所有节点上的数据保持同步更新C. 所有节点上的数据在某个时间点相同D. 所有节点上的数据可以不同7. 分布式系统中的负载均衡是什么?A. 将请求平均分配到多个服务器B. 将流量限制到单个服务器C. 将流量分散到多个服务器D. 将流量全部转发到单个服务器8. 分布式系统中的复制是什么?A. 在多个节点上创建数据的副本B. 将数据存储在远程位置C. 将数据加密D. 将数据存储在本地9. 分布式系统中的CAP理论指的是什么?A. 一致性、可用性和分区容错性之间的权衡B. 一致性、可用性和性能之间的权衡C. 一致性、可用性和可伸缩性之间的权衡D. 一致性、可用性和安全性之间的权衡10. 分布式系统中的分布式事务是什么?A. 一种需要在多个节点上同步执行的事务B. 一种可以在多个节点上并行执行的事务C. 一种不能在多个节点上同步执行的事务D. 一种可以在多个节点上同步执行但不需要一致性的事务11. 分布式系统的定义是什么?A. 一组独立的计算机通过网络进行通信和协作B. 一个硬件和软件的组合,能够在多个处理器上运行C. 一个提供分布式服务的互联网D. 一个由多个服务器组成的系统,每个服务器都有自己的资源12. 分布式系统中的“分布式”一词意味着什么?A. 多个系统组件位于不同的地理位置B. 多个系统组件共同工作以完成一项任务C. 多个系统组件独立地运行并相互通信D. 多个系统组件共享数据和资源13. 分布式系统中的节点可以是哪种类型?A. 主节点B. 从节点C. 客户端D. 所有类型的节点14. 分布式系统中的数据复制是为了什么目的?A. 提高系统性能B. 防止数据丢失C. 提高数据的可用性D. 保证数据的一致性15. 分布式系统中的负载均衡是一种什么技术?A. 将请求分配到多个服务器以优化性能B. 将流量限制到特定的服务器以避免拥塞C. 将客户端的请求直接路由到正确的服务器D. 使用一种算法来决定哪个服务器应该处理哪个请求16. 分布式系统中的共识算法是什么?A. 一种确保所有节点对数据的一致性达成一致的技术B. 一种用于同步不同节点之间的数据状态的技术C. 一种用于检测和处理网络延迟的技术D. 一种用于管理分布式系统中的故障的技术17. 分布式系统中的容错机制是什么?A. 一种确保系统在部分组件失败时仍能正常运行的技术B. 一种用于检测和修复系统错误的技术C. 一种用于保护系统免受恶意攻击的技术D. 一种用于限制系统中的用户数量的技术18. 分布式系统中的数据分片是什么?A. 将数据分割成小块以便于存储在不同的位置B. 将数据分割成小块以便于在不同的硬件设备上存储C. 将数据分割成小块以便于在不同的网络上进行传输D. 将数据分割成小块以便于在不同的时间点进行访问19. 分布式系统中的消息传递机制是什么?A. 一种用于在节点之间传递消息的技术B. 一种用于在节点之间同步数据的技术C. 一种用于在节点之间交换数据的技术D. 一种用于在节点之间协调任务的技术20. 分布式系统中的安全性是指什么?A. 保护系统免受未经授权的访问B. 保护系统免受未经授权的修改C. 保护系统免受未经授权的数据泄露D. 保护系统免受所有上述威胁21. 分布式系统的定义是什么?A. 一组计算机通过互联网进行通信和协调的系统B. 一个硬件和软件集合,能够在有限时间内处理大量数据C. 一个提供分布式服务的互联网系统D. 一种允许多个用户访问和共享资源的网络架构22. 分布式系统中的“分布式”一词意味着什么?A. 多个系统独立运行B. 数据存储在多个位置C. 系统具有高可用性和可扩展性D. 所有节点共同工作以完成特定任务23. 分布式系统的核心特性包括哪些?A. 可靠性B. 可用性C. 并发性D. 容错性24. 在分布式系统中,通常使用哪种通信协议?A. HTTPB. TCP/IPC. UDPD. ICMP25. 分布式系统中的“容错性”是什么意思?A. 系统在部分组件失败时仍能继续运行的能力B. 系统能够自动恢复丢失的数据或进程的能力C. 系统能够自我调整以避免单点故障的能力D. 系统能够确保所有节点之间的同步性26. 分布式数据库的概念是什么?A. 一个包含多个数据副本的数据库,以提高数据可用性和性能B. 一个只有一个数据副本的数据库C. 一个动态调整数据分布的数据库D. 一个支持实时数据更新的数据库27. 分布式系统的设计原则之一是什么?A. 高度集权B. 高度分散C. 高度可伸缩性28. 在分布式系统中,什么是“微服务”?A. 一种特定的编程风格或架构模式,其中应用程序被拆分成一系列小型服务B. 一种分布式系统的实现技术C. 一种单一的、集中的服务D. 一种特定的数据存储技术29. 分布式系统中的“同步”和“异步”有什么区别?A. 同步是指多个进程或线程在同一时间访问同一资源B. 异步是指多个进程或线程在不同的时间访问同一资源C. 同步通常用于需要数据一致性的场景D. 异步通常用于需要提高系统性能的场景30. 分布式系统的发展历程及其在不同领域中的应用有哪些?A. 分布式系统的发展始于20世纪80年代B. 分布式系统广泛应用于大数据处理、云计算、物联网等领域C. 分布式系统的发展受到了计算机网络技术的影响D. 分布式系统是现代计算机系统的基本组成部分31. 分布式系统的定义是什么?A. 一组通过网络进行通信的计算机系统B. 一个硬件和软件的组合,可以在多个位置进行数据处理和存储C. 一种允许多个服务器共享资源和数据的系统D. 一种设计用于处理大量数据并保证数据一致性的系统32. 分布式系统中的“分布式”一词意味着什么?A. 多个系统独立运行B. 资源共享C. 数据备份D. 所有这些都正确33. 分布式系统的核心特性是什么?B. 高可用性C. 任务无关性D. 资源共享34. 分布式系统中的“并发”是指什么?A. 同时执行多个任务B. 同时访问同一资源C. 同时处理多个数据流D. 同时修改数据库35. 以下哪个选项不是分布式系统中的常见同步问题?A. 机器之间的网络延迟B. 任务执行的先后顺序C. 共享资源的访问冲突D. 数据一致性问题36. 分布式系统中的“透明性”是指什么?A. 用户感觉好像所有的系统组件都在本地运行B. 系统管理员可以远程管理所有组件C. 应用程序的数据和代码在主机之间是可移植的D. 所有这些都正确37. 以下哪个分布式算法不是CAP定理中提到的?A. 客户端-服务器算法B. 一致性算法C. 分区容错算法D. 内容分发算法38. 分布式系统中的“分区容错”是什么意思?A. 在网络故障时,系统仍然可以运行B. 在网络分区时,系统能够继续运行C. 在网络拥堵时,系统仍然可以运行D. 在网络配置错误时,系统能够继续运行39. 以下哪个选项不是分布式系统中的常见性能指标?A. 响应时间B. 可扩展性C. 容错性D. 资源利用率40. 分布式系统与传统集中式系统的最大区别是什么?A. 可靠性更高B. 可伸缩性更好C. 无需依赖中央控制点D. 所有这些都正确二、问答题1. 什么是分布式系统?请简述其基本特性。
分布式系统概念与设计(第三版)课后习题与答案Chapter5

Chapter 5Exercise Solutions5.1The Election interface provides two remote methods:vote: with two parameters through which the client supplies the name of a candidate (a string) and the‘voter’s number’ (an integer used to ensure each user votes once only). The voter’s numbers areallocated sparsely from the range of integers to make them hard to guess.result: with two parameters through which the server supplies the client with the name of a candidateand the number of votes for that candidate.Which of the parameters of these two procedures are input and which are output parameters?5.1 Ans.vote: input parameters: name of candidate, voter’s number;result: output parameters: name of candidate, number of votes5.2Discuss the invocation semantics that can be achieved when the request-reply protocol isimplemented over a TCP/IP connection, which guarantees that data is delivered in the order sent,without loss or duplication. Take into account all of the conditions causing a connection to bebroken.5.2 Ans.A process is informed that a connection is broken:•when one of the processes exits or closes the connection.•when the network is congested or fails altogetherTherefore a client process cannot distinguish between network failure and failure of the server.Provided that the connection continues to exist, no messages are lost, therefore, every request will receive a corresponding reply, in which case the client knows that the method was executed exactly once.However, if the server process crashes, the client will be informed that the connection is broken and the client will know that the method was executed either once (if the server crashed after executing it) or not at all (if the server crashed before executing it).But, if the network fails the client will also be informed that the connection is broken. This may have happened either during the transmission of the request message or during the transmission of the reply message. As before the method was executed either once or not at all.Therefore we have at-most-once call semantics.5.3Define the interface to the Election service in CORBA IDL and Java RMI. Note that CORBA IDLprovides the type long for 32 bit integers. Compare the methods in the two languages forspecifying input and output arguments.5.3 Ans.CORBA IDL:interface Election {void vote(in string name, in long number);void result(out string name, out long votes);};Java RMIWe need to define a class for the result e.g.class Result {String name;int votes;}The interface is:import java.rmi.*;public interface Election extends Remote{void vote(String name, int number) throws RemoteException;Result result () throws RemoteException;};This example shows that the specification of input arguments is similar in CORBA IDL and Java RMI.This example shows that if a method returns more than one result, Java RMI is less convenient than CORBA IDL because all output arguments must be packed together into an instance of a class.5.4The Election service must ensure that a vote is recorded whenever any user thinks they have casta vote.Discuss the effect of maybe call semantics on the Election service.Would at-least-once call semantics be acceptable for the Election service or would yourecommend at-most-once call semantics?5.4 Ans.Maybe call semantics is obviously inadequate for vote! Ex 5.1 specifies that the voter’s number is used to ensure that the user only votes once. This means that the server keeps a record of who has voted. Therefore at-least-once semantics is alright, because any repeated attempts to vote are foiled by the server.5.5 A request-reply protocol is implemented over a communication service with omission failures toprovide at-least-once RMI invocation semantics. In the first case the implementor assumes anasynchronous distributed system. In the second case the implementor assumes that the maximumtime for the communication and the execution of a remote method is T. In what way does the latterassumption simplify the implementation?5.5 Ans.In the first case, the implementor assumes that if the client observes an omission failure it cannot tell whether it is due to loss of the request or reply message, to the server having crashed or having taken longer than usual.Therefore when the request is re-transmitted the client may receive late replies to the original request. The implementation must deal with this.In the second case, an omission failure observed by the client cannot be due to the server taking too long.Therefore when the request is re-transmitted after time T, it is certain that a late reply will not come from the server. There is no need to deal with late replies5.6Outline an implementation for the Election service that ensures that its records remain consistentwhen it is accessed concurrently by multiple clients.5.6 Ans.Suppose that each vote in the form {String vote, int number} is appended to a data structure such as a Java Vector. Before this is done, the voter number in the request message must be checked against every voterecorded in the Vector. Note that an array indexed by voter’s number is not a practical implementation as the numbers are allocated sparsely.The operations to access and update a Vector are synchronized, making concurrent access safe.Alternatively use any form of synchronization to ensure that multiple clients’ access and update operations do not conflict with one another.5.7The Election service must ensure that all votes are safely stored even when the server processcrashes. Explain how this can be achieved with reference to the implementation outline in youranswer to Exercise 5.6.5.7 Ans.The state of the server must be recorded in persistent storage so that it can be recovered when the server is restarted. It is essential that every successful vote is recorded in persistent storage before the client request is acknowledged.A simple method is to serialize the Vector of votes to a file after each vote is cast.A more efficient method would append the serialized votes incrementally to a file.Recovery will consist of de-serializing the file and recreating a new vector.5.8Show how to use Java reflection to construct the client proxy class for the Election interface. Givethe details of the implementation of one of the methods in this class, which should call the methoddoOperation with the following signature:byte [] doOperation (RemoteObjectRef o, Method m, byte[] arguments);Hint: an instance variable of the proxy class should hold a remote object reference (see Exercise 4.12).5.8 Ans.Use classes Class and Method. Use type RemoteObjectRef as type of instance variable. The class Class has method getMethod whose arguments give class name and an array of parameter types. The proxy’s vote method, should have the same parameters as the vote in the remote interface - that is: two parameters of type String and int. Get the object representing the vote method from the class Election and pass it as the second argument of doOperation. The two arguments of vote are converted to an array of byte and passed as the third argument of doOperation.import ng.reflect;class VoteProxy {RemoteObjectRef ref;private static Method voteMethod;private static Method resultMethod;static {try {voteMethod = Election.class.getMethod ("vote", new Class[]{ng.String.class,int.class}));resultMethod = Election.class.getMethod ("result", new Class[] {}));}catch(NoSuchMethodException){}}public void vote (String arg1, int arg2) throws RemoteException {try {byte args [] = // convert arguments arg1 and arg2 to an array of bytesbyte result = DoOperation(ref, voteMethod, args);return ;} catch (...) {}}5.9Show how to generate a client proxy class using a language such as C++ that does not supportreflection, for example from the CORBA interface definition given in your answer to Exercise 5.3.Give the details of the implementation of one of the methods in this class, which should call themethod doOperation defined in Figure 4.12.5.9 Ans.Each proxy method is generated from the signature of the method in the IDL interface,e.g.void vote(in string name, in long number);An equivalent stub method in the client language e.g. C++ is produced e.g.void vote(const char *vote, int number)Each method in the interface is given a number e.g. vote = 1, result = 2.use char args[length of string + size of int] and marshall two arguments into this array and call doOperation as follows:char * result = DoOperation(ref, 1, args);we still assume that ref is an instance variable of the proxy class. A marshalling method is generated for each argument type used.5.10Explain how to use Java reflection to construct a generic dispatcher. Give Java code for adispatcher whose signature is:public void dispatch(Object target, Method aMethod, byte[] args)The arguments supply the target object, the method to be invoked and the arguments for thatmethod in an array of bytes.5.10 Ans.Use the class Method. To invoke a method supply the object to be invoked and an array of Object containing the arguments. The arguments supplied in an array of bytes must be converted to an array of Object.public void dispatch(Object target, Method aMethod, byte[] args)throws RemoteException {Object[] arguments = // extract arguments from array of bytestry{aMethod.invoke(target, arguments);catch(...){}}5.11Exercise 5.8 required the client to convert Object arguments into an array of bytes before invokingdoOperation and Exercise 5.10 required the dispatcher to convert an array of bytes into an arrayof Object s before invoking the method. Discuss the implementation of a new version ofdoOperation with the following signature:Object [] doOperation (RemoteObjectRef o, Method m, Object[] arguments);which uses the ObjectOutputStream and ObjectInputStream classes to stream the request and replymessages between client and server over a TCP connection. How would these changes affect thedesign of the dispatcher?5.11 Ans.The method DoOperation sends the invocation to the target’s remote object reference by setting up a TCP connection (as shown in Figures 4.5 and 4.6) to the host and port specified in ref. It opens an ObjectOutputStream and uses writeObject to marshal ref, the method, m and the arguments by serializing them to an ObjectOutputStream. For the results, it opens an ObjectIntputStream and uses readObject to get the results from the stream.At the server end, the dispatcher is given a connection to the client and opens an ObjectIntputStream and uses readObject to get the arguments sent by the client. Its signature will be:public void dispatch(Object target, Method aMethod)5.12 A client makes remote procedure calls to a server. The client takes 5 milliseconds to compute thearguments for each request, and the server takes 10 milliseconds to process each request. The localoperating system processing time for each send or receive operation is 0.5 milliseconds, and thenetwork time to transmit each request or reply message is 3 milliseconds. Marshalling orunmarshalling takes 0.5 milliseconds per message.Calculate the time taken by the client to generate and return from two requests:(i)if it is single-threaded, and(ii)if it has two threads that can make requests concurrently on a single processor.You can ignore context-switching times. Is there a need for asynchronous RPC if client and serverprocesses are threaded?5.12 Ans.i) time per call = calc. args + marshal args + OS send time + message transmission +OS receive time + unmarshall args + execute server procedure+ marshall results + OS send time + message transmission +OS receive time + unmarshal args= 5 + 4*marshal/unmarshal + 4*OS send/receive + 2*message transmission + execute server procedure = 5+ 4*0.5 + 4*0.5 + +2*3 + 10 ms = 5+2+2+6+10 =25ms.Time for two calls = 50 ms.ii) threaded calls:client does calc. args + marshal args + OS send time (call 1) = 5+.5=.5 = 6then calc args + marshal args + OS send time (call 2) = 6= 12 ms then waits for reply from first callserver gets first call aftermessage transmission + OS receive time + unmarshal args = 6+ 3+.5+.5= 10 ms, takes 10+1 to execute, marshal, send at 21 msserver receives 2nd call before this, but works on it after 21 ms taking10+1, sends it at 32 ms from startclient receives it 3+1 = 4 ms later i.e. at 36 ms(message transmission + OS receive time + unmarshal args) laterTime for 2 calls = 36 ms.5.13Design a remote object table that can support distributed garbage collection as well as translatingbetween local and remote object references. Give an example involving several remote objects andproxies at various sites to illustrate the use of the table. Show what happens when an invocationcauses a new proxy to be created. Then show what happens when one of the proxies becomesunreachable.5.13 Ans..local reference remote reference holdersThe table will have three columns containing the local reference and the remote reference of a remote object and the virtual machines that currently have proxies for that remote object. There will be one row in the table for each remote object exported at the site and one row for each proxy held at the site.To illustrate its use, suppose that there are 3 sites with the following exported remote objects:S1: A1, A2, A3S2: B1, B2;S3: C1;and that proxies for A1 are held at S2 and S3; a proxy for B1 is held at S3.Then the tables hold the following information:.at S1at S2at S3local remote holders local remote holders local remote holdersa1A1S2, S3b1B1S3c1C1a2A2b2B2a1A1proxya3A3a1A1proxy b1B1proxy Now suppose that C1(at S3) invokes a method in B1 causing it to return a reference to B2. The table at S2 adds the holder S3 to the entry for B2 and the table at S3 adds a new entry for the proxy of B2.Suppose that the proxy for A1 at S3 becomes unreachable. S3 sends a message to S1 and the holder S3 is removed from A1. The proxy for A1 is removed from the table at S3.5.14 A simpler version of the distributed garbage collection algorithm described in Section 5.2.6 justinvokes addRef at the site where a remote object lives whenever a proxy is created and removeRefwhenever a proxy is deleted. Outline all the possible effects of communication and process failureson the algorithm. Suggest how to overcome each of these effects, but without using leases.5.14 Ans.AddRef message lost - the owning site doesn’t know about the client’s proxy and may delete the remote object when it is still needed. (The client does not allow for this failure).RemoveRef message lost - the owning site doesn’t know the remote object has one less user. It may continue to keep the remote object when it is no longer needed.Process holding a proxy crashes - owning site may continue to keep the remote object when it is no longer needed.Site owning a remote object crashes. Will not affects garbage collection algorithmLoss of addRef is discussed in the Section 5.2.6.When a removeRef fails, the client can repeat the call until either it succeeds or the owner’s failure has been detected.One solution to a proxy holder crashing is for the owning sites to set failure detectors on holding sites and then remove holders after they are known to have failed.5.15Discuss how to use events and notifications as described in the Jini distributed event specificationin the context of the shared whiteboard application. The RemoteEvent class is defined as followsin Arnold et al. [1999].public class RemoteEvent extends java.util.EventObject {public RemoteEvent(Object source, long eventID,long seqNum, MarshalledObject handback)public Object getSource () {…}public long getID() {…}public long getSequenceNumber() {…}public MarshalledObject getRegistrationObject() {…}}The first argument of the constructor is a remote object. Notifications inform listeners that an eventhas occurred but the listeners are responsible for obtaining further details.5.15 Ans.Event identifier,. evID s. Decided by the EventGenerator. Simplest solution is just to have one type of event -the addition of a new GraphicalObject. Other event types could for example refer to deletion of a GraphicalObject.Clients need to be notified of the remote object reference of each new GraphicalObject that is added to the server. Suppose that an object in the server is the EventGenerator. It could implement the EventGenerator interface and provide the register operation, or it could be done more simplye.g. addListener(RemoteEventListener listener, long evID)// add this listener to a vector of listenersThis would be better if Leases were used to avoid dealing with lost clients.The newShape method of shapeListServant (Figure 5.14) could be the event generator. It will notify all of the EventListeners that have registered with it, each time a new GraphicalObject is added. e.g.RemoteEvent event = new RemoteEvent(this, ADD_EVENT, version, null)for all listeners in the vectorlistener.notify(event)Each client creates an RemoteEventListener for receiving notifications of events and then registers interest in events with the server, passing the EventListener as argument.class MyListener implements RemoteEventListener {public MyListener() throws RemoteException[}public void notify(RemoteEvent event) throws UnknownEventException,RemoteException {Object source = getSource();long id = event.getID();long version = event.getSequenceNumber();// get the newly created GraphicalObject from the server}}Then to become a listener (add the following to the client program shown in Figure 5.15):sList.addListener(new MyListener(), ADD_EVENT);The client getting the newGraphicalObject needs to be able to get it directly from the version number, rather than by getting the list of Shapes and then getting the GraphicalObject. The interface to ShapeList could be amended to allow this.5.16Suggest a design for a notification mailbox service which is intended to store notifications onbehalf of multiple subscribers, allowing subscribers to specify when they require notifications tobe delivered. Explain how subscribers that are not always active can make use of the service youdescribe. How will the service deal with subscribers that crash while they have delivery turned on?5.16 Ans.The Mailbox service will provide an interface allowing a client to register interest in another object. The client will need to know the RemoteEventListener provided by the Mailbox service so that notifications may be passed from event generators to the RemoteEventListener and then on to the client. The client will also need a means of interacting with the Mailbox service so as to turn delivery on and off. Therefore define register as follows:Registration register() ...The result is a reference to a remote object whose methods enable the client to get a reference to a RemoteEventListener and to turn delivery on and off.To use the Mailbox service, the client registers with it and receives a Registration object, which it saves in a file. It registers the RemoteEventListener provided by the Mailbox service with all of the EventGenerators whose events it wants to have notification of. If the client crashes, it can restore the Registration object when it restarts. Whenever it wants to receive events it turns delivery on and when it does not want them it turns delivery off.The design should make it possible to specify a lease for each subscriber.5.17Explain how a forwarding observer may be used to enhance the reliability and performance ofobjects of interest in an event service.5.17 Ans.Reliability:The forwarding observer can retry notifications that fail at intervals of time.If the forwarding observer is on the same computer as the object of interest, then the two could not fail independently.Performance:The forwarding observer can optimize multicast protocols to subscribers.In Jini it could deal with renewing leases.5.18Suggest ways in which observers can be used to improve the reliability or performance of yoursolution to Exercise 5.13.5.18 Ans.The server can be relieved of saving information about all of the clients’ interests by creating a forwarding agent on the same computer. the forwarding agent could use a multicast protocol to send notifications to the clients. IP multicast would do since it is not crucial that every notification be received. A missed version number can be rectified as soon as another one is received.。
东北大学考博专业课分布式系统课件第一章

25
(3)总线型多计算机
Local Memory Local Memory Local Memory
CPU
CPU
CPU
• 本地内存 • 局域网络(10M ~ 100M~1G) •Share-nothing结构 •缺点:有限伸缩性(25-100节点)
2006-3-7
东北大学软件所 于戈
第1章 分布式系统 章
东北大学信息学院 于戈 2006年3月
主要内容
1.1 分布式系统概念 1.2 分布式系统的特点 1.3 硬件概念 1.4 软件概念 1.5 客户/服务器模型 1.6 分布式系统设计问题
2006-3-7
东北大学软件所 于戈
第一章 分布式系统概述
2
1.1 分布式系统概念
“一个分布式系统是若干个独立的计算机的集合, 一个分布式系统是若干个独立的计算机的集合, 一个分布式系统是若干个独立的计算机的集合 但是对该系统的用户来说, 但是对该系统的用户来说,感觉该系统就像一台计算 机一样。 机一样。” • 硬件方面:每台计算机都是独立、自主的计算机 • 软件方面:用户感觉在独占系统
排名 1 2 3 4 5 6 7 8 9 10 26 42 93 地点 美国DOE/NNSA/LLNL 美国IBM Thomas J. Watson Research Center 美国DOE/NNSA/LLNL 美国NASA/Ames Research Center/NAS 美国Sandia National Laboratories 美国Sandia National Laboratories 日本The Earth Simulator Center 西班牙Barcelona Supercomputer Center 荷兰ASTRON/University Groningen 美国Oak Ridge National Laboratory 中国Meteorological Administration 中国Shanghai Supercomputer Center 中国Chinese Academy of Science 计算机 BlueGene/L - eServer Blue Gene Solution,IBM BGW - eServer Blue Gene Solution, IBM ASC Purple - eServer pSeries p5 575 1.9 GHz, IBM Columbia - SGI Altix 1.5 GHz, Voltaire Infiniband, SGI Thunderbird - PowerEdge 1850, 3.6 GHz, Infiniband, Dell Red Storm Cray XT3, 2.0 GHz, Cray Inc. Earth-Simulator, NEC MareNostrum - JS20 Cluster, PPC 970, 2.2 GHz, Myrinet, IBM Stella - eServer Blue Gene Solution, IBM Jaguar - Cray XT3, 2.4 GHz, Cray Inc. eServer pSeries 655 (1.7 GHz Power4+), IBM Dawning 4000A, Opteron 2.2 GHz, Myrinet,曙 光 DeepComp 6800, Itanium2 1.3 GHz, QsNet,联想 处理机# 处理机 131072 40960 10240 10160 8000 10880 5120 4800 12288 5200 3200 2560 1024 年份 2005 2005 2005 2004 2005 2005 2002 2005 2005 2005 2005 2004 2003 Rmax 280600 91290 63390 51870 38270 36190 35860 27910 27450 20527 10310 8061 4193 Rpeak 367000 114688 77824 60960 64512 43520 40960 42144 34406.4 24960 21760 11264 5324.8
分布式系统设计

分布式系统设计在现代计算机系统中,分布式系统已经成为一个非常重要的话题。
随着计算机应用场景的不断扩展和计算能力的不断提升,分布式系统的设计和实现变得越来越关键。
本文将探讨分布式系统设计的原则和方法。
一、分布式系统的概念和特点分布式系统是由多台计算机组成的系统,通过网络连接并协同工作。
分布式系统的特点包括以下几个方面:1. 分布性:分布式系统中的计算机节点可以分布在不同的地理位置上,通过网络进行通信和协同工作。
2. 并发性:分布式系统中的计算机节点可以同时处理多个任务,实现任务的并行处理。
3. 可靠性:分布式系统中的计算机节点可以具备容错和冗余功能,提高系统的可用性和可靠性。
4. 可扩展性:分布式系统可以根据需求进行水平和垂直的扩展,提高系统的性能和容量。
二、分布式系统设计的原则在设计分布式系统时,需要遵循以下原则:1. 透明性原则:分布式系统的设计应该尽可能隐藏分布性,使得用户感觉不到分布式系统的存在,使用起来与单机系统无异。
2. 并发性原则:分布式系统应该支持并发处理,充分利用计算机节点的并行处理能力,提高系统的性能和吞吐量。
3. 可靠性原则:分布式系统应该具备容错和冗余功能,能够在节点故障或网络异常的情况下继续正常工作,保证系统的可用性和可靠性。
4. 一致性原则:分布式系统中的数据和状态应该保持一致,不同节点之间的数据更新应该同步或者达到一致。
三、分布式系统设计的方法在设计分布式系统时,可以采用以下方法:1. 分布式计算模型:选择适合场景的分布式计算模型,如客户-服务器模型、对等模型、集群模型等,根据需求选择最合适的模型。
2. 分布式架构:选择适合场景的分布式架构,如分层架构、微服务架构、事件驱动架构等,根据系统需求和性能要求选择最合适的架构。
3. 通信协议和接口设计:设计合适的通信协议和接口,确保不同节点之间可以进行有效的通信和数据交换。
4. 数据一致性和同步:设计合理的数据一致性算法和同步机制,保证分布式系统中的数据和状态保持一致。
系统分析与设计课后习题答案[整理版]
![系统分析与设计课后习题答案[整理版]](https://img.taocdn.com/s3/m/3b00fb9f690203d8ce2f0066f5335a8102d266ac.png)
第一章1.什么是系统?信息系统一般具有那些特性?答:系统是一组为实现某些结果相互联系相互作用的部件的集合。
1.可分解性2.边界性2.从应用范围来看,信息系统可以分为哪些类型?答:1.事物处理系统2.管理信息系统3.智能支持决策系统4.办公自动化系统3.信息系统中典型的关联人员有哪些?他们的角色是什么?答:系统所有者(通常是中层或者高层经理,对于小型系统来说,可能是中层经理或者主管)、用户、分析设计人员(都代表信息系统的技术专家角色)、外部服务者(业务顾问和系统顾问等)以及项目经理(团队的领导者)4.请解释系统内部用户和外部用户的区别是什么?答:内部系统用户主要是指系统实际操作人员,这些人员往往专注于信息系统的处理速度和处理事务的正确性。
外部系统用户主要是指系统的直接或者间接使用人员,所有这些外部系统用户最关注的是使用系统的服务操作是否简单易学,方便操作。
5.什么是模型驱动分析?为什么要使用此方法?举例说明。
答:模型驱动分析法强调绘制图形化系统模型来记录和验证现有的或建议的系统。
系统模型最终将成为设计和构造一个改进系统的蓝图。
结构化分析、信息工程和面向对象分析都是基于模型驱动的分析方法。
6.什么是系统开发生存周期?在项目启动阶段涉及的主要活动有哪些?答:开发一个完整的系统项目总会经历“目标、计划、分析、设计、实现、维护”这样的过程或步骤,这就是系统开发的生存周期(系统项目启动、业务需求分析、详细系统设计、系统实现与维护)。
启动阶段的主要涉及5个活动:定义问题域、制定项目的进度表、确认项目的可行性、安排项目人员、启动项目。
7.为什么引入系统原型开发方法?它的优缺点是什么?答:采用最经济的方法,尽快设计出一个可以实际运行的系统原型。
优点:提高了用户参与的主动性;系统开放周期短;能更好的适应需求的变化并减少误解,能有效的提高最终系统的质量,特别是用户接受性,为保证将系统提供给用户使用奠定了基础。
缺点:1.系统分析和功能设计贯穿于整个开发过程中,使得系统的总体结构变得不明确;2.原型选取的不确定性可能降低系统开放速度;3.对原型进行分析设计时,依然沿袭结构化方法,自顶向下模块化的设计思想,数据和功能相互分离的缺陷在原型法中依然存在,不利于软件构件的重用;4.开发过程中不断引入用户需求的变化,造成了系统开发的不确定性。
分布式系统概念与设计(第三版)课后习题与答案Chapter15

Chapter 15Solutions15.1Outline a system to support a distributed music rehearsal facility. Suggest suitable QoSrequirements and a hardware and software configuration that might be used.15.1 Ans..This is a particularly demanding interactive distributed multimedia application. Konstantas et al. [1997] report that a round-trip delay of less than 50 ms is required for it. Clearly, video and sound should be tightly synchronized so that the musicians can use visual cues as well as audio ones. Bandwidths should be suitable for the cameras and audio inputs used, e.g. 1.5 Mbps for video streams and 44 kbps for audio streams. Loss rates should be low, but not necessarily zero.The QoS requirements are much stricter than for conventional videoconferencing – music performance is impossible without strict synchronization. A software environment that includes QoS management with resource contracts is required. The operating systems and networks used should provide QoS guarantees. Few general-purpose OS’s provide them at present. Dedicated real-time OS’s are available but they are difficult to use for high-level application development.Current technologies that should be suitable:•ATM network.•PC’s with hardware for MPEG or MJPEG compression.•Real-time OS with support for high-level software development, e.g. in CORBA or Java.15.2The Internet does not currently offer any resource reservation or quality of service managementfacilities. How do the existing Internet-based audio and video streaming applications achieveacceptable quality? What limitations do the solutions they adopt place on multimediaapplications?15.2 Ans..There are two types of Internet-based applications:a)Media delivery systems such as music streaming, Internet radio and TV applications.b)Interactive applications such as Internet phone and video conferencing (NetMeeting, CuSeemMe).For type (a), the main technique used is traffic shaping, and more specifically, buffering at the destination.Typically, the data is played out some 5–10 seconds after its delivery at the destination. This masks the uneven latency and delivery rate (jitter) of Internet protocols and masks the delays incurred in the network and transport layers of the Internet due to store-and-forward transmission and TCP’s reliability mechanisms.For type (b), the round trip delay must be kept below 100 ms so the above technique is ruled out. Instead, stream adaptation is used. Specifically, video is transmitted with high levels of compression and reduced frame rates. Audio requires less adaptation. UDP is generally used.Overall, type (a) systems work reasonably well for audio and low-resolution video only. For type (b) the results are usually unsatisfactory unless the network routes and operating system priorities are explicitly managed.15.3Explain the distinctions between the three forms of synchronization (synchronous distributedstate, media synchronization and external synchronization) that may be required in distributedmultimedia applications. Suggest mechanisms by which each of them could be achieved, forexample in a videoconferencing application.15.3 Ans..synchronous distributed state: All users should see the same application state. For example, the results of operation on controls for a video, such as start and pause should be synchronized, so that all users see the same frame. This can be done by associating the current state (sample number) of the active multimedia streams with each state-change message. This constitutes a form of logical vector timestamp.media synchronization: Certain streams are closely coupled. E.g. the audio that accompanies a video stream.They should be synchronised using timestamps embedded in the media data.external synchronization: This is really an instance of synchronous distributed state. The messages that update shared whiteboards and other shared objects should carry vector timestamps giving the states of media streams.15.4Outline the design of a QoS manager to enable desktop computers connected by an ATM networkto support several concurrent multimedia applications. Define an API for your QoS manager,giving the main operations with their parameters and results.15.4 Ans..Each multimedia application requires a resource contract for each of its multimedia streams. Whenever a new stream is to be started, a request is made to the QoS manager specifying CPU resources, memory and network connections with their Flow Specs. The QoS manager performs an analysis similar to Figure 15.6 for each end-to-end stream. If several streams are required for a single application, there is a danger of deadlock – resources are allocated for some of the streams, but the needs of the remaining streams cannot be satisfied. When this happens, the QoS negotiation should abort and restart, but if the application is already running, this is impractical, so a negotiation takes place to reduce the resources of existing streams.API:QoSManager.QoSRequest(FlowID, FlowSpec) –> ResourceContractThe above is the basic interface to the QoS Manager. It reserves resources as specified in the FlowSpec and returns a corresponding ResourceContract.A FlowSpec is a multi-valued object, similar to Figure 15.8.A ResourceContract is a token that can be submitted to each of the resource handlers (CPU scheduler,memory manager, network driver, etc.).Application.ScaleDownCallback(FlowID, FlowSpec) -> AcceptRejectThe above is a callback from the QoS Manager to an application, requesting a change in the FlowSpec fora stream. The application can return a value indicating acceptance or rejection.15.5In order to specify the resource requirements of software components that process multimediadata, we need estimates of their processing loads. How should this information be obtained?15.5 Ans..The main issue is how to measure or otherwise evaluate the resource requirements (CPU, memory, network bandwidth, disk bandwidth) of the components that handle multimedia streams without a lot of manual testing.A test framework is required that will evaluate the resource utilization of a running component. But there isalso a need for resource requirement models of the components – so that the requirements can be extrapolated to different application contexts and stream characteristics and different hardware environments (hardware performance parameters).15.6How does the Tiger system cope with a large number of clients all requesting the same movie atrandom times?15.6 Ans..If they arrive within a few seconds of each other, then they can be placed sufficiently close together in the schedule to take advantage of caching in the cubs, so a single disk access for a block can service several clients.If they are more widely spaced, then they are placed independently (in an empty slot near the disk holding he first block of the movie at the time each request is received). There will be no conflict for resources because different blocks of the movie are stored on different disks and cubs.15.7The Tiger schedule is potentially a large data structure that changes frequently, but each cub needsan up-to-date representation of the portions it is currently handling. Suggest a mechanism for thedistribution of the schedule to the cubs.15.7 Ans..In the first implementation of Tiger the controller computer was responsible for maintaining an up-to-date version of the schedule and replicating it to all of the cubs. This does not scale well – the processing and communication loads at the controller grow linearly with the number of clients – and is likely to limit the scale of the service that Tiger can support. In a later implementation, the cubs were made collectively responsible for maintaining the schedule. Each cub holds a fragment of the schedule – just those slots that it will be playing processing in the near future. When slots have been processed they are updated to show the current viewer state and then they are passed to the next ‘downstream’ cub. Cubs retain some extra fragments for fault-tolerance purposes.When the controller needs to modify the schedule – to delete or suspend an existing entry or to insert a viewer into an empty slot – it sends a request to the cub that is currently responsible for the relevant fragment of the schedule to make the update. The cub then uses the updated schedule fragment to fulfil its responsibilities and passes it to the next downstream cub.15.8When Tiger is operating with a failed disk or cub, secondary data blocks are used in place ofmissing primaries. Secondary blocks are n times smaller than primaries (where n is the declusterfactor), how does the system accommodate this variability in block size?15.8 Ans..Whether they are large primary or smaller secondary blocks, they are always identified by a play sequence number. The cubs simply deliver the blocks to the clients in order via the ATM network. It is the clients’responsibility to assemble them in the correct sequence and then to extract the frames from the incoming sequence of blocks and play the frames according to the play schedule.。
分布式系统设计
分布式系统设计一、引言在当今互联网高度发达的时代,分布式系统已经成为许多企业和组织的首选方案。
分布式系统可以将任务分发到多个计算机节点上,实现大规模计算和数据处理,提高系统的可靠性和性能。
本文将探讨分布式系统的设计原则、架构模式以及相关的技术。
二、设计原则在设计分布式系统时,需要考虑以下原则:1. 可扩展性:分布式系统应该能够方便地扩展节点和资源,以应对不断增长的业务需求。
2. 可靠性:系统应该能够处理节点故障和网络错误,并具有容错机制,保证数据的安全性和可用性。
3. 并发性:分布式系统需要支持并发处理,提高系统的性能和资源利用率。
4. 数据一致性:不同节点之间的数据应该保持一致性,避免数据冲突和不一致。
5. 容错性:系统应该能够检测和纠正错误,保证系统的可靠性和可用性。
三、架构模式分布式系统可以采用不同的架构模式,根据不同的需求选择合适的模式。
以下是几种常见的架构模式:1. 客户端-服务器模式:客户端向服务器发送请求,服务器进行计算和处理,并返回结果给客户端。
这种模式适合于请求-响应型的应用场景。
2. 主从模式:一个节点充当主节点,负责协调和管理其他从节点。
主节点负责分发任务和处理结果,从节点负责执行任务并返回结果。
3. 分布式数据库模式:数据存储在多个节点上,并进行分片和复制,提高数据的可靠性和性能。
4. Peer-to-Peer模式:每个节点可以同时充当客户端和服务器的角色,节点之间相互协作完成任务。
5. MapReduce模式:将一个大任务分解成多个小任务,分发到不同的节点上并行计算,最后合并结果。
四、相关技术在设计和实现分布式系统时,可以借助以下技术来解决各种问题:1. 分布式文件系统:如Hadoop的HDFS,可以存储和管理分布式系统中的大规模数据。
2. 分布式计算框架:如Spark、Hadoop等,可以将大规模计算任务分发到多个节点上进行并行计算。
3. 一致性协议:如Paxos、Raft等,用于保证分布式系统中的数据达到一致性的状态。
分布式系统架构设计Fourinone试题及答案
分布式系统架构设计Fourinone试题及答案1.分布式系统中的扩展技术通常有?隐藏通信等待时间〔正确答案〕复制技术〔正确答案〕互操作性可移植性2.下面属于分布式混合体系结构的是?点对点体系结构超级对等体边界效劳器系统〔正确答案〕协作分布式系统〔正确答案〕3.下面形成分布式反应限制循环的元素是?尺度预测组件〔正确答案〕循环体反应分析组件〔正确答案〕调整方法组件〔正确答案〕4.在分布式虚拟机体系结构中,虚拟化通常采用的方式是系统调用系统移植构建进程虚拟机〔正确答案〕虚拟机监视器〔正确答案〕5.进行代码迁移的理由是?提升系统的整体性能〔正确答案〕提升灵活性〔正确答案〕提升平安性提升存储水平6.在迁移与本地资源的关系中,进程对资源的绑定有?紧固连接的绑定按标识符绑定〔正确答案〕按值绑定〔正确答案〕按类型绑定〔正确答案〕7.在迁移与本地资源的关系中,资源对机器的绑定有?未连接资源〔正确答案〕附着连接的资源〔正确答案〕紧固连接的资源〔正确答案〕按类型的资源8.在DEC中,IDL中的头文件包含?唯一标识符〔正确答案〕调用语义类型定义〔正确答案〕常量定义与函数原型〔正确答案〕9.早面向消息的持久通信中,消息队列系统中的根本接口有?put〔正确答案〕get〔正确答案〕M_bsendsocket10.在流同步中,同步机制需要搞清楚的问题是?限制接口MPEG 流俩个流同步的根本机制〔正确答案〕在网络下机制的版本〔正确答案〕11.网络体系结构可以定义为?一种计算机网络的实现执行计算机数据处理的软件结构建立和使用通信硬件和软件的一套规那么和标准〔正确答案〕由ISO制定的一个标准12.在OSI参考模型中,数据链路层的数据效劳单元是?分组报文帧〔正确答案〕比特序列13.下面属于分布式计算系统的是?资源治理集群计算〔正确答案〕网格计算〔正确答案〕运行应用程序14.目前分布式信息系统按集成可分为?事务处理系统〔正确答案〕企业应用集成〔正确答案〕网络治理资源分配系统15.现在已认可的分布式系统软件体系结构样式有?分层体系结构〔正确答案〕基于对象的体系结构〔正确答案〕以数据为中央的体系结构〔正确答案〕基于事件的体系结构〔正确答案〕16.俩个旅行社甲和乙为旅客订某航空公司机票,形成互斥的资源是?飞机票〔正确答案〕旅行社航空公司旅行社和航空公司17. DNS属于〔〕协议.应用层〔正确答案〕传输层互联网层网络接口层18.活动目录是一种〔〕结构的目录效劳.层次式〔正确答案〕分布式〔正确答案〕对等式主次式19.对于域名:test , DNS效劳器查找的顺序是?先查找test主机,再查找域先查找域,再查找test主机〔正确答案〕随机查找以上答案皆是20. SMTP协议是关于〔〕的协议.邮件传输〔正确答案〕文件传输超文本传输网络新闻组件传输21. POP3协议是关于〔〕的协议.超文本传输邮件传输接收邮件〔正确答案〕网络新闻组件传输22.远程客户端登录终端效劳器必须提供一定的信息,以下有〔〕属于这种必要的信息.用户名〔正确答案〕域效劳器IP地址〔正确答案〕连接名称23.在多播通信中,应用层多播树的质量通常以〔〕不同的尺度来度量. 链接树〔正确答案〕相对延时补偿〔正确答案〕树本钱〔正确答案〕树结构24.以多播流方式传递内容时只能采用〔〕类型的发布点.单播发布点播送发布点〔正确答案〕单播发布点或播送发布既不是单播发布点也非播送发布点25. DNS名称空间是分层组织的一棵有根树,标识符有?字母组成数字组成字母和数字组成〔正确答案〕汉字组成26. IDL编译器的输出包括的文件是?文件头〔正确答案〕客户存根〔正确答案〕守护程序效劳器存根〔正确答案〕27.以下属于流同步的是?位同步字同步离散数据流与连续数据流之间同步〔正确答案〕口型同步〔正确答案〕28.实现线程的根本方法有?构造一个完全在用户模式下执行的线程库〔正确答案〕由进程间间通信实现由内核来治理线程并进行调整〔正确答案〕由用户程序来实现29.下面是多线程效劳器可行的设计方法是?多线程文件效劳器〔正确答案〕Web效劳单线程文件效劳器〔正确答案〕作为有限状态机〔正确答案〕30.与迭代名称解析比拟,递归名称解析的优点是?要求效劳器性能高缓存结果更为有效〔正确答案〕能减少通信开销〔正确答案〕算法简单31.名称用来表示实体,下面属于尸体名称的是?实体图标识符〔正确答案〕易于理解的名称〔正确答案〕实体地址〔正确答案〕32.下面用于定位移动实体的方法是?使用播送与多播〔正确答案〕使用转发指针〔正确答案〕给实体指定一个起始位置〔正确答案〕创立一棵分层搜索树〔正确答案〕33.分布式系统的全局状态是指?用于计算的临时记录每个进程的本地状态〔正确答案〕要发送的消息当前正在传输中的消息〔正确答案〕34.面向消息的中间件模型一般提供?持久异步通信〔正确答案〕RPC和RMI电子邮件〔正确答案〕工作流〔正确答案〕35.在分布式系统中,实现事务的方法是?创立进程为进程分配私有工作空间〔正确答案〕做写前日志〔正确答案〕创立线程36.并发限制的总体思想是?正确调度相冲突的操作〔正确答案〕对事务进行治理进行数据的更新有序的通信37.下面属于进程同步算法的是?FIFO算法基于优先级的算法选举算法〔正确答案〕互斥算法〔正确答案〕38.严格一致性中存在的问题是?依赖于绝对的全局时间〔正确答案〕不依赖与绝对的全局时间依赖于并发限制算法不依赖与并发限制算法39.以下属于“以数据为中央的一致性模型〞是?持久一致性〔正确答案〕最终一致性因果一致性〔正确答案〕顺序一致性〔正确答案〕40.以下属于“以客户为中央的一致性模型“是?严格一致性单调读一致性〔正确答案〕单调写一致性〔正确答案〕读写一致性〔正确答案〕41.下面属于一致性协议的是?传输协议中间件协议基于主备份的协议〔正确答案〕复制的写协议〔正确答案〕42.基于主备份的协议是指?负责协调X上的远程写操作〔正确答案〕负责协调X上的本地写操作〔正确答案〕主动复制・协调操作43.冗余是获得容错性所需的技术,下面属于冗余掩盖故障的是?存储器冗余信息冗余〔正确答案〕时间冗余〔正确答案〕物理冗余〔正确答案〕44.在可靠多播通信中,解决反应拥塞的方法是?无等级的反应限制〔正确答案〕分等级的反应限制〔正确答案〕分层的反应限制闭环反应限制45.实现可靠原子多播的方法是?转发指针消息排序〔正确答案〕虚拟同步〔正确答案〕指针缓存。
分布式数据库系统部分课后题答案
∑ ∑ aff ( A1, A1) =
3 l =1
accl
(qk
)
=
acc1
(q2
TITLE
根据如下关系代数表达式进行分片后的 EMP TITLE PAY 连接图:
EMP1 = σ TITLE =”Elect. Eng.”(EMP);
EMP2 =σ TITLE =”Syst. Anal.”(EMP);
EMP3 = σ TITLE =”Mech. Eng..”(EMP);
EMP4 =σ TITLE =”Programmer”(EMP);
TITLE Mech. Eng. Programmer Mech. Eng
图 5.5.2
EMP2 ENO ENAME E1 J. Doe E2 M. Smith E5 B. Casey E6 L. Chu E8 J. Jones
TITLE Elect. Eng Syst. Anal. Syst. Anal. Elect. Eng. Syst. Anal.
PAY TITLE
Elect. Eng. Syst. Anal. Mech. Eng. Programmer
SAL 40000 34000 27000 24000
Figure 5.3. Modified Example Database
5.1 p1: TITLE < “Programmer” and p2: TITLE > “Programmer”. (a) 根据{ p1, p2 }对关系 EMP 进行水平分片:EMP1 = σ TITLE < ”Programmer” (EMP);
q5 1 1 1 0 0
(a)
S1 S2 S3
q1 10 20 0
操作系统第五版1-12章课后题中文答案
复习题:1.1、列出并简要地定义计算机的四个主要组成部分。
答:主存储器,存储数据和程序;算术逻辑单元,能处理二进制数据;控制单元,解读存储器中的指令并且使他们得到执行;输入/输出设备,由控制单元管理。
1.2、定义处理器寄存器的两种主要类别。
答:用户可见寄存器:优先使用这些寄存器,可以使机器语言或者汇编语言的程序员减少对主存储器的访问次数。
对高级语言而言,由优化编译器负责决定把哪些变量应该分配给主存储器。
一些高级语言,如C语言,允许程序言建议编译器把哪些变量保存在寄存器中。
控制和状态寄存器:用以控制处理器的操作,且主要被具有特权的操作系统例程使用,以控制程序的执行。
1.3、一般而言,一条机器指令能指定的四种不同操作是什么?答:这些动作分为四类:处理器-寄存器:数据可以从处理器传送到存储器,或者从存储器传送到处理器。
处理器-I/O:通过处理器和I/O模块间的数据传送,数据可以输出到外部设备,或者从外部设备输入数据。
数据处理,处理器可以执行很多关于数据的算术操作或逻辑操作。
控制:某些指令可以改变执行顺序。
1.4、什么是中断?答:中断:其他模块(I/O,存储器)中断处理器正常处理过程的机制。
1.5、多中断的处理方式是什么?答:处理多中断有两种方法。
第一种方法是当正在处理一个中断时,禁止再发生中断。
第二种方法是定义中断优先级,允许高优先级的中断打断低优先级的中断处理器的运行。
1.6、内存层次的各个元素间的特征是什么?答:存储器的三个重要特性是:价格,容量和访问时间。
1.7、什么是高速缓冲存储器?答:高速缓冲存储器是比主存小而快的存储器,用以协调主存跟处理器,作为最近储存地址的缓冲区。
1.8、列出并简要地定义I/O操作的三种技术。
答:可编程I/O:当处理器正在执行程序并遇到与I/O相关的指令时,它给相应的I/O模块发布命令(用以执行这个指令);在进一步的动作之前,处理器处于繁忙的等待中,直到该操作已经完成。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Distributed Systems: Concepts and DesignEdition 5By George Coulouris, Jean Dollimore and Tim Kindberg and Gordon BlairAddison-Wesley ©Pearson Education 2012Chapter1Exercise Solutions1.1We define a distributed system as one in which hardware or software components located atnetworked computers communicate and coordinate their actions only by passing messages. Whatare the consequences of defining a distributed system in this manner?1.1 Ans.a.Concurrencyb.No global clockc.Independent failures.1.2How might the clocks in two computers that are linked by a local network be synchronized withoutreference to an external time source? What factors limit the accuracy of the procedure you havedescribed? How could the clocks in a large number of computers connected by the Internet besynchronized? Discuss the accuracy of that procedure.1.2 Ans.Several time synchronization protocols are described in Section 10.3. One of these is Cristian’s protocol.Briefly, the round trip time t to send a message and a reply between computer A and computer B is measured by repeated tests; then computer A sends its clock setting T to computer B. B sets its clock to T+t/2. The setting can be refined by repetition. The procedure is subject to inaccuracy because of contention for the use of the local network from other computers and delays in the processing the messages in the operating systems of A and B. For a local network, the accuracy is probably within 1 ms.For a large number of computers, one computer should be nominated to act as the time server and it should carry out Cristian’s protocol with all of them. The protocol can be initiated by each in turn. Additional inaccuracies arise in the Internet because messages are delayed as they pass through switches in wider area networks. For a wide area network the accuracy is probably within 5-10 ms. These answers do not take into account the need for fault-tolerance. See Chapter 10 for further details.1.3Consider the implementation strategies for massively multiplayer online games as discussed inSection 1.2.2. In particular, what advantages do you see in adopting a single server approach forrepresenting the state of the multiplayer game? What problems can you identify and how mightthey be resolved?1.3 Ans.The advantages of having a single server maintain a representation of the game are that: (1) there is a single copy and hence no need to maintain consistency of multiple copies; and (2) clients have a single place to go to discover this state. There may also be advantages to having a global view of the entire systems state.The potential problems are that this single server may fail and may also become a bottleneck affecting the performance and scalability of the approach. To handle failure, it would be necessary to introduce replication, which in turn would require a solution to maintaining consistency across replicas. There are a number of solutions to improving performance and scalability including running the server on a cluster architecture as described in Section 1.2.2, or again using replication and load balancing within the distributed environment. Alternatively, a peer-to-peer solution can be adopted. These techniques are covered throughout the book.1.4 A user arrives at a railway station that she has never visited before, carrying a PDA that is capableof wireless networking. Suggest how the user could be provided with information about the localservices and amenities at that station, without entering the station’s name or attributes. Whattechnical challenges must be overcome?1.4 Ans.The user must be able to acquire the address of locally relevant information as automatically as possible. One method is for the local wireless network to provide the URL of web pages about the locality over a local wireless network.For this to work: (1) the user must run a program on her device that listens for these URLs, and which gives the user sufficient control that she is not swamped by unwanted URLs of the places she passes through; and(2) the means of propagating the URL (e.g. infrared or an 802.11 wireless LAN) should have a reach thatcorresponds to the physical spread of the place itself.1.5Distributed systems are going through a period of significant change, which can be traced back toa number of influential trends. Can you identify what these might be?1.5 Ans.a.The emergence of pervasive networking technology.b.The emergence of ubiquitous computing coupled with the desire to support user mobility indistributed systems.c.The increasing demand for multimedia services.d.The view of distributed systems as a utility.1.6Due to the increasing maturity of distributed systems infrastructure, organizations are movingtowards viewing distributed systems as a utility. I n this model, resources are provided byappropriate service suppliers and effectively rented rather than owned by the end user. Explain thismodel with respect to physical resources and software services. Can you give examples of somecompanies that support such software services?1.6 Ans.a.Physical resources such as storage and processing can be made available to networkedcomputers removing the need to own such resources on their own.b.Software services can also be made available across the global Internet using this approach.Example of companies supporting such software services are ,.1.7 A server program written in one language (for example C++) provides the implementation of aBLOB object that is intended to be accessed by clients that may be written in a different language(for example Java). The client and server computers may have different hardware, but all of themare attached to an internet. Describe the problems due to each of the five aspects of heterogeneitythat need to be solved to make it possible for a client object to invoke a method on the serverobject.1.7 Ans.As the computers are attached to an internet, we can assume that Internet protocols deal with differences in networks.But the computers may have different hardware - therefore we have to deal with differences of representation of data items in request and reply messages from clients to objects. A common standard will be defined for each type of data item that must be transmitted between the object and its clients.The computers may run different operating systems, therefore we need to deal with different operations to send and receive messages or to express invocations. Thus at the Java/C++ level a common operation would be used which will be translated to the particular operation according to the operating system it runs on.We have two different programming languages C++ and Java, they use different representations for data structures such as strings, arrays, records. A common standard will be defined for each type of data structure that must be transmitted between the object and its clients and a way of translating between that data structure and each of the languages.We may have different implementors, e.g. one for C++ and the other for Java. They will need to agree on the common standards mentioned above and to document them.1.8What is client-server computing? Which of these roles is an active role, and which is a passiveone? Explain remote invocation in this context.1.8 Ans.Client server computing refers to a running program (a process) on a networked computer that accepts requests from programs running on other computers to perform a service and responds appropriately.Clients are active (making requests) and servers are passive.The interaction between a client and a server, from the point when the client sends its request to when it receives the server’s response, is called remote invocation.1.9Suppose that the operations of the BLOB object are separated into two categories – publicoperations that are available to all users and protected operations that are available only to certainnamed users. State all of the problems involved in ensuring that only the named users can use aprotected operation. Supposing that access to a protected operation provides information thatshould not be revealed to all users, what further problems arise?1.9 Ans.Each request to access a protected operation must include the identity of the user making the request. The problems are:•defining the identities of the users. Using these identities in the list of users who are allowed to access the protected operations at the implementation of the BLOB object. And in the request messages.•ensuring that the identity supplied comes from the user it purports to be and not some other user pretending to be that user.•preventing other users from replaying or tampering with the request messages of legitimate users.Further problems.•the information returned as the result of a protected operation must be hidden from unauthorised users.This means that the messages containing the information must be encrypted in case they are interceptedby unauthorised users.1.10The INFO service manages a potentially very large set of resources, each of which can be accessedby users throughout the Internet by means of a key (a string name). Discuss an approach to thedesign of the names of the resources that achieves the minimum loss of performance as the numberof resources in the service increases. Suggest how the INFO service can be implemented so as toavoid performance bottlenecks when the number of users becomes very large.1.10 Ans.Algorithms that use hierarchic structures scale better than those that use linear structures. Therefore the solution should suggest a hierarchic naming scheme. e.g. that each resource has an name of the form ’A.B.C’etc. where the time taken is O(log n) where there are n resources in the system.To allow for large numbers of users, the resources are partitioned amongst several servers, e.g. names starting with A at server 1, with B at server 2 and so forth. There could be more than one level of partitioning as in DNS. To avoid performance bottlenecks the algorithm for looking up a name must be decentralised. That is, the same server must not be involved in looking up every name. (A centralised solution would use a single root server that holds a location database that maps parts of the information onto particular servers). Some replication is required to avoid such centralisation. For example: i) the location database might be replicated at multiple root servers or ii) the location database might be replicated in every server. In both cases, different clients must access different servers (e.g. local ones or randomly).1.11 A distributed system is described as scalable when it remains effective when there is a significantincrease in the number of resources and the number of users. However, these systems sometimesface performance bottlenecks. How can these be avoided?1.11 Ans.Caching and replication may be used to improve the performance of the resources that are very heavily used in a distributed system.1.12 A server process maintains a shared information object such as the BLOB object of Exercise 1.7.Give arguments for and against allowing the client requests to be executed concurrently by theserver. In the case that they are executed concurrently, give an example of possible ‘interference’that can occur between the operations of different clients. Suggest how such interference may beprevented.1.12 Ans.For concurrent executions - more throughput in the server (particularly if the server has to access a disk or another service)Against - problems of interference between concurrent operationsExample:Client A’s thread reads value of variable XClient B’s thread reads value of variable XClient A’s thread adds 1 to its value and stores the result in XClient B’s thread subtracts 1 from its value and stores the result in XResult: X := X-1; imagine that X is the balance of a bank account, and clients A and B are implementing credit and debit transactions, and you can see immediately that the result is incorrect.To overcome interference use some form of concurrency control. For example, for a Java server use synchronized operations such as credit and debit.1.13The ANSA Reference Manual [ANSA 1989] identified eight forms of transparency in a distributedsystem. Which are the two most important transparencies among these?1.13 Ans.The two most important transparencies are access and location transparency; their presence or absence most strongly affects the utilization of distributed resources. They are sometimes referred to together as network transparency.1.14One of the main standard technological components of web is the HyperText Transfer Protocol(HTTP), which defines the ways in which browsers and other types of clients interact with webservers. What are the different features of the HTTP?1.14 Ans.The main features of HTTP are:a.Request-reply interactionsb.Content typesc.One resource per requestd.Simple access control1.15What are the two main functions of an HTTP URL? Explain its general form. Identify the serverDNS name, path name, query, and fragment for the URL /search?q=sabretooth.1.15 Ans.An HTTP URL has two main jobs to do: to identify which web server maintains the resource, and to identify which of the resources at that server is required.In general, HTTP URLs are of the following form:http:// servername [:port] [/pathName] [?query][ #fragment]where items in square brackets are optional. A full HTTP URL always begins with the string ‘http://’followed by a server name, expressed as a Domain Name System (DNS) name. The server’s DNS name is optionally followed by the number of the ‘port’ on which the server listens for requests.Then comes an optional path name of the server’s resource. If this is absent then the server’s default web page is required. Finally, the URL optionally ends in a query component – for example, when a user submits the entries in a form such as a search engine’s query page – and/or a fragment identifier, which identifies a component of the resource.In the URL /search?q=sabretoothThe Server DNS name is The Path name is searchThe Query is q= sabretoothThere is no Fragment.。