answersLogoWhite

0


Best Answer

while(1) { // thread i (0 <= i < n)

for (j=1 ; j<n ; j++) {

flag[i]=j;

last[j]=i;

for (k=0 ; k<n ; k++) {

if (k==i) continue;

while (flag[k]>=flag[i] && last[j]==i) {

sleep(random());

}

}

}

// critical section

...

// end of critical section

flag[i]=0;

// not critical section

...

// end of not critical section

}

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Peterson algorigthm with n process
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

When was Edward N. Peterson born?

Edward N. Peterson was born in 1925.


When was Adrian N. Peterson born?

Adrian N. Peterson was born on 1979-07-01.


When was Chase N. Peterson born?

Chase N. Peterson was born on 1929-12-27.


What has the author Marshall N Peterson written?

Marshall N. Peterson has written: 'The Highland Maya in fact and legend'


What has the author Dwight N Peterson written?

Dwight N. Peterson has written: 'The origins of Mark' -- subject(s): Bible, Criticism, interpretation


What are the release dates for WRAL Murder Trials - 2003 Michael Peterson Case Appeals Process Moving Slowly in Peterson Case?

WRAL Murder Trials - 2003 Michael Peterson Case Appeals Process Moving Slowly in Peterson Case was released on: USA: 10 December 2012


Where is the Peterson Garden Project Inc in Chicago Illinois located?

The address of the Peterson Garden Project Inc is: 4642 N Francisco Ave, Chicago, IL 60625-3723


What has the author Harry N Peterson written?

Harry N. Peterson has written: 'Statement of program for proposed new downtown central library building in Washington, D.C' -- subject(s): District of Columbia, District of Columbia. Public Library, Library planning


What has the author N Phil Peterson written?

N. Phil Peterson has written: 'Riverine pond enhancement project, October 1982-December 1983' -- subject(s): Environmental aspects, Environmental aspects of Fish-culture, Fish habitat improvement, Fish-culture, Fishery management


Can plants proces nitrogen?

No they cannot process N. Some bacteria can process N


Which process defines the Fibonacci sequence?

The process isa(1) = 1 a(2) = 1 a(n+1) = a(n-1) + a(n) for n &gt;= 2


What has the author Walfred Hugo Peterson written?

Walfred Hugo Peterson has written: 'Dormitory drug dens and due process' -- subject(s): Searches and seizures, Trials (Narcotic laws), Trials, litigation