CIS 332 Homework 4: Process Synchronization


Student Name:                                             SID:                                                        Section:
CIS332 (Spring 1999) Principles of Operating Systems;   Professor Franz J. Kurfess
Home page:http://www.cis.njit.edu/franz   E-mail:franz@cis.njit.edu
 
Faculty Assistant: Ning Zhu E-mail:cis332fk@cis.njit.edu
Homework  Task  Deadline  Points 
Process Synchronization Tuesday, Feb. 16, 1999  10 
1. One method for the cooperation of processes is through shared data. A problem here can be data integrity; two processes modify the same data item in an uncoordinated way, and the result is not what it should be. Analyse the following example with respect to data integrity: Two processes P0 and P1 share the two data items a and b; it is important for the overall program that the relationship a = b always is maintained. Is this guaranteed for the following code? (3 points)
 
      P1: a := a + 2;               P2: b := b * 3;
          b := b + 2;                   a := a * 3; 
      
          
Please note that processes can be interrupted at any point during their execution, and that there are several possible sequences for the execution of the above instructions. Explain your answer by giving two possible sequences for the execution of the above processes.
 
 
 
 
 
 
 
 
 
 

2. What is the difference between critical sections and critical regions? (4 points)
 
 
 
 
 
 
 
 
 
 

3. How does the concept of critical sections help with solving the above synchronization problem? (3 points)
 
 
 
 
 
 
 
 
 
 


Franz Kurfess
Last modified: Tue Feb 9 10:44:50 EST 1999