Exercise 6.1 a) What kind of tasks do not require any kind of synchronization? [
ID: 3532416 • Letter: E
Question
Exercise 6.1 a) What kind of tasks do not require any kind of synchronization? [2 points] b) What are the primary problems with using semaphores to provide synchronization? [2 points] c) Define rendezvous, accept clause, entry clause, actor task, server task, extended accept clause, open accept clause, and closed accept clause. [4 points] Exercise 6.2 a) Define semaphores in Java and use them to provide both cooperation and competition syn- chronization in the shared-buffer example. [4 points] b) The reader-writer problem can be stated as follows: A shared memory location can be con- currently read by any number of tasks, but when a task must write to the shared memory location, it must have exclusive access. Write a Java program for the reader-writer prob- lem. [8 points]Explanation / Answer
6.1)
a) any task which does not use shared memory i.e it does not access resources that are accessed by other processes, does not require any kind of synchroniztion. Synchronization tools are effective only when they are used consistently by all threads in an application.
b)Semaphores don't have priority-inversion avoidance. They're arguably harder to use than condition variables, because they require the client code to ensure that the number of posts "matches" the number of waits in some appropriate way. With condition variables it's easy to tolerate spurious posts, because nobody actually does anything without checking the condition.
c) A Rendezvous Barrier is a synchronization primitive in which threads "meet". Threads that get to the rendezvous point wait until all the threads have reached the rendezvous point, and then they continue.a method of synchronizing two concurrent tasks for communicating data
Access clauses help in providing mutually exclusive access to a shared data structure that woud take place as with the use of semaphores
A task that has accept clauses, but no other code is called a server task
A task without accept clauses is called an actor task
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.