Toyota TRI-AD tokyo SWE concurrency / mutual exclusion algo

Hi,

Have been given a problem from TRI. They notified me they were not statisfied with my work but refuse to give the slightest hint about why. Find it so harsh behavior given I spent hours working on it.
I can't stay without clue about this so I d like to know how you would answer the question yourself.you are given an algorithm which should allow to concurrent process to access shared data in mutual exclusion fashion, and are basically asked to

  1. advise if it is appropriate on a safety point of view
  2. then implement it in C++)

. Here it is:

image

Thank you.

(ok guys I know it is not your leetcode type standard puzzle for amazon/google... but I do find it interesting so please have a look for a change :) )

Comments (2)