Showing a simple example of deadlock with semaphores
问题 I'm currently taking Operating Systems and our teacher assigned this problem for our lab but he's not very helpful. So I need to show a basic example of deadlock with semaphores and my output needs to demonstrate the occurence of the deadlock. I'm assuming he means if my exception is caught. This is as close as I've gotten. import java.util.concurrent.Semaphore; public class deadlockTest2 { private Semaphore sem1=new Semaphore(1); private Semaphore sem2=new Semaphore(1); private int num;