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.
- Threads
- Problem 4.4 from course book [Stal05 and Stal01]
- problem 4.5 from course book [Stal05 and Stal01]
- Give a synchronization example, where Solaris thread primitive sema_tryp() is
used, but a similar solution with primitive sema_p() would not work.
Explain.
- [2 htp] Let us consider the Linux kernel synchronization primitives (Ch 6.8 [Stal05]).
- 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?
- 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?
- 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?
- 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.
- Give an example situation where one should use some Barrier operation. Explain.
- Problem 6.20 from text book [Stal05, s. 299]: