Write C code that creates and runs 3 Pthreads t1, t2, and t3 on Ubuntu Linux. Each thread runs code that has a perpetually executing main critical section containing two critical sections to be executed back to back. The main critical section is controlled by a single counting semaphore initialized at 2. The first and second critical sections are each controlled by two mutex locks m1 and m2 (i.e., must secure both locks before going into either section). Code must enforce mutual exclusion for each critical section (i.e., the two threads cannot be inside critical1() or critical2() at the same time). code must be deadlock free.
12 freelancers are bidding on average $31 for this job
I can write a nice and correct C multi-threading solution with mutex in 1-2 days, if you're ok with that deadline, I can do it. Contact me in chat if you're interest