Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 11 The Ultimate Database For Cloud Analytics And Mobile

Authors: John Campbell, Chris Crone, Gareth Jones, Surekha Parekh, Jay Yothers

1st Edition

1583474013, 978-1583474013

More Books

Students also viewed these Databases questions

Question

Do they appear to be stressed out?

Answered: 1 week ago

Question

=+ Who do you think is right? Why?

Answered: 1 week ago