代写范文

留学资讯

写作技巧

论文代写专题

服务承诺

资金托管
原创保证
实力保障
24小时客服
使命必达

51Due提供Essay,Paper,Report,Assignment等学科作业的代写与辅导,同时涵盖Personal Statement,转学申请等留学文书代写。

51Due将让你达成学业目标
51Due将让你达成学业目标
51Due将让你达成学业目标
51Due将让你达成学业目标

私人订制你的未来职场 世界名企,高端行业岗位等 在新的起点上实现更高水平的发展

积累工作经验
多元化文化交流
专业实操技能
建立人际资源圈

Assignment代写:Chord system

2018-03-20 来源: 51due教员组 类别: 更多范文

下面为大家整理一篇优秀的assignment代写范文- Chord system,供大家参考学习,这篇论文讨论了和弦系统。和弦系统是一种结构化的对等网络结构,可实现扩展的分布式哈希表。

The Chord system is a structured peer-to-peer network architecture realizing a scalable distributed hash table. In Chord, the peers are organized as a ring. A position within Chord which is held by a computing node is called an index node or simply a peer. Each index node has a finger table and, in addition, holds data items associated with its own key value and any other data items associated with keys larger than the previous index node in the Chord ring.

To succeed with this programming task, you will need to understand the Chord system very well! Do not commence the programming task until you have developed a solid understanding of the Chord system. You may need to study the lecture notes, the relevant paragraphs in the text book, and relevant internet sources in order to acquire the level of understanding of CHORD required for this assignment. Commence the work on this assignment once you are confident to have understood how CHORD works. Your task is to write a simulation of the Chord system on a single computer as a single (non-parallelized, not multi-threaded) process. We will keep this task as simple as possible. The main objectives are:

• to understand how the nodes in Chord communicate.

• to understand how nodes are managed (added/removed) from the system.

• to understand the effects of adding and removal of index nodes.

• to understand how the finger table is computed and maintained.

• to understand how memory utilization and data distribution takes place in Chord.

• to understand how searching is done efficiently in Chord.

• To understand why CHORD is a such a fast and efficient algorithm.

• to understand the concept of scalable algorithms and fast code.

To keep the task as simple as possible, you are to write a single-threaded simulation (i.e. no additional threads are to be created during runtime). Follow the following guidelines: Develop data structures which are suitable to hold required information for each peer in a CHORD system. Note

Develop data structures which are suitable to hold required information for each peer in a CHORD system. Note that index nodes can hold (and access) local information only (I.e, an index nodes never knows of all the other index nodes in a CHORD). Remember that your implementation is to simulate a distributed system. Thus, do not make use of any global variables!

On the basis of the data structures developed by you, write a single threaded (single process) simulation in either C, C++, or Java of the Chord system with the following functions (this is the minimum requirement). You may introduce any number of functions in addition to those stated here: InitChord(n,…): Create and initialize a new Chord system of size 2n. You can assume that the parameter

InitChord(n,…): Create and initialize a new Chord system of size . You can assume that the parameter n is a positive valued integer whose value is limited to 1 < n < 32. Thus, the smallest CHORD that can be created by this function is of size 2, and the largest CHORD is 231. Note that in general the size of a Chord is much larger than the number of available index nodes. An example: The CHORD shown in the lecture notes “Architectures” was of size 24 but consisted of only 5 peers.

This function will also print your name and student number to the screen (print to standard output). Normally, in a real world CHORD, when a new CHORD is created than there will be at least one index node (the node which created the CHORD will become the first index node in the system), and the new node would assume a random location within CHORD. We will simulate this by creating a new index node at location 0 (zero) within the ring as part of this InitChord(.) function. The size of the finger table for this peer (and any other peer that may be added later) is equal to n.

If InitChord(.) is called more than once (i.e. when is already a Chord when InitChord is called again) then this function will completely remove the previous CHORD from memory then initialize a new Chord system. The removing of a pre-existing CHORD requires the removal of all its associated peers from the system and the release of all allocated memory (in case of a C or C++ implementation). The value of parameter n is obtained from a script file (see example below).

AddPeer(ID, …): Adds one new peer (an index node) to your Chord system. The ID (an integer value) of the new peer is provided, and can be assumed to be a value within [0; 2n1]. You will need to create a finger table of appropriate size (of size n) for this new index node. Optional: you may also decide to associate a keylist to this Chord. A keylist is a list of IDs which are inbetween the current index and the previous index node as was described in the textbook (see the section on Architectures). However, this is optional as it is possible to implement an efficient and functional CHORD without this keylist. The value for ID is obtained from a script file (see example below). If the addition of the peer was successful then this function prints to the screen (standard output) the following: “PEER <ID> ADDED”, where <ID> is the ID of the peer just inserted. Note: The addition of a new peer can require an update of the finger table of some of the other index nodes. This is a very important aspect in Chord!

RemovePeer(ID, …): Removes a given peer from Chord, associates any data items that this peer held with the correct peer in the remaining CHORD, and appropriately updates the finger tables of the remaining peers. This function removes this peer completely. You will need to think about how the removal of an index node affects (the finger table, data items, etc) of the other, remaining index nodes. If the removal of a peer was successful then this function prints to the screen “PEER <ID> REMOVED”. If this function causes the removal of the last remaining peer in the Chord, then all data items are lost (memory freed), and the program is to print “Last of the peers removed. CHORD terminated”, then your program is to exit.

FindKey(key, …): This function searches for the peer responsible for the given (hash) key. This search function must use the finger tables of the peers as described in the lectures and the text book. Follow the algorithm as is described in the book (and illustrated in Figure 54) to locate the peer that is responsible for the key. The function prints to standard output the IDs of the peers visited separated by the ‘>’ symbol and a newline character at the end. For example, if a peer with ID = 1 initiated a search and the IDs of the peers visited during the search was 7,12 then this function will print 1>7>12

Hash(string): Computes a hash key for a given data item. You can assume that the data item is a string. The function returns a key value which is an integer within [0;2n). The algorithm that must be used for this function is shown at the end of this assignment.

Insert(string, …): This function simulates that index node ID inserts a data item into the Chord. The data item is given as a string parameter. The peer will call the function Hash(string) to compute the associated hash-key. The string is then to be stored at the index node that is responsible for the computed key value. Note that the FindKey() function may need to be called in order to locate the node responsible for this data item. Once found, the peer that is responsible for this data item is to store the data item. Note that the data item is stored in a part of the memory that is only accessible by the targeted peer. Note also that this means that a peer may have to store more than one data value. This function will print to the screen the string “INSERTED <string> (key=<key_value>) AT “ followed by the ID value of the peer at which the data item is stored.

Delete(string, …): This function simulates that the index node ID requests the removal of a data item identified by the parameter string from the Chord. You can again assume that the data item is given as a string parameter. Similar as before, this function uses the hash function to compute the associated key value, then FindKey(.) to compute the peer responsible for the data item, then removes the string from the memory of that peer. If successful, this function will print to the screen: “REMOVED <string> (key=<key_value>) FROM “ followed by the ID value of the peer from which the string was removed.

Print(key, …): This function will print information about the peer that is responsible for the given key. Thus, the function may need to call FindKey() in order to find the peer that is responsible for key value. Once found, the target peer will then print “DATA AT NODE <MYID:>”, where <MYID> is the ID of the peer, followed by a newline, then followed by the list of all data items (strings) stored at this node (separated by a newline), followed by the string “FINGER TABLE OF NODE <MYID>”, a newline, and the content of the finger table of node “MYID”.

Read(filename): Reads a set of instructions from a given text file. The file contains one instruction per line. Anything after a hash ‘#’ symbol is to be treated as comment and is to be ignored. The instructions are named analogous to the functions which need to be called. For example, a file may contain the following list of instructions:

initchord 5                 #Create a CHORD of size 32

addpeer 7                   #Add a new peer whose ID is to be 7

addpeer 3                   #Add peer 3…

removepeer 3            #…and remove it again

addpeer 12

addpeer 3

addpeer 9

removepeer 3

addpeer 17

insert THIS IS A TEST

insert Markus Hagenbuchner

insert CSCI319

print 12

delete THIS IS A TEST

print 12

removepeer 0

print 7

print 9

print 12

print 17

When compiled, the program should be executed at a command line and accept the file name of a file containing the instructions. Assuming that the compiled code is named CHORD, and assume that the file myfile.dat contains instructions (in the format as was shown before), then the program should be able to run by issuing the following command line instruction:

./CHORD myfile.dat

this would execute all instructions within the myfile.dat. There is one instruction per line in myfile.dat. Instructions not recognized by your program should be ignored quietly (i.e. no error message). Do not assume a maximum file size for the file that contains the instructions. In other words, the file may contain any arbitrary number of instructions.

51due留学教育原创版权郑重声明:原创assignment代写范文源自编辑创作,未经官方许可,网站谢绝转载。对于侵权行为,未经同意的情况下,51Due有权追究法律责任。主要业务有assignment代写、essay代写、paper代写、cs代写服务。

51due为留学生提供最好的assignment代写服务,亲们可以进入主页了解和获取更多assignment代写范文 提供作业代写服务,详情可以咨询我们的客服QQ:800020041。

上一篇:assignment代写:Flight Simulator 下一篇:cs代写:Basic MonoGame