multithreading - Concurrency control algorithm -
i trying modify concurrency control algorithm take advantage of priority of threads (i.e if lower priority thread , higher priority thread wants enter critical section @ same time, higher priority thread goes in first, while lower priority thread waits no. of cycles).
here modified algorithm:
procphase[i] = want_cr; int j = turn; { while (j != i) { if (procphase[j] != out_cr) { if (procphase[j] == want_cr && thrd_prty[i]<thrd_prty[j]) { if(turndown[i]<5) { turndown[i]=turndown[i]+1; j=turn; } } else if(procphase[j] ==claim_cr) { j=turn; } else{} } else j=(j+1)%n; } procphase[i] = claim_cr; j = (j + 1) % n; while (procphase[j] != claim_cr) j = (j + 1) % n; } while (!(j == && (turn == || procphase[turn] == out_cr))); turn = i;
the original algorithm eisenberg mcguire algorithm, algorithm getting stuck in between , not find why.
Comments
Post a Comment