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

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -