Done
parent
e1080b73d8
commit
07650b1863
|
@ -6,6 +6,6 @@ Machine.bank = false
|
|||
Machine.networkLink = false
|
||||
ElevatorBank.allowElevatorGUI = true
|
||||
NachosSecurityManager.fullySecure = false
|
||||
#ThreadedKernel.scheduler = nachos.threads.PriorityScheduler
|
||||
ThreadedKernel.scheduler = nachos.threads.RoundRobinScheduler
|
||||
ThreadedKernel.scheduler = nachos.threads.PriorityScheduler
|
||||
#ThreadedKernel.scheduler = nachos.threads.RoundRobinScheduler
|
||||
Kernel.kernel = nachos.threads.ThreadedKernel
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -10,7 +10,7 @@ public class Boat
|
|||
BoatGrader b = new BoatGrader();
|
||||
|
||||
System.out.println("\n ***Testing Boats with only 2 children***");
|
||||
begin(100, 100, b);
|
||||
begin(100, 4, b);
|
||||
|
||||
/*
|
||||
System.out.println("\n ***Testing Boats with 2 children, 1 adult***");
|
||||
|
@ -109,11 +109,17 @@ public class Boat
|
|||
ship1.V();
|
||||
adult0.V();
|
||||
position=1;
|
||||
|
||||
condLock1.acquire();
|
||||
cond1.wake();
|
||||
condLock1.release();
|
||||
}
|
||||
else
|
||||
{
|
||||
adult1.P();
|
||||
while(true)
|
||||
{
|
||||
ship1.P();
|
||||
numLock.acquire();
|
||||
int x=passed_children;
|
||||
numLock.release();
|
||||
|
@ -121,13 +127,12 @@ public class Boat
|
|||
break;
|
||||
else
|
||||
{
|
||||
ship1.V();
|
||||
condLock1.acquire();
|
||||
cond1.sleep();
|
||||
condLock1.release();
|
||||
}
|
||||
}
|
||||
adult1.P();
|
||||
ship1.P();
|
||||
bg.AdultRowToOahu();
|
||||
numLock.acquire();
|
||||
passed_adults-=1;
|
||||
|
@ -181,9 +186,7 @@ public class Boat
|
|||
child0.V();
|
||||
child0.V();
|
||||
ship1.V();
|
||||
condLock1.acquire();
|
||||
cond1.wakeAll();
|
||||
condLock1.release();
|
||||
|
||||
}
|
||||
position=1;
|
||||
}
|
||||
|
@ -219,8 +222,10 @@ public class Boat
|
|||
}
|
||||
|
||||
static int boatPosition=0;
|
||||
|
||||
static int num_adults=0;
|
||||
static int num_children=0;
|
||||
|
||||
static int passed_adults=0;
|
||||
static int passed_children=0;
|
||||
|
||||
|
|
|
@ -562,22 +562,19 @@ public class KThread {
|
|||
Machine.interrupt().restore(intStatus);
|
||||
while(true)
|
||||
{
|
||||
//ThreadedKernel.alarm.waitUntil(1);
|
||||
ThreadedKernel.alarm.waitUntil(1);
|
||||
|
||||
KThread.yield();
|
||||
myLock.acquire();
|
||||
KThread.yield();
|
||||
|
||||
intStatus=Machine.interrupt().disable();
|
||||
System.out.println("Effective priority for thread "+thread+" is "+ThreadedKernel.scheduler.getEffectivePriority(thread));
|
||||
//System.out.println("Effective priority for thread "+other+" is "+ThreadedKernel.scheduler.getEffectivePriority(other));
|
||||
Machine.interrupt().restore(intStatus);
|
||||
|
||||
KThread.yield();
|
||||
myLock.release();
|
||||
KThread.yield();
|
||||
|
||||
priority=7-priority;
|
||||
myLock.release();
|
||||
|
||||
intStatus=Machine.interrupt().disable();
|
||||
ThreadedKernel.scheduler.setPriority(thread,priority);
|
||||
Machine.interrupt().restore(intStatus);
|
||||
|
@ -634,10 +631,9 @@ public class KThread {
|
|||
*/
|
||||
|
||||
//Test for Donation
|
||||
/*
|
||||
Lock myLock=new Lock();
|
||||
|
||||
DonationTest d1=new DonationTest(1,2,myLock);
|
||||
DonationTest d1=new DonationTest(1,3,myLock);
|
||||
KThread t1=new KThread(d1);
|
||||
d1.setThread(t1);
|
||||
|
||||
|
@ -650,7 +646,6 @@ public class KThread {
|
|||
|
||||
t2.fork();
|
||||
d1.run();
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue