DEADLOCK PREVENTION AND DETECTION IN ...

1 downloads 0 Views 1MB Size Report
Saripan and S. Subramaniam, “A preliminary study on ancestral voting algorithm for ..... [Vijay Kumar, 1991] Vijay Kumar, Jerry Place, and Gi-Chul Yang, “An.
DEADLOCK PREVENTION AND DETECTION IN DISTRIBUTED SYSTEMS

A Thesis Submitted in partial fulfilment of the requirements for the award of degree of MASTER OF TECHNOLOGY IN COMPUTER SCIENCE & ENGINEERING BY NAVIN KUMAR (MTCS/3001/2014)

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING BIRLA INSTITUTE OF TECHNOLOGY, MESRA, RANCHI, INDIA ALLAHABAD CAMPUS

1

DECLARATION CERTIFICATE This is to certify that the work presented in the thesis entitled “DEADLOCK PREVENTION AND DETECTION IN DISTRIBUTED SYSTEMS” in the partial fulfilment of the requirement for the award of the degree of Master of Technology (M-Tech) of Birla Institute of Technology Mesra, Ranchi in an authentic work carried out under my supervision and guidance. To the best of my knowledge, the content of this thesis does not form the basis of an award of my previous degree to anyone else.

Date: 16/05/2016

Dr. Kamta N. Mishra (Guide) Assistant Professor Department of CSE Birla Institute of Technology Mesra, Ranchi - 835215 Extension Centre - Naini, Allahabad

Head / In-Charge

Director

Dept. of CSE

BIT Mesra, Ranchi

BIT Mesra, Ranchi

Ext. Centre, Allahabad

Ext. Centre, Allahabad

i

CERTIFICATE OF APPROVAL The foregoing thesis entitled “DEADLOCK PREVENTION AND DETECTION IN DISTRIBUTED SYSTEMS”, is hereby approved as a creditable study of thesis topic and has been presented in satisfactory manner to warrant its acceptance as pre-requisite to the degree for which it has been submitted. It is understood that by this approval, the undersigned do not necessarily endorse any conclusion drawn or opinion expressed therein, but approved the project report for the purpose for which it is submitted.

(Internal Examiner)

(External Examiner)

Chairman Prof. In-Charge of the Department Department of Comp. Sc. & Engg. B.I.T. Mesra, Ranchi- Allahabad Campus ii

PUBLICATIONS FROM THE THESIS [S1, 2016] Navin Kumar* and Kamta Nath Mishra, “Mutual Exclusion and Deadlock Detection Techniques in Distributed Systems: A Review”, Under review since March 2016 with International Journal of Computer Networks, MECS press Hong Kong, pp. 1-24, February 2016.

[S2, 2016] Navin Kumar* and Kamta Nath Mishra, “An Efficient Voting and Priority Based Technique for Deadlock Prevention in Distributed Systems”, Submitted for Journal Publication, May 2016.

iii

ABSTRACT In normal multiprogramming environment, several processes may compete for a finite number of resources. Here a process requests for a resource and if the resources are not available at any time, then the process enters into the „Waiting State‟. But sometimes a waiting state is unable to convert its present state and thus enters into a new situation called as „Deadlock‟. Thus we can say that a „Deadlock‟ state occurs whenever at least two or more than two processes are in waiting state indefinitely for an event that can be caused only by one of the waiting processes. Mutual Exclusion is a condition where two or more than two processes wants to access the same resources which holds for non-sharable resources i.e. a printer cannot be shared by several processes. In other words, mutual exclusion ensures that at most one process can access the shared resources at any time (Safety) and that all requests are eventually satisfied (Liveness). Thus, sharable resources, on the other hand, do not require mutually exclusive access and therefore cannot be involved in a deadlock. A good example of this „Sharable Resource‟ can be understood by „Read-Only‟ files which can be simultaneously processed by several processes at the same time; hence a process never needs to wait for sharable resources. While “A Distributed System is a collection of physically separated, possibly heterogeneous computer systems or processes that are networked to provide the users with access to the various resources that the system maintains”.

iv

The access to this shared resource increases „Computation Speed‟, „Data Availability‟, „Functionality ‟and „Reliability‟ etc. In addition with this, concurrency and starvation control in distributed systems had always been a problem in distributed system. In order to find a solution for these drawbacks to different researchers we came with our solution in our research paper named “A new voting and priority based technique for deadlock prevention in distributed systems”. As we know that the voting based approach follows a simple method where a process getting the majority of votes will only be allowed to enter into the critical section (C.S.) and then the process having majority a bit lesser than the earlier one will enter into the critical section and so on. But this method also had a disadvantage as if no process remains in the situation of achieving majority of votes then the system will remain in idle situation along with a suitable amount of minority processes remaining into the queue waiting for their turn to come. In the prioritized distributed mutual exclusion based algorithm, process having the highest priority amongst all the processes residing in the distributed system is allowed to enter into the critical section (C.S.) thus leaving the other less prioritized processes into the queue resulting in an increase into the total number of less prioritized processes. Hence, keeping the above mentioned reasons into consideration we have tried to propose a new algorithm which can provide a solution for both the voting based and priority based algorithms. Here, we have presented a combined solution for both the above mentioned algorithm with name “An efficient voting and priority based technique for deadlock prevention in distributed system” keeping some other constraints like treatment

v

for „non-maskable interrupts‟ and „Shortest Job Scheduling First (SJSF)‟ techniques along with some other experimental aspects such as allowing multiple critical sections to the distributed systems also so that in any case the processor should not remain idle and they can be able to perform some fast computing of processes under standard conditions.

Keywords: - Mutual exclusion, Deadlock detection, Group mutual exclusion, Token based, Non-Token based, Priority based, Non priority based, Voting Based, Priority Based, Deadlock, Distributed Systems, Critical Section, Maskable/Non-maskable Interrupts.

vi

ACKNOWLEDGEMENTS I have taken efforts in this thesis. However, it would not have been possible without the kind support of many individuals and organizations. I would like to extend my sincere thanks to all of them. I extend my deep gratitude towards my guide Dr. K. N. Mishra, Assistant Professor, Birla Institute of Technology, Mesra, Ranchi, Allahabad campus under whose supervision I have carried out this work. I am thankful to Dr. Anupam Agrawal, Professor, Dept. of Information & Technology, Indian Institute of Information Technology, Allahabad, INDIA for permitting me to access the enrich research lab of IIITA. I thank with gratitude to Prof. (Dr.) P. K. Srivastava, Director, B.I.T. Allahabad campus for his valuable suggestions in improving the overall standard of this thesis.I am highly indebted to all the professors Dr. S. Kanungo, Dr. R. S. Pandey, Dr. S. C. Pandey, Asst. Prof. Mr. Ajit Kr. Keshri, Asst. Prof. Mr. Ratnesh Mishra, Dr. P. C. Srivastava, Dr. S. K. Pandey, Dr. A. K. Mahanty and Dr. Ashish K. Dubey of Birla Institute of Technology, Allahabad campus; for their guidance and constant supervision and support as well as for providing pivotal information‟s regarding this thesis work and other activities on regular basis and also for their heartily support during the completion of this thesis. I would like to express my sincere gratitude towards my parents and family members for showing their perseverance and keeping faith in me, which helped me completing this thesis.

vii

I would also like to express my gratitude to the industry person Mr. Ritesh Sinha, M.D. RikArena consultancy Pvt. Ltd., Patna, for his technical and logical support required during the accomplishment of this thesis. My thanks and appreciation also goes to my colleagues in writing this thesis along with those people who have willingly or unwillingly helped me out in various ways in the completion of my thesis work. At last, I would like to thank the almighty without whom I would have been nothing.

Navin Kumar MTCS/3001/2014

viii

TABLEOFCONTENT

S. No.

Chapter Name/ Name of Content Sub Topic

Page No.

1

Declaration Certificate

i

2

Certificate of Approval

ii

3

Publications from Thesis

iii

4

Abstract

iv

5

Acknowledgements

vii

6

Table of Content

ix

7

List of Figures

xii

8

List of Tables

xiii

9

List of Symbols

xiv

10

List of Abbreviations

xv

Introduction

1

11

Chapter 1

12

1.1

The Perspective

1

13

1.2

Organization of the Thesis

6

14

Chapter 2

Mutual exclusion and deadlock detection techniques distributed systems

8

15

2.1

Literature Review

8

16

2.2

Static group priority algorithms

9

17

2.3

Dynamic group priority algorithms

10

18

2.4

Distributed group mutual algorithms

16

ix

19

2.5

Mutual exclusion techniques in distributed

16

Systems 20

2.5.1

Mutual exclusion algorithms requirements

16

21

2.6

Performance Measurements

17

22

2.7

Different mutual exclusion algorithms

19

23

2.7.1

A prioritized distributed mutual exclusion algorithm

21

24

2.7.2

A new voting based mutual exclusion

21

algorithm 25

2.7.3

26

2.8

Distributed groups mutual exclusion based on dynamic data structure

22

Deadlock detection techniques in distributed

23

Systems 27

2.8.1

Deadlock: Necessary & Sufficient Conditions

23

28

2.8.2

Resource vs. Communication

25

29

2.9

Different deadlock handling strategies

27

30

2.9.1

Deadlock Prevention

28

31

2.9.2

Deadlock Avoidance

28

32

2.9.3

Deadlock Detection

28

33

2.9.4

Deadlock detection issues and

29

resolutions 34

2.10

Control Organizations x

30

35

2.11

Combined effects of mutual exclusion and deadlock detection in distributed systems

38

36

2.12

Conclusion & Future Scope

41

37

Chapter 3

An efficient voting and priority based Technique for deadlock prevention in distributed systems

42

38

3.1

Introduction

42

39

3.2

Literature Review

44

40

3.3

Proposed Technique

47

41

3.3.1

Definitions & Assumptions

48

42

3.4

Methodologies

49

43

3.4.1

Proposed Algorithm

54

44

3.5

Flowchart Description

63

45

3.6

Performance Evaluation

66

46

3.6.1

Voting based methodology

68

47

3.6.2

Priority based methodology

68

48

3.7

Entry into critical section

70

49

3.8

Conclusion & Future Scope

78

50

Chapter 4

Conclusions & Future Research Scope

79

51

4.1

Conclusions

79

52

4.2

Future Research Scope of The Work

79

53

References

81

54

Biography

93

xi

List of Figures Figure

Name of Figure

Number

Page Number

1.1

Resource allocation graph

2

2.1

Different priority algorithms

9

2.2

Synchronization delay

18

2.3

Response time graph

19

2.4

Non mutually exclusive process diagram

20

2.5

Mutually exclusive process diagram

20

2.6

Permission based mutex algorithm

22

2.7

Resource allocation graph with deadlock

26

2.8

Resource allocation graph without deadlock

27

3.1

A distributed system

48

3.2

Algorithm for single server with single C.S.

55

based deadlock prevention system 3.3

Algorithm for deadlock prevention with

57

multiple systems having a single C.S. 3.4

Algorithm for deadlock prevention with

59

multiple server having multiple C.S. 3.5

Process movement in single server with

60

single C.S. 3.6

Multiple servers with single C.S.

62

3.7

Multiple servers with multiple C.S.

64

3.8

Flowchart for proposed deadlock prevention

65

Algorithm 3.9

Functionality of voting & priority based Systems

xii

67

3.10

Entering into C.S. with help of time stamp

70

3.11

Six different cases for entry into critical

72

Section

List of Tables Table

Name of Table

Number 1.1

Page Number

Comparison of various mutual exclusion

3

Algorithms 2.1

Comparison between various algorithms

38

2.2

Study of various mutual exclusion algorithms

40

3.1

Voting percentage method

68

3.2

Priority Table

68

3.3

Comparison amongst proposed algorithm

74

3.4

Comparison between new proposed

74

algorithm With some other mutual exclusion algorithms

xiii

List of Symbols S. No. Symbol

Description of Symbol

1

Ɣ

Array containing five tuples

2

{

Left curly bracket

3

}

Right curly bracket

4



Small element of a set

5



Not equal to

6



Less than equal to

7



Greater than equal to

8



Equivalence

9



Equivalent to

10



Equal to

11

%

Percentage

12

˂

Less than

13

˃

Greater than

14

¦¦

Or

15

=

Equal to

16

!=

Not equal to

17

/

Upon

18

:

Colon

xiv

List of Abbreviations S. No. Abbreviation

Full Name

1

M.E.

Mutual Exclusion

2

Mutex

Mutual Exclusion

3

C.S.

Critical Section

4

Si

Site

5

Pi

Process

6

Ri

Request

7

FCFS

First Come First Served

8

GME

Groups Mutual Exclusion

9

DGME

Distributed Groups Mutual Exclusion

10

TWF

Total Weight For

11

WFG

Weight For Graph

12

SJSF

Shortest Job Scheduling First

13

D.S.

Distributed Systems

14

O.S.

Operating Systems

15

NMI

Non Maskable Interrupts

xv

CHAPTER1 INTRODUCTION 1.1

THE PERSPECTIVE Mutual Exclusion (Mutex) process is a state where only a single process

can be allowed to access in its critical section (CS) [Lejeune, 2013]. With the help of this paper, we want to illustrate an overview of “mutual exclusion and deadlock detection technique in distributed systems”. Though many deadlock detection algorithms are there mentioned in the literatures. Here the performance of various mutual exclusion and deadlock detection techniques in distributed systems are analyzed in this paper. We have analyzed three different techniques i.e. “A prioritized distributed mutual exclusion algorithm balancing priority inversions and response time”, “A new voting-based mutual exclusion algorithm for distributed systems” and “Distributed groups mutual exclusion based on dynamical data structures”.

Thus with the help of this paper we have tried to analyze through these three proposed mutual exclusion and deadlock detection algorithms in distributed systems. In this paper, we have examined and report the factors by which these algorithms differ from one another either in „throughput‟, „no. of blocked transactions‟, „restarted transactions‟, „no. of instructions‟ etc. We have also presented a performance evaluation model for the distributed database environment and also listed the performance parameters and evaluation criteria. Therefore mutual exclusion plays an important role in the computer systems design and architecture. Generally Mutually Exclusion based algorithms are further categorized into two types. The two types of mutually exclusion based algorithms are: (i) Token Based algorithm mutual exclusion and (ii) Non-Token Based mutual algorithm.

[1]

A token-based mutual exclusion algorithm uses a unique „Token‟ and this token is shared between different computers of the same site or all the computers of different sites of the distributed system [Suzuki, 1985], [Singhal, 1989] and [Raymond, 1989]. Examples of token based algorithm are SuzukiKassami algorithm, Singhal‟s algorithm and Raymod‟s tree based algorithm. On the other hand Non-token based mutual exclusion algorithm which is also known as „Permission based‟ algorithm, uses the „Time Stamp (TSi)‟ value to order the request of sites for entering into the „critical section (CS)‟ [Lamport, 1978], and [Maekawa, 2012].

Requests

Resource X

Allocated To

For

PA

Allocated To

PB

Resource Y

Requests For

Fig. 1.1: Resource allocation graph Examples of Non-Token based algorithms are: Lamport‟s algorithm, Ricart-Agarwal‟s algorithm and Maekawa‟s algorithm. In token based mutual exclusion algorithm for distributed systems, a unique token is shared among all the sites and then only a site (Si) are permitted to enter into the critical section (CS) of the process (Pi) if it gets the „token‟. This algorithm uses a „sequence number‟ in order to recognize the position of the request (Ri.) made by the site (Si).

[2]

For every request (Ri) for the token, it contains a sequence number (SQi) and a site (Si) increments its sequence number (SQi) for every next request (Ri) made by any new site (Si). Suzuki-Kassami algorithm [Suzuki, 1985] requires „0‟ to „N-1‟ messages per critical section invocation and the synchronization delay for this algorithm will be „0‟ to„t-1‟. While in Singhal‟s heuristic algorithm [Singhal, 1997], each site (Si) maintains information about the state of other sites in the system. Here, the average message traffic is N/2 which decreases the data communication load up to a great extent by just requesting to a single site holding the token.

Table 1.1: Comparison of various Mutual Exclusion Algorithms S. No .

Name of Algorithm

Synchronizati on Delay

1.

SuzukiKassami [47] Singhal‟s Heuristic [84] Raymond[5 9]

2. 3.

No. of Messag es (Hl)

Respon se Time

Type of Algorith m

T

No. of Messag es (Ll) N

N

2T+E

Token

T

N/2

N

2T+E

Token

T log(N/2)

Log(N)

4

T(log N) +E

Token

4.

Lamport[63 ]

T

3(N-1)

3(N-1)

2T+E

NonToken

5.

RicartAgarwal[35 ] Maekawa[7 5]

T

2(N-1)

2(N-1)

2T+E

Nontoken

2T

3√N

5√N

2T+E

Nontoken

6.

Also the Raymond‟s tree based algorithm [Raymond, 1989] minimizes the number of requests to log (N) with a synchronization delay of „T‟. Since these are further divided into three types thus we are giving their comparisons [Alistrah, 2014] in order to make a brief conclusion.

In non-token or permission based mutual exclusion algorithm, various sites (Si) waits for the permission in the form of a logical time stamp (TS i) based upon which every site (Si) maintains a queue [Yang, 2005]. It requires

[3]

at least two or more successive turns of message exchange among competing processes. This algorithm was firstly proposed by „Leslie Lamport‟ as explanation of his clock synchronization scheme. This algorithm was based on „First Come First Serve (FCFS)‟ order for executing the processes (Pi) of sites (Si). The Lamport‟s algorithm required (N-1) no. of request messages, (N-1) no. of reply messages and (N-1) no. of release messages. Therefore the total no. of messages required for attaining the „mutual exclusion‟ is 3(N-1). Later on Ricart-Agarwal has reduced this no. of messages from Lamport‟s to 2(N-1) which was further improved by Carvalho and Roucairol‟s algorithm from the Ricart-Agarwal algorithm by deducing some unnecessary request and reply messages in their algorithm between 0 to 2(N-1). But a disadvantage with this algorithm is that it does not work with the partitioned network [Woo, 1992] and not even a single process attains to its all of the remaining N-1 processes. Further Maekawa pushed the no. of messages from O (N) to √N. The performance of these algorithms is measured with the performance metrics of the mutual exclusion algorithms [Adam, 1994]. These are: (a) Average no. of messages necessary per critical section invocation and (b) Response time and the fault tolerance. A mutual exclusion algorithm should also be starvation free, fairness, safety and aliveness like properties. Apart from the above techniques for mutual exclusion algorithm in distributed systems mentioned in the literature, some new approaches have also come into existence [Muhammad, 2005].

Through this review we have tried to analyze these new techniques of mutual exclusion algorithms for their fairness as well as a comparative study is also made with the previous techniques available in literatures. These new techniques are “A prioritized distributed mutual exclusion algorithm balancing priority inversions and response time” [Lejeune, 2013], “A new voting-based mutual exclusion algorithm for distributed systems” [Kanrar, 2013] and “Distributed groups mutual exclusion based on dynamical data structures” [Thiare, 2009]. As we can say that the above mentioned strategies cannot be

[4]

suitable for all kind of applications such as those where some tasks have some priority over the others, in real time environment and applications where priority is attached with the quality of services [Guha, 2005].

In order to overcome these constraints various authors have proposed some mutual exclusion algorithms where every request is associated to a priority level. But this priority based order induces „starvation‟ problems which then violates the liveness property [Didier, 2014]. Because in the priority based mutual exclusion algorithm this starvation occurs as a request having higher priority prevents the request having lower priority [Zarafshan, 2011] forever to execute the CS. Therefore the priority based mutual exclusion algorithm which is an extension of the “level-distance algorithm” aims on providing a good tradeoffs between the number of priority inversions and response time [Velazquez, 1993]. Here the distance mechanism has not been changed but the level mechanism has been replaced. While in the previous level mechanism [Agarwal, 2006], a node considered only the requests received by it while in this theory a node considers the total number of pending requests that it retains in its own local queue [Ali, 2004]. Later on, the number of requests required to enhance a priority „p-1‟ is dependent upon a function level Ғ (p). This algorithm uses the token to propagate the knowledge about requests issued by all the nodes of the system. “A new voting–based mutual exclusion algorithm for distributed systems” deals with the concurrency control for a distributed system [Kanrar, 2013]. As concurrency control [Chengjun, 2009] in a distributed system had always been a challenge and is getting even more critical eventually with an increase in complexity among such systems. In order to overcome this issue, a simple principle has been implemented that any process getting majority of votes will only be allowed inside the critical section (CS) [Lien, 1994], [Cidon, 1987].

But this situation leads to a live-lock condition where no single process reaches to that pre requisite number of the majority of votes. Therefore, this

[5]

new voting based algorithm was based upon selection of a process from all candidates for CS which will help in increasing the availability of the distributed system [Serrano, 2013], [Carrier, 2015]. Group mutual algorithm (GME) is a problem present in the field of mutual exclusion. This is an interesting problem regarding the generalization of the mutual exclusion problem. Various solutions for GME have been provided so far for message passing distributed systems. For this a new Distributed Group Mutual Exclusion (DGME) solution has been propounded based upon the clients/server model by implementing dynamic data structure [Woo, 1992]. These GME processes can access the same opened session simultaneously. Here the number of messages lies between 0 to m, where m denotes number of session in the network. Here, the average case is O log(m) no. of messages required to open any session, while the maximum concurrency is n, where n is the number of processes in the network [Segal, 1988]. 1.2 ORGANIZATION OF THE THESIS

Chapter 1: The key issues in the area of mutual exclusion with deadlock prevention and detection in distributes system are discussed here. The statement of the problem and the objectives of the research are also described in this chapter. Chapter 2: The analysis and literature review of mutual exclusion, deadlock occurrence, deadlock detection and deadlock prevention are discussed in this chapter. Various deadlock detection algorithms with mutual exclusion in distributed systems are classified into two categories namely token based algorithms and non token based algorithms, definitions and functionalities of the variables used are defined here. The existing deadlock detection algorithms in distributed systems based on physiological, behavioural and combinational features are discussed and their performances are analyzed in this chapter.

[6]

A research paper titled “Mutual Exclusion and Deadlock Detection Techniques in Distributed Systems: A Review” based on chapter 1 and chapter 2 of this thesis has already been submitted under review in February 2016 for publication in journals of International repute.

Chapter 3: In this chapter we have developed some new thoughts and logics regarding deadlock prevention and deadlock detection in distributed systems. This has been discussed with the help of various tables, comparisons, facts and figures. Therefore, deadlock prevention & deadlock detection techniques are discussed in this chapter and a new algorithm is designed in this perspective. The deadlock prevention based various prospects are also discussed in this chapter. The algorithms and results of this chapter titled “An Efficient Voting and Priority Based Technique for Deadlock Prevention in Distributed System” are ready for submission in May 2016 to journals of international repute.

Chapter 4: The conclusions drawn from the study are summarized in this chapter and future research scopes are outlined.

[7]

CHAPTER 2 MUTUAL EXCLUSION AND DEADLOCK DETECTION TECHNIQUES IN DISTRIBUTED SYSTEM 2.1 LITERATURE REVIEW

As we have defined earlier that it is divided into two groups; the priority based and non-priority based algorithm [Lejeune, 2012]. Now, the priority based algorithms are further classified into two kinds, static priority group [Ahmad, 1991] and dynamic priority group [Ramos, 2012]. In static priority group the requests (Ri) maintains their exact priority until its entrance into the critical section (CS) which induces the strict compliance with the priorities but also violates the aliveness property [Paydar, 2006] if another request of higher priority requests for entrance into the CS, hence resulting in a stagnation of the lower priority requests for much longer time creating starvation. On the other hand, in the second group algorithm the request priority gets incremented for every time whenever a request of higher priority is granted by the system [Muller, 1998]. This mechanism retains the liveness property of the system but degrades the priority order by creating a situation called as priority inversions. We are describing the three different categories of these algorithms as shown in fig 2.1 below [Chang, 1994].

[8]

Priority Algorithms

Static Group

Dynamic Group

Distributed Group

Fig. 2.1: Different priority algorithms

2.2

STATIC GROUP PRIORITY ALGORITHMS

This algorithm [Goscinski, 1990] is based upon the token based [Suzuki, 1985] algorithm having complexity of O (N) where N depicts total no. of nodes. Here the hold requests are stored into a global queue and are piggybacked with the token (Ti) messages but starvation may also occur as the algorithm can lose priority requests during the transition of tokens and thus is not held by any node. This [Johnson, 1996] is presented by the algorithm for prioritized distributed mutual exclusion where both these algorithms uses a path compression technique for fast access and low message overhead. While an another [Housni, 2001], [Izumi, 2010] algorithm is an extended version of the Raymond‟s algorithm where every node is responsible for maintaining local priority queues of requests what it has received just like [Kanrar, 2010], [Kanrar, 2013] algorithm. Thus here the requests with higher priorities only are forwarded to its upper node. This algorithm [Muller, 1998] has been affected by token passing algorithm [Postolache, 2012] exploiting dynamic tree as a logical structure for forwarding the priority requests. Here the local priorities are kept by every node with responsibility along with recording the time locally. Here, according to the order of their priority, a global queue is

[9]

also formed by these local queues whose implementation is quite complex as the dynamic tree tries to become a simple queue. According to the NiamiTrehel algorithm, root nodes acts as a token keeper rather than acting as a root node; having a message complexity of O (N/2). This algorithm followed a hierarchical approach in which the processes are grouped in accordance to their priority [Izumi, 2010].

Here every group is represented with the help of one router process. In this, each group is represented with the help of one router process and each process is organized into static logical tree like structure as in Raymond‟s tree algorithm [Raymond, 1989], while the router applies the algorithm [Allen, 2007] for sending requests only to the same priority within its group. 2.3

DYNAMIC GROUP PRIORITY ALGORITHMS As all the algorithms mentioned in this group are mainly based on

the Raymond‟s algorithm which we will go on describing one by one. It is [Raymond, 1989] a token-based mutual exclusion algorithm where the processes are organized in a static logical tree and only the directions of links between any two processes can change during the algorithms execution and hence are called as dynamic priority algorithms. Here, the nodes thus form a directed path tree [Mallikarjun, 2012] to the root. Apart from root every node has a father node and the root process is the owner of the token and the node having the token is the unique process having the right to enter into the critical section (CS). Whenever a process requires the token, it sends a request to its owner node (father node) [Chul Park, 1991] which will be again forwarded till it reaches to the root or the node which is also having a pending request. In this algorithm, every process saves its own requests and those received from the children to local FIFO queue. Whenever the root node releases its token, it is (token message) sent to the first process of its own local queue and if the process‟s own request of this local queue [Singhal, 1997], then it executes the critical section otherwise it forwards the token to the first element of the local

[10]

queue and later on becomes its father node. Apart from this, whenever a node sends a token due to the emptiness of its local queue, a request is sent to its new father node on behalf of the first request of its queue. While in the algorithm, they have tried to modify the Raymond‟s algorithm for every process by introducing a priority level for every critical section (CS) request made. They said that the greater will be the integer value (level), higher will be the priority [Adam, 1994], [Vasudevan, 2010]. Here, the pending requests of a process‟s local queue are arranged in a decreasing fashion of priority levels. This phenomenon is quite similar to Raymond‟s algorithm where any process who wants to process sends a request for the token to its upper node (father) which on being received is included into the local queue according to their level of priority and is only forwarded later on if the request level of the priority will be higher than that of the topmost element of the queue [Lee, 1995]. Also, in order to avoid starvation, the pending priority levels value „p‟ of those requests having priority value lower than that is increased by one every time a new request enters into the C.S. [Chengjun, 2009].

