Page 1 of 1

Given the following code snippet. 2 3. 4. 5. 6. 17. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25

Posted: Tue Jul 05, 2022 10:26 am
by answerhappygod
Given The Following Code Snippet 2 3 4 5 6 17 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 1
Given The Following Code Snippet 2 3 4 5 6 17 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 1 (201.71 KiB) Viewed 10 times
Given the following code snippet. 2 3. 4. 5. 6. 17. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. import threading #global variable y y=0 def increment (): global y for in range (1000000): if y +=1 def main (): global x tIncrment threading.Thread (target-increment) tIncrment2 threading.Thread (target-increment) tIncrment.start() tIncrment2.start() tIncrment.join() tIncrment2.join() name main () print (y) main Determine how many processes and threads are in the given code. Determine the output of the given code and justify your answer. Identify the critical sections of the given code. Revise the code and apply mutual exclusion on the critical sections in the given code, then write the output of the revised code. Revise the thread(s) in the given code using process(s). Using the Clojure programming language, construct a new application and use atomic concepts to replace the given code.