Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider the following code: public class myFirstThread extends Thread { public class mySecondThread extends Thread { Semaphore 31, 32, 33; Semaphore 31,32,33; public myFirstThread (Semaphore
Consider the following code: public class myFirstThread extends Thread { public class mySecondThread extends Thread { Semaphore 31, 32, 33; Semaphore 31,32,33; public myFirstThread (Semaphore a, Semaphore b, Semaphore c) { public mysecondThread (Semaphore a, Semaphore b, Semaphore c) { s1 = a; s1 = a; 32 = b; 32 = b; 33 = c; 33 = c; public void run() { //first thread implementation public void run() { // second thread implementation public static void main(String[] args) { Semaphore 31 = new Semaphore (1); Semaphore 32 = new Semaphore (2); Semaphore 33 = new Semaphore (1); Thread ti = new myFirstThread (31,32,33); Thread t2 = new mySecondThread (31, 32, 33); t1.start(); t2.start(); Which of the following pairs of implementations of the run methods can deadlock? Exception handling code (try, catch) has been omitted for clarity. first thread implementation second thread implementation a public void run() { 31.acquire(); 31.release(); public void run() { 33. acquire(); 33. release (); } b public void run() { 31.acquire(); 33. acquire(); 31.release(); public void run() { 31.acquire(); 33. acquire(); 31. release (); 33.release(); 33. release (); } public void run() { public void run() { 33. acquire(); 31.acquire(); 31.acquire(); 33. acquire(); 31.release(); 33. release (); 31. release (); 33. release (); } } d public void run() { 31.acquire(); 33. acquire(); 31.release(); 33. release (); public void run() { 31.acquire(); 31.release(); e public void run() { 32.acquire(); 33. acquire(); 33. release (); 32.release (); public void run() { 33. acquire(); 32.acquire(); 32.release(); 33. release(); } f public void run() { 31.acquire(); 33. acquire(); 31.release(); 33. release(); public void run() { 31.acquire(); 33. acquire(); 31. release (); 32.release(); } public void run() { 31.acquire(); 33. release(); public void run() { 33. acquire(); 31.release(); } } Select one or more: a b d Of
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started