How to extend the Peterson algorithm to three or more processes

Peterson algorithm implements mutually exclusive access by pure software. But it only illustrates the mutual exclusion between the two processes, as shown below

-sharpdefine FALSE 0
-sharpdefine TRUE 1
-sharpdefine N 2

int turn;
int interested[N];

void enter_region(int process)
{
    int other;
    other = 1 - process;
    intersted[process] = TRUE;
    turn = process;
    while(turn == process && interested[other] == TRUE);
}

void leave_region(int process)
{
    interested[process] = FALSE;
}

how to extend to multiple processes?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b30be4-4e9a2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b30be4-4e9a2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?