Challenge: The Problem with Shared State

Solve a programming challenge about a shared state and deadlock.

We'll cover the following

Problem

Write a code to induce a deadlock situation using mutex.withlock(). The code should print “Educative” and then “Inc.” but “Inc.” should be in a deadlock situation, so it should not be printed.

Restriction

The output will be available in the terminal.

Output

The output will be as follows; here, we will see a delay of two seconds.

Educative

Get hands-on with 1200+ tech skills courses.