University of Helsinki Department of Computer Science
 

Department of Computer Science

Department information

 
Suomeksi

Operating Systems, Fall 2006, Homework 4

This homework will be covered in practise session on Thursday 28.9.2006 (week 38).

The homework and practice sessions will follow the normal department's practise. The homework is solved and done in advance, that is before the practise session. You may solve the problems alone or in a small group. The practise session is used to discuss about different solutions.

The submission deadline for the team tasks of this part one is Friday September 29.

The exercises are based on chapters 4 to 6. Please notice that most of the material in chapters 5 and 6 is covered in the course Concurrent Programming. This course will cover only the operating system examples of these two chapters.

  1. Threads
    1. Problem 4.4 from course book [Stal05 and Stal01]
    2. problem 4.5 from course book [Stal05 and Stal01]

  2. Give a synchronization example, where Solaris thread primitive sema_tryp() is used, but a similar solution with primitive sema_p() would not work. Explain.

  3. [2 htp] Let us consider the Linux kernel synchronization primitives (Ch 6.8 [Stal05]).
    1. Problem 6.20 from text book [Stal05, s. 299]:
      Consider the following fragment of code on a Linux system.

        read_lock (&mr_rwlock);
        write_lock (&mr_rwlock);

      Where mr_rwlock is a reader-writer lock. What is the effect of this code?

    2. Give an example on a situation, where spinlock operation can be translated into code that does not include busy-waiting. Why can this be translated this way? What do you gain with it?
    3. Give an example on a situation, where spinlock operation must be translated into code that includes busy-waiting. Why must it be translated this way? What do you gain with it?
    4. What is the difference between Reader-Writer Spinlock -operation and Reader-Writer Semaphore -operation? Give an example situation where one should use Reader-Writer Spinlock operation, but not Reader-Writer Semaphore operation.
    5. Give an example situation where one should use some Barrier operation. Explain.


Tiina.Niklander@cs.helsinki.fi