Juspay Tree of Space Hackathon Part B Thread Safe

Posted
24 May 2025
569 reads

Summary

I was interviewed by Juspay and asked to design a thread-safe locking system for a tree. I discussed multiple approaches and provided a detailed custom Spinlock implementation, addressing the interviewer's requirement for a library-free solution.

How it went

I was presented with the following problem:

Design a thread-safe locking system for a tree. Each node can be locked by a user only if: None of its ancestors or descendants are locked. Locking/Unlocking must be thread-safe (no race conditions). The solution should efficiently support concurrent operations.

The interviewer shared my Hackathon Part A solution that I had submitted previously. They were specifically looking for a solution without using any libraries and wanted me to break down the algorithm and make it thread-safe. My advice for this round is to just stay calm and communicate clearly. That’s all you can do.

Questions asked (1)

  1. 01

    Design Thread-Safe Tree Locking System

    Data Structures & Algorithms · Hard

    Design a thread-safe locking system for a tree. Each node can be locked by a user only if: None of its ancestors or descendants are locked. Locking/Unlocking must be thread-safe (no race conditions). The solution should efficiently support concurrent operations.

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Juspay recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

Be the first to share your thoughts and start the discussion!