Later on Chang, [Chang, 1996] has proposed a similar algorithm to [Lee, 1995] Lee, that was also based upon the Raymond‟s algorithm pointing at applying dynamic priorities to requests and reducing communication traffic. To reveal priority [Paydar, 2006], a mechanism called aging strategy. According to aging strategy, if any process „p‟ exits the CS or if that is a non requesting node holding the token receives any request, then p increases the priority of every request (including the pending ones) residing in its local queue by 1. Performing such an action on the local queue also reduces the gap in terms of „average response time‟ between the priorities. At the same time it also induces a greater number of priority inversions as compared to the Kanrar‟s [Kanrar, 2013] algorithm. Thus, Chang [Chang, 1996] has proposed this algorithm in order to reduce the communication overhead of the incoming requests as a request always follows the token from an intermediate node whose local queue is containing more than one element [Singhal, 2008] .

[11]

Chang‟s [Chang, 1996] communication traffic optimization technique is applied in piggybacking whenever any request on the token message is possible. Thus keeping in mind about reducing the number of priority inversions a new kind of algorithm has been coined by J. Lejeune, L. Arantes, J. Sopena and P. Sens [Lejeune, 2013] [Lejeune, 2012]. Their new algorithm known as level- distance algorithm is mainly based upon Kanrar-Chaki. Here they [Lejeune, 2013] have introduced a technology called level-mechanism in which a priority into the local queue is not incremented at every insertion of requests of a higher priority to the local queue but only after T insertion of requests (where T is a threshold value) having such priority. Here the threshold value depends upon an exponential level to upgrade its priority to „p‟. Thus any request of priority „p-1‟ will have to wait for a 2(p+c) no. of insertions of requests of higher priority. Here „e‟ denotes the priority and „c‟ is a constant which prevents the small priorities from incrementing too fast. They [Lejeune, 2013] have also used Chang‟s communication traffic optimization method for reducing the cost affectivity in messages as well as regarding the piggybacking of any request in the token message. Along with this they have also depicted a throughput enhancing algorithm [Rabinowich, 1992] by the name distance mechanism which orders request of the same priority based upon their locality [Lejeune, 2012]. Here the request distance between site S1 and site S2 is denoted by the number of intermediary nodes lying between S1 and S2 is solving the problem of same priority level [Wu, 1993]. In such a case where two pending requests have the same level of priority, the token [Jiang, 2003] will be transferred to that node which will have the shortest request path distance with respect to the demanding token holder. Apart from the above mentioned algorithms some other algorithms have also been evolved amongst whom one is based upon selection of site by majority of voting [Thomas, 1979], [Ahmad, 1991]. But this algorithm was far from accuracy as it suffers from the aliveness. This can be understood in a non-partitioned network [Lamport, 1987]. Let us suppose two different sites

[12]

gets the same amount of votes (e.g. 40 %) then this may result in a deadlock between those processes entering into CS first [Bhatt, 2010]. The same situation may also occur for a network having more than two requests. Thus a new algorithm known as „policy-based‟ mutual exclusion algorithm for distributed environment has been proposed [Panghal, 2011], [Tamura, 1988]. Here, rules are defined to find out the conflicting situations for different conditions in its policy specifications. These rules [Joung, 2002] were used for detecting the processes for identifying potential inconsistencies to obtain a „conflict free‟ system. Another idea has been given by Geeblen, Kulikowski, Truyen and Joosen [Geeblen, 2010] to design a workflow process as a template.

Here the before the implementation of the tasks, they are specified as an abstract level [Bukhres, 1992], [Bukhres, 1991], then are modelled as aspects and finally are selected from the library according to the policy-based adaptation logic [Chandy, 1984]. A new technique known as Voting-based algorithm has been proposed by Kanrar et. al. for the mutual exclusion (ME) which finds a valid candidate for the CS whenever the majority consensus is not achieved by any process [Kanrar, 2013]. Here, a candidate process has been elected even when the network is completely partitioned into „N‟ partitions along with a single process in each partition. This algorithm is supposed to improve the resource utilization in distributed environment. Here, each candidate process seeking an entry to the CS [Kawazu, 1979] sends a request message for voting to every other process which is counted on the receipt of the response gained from various nodes. In order to grant permission for making entry to the critical section (CS), the votes obtained by the candidate process should be either more than or equal to the majority [Kanrar, 2013]. This voting is further categorized on static and dynamic. Any process tending to enter into the CS must have the permission of majority of nodes in the system else the process has to wait until it is allowed for so. One more tree based structure algorithm also came into existence which is a

[13]

hierarchical protocol, called as „Tree-Quorum‟ protocol [Agarwal, 1991]. This algorithm uses the information stored in the tree structure to degrade the communication

requirements

for

read-write

operations

which

is

a

generalization of the static approach [Baldoni, 2000]. One another static approach, a deterministic majority voting algorithm has been proposed [Xu, 1994].

In this voting algorithm error correcting codes has been used to reduce the average case communication complexity to a good extent. But one of the disadvantages of this static approach [Velazquez, 1993] is that when a distributed system is partitioned as resultant of node or link failure, a static voting algorithm cannot adapt its votes without any interruption in the system. Therefore it became necessary to change the paradigm into dynamic voting in order to avoid the halted states [Wang, 1989] and to increase the availability of mutual exclusion. Thus stimulating from this fact the dynamic method [Alistrah, 2014] has been reassigned into two new aspects known as the „Group consensus method‟ and „Autonomous reassignment method‟ [Barbara, 1989]. In this each node makes a decision about changing its votes and picking up a new vote value on its own. Reassignment by the group consensus method is more accurate and resilient [Chen, 1990] to future failures but its implementation is quite complicated. The autonomous reassignment method is quicker, simpler and flexible than the previous one. Adding to these voting schemes, two more generalizations have been proposed by Jajodia and Mutchler [Jajodia, 1990]. They coined (i) Dynamic voting and (ii) Dynamic voting with linear ordered copies. In first one, the number of sites required for performing an update was a function equivalent of updated copies in existence present at the time of updating and not to the total number of copies; what normally happens in the case of static algorithms. The later one (dynamic linear voting) accepts any update any time a dynamic voting does.

[14]

A new kind of dynamic voting based approach termed as „ancestral voting‟ has been proposed by Zarafshan et. al. [Zarafshan, 2011] according to them, their algorithm can maintain mutual exclusion and helps in increasing the availability of the distributed system. Adding to this a „dynamic voting consistency‟ algorithm was given by Adam [Adam, 1994] who was effective in a kind of environments where the majority of user requests are of „read‟ types. It also works on the majority partitions, even if the changes in the network topology occur at a higher rate than update rate as long as simple partitioning takes place as availability is an important factor for distributed mutual exclusion algorithm [Ehanul, 2006]. Thus in case of voting based algorithms, any node seeking entry to CS has to attain a majority of votes at last. When no partition is available due to network partitioning in distributed systems, then in that case a quorum of votes can be collected [Lamport, 1979]. The availability of vote assignments tells us about the possibility of finding an active partition with total votes either more than or equal to required quorum [Chang, 1994]. Thus in highly available vote assignments, probability of finding such partitions as well as probability of a restricted operation being performed were very high. Hence voting as well as coteries is used to obtain mutual exclusion along with commitment of transaction in partitioned distributed system

[Garcia-Molina, 1985].

Depending upon the fact that whether node keeps track of the current state of the system or not, coterie based algorithms can be divided into static or dynamic in case of voting-based algorithms [Segal, 1988]. Thus to exploit them to optimize performance dynamic distributed mutual exclusion algorithms adapts to fluctuating system conditions [Muhammad, 2005]. Therefore to improve the availability of replica control protocols, a mechanism by Rabinovich and Lazowska was proposed which allows dynamic adjustment of quorum sets when defined based on a logical network structure [Atreya, 2005]. Its main principle was to devise a rule which

[15]

unambiguously imposes a desired logical structure on a given ordered set of processes. Here, each node is assigned a name linearly ordered. 2.4

DISTRIBUTED GROUP MUTUAL ALGORITHM

The distributed group mutual exclusion algorithm is a third kind of mutual exclusion algorithm based on client/server model using dynamic data structure [Thiare, 2009]. In this several processes (Clients) can access the same open server which ensures that by any time, at most one server (Session) should be opened and any requested session should open within a finite time [Carvalho, 1984]. Here, Joung [Joung, 2002] has modelled the design issues for mutual exclusion between groups of processes in his theory Congenial Talking Philosophers‟. In this problem every critical section to the same group can be executed simultaneously [Xie, 2001]. CS belonging to different groups must execute into a sequential mode with mutual exclusion principle. Joung [Joung, 2000] gave an example of CD (Compact Disc) juke box which was shared by many processes at a time. Joung introduced the concept of m-group quorum a no. of solutions for this problem were proposed without using shared memory or global clocks concept where the processes communicates by exchanging messages. The Beauquier J. et al. [Beauquier, 2003] presented three new solutions for distributed group mutual exclusion. In this two solutions [Richa, 2011] were based on static panning tree and the third one is based dynamic spanning tree concept. R. Atreya and N. Mittal [Atreya, 2005] in their paper have used the notion of surrogate-quorum to solve the GME. It requires a low message complexity with low minimum synchronization delays with two message hops [Tamhane, 2010].

[16]

2.5

MUTUAL EXCLUSION TECHNIQUES IN DISTRIBUTED SYSTEMS As we know that mutual exclusion is a state where concurrent access

to a shared resource by multiple uncoordinated user requests which is serialized to secure the integrity of shared resource [Suzuki, 1985], [Singhal, 2008].

2.5.1

Mutual Exclusion Algorithm Requirements

In order to maintain the mutual exclusion there exists some characteristics [Danek, 2010] which must be followed. These are: (a)

Freedom from deadlock: Here two or more than two sites should not

wait for any message for infinite time. (b)

Freedom from starvation: Here every requesting site should get an

equal opportunity to execute the CS too within a finite time rather than waiting infinitely for its turn. (c)

Fault Tolerance: This algorithm should be fault tolerant in any case of

system failure. This tolerance helps the system to reorganize from its situation and continues to function without any prolonged disruption. (d)

Fairness: It states that an order must be maintained while executing

the requests in order to imply fairness as a physical clock does not exists for determination of time to save it from starvation.

2.6

PERFORMANCE MEASUREMENT Measure of the performance [Anna, 1989] is a major factor for any

algorithm which is decided here by four different metrics: (i) No. of messages (ii) Synchronization delay (iii) Response Time (iv) System Throughput. Here no. of messages is required for CS invocation while the synchronization delay is the time required when a site leaves the CS and the other site enters into it. Response time [Ahmad, 1991] is the time a request enters into the CS and is acted upon by the CS. System throughput [Wuu, 1985] is defined as rate at

[17]

which the requests are executed by the CS. The final throughput equation can be given as: SystemThroughput  1 /(Sd  E )...............(2.1) , {Where; Sd = Synchronization Delay E = Avg. execution time of critical section}

This performance is further measured in two ways: (i) Low and High load performance and (ii) Best and Worst case performance. (i)

Low and high load Performances: Mutual exclusion algorithm‟s

performance is dependent upon its loading conditions which are of two types, the low load and high load conditions [Ratan K. Guha, 2005]. In low load condition (fig. 2.2) seldom more than one requests approaches to the CS while under the high load conditions (fig. 2.3) multiple requests [Y. Zhonghii, 1994] approaches to system and thus there always remains some pending requests for mutual exclusion at any site keeping the site busy as just after finishing one request the site requests for another one and so on. A site seldom remains idle under high load conditions.

Entry

Exit

Synchronization Delay

Fig. 2.2: Synchronization Delay

Best and worst case performances: These algorithms are also categorized into best and worst based performance metrics [Hamberg, 2008]. When the performance metrics attains the low load performance (best possible) value then it is known as the best case while when it attains the high load performance (worst possible) value then it is known as worst case. The

[18]

response time for a best case is equivalent to a round-trip message delay plus CS

execution

time.

It

is

given

by

the

formula:

BestCase  2T  E.......... ..... 2.2 {Where, T = Avg. message delay; E = Avg. critical section execution time}.

CS request arrives

Request message sends out

Site exits CS

Site enters CS

CS Execution Time(E)

Response Time (Rt)

Fig. 2.3: Response Time Graph

2.7

DIFFERENT MUTUAL EXCLUSION ALGORITHMS In order to solve this mutual exclusion problem [Cidon, 1987] various

algorithms, some new mutual exclusion problems with their solutions given by distinct researchers are discussed below. Here in fig. 2.4, n number of processes are requesting for the same resource at the same instant of time which signifies that multiple no. of processes wants to enter into the critical section (CS) at the same time interval which violates the above mentioned criteria for mutual exclusion [Lynch, 1992]. The same situation is being cleared with the help of another diagram here.

[19]

Process

Resource

Process P1

Resource Ri

Process P2 . . .

Process Pn

Fig. 2.4: Non mutually exclusive process diagram .

Process

Resource

Process P1

Resource R1

Process P2

Resource R2

Process Pn

Reource Rn

Fig. 2.5: Mutually exclusive process diagram

[20]

In fig. 2.5, each processes (P1, P2... Pn) are accessing individual resources (R1, R2... Rn) at the same instance of time; making it mutually exclusive as each single process is mutually independent for accessing its resource [S. Sreekanth, 1978]. Thus we can summarize this with the equation: Pr ocesses P1, P 2..... Pn   Re sourcesR1, R 2..... Rn  Or , Pi  Ri.......... ..... 2.3

Where (P1, P2... Pn) ε Pi; (R1, R2... Rn) ε Ri. (2 w.i.).

2.7.1

A prioritized distributed mutual exclusion algorithm balancing priority inversions and response time A new algorithm named „A prioritized distributed mutual exclusion

based algorithm with balancing priority inversions and response time‟ was coined by J. Lejeune et al [Lejeune, 2013]. This new algorithm based on distributed priorities have been proposed which considerably reduces the maximum waiting time for the low priority requests without increasing the number of priority inversions [Lee, 2001]. This behaviour of the algorithm came as a result of the awareness factor which gave it more flexibility for priority increments [Bhalla, 2003]. Later on the level functions allows for better configuration of threshold between maximum waiting time and number of priority inversions where the algorithm complexity level was kept maintained by the distance mechanism [Lejeune, 2012].

2.7.2

A new voting based mutual exclusion algorithm for distributed systems This algorithm was proposed by Kanrar et. al. [Kanrar, 2010] based

upon “permission based M.E.” which includes a voting based approach for Mutual Exclusion in which the process which gets the majority of votes will only be allowed into C.S. [Acosta, 2014]. This is because in earlier voting based algorithm, if any of the process does not achieves the majority of votes

[21]

then this may lead to a live-lock situation [Golab, 2011]. Thus in order to avoid this condition, this algorithm has been developed.

Here though the

safety property is guaranteed still the bounded or progress condition fails if no single process earns majority voting. In this paper they have proposed this algorithm in order to overcome this problem to find a candidate where majority consensus [Thomas, 1979] was not achieved by this algorithm. This proposed algorithm was evaluated for multiple perspectives like safety, liveness, correctness, improved resource availability, low storage and message complexity etc. This algorithm maintains the liveness and safety was ensured [Verbeek, 2012]. This algorithm is executed much faster than the typical voting based approaches as a candidate process that need not to wait for replies from all other processes [Patel, 2012].

Permission Based

Voting Based

Coterie Based

Static Voting

Dynamic Voting

Fig. 2.6: Permission based Mutex algorithm [Jonathan Lejeune, 2013].

2.7.3

Distributed groups mutual exclusion based on dynamic data structures Another algorithm named „Distributed group mutual exclusion based

algorithm‟ was developed by Thiare et. al [Thiare, 2009] where a new algorithm based upon client/server model applying dynamic data structure was propounded. Here, the same opened session (Server) can be accessed by

[22]

multiple clients (Processes) simultaneously that makes sure that at most one session must be opened continuously at the same time some another process will be opened within a finite time [Rinard, 1999]. Here each satisfying request has been denoted by a no. of message which lies between „0‟ to „m‟. For the best case it is „0‟ and for the worst case it is denoted by „m‟ respectively where m denotes the no. of sessions in any distributed system/network. Here a privilege is given to those processes who want in to attend the session on current basis [Farajzadeha, 2005]. In average case the total no. of messages required to open a session is O (Log (m)) with a maximum concurrency of n where n is the number of processes in a network.

2.8

DEADLOCK DETECTION TECHNIQUES IN DISTRIBUTED SYSTEMS In general, a distributed system is defined as a network of multiple

sites (Si) that exchange information by passing messages. Here, a site mainly consists of a communication network [M. Bench~fl"ba, 2004], an interface to local users and computing and storage facilities. A process can make requests (Reqi) and can release resources (Resi) (local or remote) in distributed systems randomly which remains unknown a priori and any process can request any resources holding others [N. R. Adam, 1994]. Thus when the sequence of the allocation of resources to the processes becomes uncontrolled then “deadlock” occurs in such environments [Q. Ehanul, 2006]. To refrain from such an environment, various mechanisms called as deadlock detection techniques have been implemented in the literatures. Various deadlock detection mechanisms [S. Kanrar, 2013] are categorized as follows.

2.8.1

Deadlock: Necessary & sufficient conditions Deadlock in a system is a situation where a process never finishes its

execution as the system resources are bounded preventing other jobs from taking a start. Deadlock occurs in some fixed conditions only which is known

[23]

as „necessary condition‟ [Ajoy, 1990] [A. Silberschatz, 2007] which are elaborated as follows: (i) Mutual Exclusion.

(ii) Hold and Wait.

(iii) No Pre-emption.

(iv) Circular Wait.

(i)

Mutual Exclusion: According to this at least one resource must be

held non sharable to processes (Pi) in such a way so that the resource can be utilized by only one process at a time. In case another process request for the same resource, then the request must be delayed until the release of that resource (Ri). (ii)

Hold and Wait: This says that a process must be holding at least one

resource and should be waiting for acquiring some other resources which are currently being held by other processes.

(iii)

No Pre-emption: It says that the resources cannot be pre-empted

which means that a resource can only be released when the process holding that resource is finished.

(iv)

Circular Wait: There must be a fashion of holding resources between

the processes such that every previous process should be waiting for the resource held by its next process e.g. Let there be a set P {P1, P2, P3... Pn} holding resources of a set R {R1, R2, R3...Rn} in such a way that P1 is waiting for the resource held by P2 (i.e. R2) similarly P2 is waiting for the resource held by P3 (i.e. R3) and so on. This forms a circle like P1→ P2→ P3→ ... Pn→ P1. Thus

Circular

wait

can

be

W  P1  P2  P3  .....Pn  P1...............(2.4)

{Where W = Circular wait graph}.

[24]

represented

as:

2.8.2

Resource vs. Communication As per the literature [Singhal, 2008], there exist two kinds of

deadlocks (i) Resource deadlock and (ii) Communication deadlock. Resource deadlock occurs when the process (Pi) waits for all the requested resources before proceeding further. Thus if multiple processes in the system gets on requesting for the set of resources held by another processes, then this situation is known as “resource deadlock” situation. On the other hand, during communication deadlock the processes remains in waiting state while communicating with the other set of processes [Woo, 1992]. Here each process of the set waits for communicating with the other processes of the set resulting in a non initiation by any process in further communication unless a site receives any requests, it has requested for. From fig. 2.7, we can understand that the resource allocation graph is making a complete cycle as: P0 →R0 →P1 → R2 →P2 →R1 →P0.

This cycle

justifies that a non finishing cycle has been formed here which assures the circular wait condition hence converting the above graph into a deadlock [Lee, 1995].

[25]

.

R0

R2

P0

P2

P1

R1

. . Fig. 2.7: Resource allocation graph with a deadlock

[26]

.

Pb Ra

. .

Pc

Pa

Rb Pd

. .

Fig. 2.8: Resource allocation graph without deadlock

As no such cycle has formed in the above resource allocation graph (fig. 2.8) hence this graph is deadlock free.

2.9

DIFFERENT DEADLOCK HANDLING STRATEGIES There are three different deadlock handling strategies which are

mentioned as:

Deadlock Detection, Deadlock Prevention and Deadlock

Avoidance [Aasim, 2012], [Singhal, 2008] and [Silberschatz, 2007]. As it is complicated to implement various deadlock handling strategies in distributed systems due to the fact that no one site within a distributed system has the idea about the state of another system, hence leading to some unpredictable delays.

[27]

2.9.1

Deadlock Prevention It is achieved either by having a process acquiring all the required

resources before its execution or by allowing pre-emption of processes holding the much needed resources [Anup, 2008]. In earlier methods, a request/release was made by the process to a remote resource by sending a request/release message to those sites retaining resources. But this method has a number of drawbacks like it is inefficient as it decreases the systems concurrency. Also while acquiring the resource phase; a deadlock may occur in a set of processes [Johnston, 1991]. This problem can be handled by pushing processes for the needed resources deliberately. Apart from these in many systems future resource requirement become unpredictable.

2.9.2

Deadlock Avoidance In this approach a resource is granted to a process only when the

resulting global system state remains safe [Pyla, 2010]. But due to some reasons, deadlock avoidance is seems impractical in distributed systems which are as follows [Zhonghii, 1994]. (a) Huge storage capacity and along with extensive communication costs are required by every site in order to maintain information on the global state of the system. (b) Process of verification for a safe global state must be mutually exclusive as if multiple sites can concurrently perform verification for a safe global state, resulting in finding a safe state but not a safe global state [Ali, 2004]. Hence this verification severely limits the throughput and the concurrency of the system. (c) Also it will be computationally very expensive to verify for a safe state for a very large number of processes and resources.

2.9.3

Deadlock Detection As the name suggest, its main focus is on detecting the various

deadlocks occurring into the system. It requires a supervision of the processresource status interaction for the presence of any cyclical wait state

[28]

[Farajzadeha, 2005]. In distributed system deadlock detection has mainly two favourable conditions as (i) whenever a cycle is detected in the WFG (waitfor-graph), the state continues until it is detected and broken and (ii) detection of cycle can proceed concurrently with normal activities of the system and thus does not have any negative effect on system throughput. Thus due to above mentioned reasons, deadlock detection is much more focussed in the literature of deadlock handling under distributed systems [Banerjee, 1996].

2.9.4

Deadlock detection issues and resolution This mainly comprise of two basic steps: (i) detection of existing

deadlocks and (ii) resolution of detected deadlocks.

Mainly two issues are involved in the detection of deadlocks which are, maintaining the WFG (wait-for-graph) and searching WFG for the presence of any cycle [Niami, 1993], [Nakamura, 1993]. Now, depending upon the way of approach for searching the information through WFG deadlock detection is further categorized into three parts: (a) Centralized Detection (b) Distributed Detection and (c) Hierarchical Detection. Later on these algorithms must satisfy two more conditions for a perfect detection. These are: (ᵝ) Progress and (ᵞ) Safety. Under running situation an algorithm must be able to detect the discrepancies as soon as the deadlock occurs in the system. This activity of deadlock detection should continuously run until the deadlock is detected. Similarly under safety mode, the algorithm must not return the non-existent deadlocks also known as phantom deadlock. Normally it does not pertain difficult to design a correct deadlock detection mechanism as the sites may receive out of date and inconsistent WFGs of the systems in distributed systems where there remains no global memory and the communication occurs only through messages.

In resolution mode the deadlock is resolved by breaking existing wait for dependencies in the systems wait-for graph [Yeung, 1995], [Yeung, 1994].

[29]

Here the deadlocked processes are rolled back and their resources are assigned to blocked processes to resume execution. Here the corresponding information should immediately be cleaned from the system on the disruption of wait for dependencies of the system. In case required information is not cleaned up in timely manner appropriately, it may result in phantom deadlock detection.

2.10

CONTROL ORGANIZATIONS As mentioned above, there exist three types of control organizations

for detecting deadlocks in distributed systems [Agarwal, 1991] which are: Centralized control, Distributed control and Hierarchical control.

2.10.1 Centralized Control Organization In this algorithm, a designated site acting as a control site has been made responsible of constructing the global WFG along with searching for cycles. On demand for deadlock detection the control site maintains global WFG constantly after consulting through the local WFG from every site [Izumi, 2010]. It is conceptually easy and simple to implement as the control site here has complete information about every deadlock cycle which can be optimally resolved. But this algorithm has a drawback in the form of single point of failure as the communication links become congested near the control site [Kumar, 1991]. Here, traffic produced due to deadlock detection activity is independent of rate of deadlock formation as well as structure of deadlock cycles.

2.10.2 Completely Centralized Algorithm This is the simplest centralized deadlock detection algorithm where a fixed site is designated called as „control site‟ which is responsible for maintaining the WFG of the entire system as well as for rectification of the deadlock in entire system [Chengjun, 2009]. Here every site requests and release resources by ending request resource and release resource messages to

[30]

the control site [Xiao, 2007]. As soon as the control site receives any request resource or control resource messages it updates its WFG request accordingly [Chen, 1996]. After this whenever a request edge is added to the WFG, the control site checks for any existence for deadlocks. This algorithm is easy ad simple to implement along with its inefficiency of being site centric during resource acquisition and release requests even these resources are local resulting in large delays in user request response time, large communication overhead and congestion in communication links near the control sites with a poor reliability factor because if the control site fails, the complete system will reach to halt. But the above mentioned demerits can be mitigated by having each site maintaining their resource status locally and communication of resource status periodically for construction of the global WFG by each site for the detection of deadlocks [Revannaswamy, 1997]. Even though because of inherent communication delays and lack of perfectly synchronized clocks the control site may get an inconsistent view of the system and thus false deadlock is detected.

2.10.3 Ho-Ramamoorthy Algorithm To fix the centralized problems, another algorithm in the field of centralized deadlock detection is known as one phase and two phase detection algorithm [Huang, 2008]. This is done by collecting two consecutive status reports by keeping two status tables at each site in order to ensure that the control site gets an appropriate view of the complete system.

(a)

One phase algorithm: This algorithm [Ali, 2004] requires only one

status report from each site irrespective of that each site maintains two status tables namely resource status table and process status table [Sreekanth, 1978]. While the resource table at site keeps track of those transactions which have locked by or are waited for by all transactions at a particular site. Generally a designated site urges both the tables from every other site for constructing WFG by using those transactions for which the entries in the resource table

[31]

matches the corresponding entries in the process table along with searching for WFG for cycles for deadlock detection. If any cycle is found in the WFG then the deadlock is said to be detected otherwise the WFG is deadlock free [Lee, 2001]. But this technique has some drawbacks too as this algorithm is unable to detect any false deadlocks because of the elimination of inconsistencies in state information common to both tables which are introduced due to unpredictable message delays. As compared to two phase algorithm [Johnson, 1996], it is much faster and requires lesser messages but also needs more storage since every site maintains two status tables and deals with bigger messages as here every message consists of two instead of one table.

(b)

Two phase algorithm: In this algorithm [Johnson, 1996], [Kawazu,

1979] each control site maintains a status table containing status of all initiated processes of that site. The status contains all the locked and waiting resources. The control sites request for all status tables from all of its sites and constructs WFG by using only common reports of both tables in which if the same cycle is detected then the system is called to be in deadlock else its deadlock free [Ogaswara, 2004]. Its function consists of selecting only the common transactions of the two algorithms which gives a consistent view of the system which reflects a correct state of system. If any deadlock occurs then the same wait for condition will occur for both the cases which was claimed to be proved incorrect as a cycle in wait-for conditions of the transactions common in both reports does not signifies any deadlock [Maruta, 1998]. This algorithm also capable of reporting false deadlocks along with probability of reducing inconsistent views by getting two consecutive reports but does not eliminates any such kind of possibility.

2.10.4 Distributed Control Organization Main responsibility of this algorithm is detection of global deadlock being shared equally among all sites. Compared to centralized control, this

[32]

algorithm is not vulnerable to a single point of failure and thus no site is swamped with deadlock detection activity as it is initiated only when a waiting process is suspected to be a part of deadlock cycle [Yeung, 1994]. But these are difficult to design and implement as it lacks the globally shared memory. Also here sites may initiate deadlock detection even for the same deadlock and its correctness proof is also difficult to observe as deadlock resolution is a tedious task in distributed deadlock detection since multiple sites can detect the same deadlock without being aware about the movement of the other sites or processes involved into deadlock.

2.10.5 Distributed Deadlock Detection Algorithm In this, all sites of a system actively participate in detecting any cycle in WFG which is likely to be distributed over the sites of the system. This algorithm [Yang, 2005], [Yeung, 1995] is initiated whenever a process is forced to wait and can be initiated either by local site or the site where the process waits [Rinard, 1999]. It is further categorized into four classes: (a) Path-pushing (b) Edge-chasing (c) Diffusion computation and (d) Global state detection. These are described as follows.

2.10.6 Path-Pushing Algorithm This algorithm uses paths for propagating information about the wait for dependencies. One solution to this problem was given by Obermack. He has chosen this path-pushing detection algorithm as this was used by IBM Corporation on its distributed database system. Here processes were referred as transactions denoted by T1, T2, and T3..... Tn; and these transactions consists of many sub transactions which normally executes at different sites. This model assumes that at most one sub transaction is executed at a time within a given transaction which sequentially passes from one sub transaction to another sub transaction which communicates by passing messages. This

[33]

algorithm requires n(n-1)/2 no. of messages for detecting deadlocks for n sites where size of message is O(n) and detection delay is O(n). Hence, Total no. of messages required: P  N ( N  1) / 2................(2.5) Where, p = total no. of messages. n = total no. of sites.

2.10.7 Edge-Chasing Algorithm The edge-chasing algorithm for deadlock detection in distributed system has been propounded by Chandy-Misra-Haas for the AND request model. It uses a special message called „probe‟ used for propagating the messages. A probe [Postolache, 2012] is a triplet (i, j, k) which indicates that deadlock detection is initiated for any process Pi which is being sent by origin site of process Pj to the core site of process Pk.. Here the deadlock is detected if the same probe is returned back to the central site while travelling along the edges of the global TWF. This algorithm requires m (n-1)/2 no. of messages where m is the total no. of messages and n is the total no. of sites with a message delay of O (n). No. of edges required e  m(n  1) / 2...............(2.6) Where, e = total no. of edge. m = total no. of message involved. n = total no. of sites.

One more algorithm given in this field was proposed by Sinha and Natarajan. In this algorithm transactions are assigned unique priorities and a conflict occurs when a transaction waits for any locked data object having lower priority transaction. This conflict has been named as „antagonistic‟ who initiates deadlock detection [Huang, 2008] only after its occurrence. It detects a deadlock by circulating a probe message in the TWF graph through a cycle. Here probe message is a two tuple (i, j) constraint where Ti indicates transaction that initiated deadlock and Tj signifies transactions having lower priorities the probes has travel for. But this probe is discarded when a lower

[34]

priority transaction is received by waiting transactions. Here deadlock is detected when the issued probe by any higher priority returns back to it and it involves only one detector for one deadlock. In Sinha-Natarajan‟s algorithm, detector of the deadlock resolves deadlock by aborting lowest priority transactions of cycles making deadlock detection simple and became the first algorithm for comprehensively treating the deadlocks.

2.10.8 Diffusion Computation Based Algorithm In this deadlock detection based algorithm computation is performed by diffusing through WFG of the system. Chandy et al.‟s [Chandy, 1984] has given an algorithm for OR request model to illustrate the diffused computation based technique [Hosseini, 2005]. The deadlock has initiated a diffusion computation is determined by process where the messages are presented by query and reply respectively as query (i, j, k) and reply (i, j, k) denoting their belonging to a diffusion computation which is initiated by a process Pi and sent from process Pj to process Pk. This process can be in two states mainly active and blocked. In active state a process remains in executing mode while in blocked state the process remains in waiting mode for acquisition of resources [Ramos, 2012]. Deadlock detection is initiated by any blocked process by sending a query message to all the processes from whom it needs to receive messages, thus these processes are termed as dependent processes.

2.10.9 Global State Detection Algorithm This approach uses three distinct methods for deadlock detection n distributed systems. The algorithm proposed by Bracha and Toueg is based upon two phases. In the first phase snapshots of WFG is recorded and in the second phase granting of request requests is simulated for checking generalized deadlocks and the second phase is nested within the first phase and hence second phase terminates before the first phase. One more algorithm in this section has been propounded by Kshemkalyani and Singhal known as

[35]

Kshemkalyani-Singhal‟s algorithm consists of single phase [Singhal, 2008]. It consists of a fan-out sweep of messages outwards from an initiator process and a fan-in sweep of messages inwards to the initiator process. A sweep is a traversal of WFG in which all messages are sent in the direction of WFG known as outward sweep or all messages are sent against the direction of WG edge known as inward sweep. Both these sweeps are performed concurrently [Ling, 2006]. In outward sweep all the snapshots of the distributed WFG is recorded while in the inward sweep these recorded distributed WFG is reduced to determine whether the initiator is deadlocked. Hence this algorithm deals with the complications introduced as the two sweeps can overlap in times at any process [Chul Park, 1992]

2.10.10

Hierarchical Control Organization In this control approach different sites are arranged into hierarchical

manner and the deadlock condition is detected by the sites only to its descendent sites/processes. It uses the local access patterns of the site clusters for detecting the deadlocks efficiently [Aasim, 2012]. It utilizes the best features of the centralized as well as distributed control methods for detection in which they avoided the single point of failure. Special care required here while arranging the sites hierarchically [Ahmad, 1991]. Later on for more effectiveness, most of the deadlock is to be localized into small clusters as possible because it can be achieved with large spanned deadlocks. Normally there are two kinds of hierarchical deadlock detection algorithms (a) MenasceMuntz algorithm and (b) Ho-Ramamoorthy algorithm.

(a)

Menasce-Muntz Algorithm In this algorithm all the controllers are arranged in tree manner. The

controller at the bottom most level is known as leaf controllers and is responsible for managing resources while the others called as non-leaf controllers are responsible for deadlock detection [Muhammad, 2005]. Leaf controller maintains a part of global TWF graph concerned with the allocation

[36]

of resources while a non-leaf controller maintains all TWF graphs spanning its children controllers and for detecting all leaf controllers involving its complete leaf controllers. Every single change occurred in the TWF graph controller due to conditions like resource allocation, release or wait is propagated to its parent controller [Jiang, 2003]. After acquiring this parent controller makes changes in its TWF graph and starts searching for cycles while propagating the changes in upward direction if required. The non-leaf controller continuously receives updated data regarding TWF graph of its children whenever any change occurs in the TWF graph of system [Carrier, 2015].

(b)

Ho-Ramamoorthy Algorithm In their hierarchical algorithm, they grouped the sites into several

disjoint clusters and periodically a site is chosen as a control site which again dynamically chooses a control site for each cluster. The central cluster then maintains the data of every other by requesting each one of the clusters their inter cluster transaction status information and their wait-for relations [Didier, 2014]. After collecting all the information about status tables from all the sites in its cluster the control site applies for one phase deadlock detection algorithm for detecting all deadlocks involving only intra cluster transactions after which all these intra cluster information are further sent to the central control site where it is spliced into small information [Razzaque, 2008]. After splicing a WFG system is created and any cycle is searched. In this way a control site detects all deadlocks located in its cluster and thus the central control site detects all the inter cluster deadlocks [Serrano, 2013].

[37]

2.11 COMBINED EFFECT OF MUTUAL EXCLUSION DEADLOCK DETECTION IN DISTRIBUTED SYSTEM

AND

As we know that if any system/network wants to be in a deadlock freestate then it must have mutually exclusive else the system may meet the deadlock situation [Singhal, 1997]. Therefore I can say that both the effects of mutual exclusion and deadlock detection are very much related to run a system successfully. So in order to prove this logic I have went through various papers on deadlock detection and prevention through which I have tried to reach to a conclusion regarding effect of both these aspects upon a system. The proposed study has been presented in the tabular form in table 2.1: Table 2.1: Comparison between various algorithms S. No.

Name of Algorithm

Proposed By

1

A prioritized distributed mutual exclusion algorithm balancing priority inversions and response time A new voting based mutual exclusion algorithm for distributed systems

Jonathan Lejeune, Luciana Arantes and Julien Sopena

2

3

Distributed groups mutual

No. of Messages (L1) N

Sukhendu Kanrar, Samiran Chatopadhyay and Nabendu Chaki

N

Ousmane Thiare, Mohd. Naimi,

N

[38]

Response Time

Time Complexity

Type of Algorithm

Higher the priority, lower the response time

O (log n)

Level distance algorithm

Message exchange is 2(N-1), do not wait for response from all participating processes and hence terminates faster than with much less exchange of messages At most 2t, where t = maximum

O (log n)

Permission based/ Voting based algorithm

O (log n)

Message passing algorithm

exclusion algorithm based on dynamical data strucutres

Mourad Gueroui

message delay

The above table 2.1 shows the variations in the algorithms taken for study, and their specifications. As per the above table we can reach up to the conclusion that though they all follows different ways of algorithm, yet all of them deals with same no. of messages having almost same time complexity with a bit different response time. From the above information I can conclude that still in the area of distributed mutual exclusion algorithms mentioned in the literatures, no algorithm have been developed who can deal with only „N‟ no. of message exchange per transaction along with a time complexity lesser than O (log n/2) i.e. Muller‟s algorithm [Muller, 1998] and [Muller, 1999].

On the other hand if we summarize the various algorithms which I followed for studying the various aspects regarding “Deadlock Detection”; I have perceived following aspects form the algorithms I have selected for my reference. I have selected three deadlock detection algorithms proposed by three distinct literature writers they are: “An efficient distributed deadlock detection algorithm” by „Soojung Lee and Junguk L. Kim‟ [Lee, 1995], “Performance comparison of distributed deadlock detection algorithms” by „Omran Bukhres‟ [Bukhres, 1992] and “A new distributed deadlock detection algorithm for distributed database systems” by „Chim-fu Yeung, Sheung-lun Hung, Kam-yiu Lam and Chee- Keung Law‟ [Yeung, 1994]. From the above literatures I have gathered some conclusions regarding „deadlock detection‟ which are shown with the help of table 2.2).

[39]

Table 2.2: Study of various mutual exclusion algorithms S. NO.

Name of Algorithm

Name of Researcher

1

An efficient distributed deadlock detection algorithm

Soojung Lee, J. L. Kim

Conclusions

(i)

They have constructed a tree through probe propagation and declared deadlock upon encountering of back edges. A simple mechanism to distinguish various types of WFG was employed. This may resolve even those deadlocks for which the initiator of the algorithm keeps waiting transitively, while in other existing algorithms the initiators detects only those deadlocks to which they only belong. This algorithm is also compared in two categories: history independent and history based. As compared to Chandy‟s et al [58] and Kshemkalyani and Singhal‟s [83] algorithm, it takes far less time than those. This algorithm generates only twice (2n) the messages as compared to others like Singhal‟s and Kshemkalyani‟s who generates more messages. In this deadlock detection was mainly involved on distributed database systems. It says that the distributed database systems with resource sharing capabilities running locking concurrency control algorithms are more prone to deadlocks. It shows that when the number of concurrent transactions remains low, then two deadlock detection algorithms performs almost alike due to fewer conflicts. While it also says that the selection for the best deadlock detection algorithm is very much dependent upon the system‟s operating region. This algorithm was a probe-based introduced to rectify the shortfalls of Chandy‟s et al algorithm [58]. It was subjected to extensive simulation experiments and thus showed to be error free and suffered from very little performance degradation. It says that the systems performance degrades as the no. of probe initiations increases. Large portions of deadlock detection overheads are wasted due to the fact that the site controller does not know about the time of formation of the deadlock. Therefore some rules should be developed in order to determine the best time for deadlock detection determination. Rate of probe initiation has significant effect on the system‟s performance having high data contention. It says that exactly there exists no perfect rule today for determining the best time for initiation of

(ii) (iii)

(iv)

(v)

2

Performance comparison of distributed deadlock detection algorithms

Omran Bukhres

(i) (ii)

(iii)

(iv)

3

A new distributed deadlock detection algorithm for distributed database systems

Chim-fu Yeung, Sheung-lun Hung, Kamyiu Lam and Chee-Keung Law

(i)

(ii)

(iii) (iv)

(v)

(vi) (vii)

[40]

deadlock detection and finding rule(s) for minimizing deadlock detection overheads which is important for maximizing the system‟s performance.

2.12

CONCLUSIONS & FUTURE WORK The merits and demerits of various mutual exclusion & deadlock

detection algorithms in single and distributed systems have been analyzed and compared in this paper. This includes the study of various token and non token based deadlock detection algorithms based upon certain factors like synchronization delays, time and space complexity, number of messages and its message complexity etc. During our study, we come to know that that still the time complexity of O (1) and message complexity of N (1) has not been attend till date.

Therefore still there exist ample opportunity of research and advancement in the field of “Mutual Exclusion and Deadlock Detection in Distributed Systems”. Hence implementation of some new techniques is still possible in this field which can be worked out in future.

[41]

CHAPTER3 AN EFFICIENT VOTING AND PRIORITY BASED TECHNIQUE FOR DEADLOCK PREVENTION IN DISTRIBUTED SYSTEMS 3.1

INTRODUCTION As we have encountered a no. of solutions in the literatures for the

problem of mutual exclusion (Mutex) [Lamport, 1979], still a practical and suitable approach has been missing in most of these algorithms due to one or another reason. According to me the main reason for this is the variety the mutual exclusion problem contains in it. As far as distributed systems are concerned, many solutions like token based, non token/permission based [Lee, 2001], priority based, voting based and coterie based [Kanrar, 2013] etc. has been provided in literatures till date. Researchers like Lamport, Maekawa, Ricart-Agarwala, Raymond, Niami-Trehel, Suzuki-Kasami etc. had come with their various suitable solutions for mutual exclusion problems [Lamport, 1978]. But all these proposed solutions have their own pros-and-cons.

Thus, in order to provide a suitable and logical solution for mutual exclusion [Goscinski, 1990] we have proposed „An efficient voting and priority based technique for deadlock prevention in distributed systems where we have tried to propose a cumulative solution for mutex based upon the two different algorithms i.e. „A new voting-based mutual exclusion algorithm for distributed systems‟ [Kanrar, 2013] and „A prioritized distributed mutual exclusion algorithm balancing priority inversions and response time‟ by „S. Kanrar‟ et. al. [Kanrar, 2013] and „J. Lejeune‟ et. al [Lejeune, 2013].

In this paper we have proposed an algorithm in which we have tried to combine the features of new voting based algorithm with the features of

[42]

priority based algorithm along with the implementation of some new features like usability of „non-maskable‟ interrupts joined with „Shortest Job Scheduling First‟ (SJSF) algorithm. Our main aim behind proposing this algorithm is to develop an efficient algorithm which can provide the optimum opportunity to a job/process for entering into critical section (C.S.) of a system irrespective of its obtained majority (voting based algorithm) or the attained high order priority (priority based algorithm).

In the next section (section 3.2) we have described the work of other researchers which are related to mutex (mutual exclusion) detection in distributed systems. In section 3.3 (proposed technique), we have divided the amount of voting obtained by the different jobs/processes into four different margins of categories and converted them into their respective value of percentage. Similarly, for the priority based algorithm we have too divided them into margins of categories (in percentage) where the number of priorities have been calculated based upon the number of „hits‟ made by the systems to the server and that number is converted into its respective percentage similar to the earlier mentioned mechanism. Since both the above mentioned algorithms have been divided into four different categories, hence a total number of sixteen (16) individual test cases have evolved for comparison in this algorithm along with two more test cases i.e. (a) Non-maskable interrupts and (b) Shortest job first scheduling. Therefore this algorithm provides us an opportunity of eighteen (18) different test cases for making a comparison between various conditions of mutual exclusion for a distributed system, also providing us a privilege to go even for the least voted (job/process having least majority) or least prioritized jobs/processes for every time a comparison is made in this algorithm. In section 4 the performance of different mutex achievement algorithms are compared with each other and the results are shown in the form of figures and tables. The section 5 describes conclusion and future research scope of our research work.

[43]

3.2

LITERATURE REVEW As mentioned earlier that a lot of work has been published regarding

mutual exclusion solution in the literatures. Thus in this section we have tried to mention some of the earlier methods mentioned in the literatures. These solutions are divided into two distinct segments. These are: (a) Token based and (b) Non-token based algorithms. Almost all the solutions in this field lies under these two conditions.

One of the oldest works in this field was given by a researcher named Leslie Lamport [Lamport, 1978] and [Lamport, 1979] of Digital Equipment Corporation in 1987. He has worked on the original problem of Dijkstra‟s algorithm where he has propounded a new solution of the mutex problem which was presented in the absence of contention requiring only memory access and assuming the atomic read and atomic write to the shared registers. In his work “A fast mutual exclusion algorithm” [Lamport, 1987] a solution was presented for only five writes and two reads of a shared memory having time complexity of O(N) and total number of message required was 3(N-1) . This algorithm was a non-token based algorithm [Ricart, 1981] and [Maekawa, 2012].

In between another researcher Michael Fischer had proposed the simplest possible algorithm with worst time complexity of O (N) in which „i‟ denotes the „process number‟, „x‟ denotes the shared memory word. He has used angle brackets for enclosing „atomic‟ operations and „await b‟ as an abbreviation. Fischer‟s algorithm [Lamport, 1987] was: Repeat await ‹x = 0›; ‹x:= i›; ‹delay› until ‹x:= i›; Critical section; x: = 0.

[44]

Later on G. Ricart solely in his paper “An optimal algorithm for mutual exclusion” [Ricart, 1981] has proposed another non-token based algorithm with total number of message requirement 2(N-1) with synchronization delay of T. K. M. Chandy [Chandy, 1984] has also proposed a probe based algorithm in which each site had a controller that maintained a Boolean array named Dependk which was known as dependency table „k‟for every constituent process „Pk‟ where Dependk is true only if Pk‟s controller knows that Pi is dependent on itself and hence is deadlocked. Here the probe computation was initiated periodically by the controller whenever it finds the constituent process idle. But this algorithm had a drawback as some deadlocks were not detected when the degree of contention remained high for some cases. I. Suzuki and T. Kasami in their paper “A distributed mutual exclusion” [Suzuki, 1985] proposed a new token based algorithm in 1985 requiring a total number of messages equivalent to „N‟ with a synchronization delay of „T‟. After this Mukesh Singhal in his paper “Deadlock detection in distributed systems” [Singhal, 1989] in 1989 proposed Singhal‟s heuristic algorithm [Singhal, 1997] which was a „token based‟ algorithm with total number of messages required „N/2‟ (Low load) to „N‟ (High load) with a synchronization delay of „T‟. In the same year Kerry Raymond in his paper “A tree based algorithm for distributed mutual exclusion” [Raymond, 1989] proposed a new token based algorithm with total number of message requirement equivalent to Log (N) under low load and 4 under high load, with a synchronization delay of „T Log (N/2)‟. Omran Bukhres [Bukhres, 1992] in his paper “Performance comparison of distributed deadlock detection algorithms” (1992) has coined a new algorithm based upon a double multi-link list of nodes describing the interaction among resources along with the transaction in the distributed database system where each link list represents either a transaction relation or

[45]

a resource relation. His conclusion was that in distributed system [Thiare, 2009] with resource sharing capabilities running on locking concurrency control algorithms were prone to deadlocks [Ajay, 1990] Thus he gave to distinct solutions for this problem making a conclusion that the choice of the best deadlock detection algorithm [Johnston, 1991] is dependent upon the system‟s operating region while

Soojung Lee and Junguk L.Kim in their

paper “An efficient distributed deadlock detection algorithm” (1995) have proposed a distributed deadlock detection algorithm capable of detecting cycles made up of back edges in a distributed search tree. This algorithm was capable of detecting even those deadlocks in which the initiator of the algorithm was involved directly or indirectly while in most of the earlier proposed algorithms the algorithms detects only those cycles in which the initiator was directly involved.

Another group of researchers namely O. Thiare et. al. in their paper “Distributed groups mutual exclusion based on dynamical data structures” [Thiare, 2009] have proposed several solutions about a new concept in distributed mutual exclusion for „group mutual exclusion (GME)‟ problem. In this paper they have proposed a solution named as „distributed group mutual exclusion algorithm‟ based upon „client-server‟ model using dynamic data structure. Here the number messages lies between „0 to m‟ where „m‟ signifies the no. of session in the network with the avg. case of necessary message as O (log(m)) and maximum concurrency „n‟ where „n‟ is total no. of processes in the network. Apart from these previous works mentioned in the literatures, some new researchers have also come forward and contributed to this field of distributed mutual exclusion problem [Chang, 1991] in some recent times. Amongst these we are mentioning the contribution of two different groups of researchers. One of them are Sukhendu kanrar, Samiran Chattopadhyay and Nabendu Chaki who proposed “A new voting-based mutual exclusion algorithm for distributed systems” (2013) and Jonathan Lejeune, Luciana Arantes, Julian Sopena and Pierrie Sens who proposed “A prioritized

[46]

distributed mutual exclusion algorithm balancing priority inversions and response time” (2013). In the paper first paper S. Kanrar et. al. have proposed a solution for concurrency control in distributed systems through applying a voting based algorithm in which the „requests‟ gaining majority of votes will only be allowed to enter into the critical section (C.S.) [Goscinski, 1990] while other requests will be acted accordingly with the percentage of votes they acquired during voting amongst the different present systems in the distributed systems [Lee, 1995]. But this system has some drawback as every time it was not that multiple numbers of systems attains majority of votes, hence leaving a majority of number of requests in the waiting queue creating a high amount of starvation for the requesting processes. Along with this, another group of researchers i.e. J. Lejeune et. al. in the same year came with their newly proposed algorithm in order to solve for the starvation problem [Niami, 1987] lying in the distributed systems. They have proposed a new technique based upon priority and balancing priority inversions and response time. They have divided the requests made by individual systems according to their priority and the requests having higher amount of priority will be only allowed to enter into the critical section (C.S.) of the system. But again this algorithms has also its defect in the form of „fairness‟ as it was practically not possible to provide a fair chance for every requesting process to attain the highest priority even for once and to enter into the critical section (C.S.). Thus we have proposed a new technique named “An efficient voting and priority based technique for deadlock prevention in distributed system” in order to provide a feasible and logical solution for the prevention of deadlock in the distributed system.

3.3

PROPOSED TECHNIQUE In this section we have proposed an efficient voting and priority based

deadlock detection technique for a distributed system and the proposed technique is capable to provide a solution for the distributed system. Here we have divided the incoming process requests based upon two constraints (a)

[47]

Voting (Vi) and (b) Priority (Pb). Next we have divided the voting and priorities obtained by various processes into four different categories based on their equivalent percentage. These are category (i) 75.1% - 100% (ii) 50.1% 75% (iii) 25.1% - 50% and (iv) 0.1% - 25%. Here this percentage window (Wi) is applicable for both the categories. Since in voting method, the voting itself signifies the voting percentage; we have changed the total number of hits made by any process for an individual system into percentage in order to attain its percentage equivalent. This data obtained from the above motioned methods are then compared on some basic principles and only after that are allowed to enter into the critical section (C.S.). After this we have tried to compare the data obtained from above readings in order to attain a proper result.

3.3.1 Definitions & Assumptions

(i)

Distributed System (D.S.): It is a system consisting of several computers that do not share any memory or clock but communicate with each other through message exchange over a communication network. Here each computer has its own memory and runs upon its own operating system (O.S.).

Computer System 1

Computer System 2

Communication Network

Computer System 3

Computer System 4

Fig. 3.1: A distributed System (ii)

Voting: Voting (Vi) is the processes of selecting any single

process request to be entered into the critical section (C.S.) through the process of voting within the various systems of a distributed system.

[48]

Here the process attaining the majority of voting is only allowed to enter into the critical section.

(iii)

Priority: Priority (Pr) is also a way of deciding about the process to be entered into the critical section. Here the process making highest number of request attains the highest priority and hence is selected to enter into the critical section (C.S.).

(iv)

Percentage Window: Percentage Window (Wi) is defined as the margin of percentage provided for deciding the voting as well as percentage factors. This window consists of 25% of margin for both.

(v)

Test Cases: In this proposed algorithm there are 18 different test cases denoted by TCi.

Every time these test cases are tested before the approval of any request to enter into the critical section (C.S.).

3.4

METHODOLOGIES In our proposed algorithm, we have used both types of systems

which use mainly two kinds of requests incoming from the different systems in distributed systems. Apart from these two incoming request variables, there are various other useful variables which are decisive in elaborating this algorithm. These variables are: Voting based (Vi) and Priority based (Pb). Consequently, we have also devised some equations for expressing the above mentioned factors.

Voting based (Vi): Let the total no. of votes obtained by individual request = Vr Total no. of voting‟s performed by various systems = Vt.

[49]

Priority Based (Pb): Let the total no. of hits made by system = Nh. Total no. of hits = Nt. Hence,

Level (Lv): It denotes the current number of pending requests that has already been converted up in order to inverse request priority to priority+1. Site (Si): It denotes ether a specific system or its neighbour. Distance (di): It is defined as the distance between the requesting node (Reqn) and the current node (Curn). Pending_Request (P_Req): It is defined as the counter which counts the total no. of pending requests into the system since the last time it either releases the CS or received the token.

Enter_CS: This variable is used for entering the request into the critical section (C.S.).

Wait_queue (Wq): It contains the list of waiting requests. Pending_Request_Number (P_Reqp): It denotes the corresponding no. of requests with priority Pr which has not been taken into account yet for incrementing priorities.

Pending_Request_Vector P_Reqv: A request can be registered only once in P_Reqv vector of just one site (Si).

[50]

Time schedule of each job (Tsch): It is the time required to finish a given job in the queue. Based upon this schedule these jobs can be arranged according to the minimum time schedule to maximum time schedule.

Time Stamp (Ts): Another variable defined here is the time constraint/Time stamp based upon the previous table and is denoted as Ts. Time Constraint (Tc): It is defined as the exact amount of time in seconds after which the ongoing process, if unable to obtain any process/data either from the voting based side or from the priority based side; then it can increase the voting/priority percentage by itself of all the waiting processes of the wait_queue (Wq) and is denoted by Level (Lv). Exit_CS: This variable is used to denote the exit of any process from the C.S.

Prominent Process (Pp): This variable defines that very first process which is allowed to enter into the critical section for execution. NMI: It is a variable defined for „Non Maskable Interrupts‟.

Before declaring the other core variables, let us clarify about the percentage window (Wi) for the voting (Vi) and priority (Pr) percentages with conditions: (a) 75.1% - 100% = V1 = P1. (b) 50.1% - 75% = V2 = P2. (c) 25.1% - 50% = V3 = P3. (d) 0.1%- 25% = V4 = P4. Apart from the above declared variables, we need to define eighteen more variables which include eighteen different test cases for bringing processes into the C.S. These are:

[51]

Case 1: NMI (Non-Maskable Interrupt): This variable contains any kind of request running through the distributed system. NMI has the highest priority in the system and will enter into the critical section in hesitantly.

Case 2: The voting and priority percentage of different processes entering into critical section of distributed system are represented by equations from Eq. (3.3) to Eq. (3.18).

V1P1 (α): ∀ V1/P1: 75.1% ≤ (V1, P1) ≤ 100% && if V1⇔ P1, then whosever timestamp value (Ts) will be smaller will enter into the critical section (C.S.).

(3.3)

V1P2 (β): ∀ V1/P2: 75.1% ≤ V1 ≤ 100% and 50.1% ≤ P2 ≤ 75%; V1will enter into the critical section (C.S.).

(3.4)

