Upload
siau-hui-ii
View
284
Download
3
Embed Size (px)
DESCRIPTION
Distributed Computer Systems- Tutorial 5
Citation preview
AACS5164 Distributed Computer Systems Tutorial 5
Page 1
-sh-
Tutorial 5 Instructions 1. Read through Chapter 5 when you answer these questions.
2. You must try to answer all the questions before or during your tutorial class.
3. If you have any problems, ask the tutor or discuss with your classmates.
4. Attempting these questions yourself will help you learn the material.
IF YOU JUST COPY ANSWERS, YOU WILL NOT LEARN ANYTHING.
Q1. Define mutual exclusion. Name any applications that require mutual exclusion for data
access. It only allow a process to execute, it cannot support multiple process in the same time.
Example: ATM banking transaction, printer
Bank system in withdraw crash during same time with 2 persons holding same synchronize
account.
Q2.The monitor is a high level synchronization primitive which is one of the methods used to
achieve mutual exclusion. Evaluate the monitor against the three-point test in mutual
exclusion.
Three point test in mutual exclusion
1. Does the solution ensure that two processes will enter their critical regions at the same
time?
It will ensure mutual exclusion
2. Does it prevent interference from processes not attempting to enter their critical regions?
It does prevent interference from processes not currently attempting to enter their critical
regions.
3. Does it prevent starvation? (Starvation result from a process waiting forever to enter its
critical region, also referred to as indefinite waiting)
A process desiring access to a shared resource that is protected by these atomic actions
will not starve but will eventually be scheduled and thereby receive an opportunity to enter
its critical regions.
Q3. Compare monitors with semaphore concurrency control methods.
Semaphores Monitor (Condition Variable)
One is integer One is Condition Variable
May cause starvation
Can be use I anywhere in a program Can only be used in monitor
Using global varaible Data structures to be grouped together in
a package or module.
Raise or lower operations ( easily cause the
mistake like deadlock)
Signal or wait operartions (current
process access to region for waiting
process) less mistake
AACS5164 Distributed Computer Systems Tutorial 5
Page 2
-sh-
Q4. A possible side effect of mutual exclusion is deadlock. Propose THREE (3) solutions to
prevent deadlocks.
1. Not only allow single resource holding.
*There won’t be a cycle
2. Acquire in order
*A process can only request a resource that is numbered higher than all resources it has
previously been allocated therefore, cycle cannot be created.
3. Seniority Rules
*Utilizing a timestamp method. Any process holding a resource must
relinquish a resource if an older (based on the timestamp) request that
resource.
Q5. Will lock hardware support with strict turn alternation concurrency control method pass the 3
points tests? If not, then why? Propose a solution to overcome this approach.
-It will fail, because the process cannot skip the turn. Solution is pooling, they process can skip to
enter the critical regions
Q6. What are the potential difficulties involved if the “Queued” messages is not utilized in the
centralized lock manager system?
-If not queue message occurred, it can or it may get the granted messages, it will make
waiting process. It does not know for how long time or undefined time to process. It will
crash the process in the critical region. Then it will fail the first point test of the three point test.
-the lock manager doest sent to queue message and it will make queue message in
undefined to waiting the time.