Accenture Interview Question

Write a program for deadlock &how to resolve that