V1P3 (γ): ∀ V1/P3: 75.1% ≤ V1 ≤ 100% and 25.1% ≤ P3 ≤ 50%; V1 will enter into the critical section (C.S.). (3.5) V1P4 (δ): ∀ V1/P4: 75.1% ≤ V1 ≤ 100% and 0.1% ≤ P4 ≤ 25%; V1 will enter into the critical section (C.S.).

(3.6)

V2P1 (ε): ∀ V2/P1: 50.1% ≤ V2 ≤ 75% and 75.1% ≤ P1 ≤ 100%; P1 will enter into the critical section (C.S.). (3.7) V2P2 (δ): ∀ V2/P2: 50.1% ≤ V2 ≤ 75% and 50.1% ≤ P1 ≤ 75%; since V2⇔ P2, hence the process having smaller time stamp (Ts) value will enter into the critical section (C.S.).

(3.8)

V2P3 (ε): ∀ V2/P3: 50.1% ≤ V2 ≤ 75% and 25.1% ≤ P1 ≤ 50%; V2 will enter into the critical section (C.S.).

(3.9)

V2P4 (ζ): ∀ V2/P4: 50.1% ≤ V2 ≤ 75% and 0.1% ≤ P1 ≤ 25%; V2 will enter into the critical section (C.S.).

[52]

(3.10)

V3P1 (η): ∀ V3/P1: 25.1% ≤ V3 ≤ 50% and75.1% ≤ P1 ≤ 100%; P3 will enter into the critical section (C.S.).

(3.11)

V3P2 (θ): ∀ V3/P2: 25.1% ≤ V3 ≤ 50% and 50.1% ≤ P2 ≤ 75%; P2 will enter into the critical section (C.S.).

(3.12)

V3P3 (ι): ∀ V3/P3: 25.1% ≤ V3 ≤ 50% and 25.1% ≤ P3 ≤ 50%; since V3⇔ P3, hence the process having time stamp value smaller will enter into the critical section (C.S.).

(3.13)

V3P4 (κ): ∀ V3/P4: 25.1% ≤ V3 ≤ 50% and 0.1% ≤ P4 ≤ 25%; V3 will enter into the critical section (C.S.).

(3.14)

V4P1 (λ): ∀ V4/P1: 0.1% ≤ V4 ≤ 25% and 75.1% ≤ P1 ≤ 100%; P1 will enter into the critical section (C.S.).

(3.15)

V4P2 (μ): ∀ V4/P2: 0.1% ≤ V4 ≤ 25% and 50.1% ≤ P2 ≤ 75%; P2 will enter into the critical section (C.S.).

(3.16)

V4P3 (ν): ∀ V4/P3: 0.1% ≤ V4 ≤ 25% and 25.1% ≤ P2 ≤ 50%; P3 will enter into the critical section (C.S.).

(3.17)

V4P4 (π): ∀ V4/P4: 0.1% ≤ V4 ≤ 25% and 0.1% ≤ P2 ≤ 25%; since V4⇔ P4, hence the process having smaller time stamp value will enter into the critical section (C.S.).

(3.18)

Case 3: SJSF- It is defined as the „shortest job scheduling first‟. In SJSF, if none of the above mentioned test cases fulfils the criteria for any process Pi to enter into the critical section (C.S.), then SJSF will rule into the process in order to reduce the burden of remaining queue. These variables and conditions

are

represented

by

the

given

equation:

NMI¦¦V1/P1¦¦V1/P2¦¦V1/P3¦¦V1/P4¦¦V2/P1¦¦V2/P2¦¦V2/P3¦¦V2/P4¦¦V3/P1¦¦V3/P2¦¦V3/P3¦¦ V3/P4¦¦V4/P1¦¦V4/P2¦¦V4/P3¦¦V4/P4 = T.

(3.19)

[53]

In case 1 & case 2 (including Eq. 3.3 – Eq. 3.18) „T‟ represents „true‟ condition. If any of the cases or equations returns „T‟ then the process „Pi‟ will enter into the critical section (C.S.). If any of the above cases and equations returns „F‟ (false) then Case 3 i.e. SJSF will enter into the critical section (C.S.).

3.4.1

Proposed Algorithm The steps of proposed voting and priority based deadlock prevention

algorithm are presented in fig. 3.1. This algorithm takes input in two different forms of voting and priority generally denoted as Vi and Pr in individual and ViPr as a joint expression. The proposed algorithm for Single server and single critical section based deadlock prevention mechanism is presented in fig. 3.2. The proposed algorithm for multiple servers with single critical section is presented in fig. 3.3. Further, the proposed algorithm for multiple servers with multiple critical sections is presented in fig. 3.4. Step 1: Process (Pi) → (Enter_CS);/* All processes wants to enter into critical section*/ Step 2: Pi → (Enter_CS); /*only one process will be allowed at a time*/ Step 3: (Pi-1) → Wait_queue (Wq); /*since only one process is allowed to enter into C.S. at a time, rest of the process will keep waiting as P_Reqv in the wait_queue (Wq)*/ Step 4: if (Pi (≡Pp) == NMI) {Pi → (Enter_CS);} Else {Pi = Pi + 1(≡Pp) → (Enter_CS)} Step 5: while (Pi! = NMI) {Check for test cases from V1P1 (α) to V4P4 (π)}. Step 6: if (∀V1P1 (α) to V4P4 (π)) ∃ Pi== T) {Pi → (Enter_CS)} Else {Pi=Pi+1(≡Pp) → (Enter_CS);} Step 7: ∀ (Pi ∈ Wq);

[54]

{(Pi = Pi + 1)} Step 8: while (Pi (≡Pp) → Enter_CS == Null > Tcon) {(∀Pi ∈ (ViPi ⇔ PrPi) == 100%) == Pi (≡P)p → Enter_CS} Step 9: while (∀ (NMI ∪ V1P1(α) to V4P4(π)) → Pi

== F)

{Case 3 (SJSF): Pi → (Enter_CS)} Step 10: for (i=Pi; i>=0; i--) {Execute Step 11 ;} Step 11: End. Fig. 3.2: Algorithm for single server and single critical section based deadlock prevention in distributed system. Step 1: All processes (Pi.k) → (Enter_CS); Step 2: (Pi.k-1) → Wait_queue (Wq); /*since only one process is allowed to enter into C.S. at a time, rest of the process will keep waiting as P_Reqv in the wait_queue (Wq)*/ Step 3: if (Pi (≡Pp) == NMI) {Pi → (Enter_CS)} Else {Pi = Pi + 1(≡Pp) → (Enter_CS)} Step 4: while (Pi! = NMI) {Check for test cases from V1P1 to V4P4}. Step 5: If ∃ any case where (%age (ViPi) ⇔ Step

1:

All

processes



(Pi.k)

(Enter_CS); Step 2: (Pi.k-1)→ Wait_queue (Wq); /*Since only one process is allowed to enter into C.S. at a time, rest of the process will keep waiting as P_Reqv in the wait_queue (Wq)*/ Step 3: if (Pi(≡Pp) == NMI) { Pi → (Enter_CS)} else{ Pi = Pi + 1(≡Pp) → (Enter_CS)}

[55]

Step 4: while (Pi! = NMI) {Check for test cases from V1P1 to V4P4}. Step 5: If ∃ any case where (%age (ViPi) ⇔ %age (PrPi)); then {time stamp (Ts) of the most prominent processes will be compared} i.e. [Ts(ViPi)] is compared with [Ts(PrPi)]; Step 6: if (Ts(ViPi)) > (Ts(PrPi)) {(ViPi) → (Enter_CS)} else {(PrPi) → (Enter_CS)} Step 7: If multiple numbers of processes appears into the percentage window (Wi) range, then again a comparison between the time stamps (Ts) will be made amongst the prominent processes from both the sides if present. Step 8: while (Exit_CS → Pi) { (Pi.k → (Enter_CS))} Step 9: ∀ (Pi ∈ Wq); (Pi = Pi + 1) } Step 10: Step 7 will be applicable to both types of systems sending the requests i.e. for voting based and priority based systems. Step 11: while (∀(NMI ∪ V1P1(α) to V4P4(π)) → Pi

== F)

{case 3 (SJSF): Pi → (Enter_CS);} Step 12: In case there exists any equality between

the

time

scheduling

(Tsch)

amongst the jobs coming from various

[56]

systems, then the differentiation between them for the most prominent process will be decided based upon their time stamp (Ts) value only. Step 13: while (Pp → Enter_CS == Null > Tcon) {(∀Pi ∈ (ViPi ⇔ PrPi) == 100% ) == Pi(≡P)p → Enter_CS} Step 14: for(i=Pi; i>=0; i--) {Execute Step 15;} Step 15: End.

Fig. 3.3: Algorithm for deadlock prevention with multiple systems having a single critical section. Step 1: Pi.k → (Enter_CS) /*All processes wants to enter into critical section. Since multiple number of systems available, hence total number of process also available = Pi.k*/ Step 2: ∀ processes Pi → (Enter_CS) ⇔(Pi.k-m). Step 3: (Pi.k-m) → Wait_queue (Wq); /* since only m process are allowed to enter into C.S. at a time, rest of the process will keep waiting as P_Reqv in the wait_queue (Wq)*/ Step 3: if (Pi= = NMI){( Pi → Enter_CS);} /* Pi (Pi∈ Pi.k) will enter into critical section*/ Else {Pi = Pi + 1; Enter_CS;} /* next process will enter into C.S.*/ Step 4: if (Pi! = NMI); {Check for test cases (V1P1 (α) → V4P4 (π)) ;} Step 5: For any process Pi; if (%age(ViPi) ⇔ %age (PrPi)) {Compare [ViPi(Ts)] && [PrPi(Ts)];}

[57]

