← Questions
Thread safety and deadlocks, explained and demonstrated
0
I was asked this
No reports yet. Sign in to say where you were asked it.
A fast concepts round. What makes code thread-safe? Show the common ways a deadlock happens (for example two threads taking two locks in opposite order) and the ways to prevent each: lock ordering, timeouts, fewer locks. Some interviewers ask you to write a deadlock on purpose and then fix it. Short follow-ups compare arrays and linked lists for access, insertion and memory.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding
