Homework-III

Homework-III - Fall 2010 CSC 4304 Systems Programming...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Fall 2010 CSC 4304 – Systems Programming Homework Assignment #3 The due date is: November 4 th , Thursday, before the class. Late submission is not allowed. Problem 1: Consider a process with two concurrent threads T1 and T2. The code being executed by T1 and T2 is as follows: Shared Data: X:= 5; Y:=10; T1: Y = X+1; X = Y; Write X; T2: U = Y-1; Y = U; Write Y; (a) Assume that each assignment statement on its own is executed as an atomic operation. What are the possible outputs of this process? Please show your work. (b) Where would be the correct place to put semaphores to prevent inconsistencies but also allow some level of parallelism? Please show how you would use semaphores to achieve this. (For this one, assume that the order in which X and Y are written is not important as long as the have the correct values.) Problem 2: Imagine you are writing the code to manage a hash table that will be shared among several concurrent threads. Assume that operations on the table need to be atomic.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/23/2011 for the course CSC 4303 taught by Professor Staff during the Fall '10 term at LSU.

Ask a homework question - tutors are online