Question: problem well before the due date ) . Consider the following test program for an implementation of KThread.join in Nachos. It begins when the main
problem well before the due date
Consider the following test program for an implementation of KThread.join in Nachos. It begins when the main Nachos thread calls KThread. selfTest. You do not need to know the details of how join is parent is placed on the ready queue; if the child has finished, the parent continues to execute without blocking. Assume join uses a wait queue of some kind in its implementation.
private static class A implements Runnable
A
public void run
KThread t new KThread new BsetName B;
System.out.println foo;
tfork ;
System.out.println far;
tjoin ;
System.out.println fum;
private static class B implements Runnable
B
public void run
System.out.println fie;
public static void selfTest
KThread t new KThread new AsetName A;
System.out.println fee;
tfork ;
System.out.println foe;
tjoin ;
System.out.println fun;
is on a queue.
a Context switches: main rightarrow
b Output:
c Thread queues when selfTest returns:
currentThread:
readyQueue:
join wait queue: to check your answer.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
