• 沒有找到結果。

Selection of the first k largest processes in hypercubes

N/A
N/A
Protected

Academic year: 2021

Share "Selection of the first k largest processes in hypercubes"

Copied!
4
0
0

加載中.... (立即查看全文)

全文

(1)

Parallel Computing 11 (1989) 381-384 381 North-Holland

Short Communication

Selection of the first k largest processes

in hypercubes

Jang-Ping S H E U

Department of Electrical Engineering, National Central University, Chungli 32054, Taiwan, R.O.C.

Chun-Lien W U

Institute of Information Engineering, Tatung Institute of Technology, Taipei, Taiwan, R. O. C.

G e n - H u e y C H E N

Department of Computer Science and Information Engineering, National Taiwan University, Taipei, Taiwan, R.O.C.

Received October 1988 Revised January 1989

Abstract. In this paper, algorithms are proposed for finding the first k largest numbered processes in hypercubes with and without faulty nodes.

Keywords. Election problem, k-selection problem, hypercubes.

I. Introduction

The election p r o b l e m [2,4,5] in a network of processes is to select a leader process from this network. Each process has a unique positive integer n u m b e r and the process with the largest n u m b e r ought to be the leader. R o t e m et al. [6] p r o p o s e d algorithms to select the first k largest n u m b e r e d processes in a ring. C h a n d r a n and Rosenfeld [1] presented a parallel algorithm to find the highest k elements out of n d e m e n t s in hypercubes. However, all of the highest k elements do not k n o w their ranks.

In this paper, we propose algorithms to determine the first k largest n u m b e r e d processes in hypercubes with or without faulty nodes. Our algorithms are based on the following assump- tions:

(1) moving a fixed-sized data packet f r o m one node to any one of its n neighbors takes a unit communication time;

(2) the data c o m m u n i c a t i o n is bidirectional; (3) each node has m e m o r y of size O(k).

(2)

382 J.-P. Sheu et al. / Selection of the first k-largest processes in hypercubes 2. The k-selection algorithm without a faulty node

In this section, we present an algorithm for the k-selection problem in a hypercube without a faulty node. Each process running at a node is uniquely identified by an integer number. In order to find the first k largest numbered processes we apply the alternate direction exchange method [7] with a slight modification. The alternate direction exchange method is that every node exchanges all its accumulated 2 ~- 1 data packets with its opposite node in the i th direction, where these directions are in turn from the 1st bit to the nth bit. The objective of the k-selection problem is to select the first k largest numbered processes. So, at each data exchange step only the first k largest numbered processes so far would be the candidates available in the following steps. In other words, when the number of process numbers accumulated is greater than k, each node only holds the first k largest ones and discards the others. In order to select the first k largest numbered processes easily, at each step we must maintain the accumulated process numbers in a list and keep these numbers in the lists of every node in descending order all the time. The k-selection algorithm is as follows:

Algorithm F K S W N F : First k-Selection With N o n F a u l t y Node.

Initial: Each node is assigned a unique process number and this number is stored in an ordered data list.

For i = 1 to n do the following steps:

Step

1 : / * Data exchange (communication) phase * /

Each node exchange all its accumulated rain{k, 2 i-1 } process numbers with its opposite node in the ith direction.

Step 2 : / * Data merging (computation) phase * /

After data exchanging, each node orderly merges the k process numbers newly received and those remaining in the previous step to obtain the new first k largest process numbers.

This algorithm consists of n steps of data communication and data computation phases. In the data computation phase, each node needs to merge two k-ordered data lists into one k-ordered data list. This operation can be performed with a two-way merge algorithm [3] but only needs k data comparisons to obtain the new ordered data list with size k.

In the following, we shall analyze the time complexity of the proposed algorithm. The communication time is the time needed to send messages and each node sends process numbers simultaneously. Thus, the communication time

C(n)

for an n-cube without a faulty node is derived as follows.

C ( n ) = ( 1 + 2 + 2 2 + . - - + 2 i ) + ( n - i - 1 ) k

w h e r e i = [ l o g k ] .

The computation time

E(n)

for an n-cube is used for merging two ordered data lists to get the first k largest numbers. By the two-way merge algorithm, it needs O ( k ) time. Therefore, the computation time

E(n) is derived as follows:

E(n)=(21+2

2 + . - - + 2 i ) + ( n - i ) k w h e r e i = [ l o g k ] .

Without loss of generality, let k = 2 i,

C(n)

is k(log N - l o g k ) + ( k - 1 ) and

E(n)

is k(log N - l o g k ) + 2 ( k - 1 ) . When k = 1 and

N, C(n)

is log N and N - 1 , respectively. Likewise,

E(n) is log N and 2 ( N - 1). Obviously, our algorithm is optimal when k is equal to

1 o r N .

(3)

J.-P, Sheu et al. / Selection of the first k-largest processes in hypercubes 383

3. The k-selection algorithms with faulty nodes

In this section, we propose algorithms for the k-selection problem in hypercubes with the presence of one faulty node and two faulty nodes. We assume that the faulty nodes can be detected by the system and then their addresses would be known by all other nonfaulty nodes. Based on the recursive construction feature of the n-cube, we can divide an n-cube with one faulty node into two (n - 1)-subcubes: one is nonfaulty and the other is faulty. In the same way, we can recursively subdivide the faulty (n - 1)-subcube into one nonfaulty (n - 2)-subcube and one faulty (n - 2)-subcube, and so on. Finally, we can locate the faulty node in a faulty 1-subcube. The k-selection algorithm for an n-cube with one faulty node is based on the above recursive partitioning property of the n-cube.

When one faulty subcube and one nonfaulty subcube are exchange data and combined to get one larger dimensional faulty subcube, the opposite node of the faulty node, called delayed node, cannot receive any data directly from the faulty node. Therefore, one of the neighbors of the delayed node, called relay node, must send data received from the other nodes of the faulty subcube to the delayed node. We call this operation at each combination step an indirect transfer phase. At the indirect transfer phase of the ith direction, the address of the relay node is obtained by complementing that of the faulty node in the ith and ( i - 1)th bits and the address of the delayed node is obtained by complementing that of the relay node in the (i - 1)th bit, where 2 ~ i ~< n.

Let C ' ( n ) and E ' ( n ) denote the complexities of the communication time and computation time of the k-selection algorithm in an n-cube with one faulty node, respectively.

Case 1: k >/2 "-1 .

C ' ( n ) = 2 N - log N - 2, E ' ( n ) = 2 N - log N - 4 + 2k.

Case 2: k < 2 "-1 .

C ' ( n ) = 2 ' + 2 - i - 3 + 2 ( l o g N - i - 1 ) k w h e r e i = [ l o g k ] ,

E ' ( n ) = 2 ' + 2 - i - 5 + 2 ( l o g N - i ) k w h e r e i = [ l o g k ] .

Now, we propose an algorithm for the k-selection problem in an n-cube with two faulty nodes. The relative locations of two faulty nodes distributed in an n-cube has n different cases depending on the Hamming distance of these two faulty nodes. Two faulty nodes in the n-cube may be or may not the neighboring. If two faulty nodes are neighboring, then they have one different bit; otherwise they have more different bits than one. However, we can always use the highest different bit between two faulty nodes, say the x t h bit, to partition the n-cube with two faulty nodes into two ( n - 1)-subcubes such that each ( n - 1)-subcube has only one faulty node. After this partition, the first k largest numbered processes for the two (n - 1)-subcubes can be selected concurrently. Next, we can merge the first k largest numbered processes in each of the two (n - 1)-subcubes to obtain the first k largest numbered processes in the n-cube with two faulty nodes.

Let C " ( n ) and E " ( n ) denote the complexities of the communication time and computation time of the k-selection algorithm in an n-cube with two faulty nodes, respectively.

Case 1: k >1 2 n- 1.

C " ( n ) = C ' ( n - 1) + 2(2 "-1 - 1), E " ( n ) = E ' ( n - 1) + 2k.

Case 2: k < 2 n-1

C " ( n ) = C ' ( n - 1) + 2k, E " ( n ) = e ' ( n - 1) + 2k.

In conclusion, we proposed a k-selection algorithm which is optimal when k is equal to 1 or N. Meanwhile, we also proposed algorithms for hypercubes with one faulty node and two faulty

(4)

384 J.-P. Sheu et al. / Selection of the first k-largest processes in hypercubes

n o d e s . T h e f u n c t i o n o f o u r a l g o r i t h m s is t h a t e v e r y n o d e k n o w s w h e r e t h e first k l a r g e s t n u m b e r e d p r o c e s s e s a r e a n d e a c h o f t h e first k l a r g e s t n u m b e r e d p r o c e s s e s c a n a l s o k n o w its r a n k .

References

[1] S. Chandran and A. Rosenfeld, Order statistics on a hypercube, Inform. Process. Lett. 27 (1988) 129-132. [2] D. Dolev, M. Klawe and M. Rodeh, An O(n log n) unidirectional distributed algorithm for extrema finding in a

circle, J. Algorithms 3 (1982) 245-260.

[3] D.E. Knuth, The Art of Computer Programming Iiol. 3: Sorting and Searching (Addison-Wesley, Reading, MA, 1974).

[4] E. Korach, S. Moran and S. Zaks, Tight lower and upper bounds for some distributed algorithms for a complete network of processors, in: Proc. 3rd Annual A C M Symposium on Principles of Distributed Computing (1984) 199-207.

[5] M.C. Loui, T.A. Matsushita and D.B. West, Election in a complete network with a sense of direction, Inform.

Process. Left. 22 (1986) 185-187.

[6] D. Rotem, E. Korach and N. Santoro, Analysis of a distributed algorithm for extrema finding in a ring, J. Parallel

Distrib. Comput. 4 (1987) 575-591.

參考文獻

相關文件

Strategy 3: Offer descriptive feedback during the learning process (enabling strategy). Where the

Now, nearly all of the current flows through wire S since it has a much lower resistance than the light bulb. The light bulb does not glow because the current flowing through it

! ESO created by five Member States with the goal to build a large telescope in the southern hemisphere. •  Belgium, France, Germany, Sweden and

(A) South Korea sends the second largest number of students to America.. (B) India has the largest number of international students in

In addition, to incorporate the prior knowledge into design process, we generalise the Q(Γ (k) ) criterion and propose a new criterion exploiting prior information about

For R-K methods, the relationship between the number of (function) evaluations per step and the order of LTE is shown in the following

Each unit in hidden layer receives only a portion of total errors and these errors then feedback to the input layer.. Go to step 4 until the error is

There are existing learning resources that cater for different learning abilities, styles and interests. Teachers can easily create differentiated learning resources/tasks for CLD and