Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Q4 (a) Table Q4(a) shows the concurrent program S. Thread j and k execute in parallel and access integer variable m. int m = 2
Q4 (a) Table Q4(a) shows the concurrent program S. Thread j and k execute in parallel and access integer variable m. int m = 2 thread i 1 m = 1; 2 3 Table Q4(a) thread k int i = m; m = 4 + i Analyse below situation: Evaluate whether the program S experience race conditions. Justify your answer. (4 marks) (ii) Define the critical sections of the code executed by thread j and thread k? (4 marks) (iii) List all data races that exist in program S. (4 marks) (b) Table Q4(b) shows the semaphore diagram that contain two processes P1 and P2. Semaphore, S is first initialized as 1.Produce the execution process for label (i), (ii), (iii) and (iv). Execution process Executing in non critical section State 1 P1 S=1 Executing in non critical section P2 State 2 P1 S=0 (ii) P2 State 3 Executing in critical section P1 S=0 (iii) P2 State 4 P1 Exit critical section and updates S=1 S=1 (v) P2 Table Q4(b) (10 marks) (c) Differentiate between GPU and CPU. (4 marks) (d) Explain the execution flow between CPU and GPU using appropriate diagram. (8 marks)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started