Step 6: if (ViPi(Ts) < PrPi(Ts)) {ViPi → Enter_CS (ViPi);} Else { PrPi → Enter_CS(PrPi); } Step 7: if (Exit_CS → Pi.k) {Continue (Pi → Pi+1) ;} /* for all waiting processes*/. Else {goto step 9} Step 8: Step 7 will be applicable for the processes of all the involving systems. Step 9: While (Pi.k! = Enter_CS) {Case 3: SJSF → (Enter_C.S.) ;} /*if not even a single process satisfies the condition to enter into CS, then shortest job will be allowed to enter into CS*/ Step 10: while (Pi (≡Pp) → Enter_CS == Null > Tcon) {(∀Pi∈ (ViPi⇔PrPi) ==100%) == (Pi (≡Pp) → (Enter_CS) ;} /* In order to achieve a prominent process (Pp)*/ Step 11: In case of equality amongst the no. of processes after step 10, decision for the most prominent process will be made on the basis of value of time stamp (Ts) amongst them. Step 12: for (i=Pi; i>=0; i--) {Execute Step 13 ;} Step 13: End.

Fig. 3.4: Algorithm for deadlock prevention with multiple servers having a multiple critical sections.

In our very first algorithm, we have proposed an algorithm for deadlock prevention in a distributed system for a single system/server with single critical section (C.S.). Here, a single server which has been already connected with multiple computer systems in a distributed system wants to inject its processes (Pi) into a single critical section for execution. This exact phenomenon is shown in the following Fig. 3.5. This figure shows the functionality of the proposed algorithm.

[58]

Here, every single process coming from various individual computer systems of the distributed system will gather at the server 1at first. From there a race will occur amongst these processes in order to make an entry to the critical section for execution. For this selection of the most prominent process (Pp) amongst the available processes will take place. This selection will take place amongst both, the voting based (Vi) as well as from the priority based (Pr) processes. Generally, three criteria have been provided in order to make these selections which are mentioned above as (i) Case 1, (ii) Case 2 and (iii) Case 3.

Comp. Sys. 1

Comp. Sys. 2

Communication n/w

Comp. Sys. 4

Comp. Sys. 3

Server 1

Critical Section

Fig. 3.5: Diagram showing the process movement in single server with single critical section

[59]

In case of conflict between the number of processes voting based and priority based, the prominent process has been decided by the value of time stamp (Ts). In this algorithm, as all processes wants to enter into the critical section and only one process will be allowed to enter into it. For this the processes will be checked for „non-maskable interrupt‟ (NMI). If the selected process is a NMI, then it will directly enter into the critical section of the system. If the process does not consist of NMI, then according to case 2, the processes will be checked out for the different cases i.e. from V1P1 to V4P4 and depending upon those cases one particular process will be allowed to enter into the critical section (C.S.). In case 2, four percentage windows have been defined for deciding the process priority which has been described above. Whenever any particular process satisfies any of the above mentioned criteria, is allowed to enter into the C.S. When any process enters into the critical section, then the rest request processes waiting into waiting queue (Wq) is incremented by 1 in order to maintain the priority level and fairness. Even after these steps, the system remains unable in finding any prominent process (Pp) then after a certain time constraint (Tcon) the priority percentage of the waiting requests from the waiting queue is increased to 100% along with the other requesting processes accordingly.

In spite of the above processes, no prominent process exits to the system then case 3 will be applicable in which the process having „shortest job scheduling first‟ will be applied. In this the process from voting based or priority based section having shortest job scheduling will be made as the prominent process for entry into the critical section so that the processor do not remain idle for a long time. After completion of one cycle, the process will continue further itself. Our second algorithm (Fig. 3.3) describes the case of „Multiple servers with single critical section‟, shown in figure 3.6.

[60]

DS 1

DS 2

DSn

S2

Sn

S1

Critical Section (C.S.)

Fig. 3.6: Multiple servers with single critical section

Here also, all the processes from the different distributed systems want to enter into the critical section. For this they send their requests to their respective servers from where it is supposed that those requested processes will enter into the critical section.

First of all the requested processes will be checked out for NMI (Nonmaskable interrupt). If the requesting process is of NMI category, then it will directly enter into the critical section (C.S.). As soon as any process will enter into the C.S., all the requesting processes into the waiting queue (Wq) will be incremented by value 1, in order to maintain the required priority level (Lv). When the requested prominent process is not of NMI category then the algorithm will check for all the equations from V1P1 to V4P4 one by one in order to achieve the most prominent process. Whenever any prominent process is obtained while checking, it will enter into the critical section else the search will continue. If two or more than two processes become a candidate for prominent process then the decision is made by comparing

[61]

between the time stamps (Ts) of those candidate processes and the process having smaller time stamp value will enter into the critical section.

Even after going through the above mentioned two cases, the system remains unable to find any prominent process then case 3 i.e. SJSF will be applied to the algorithm. In case 3, the job having shortest scheduling will enter into the critical section as a prominent process (Pp). In the failure of case 3, the value of process requests waiting into the waiting queue (Wq) will be incremented to 100% according to their weight age respectively. In this fashion, we would be able to find out the new prominent process for entry into the C.S. In case if two or more than two processes attains the priority level of 100%,then in that condition, the difference between the time stamps of these processes are compared and the process request having lowest timestamp value will only be allowed to enter into the critical section. This process will continue unless and until the value of Pi comes to 0, else the process will keep on running.

Our third algorithm deals with multiple servers with multiple critical sections (C.S.). Here more number of processes can be acted upon at the same time interval but the overall algorithm will become a bit more complex. The exact figure of this process is shown below as fig. (3.7). In this algorithm, „m‟ number of critical sections are provided for „Pik‟ number of process at one go. Thus with this algorithm, we can increase the total number of input by „m‟ times, increasing the overall performance of the system. The overall functionality of this algorithm is quite similar with the functionality of the previous algorithm.

[62]

D.S. 1

D.S. 2

D.S.n

S1

S2

Sk

C.S. 1

C.S. m

C.S. 2

Fig. 3.7: Multiple servers with multiple critical sections 3.5

FLOWCHART DESCRIPTION: SELECTION OF CANDIDATE PROCESS In this section we have described the functionality of the flowchart

(fig. 3.8) of this algorithm.

Beginning Step 1: After starting, at the very first every single process (Pi) wants to enter into the critical section. Step 2: Here all the incoming processes are checked for the NMI condition. If any process found is an NMI, and then it is directly sent to the critical section for execution, else the next step will continue. Step 3: Here all the processes are checked in based upon the test cases from Eq. 3 to Eq. 18. Step 4: If any of the cases from Eq. 3 to Eq. 18 returns a true value, then it will be sent to the critical section.

[63]

Step 5: If step 4 returns a value false then case three will be checked in for the SJSF jobs. Step 6: If step 5 returns a value true, then the process will enter into the critical section else it will go to the first step from where the same steps will continue from starting. Step 7: Process ends here. Stop.

[64]

Proposed Flowchart Diagram Start

Every process Pi wants to enter into C.S.

If Pi = NMI, send it to C.S.

Check for every process based upon test cases from Eq. 3 to Eq. 18

Check for Eq. 3 to Eq. 18, if the value returned = T then go to C.S.

Allow Case 3, SJSF to enter into the C.S.

Allows process Pi to enter into C.S.

Stop

Fig. 3.8: Flowchart for proposed deadlock prevention in distributed system

[65]

3.6

PERFORMANCE EAVALUATION

Performance evaluation is yet another important feature for any newly invented system. Thus for our algorithm also we have performed various performance evaluation tests. This performance evaluation was based on some basic factors. These are: Complexity, Deadlock Free, Fairness, Throughput and Total no. of messages. These four factors are represented by an array Ɣ = {C, D, F, T and M}.

Complexity (C): Here the term complexity refers to the level of challenges occurred during the designing, development and implementation of the proposed techniques. It is denoted as three different levels of low, medium and high. In some algorithms complexity is defined in terms of time and space. Deadlock Free (D): This variable here refers to the unavailability of any kind of deadlock from the proposed algorithm. Fairness (F): The term fairness here denotes that free and fair chance should be provided to every process waiting into the queue to be selected at least once for making an entry into the critical section. Throughput (T): The variable throughput here is defined as the rate of overall final productivity produced by these proposed algorithms. No. of Messages (M): This variable defines the total no. of messages entering or handled by the critical section at one time in a system. This variable is clearly defined in our proposed algorithm and normally the complexity of any algorithm heavily relies upon this variable. The no. of messages will be more; greater will be the complexity of the algorithm/system.

[66]

System 1

System 2

System 3

3.9(a): Voting based process selection methodology

Req. 1 Req. 1 Req. 1

System A

Req. 1 Req. 2 Req. 2 Req. 3

3.9(b): Priority based requesting methodology

Req.1 (Pi)

Server

Critical Section

3.9(c): Request 1(System 1) entering into Critical Section. Fig. 3.9: Functionality of voting and priority based systems

[67]

Table 3.1: Voting percentage method S. No. 1 2 3

System Name 1 2 3

Voting Percentage 28 51 21

Priority Level Medium Highest Lowest

Table 3.2: Priority Table S. No.

System No.

No. of Requests

1. 2. 3. 4. 5. 6. 7.

1 1 1 1 2 2 3

Req. 1 Req. 1 Req. 1 Req. 1 Req. 2 Req. 2 Req. 3

3.6.1 Voting Based Methodology In this method a voting technique is implemented amongst all the participating nodes in order to find out one system with highest percentage of votes. The process got selected for the highest percentage of votes is said to attain the majority amongst them and is set to be the suitable candidate for entering into the critical section for execution. Fig. 3.9(a) along with table 3.1 shows the exact process of selection of process with majority.

3.6.2

Priority Based Methodology This process decides its most prominent candidate on the basis of

priority [F. Muller, 1999]. This priority is decided upon the total number of requests made by any node for a particular process. As 3.9(b) describes that out of 7 numbers of requests, total number of requests claimed by request 1 stands to 4 Thus in this scenario, Req. 1 becomes the most prominent candidate in this system to enter into critical section which is shown in table 3.2. In this way decision is made in the priority based methodology.

[68]

In 3.9(a), the working of voting based process selection methodology is demonstrated. Here, we can see that there are three different systems lying in a distributed system sending its request to enter into the critical section. As we can witness that system 2 is having highest percentage of votes (majority, 51%), hence process requested by system 2 will only enter into the C.S. while the other two systems will remain into the queue.

Fig. 3.9(b) shows a priority based method has been shown in which out of 7 processes, it is visible that the overall request for „Req. 1‟ is made for most of the time (4/7) and hence amongst all the 3 processes requested by system A, probability for Req. 1 to enter into the critical section is highest, and thus will enter into the critical section.

Fig. 3.9(c) shows the entrance of a process Pi from a server into the critical section.

[69]

3.7

ENTRY INTO CRITICAL SECTION

Time Stamp Vi.Ts

Critical Section (C.S.) Req. 1

Time Stamp Pr.Ts

Req. 1 Req. 1 Req. 1 Req. 2 Req. 2 Req. 3

Fig. 3.10: Entering into C.S. with help of time stamp Fig. 3.10 shows that in case where the voting percentage becomes equivalent to the priority equivalent, then the decision of entry into the critical section will be decided through the time stamp value. This means that only that process amongst the both will make an entry into the critical section whose time stamp (Ts) value will be smaller than the other. For e.g. if Vi.Ts < Pb.Ts then ViPi will execute first else if PbTs< Vi.Ts, then PbTs will execute first.

In addition to three cases of our proposed technique (Section 3) we have used six different situations to measure the performance of distributed system. These are: Single server with single critical section; Single server with dual critical sections; Single server with multiple critical sections; Multiple systems with single critical section; Multiple systems with dual critical sections; Multiple systems with multiple critical sections.

[70]

Explanation: Server

Critical Section 1

3.11(a): Single system with single critical section

Server

Critical Section 1

Critical Section 2

3.11(b): Single system with double critical section

Server

Critical Section... m

Critical Section 1

3.11(c): Single server with multiple critical sections

[71]

Critical Section 1

Server 1

Server...k

3.11(d): Multiple servers with single critical section

Server 1

Critical Section 1

Critical Section 2

Server... k

3.11(e): Multiple servers with dual critical sections

Server 1

Server k

Critical Section 1

Critical Section m

3.11(f): Multiple servers with multiple critical sections Fig. 3.11: Six different cases for entry into critical section

[72]

The first category is of single server with a single critical section is shown in the above Fig. 3.11(a). Here only one process can be sent into critical section at a time, keeping the other processes into waiting queue. This is the slowest process amongst the six processes mentioned above, but its implementation is much simpler than others.

Fig. 3.11(b) shows the second category where one single server is attached with two different critical sections. Here, the system can work upon two distinct processes into the critical sections simultaneously. Thus it is a bit faster than the previous method but the implementation is more complex than earlier one.

Fig. 3.11(c) shows the case of single server with multiple critical sections. This method is obviously better than earlier two methods as k number of processes can enter into the critical sections at the same time, hence increases the overall productivity of the system but also increase the overall complexity of the system.

Fig. 3.11(d) expresses the case of multiple servers with single critical section. As the number of servers is more here than the exact number of critical section therefore, the competition for entering into the critical section within the processes from different servers is on the higher side in this system which may further convert into the starvation situation for any of the processes or may lead to race condition.

This situation is shown with the help of Fig. 3.11(e). Here multiple servers are connected to dual critical sections. This system is slightly better than the previous one but it may also lead to its inability to handle the huge amount of incoming data under pressurized situation.

[73]

Fig. 3.11(f) shows the case of multiple servers with multiple critical sections. Here multiple servers are connected to multiple critical sections adding to the overall throughput of this system. As multiple numbers of processes (Pi.k) can be allowed to enter into the multiple numbers of critical sections, therefore multiple numbers of processes can be carried out at the same time which increases the efficiency of the system but on the other side also increases its implementation complexity. Table 3.3: Comparison amongst proposed algorithms S. No.

Factors (Ɣ)

Proposed Technique (Single server with single critical section)

Proposed Technique (Single server with multiple critical sections)

Proposed Technique (Multiple servers with multiple critical sections)

1

Complexity (C)

Low

Medium

High

2

Deadlock Free (D)

Yes

Yes

Yes

3

Fairness (F)

Yes

Yes

Yes

4

Throughput (T)

Min = 1, Max = 1

Min = 1, Max = m

Min = m, Max = m

5

No. of Messages (M)

Min = 1, Max = 1

Min = 1, Max = k

Min = k, Max = k

Table 3.4: Comparison between new proposed algorithm and some other mutual exclusion algorithms S. No.

Name of algorithm

Complexity (C)

Deadlock Free (D)

Fairness (F)

Throughput (T)

No. of Messages (M)

1

Proposed Technique (Single server with single critical section)

Low

Yes

Yes

Min =1, Max = 1

Min = 1, Max =1

2

Proposed Technique (Single server with multiple critical sections)

Medium

Yes

Yes

Min = 1, Max = m

Min.=1 Max = k

[74]

3

Proposed Technique (Multiple servers with multiple critical sections)

High

Yes

Yes

Min = m, Max = m

Min = k Max = k

4

Voting based algorithm [23]

Low

No

No

Low

Max = 2*(N1)

5

Priority based algorithm [10]

High

No

No

Low

Min = 0.1 Max = 0.5 (Prob. ratio)

6

Distributed groups mutual exclusion algorithm [21]

High

No

Yes (FIFO)

Medium

Min = 0/1 Max = m

Above tables (table 3.2 and table 3.3) gives the comparison view of our proposed algorithm first amongst each other and later on with some other algorithms. In table 3.2, our proposed algorithms are compared with each other while in table 3.3 these proposed algorithms are compared with other algorithms. These comparisons are made upon mainly five variables represented through an array Ɣ = {C, D, F, T and M}.

In table 3.2, the complexity factor (C) amongst three proposed algorithms increases in the following order: Single server with single critical section < Single server with multiple critical sections < Multiple servers with multiple critical sections. Further since three main cases along with 16 sub case for case 2 have been projected and implemented for our proposed algorithms, hence the chance for the occurrence of any deadlock (D) is either minimal or negligible. Since our proposed algorithms are designed in such a way that every incoming/waiting process should get a chance to enter into the critical section, hence this may be said that fairness (F) property has been tried to maintain in these algorithms. As far as throughput (T) is concerned, it is min = 1, max = 1 for the single server with single critical section and min = 1, max = m for single server with multiple critical sections; while the value

[75]

changes for multiple server with multiple critical sections to min = m, max = m during any case. While as far as the no. of messages (M) is concerned, it counts up to min = 1, max = 1 for single server with single critical section. On the other hand it differs in the case of single server with multiple sections between min=1 to max = k while in case of multiple servers with multiple critical sections it lies from min = k to max = k.

Table 3.3 on the other hand compares our newly proposed algorithms with some other algorithms mentioned in the literatures based upon the same five variables. During the comparisons made between our newly proposed algorithms with other existing algorithms, it was revealed that these proposed algorithms are better than the other three mentioned algorithms in two areas of deadlock free (D) along with fairness (F). While in the case of complexity (C) the complexity of single server with single critical section along with the voting based algorithm is on the lower side. The complexity level of single server with multiple critical sections remains on the medium level while the complexities of the remaining three algorithms i.e. multiple servers with multiple critical sections along with priority based algorithm and distributed groups‟ mutual exclusion algorithm remains at the higher side. In terms of throughput (T), algorithms like our proposed single server with single critical section along with voting based algorithm and priority based algorithm remains at the lower side.

Algorithms like distributed groups mutual exclusion algorithm and our newly proposed single server with multiple critical sections algorithm has medium level of throughput. Remaining proposed multiple servers with multiple critical sections algorithm has the highest level of throughput as compared with the other algorithms of table 3.3. In the case of no. of messages requires by each process is concerned, and then in that case the newly proposed „single server with single critical section‟ algorithm requires only „1‟ process for operation under the minimum and maximum condition. The

[76]

second „single server with multiple critical sections‟ proposed algorithm can act upon „1‟ process under minimum load condition to „m‟ processes under the maximum condition which is almost same as the no. of messages required for distributed groups mutual exclusion algorithm which remains „0/1‟ under minimum and goes up to „m‟ under the maximum load condition. The priority based algorithm‟s message requirement varies in a rational manner which lies within a range 0.1