程序代写 CMPUT 379, U. of Alberta, course instructor (E. Elmallah). All rights reser

Copyright Notice: Copyright by CMPUT 379, U. of Alberta, course instructor (E. Elmallah). All rights reserved. Do not post any part on a publicly-available Web site.
Question 3 (v2) [8 points] There are two POSIX threads, T1 and T2. The code for each has the form shown below.
entry code (to the critical section)
critical section

Copyright By PowCoder代写 加微信 powcoder

exit code (from the critical section)
non-critical section
In addition to the usual requirements for mutual exclusion, it is required that T1 must not enter its critical section NENT = 5 times a row (i.e., T2 must enter at least once between any NENT consecutive entries by T1). However, there is no such restriction on T2. Write the entry code and exit code for T1 and T2, using shared variables and POSIX semaphores (or Pthread mutexes).
Notes: Outline the idea of your solution. Do not forget initialization. Explain the role of any used shared variable, semaphore, or mutex.
Marks will be deducted if the solution is unnecessarily complicated.
University of Alberta examination University of Alberta examination
University of Alberta examination
University of Alberta examination University of Alberta examination

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com