Download G2_Survey_SynchronizationTools

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Security-focused operating system wikipedia , lookup

Unix security wikipedia , lookup

Burroughs MCP wikipedia , lookup

Process management (computing) wikipedia , lookup

Distributed operating system wikipedia , lookup

Transcript
Synchronization Tools for
Distributed Operating System
Survey Paper
(Group 2)
• Team Members:
Mazen Hammad
Chuck Mann
Vrushali Nidgundi
Hong Zhang
• Course:
CSE 8343 Advanced Operating Systems
• Professor:
Dr. Mohamed Khalil
November 22, 2003
SMU School of Engineering
Group 2: Hammad, Mann, Nidgundi, & Zhang
CSE 8343 Advanced Operating Systems
Slide 1
Instructor: Dr. Khalil
Outline
•
•
•
•
•
•
Mutual Exclusion
Atomicity
Concurrency
Semaphores
Message Passing
Deadlock Handling
November 22, 2003
SMU School of Engineering
Group 2: Hammad, Mann, Nidgundi, & Zhang
CSE 8343 Advanced Operating Systems
Slide 2
Instructor: Dr. Khalil
Mutual Exclusion
• Mutual-exclusion guarantees that certain sections of
code (critical sections) will not be executed by more
than one process simultaneously. These sections of
code usually access shared variables in a common
store or access shared hardware.
• The standard solution to kernel-level mutualexclusion in uniprocessor systems is to momentarily
disable interrupts to guarantee that the process
accessing the sensitive data will not be preempted
before the access has been completed. This solution
is not available for multiprocessor systems, since
processes on these are truly concurrent.
November 22, 2003
SMU School of Engineering
Group 2: Hammad, Mann, Nidgundi, & Zhang
CSE 8343 Advanced Operating Systems
Slide 3
Instructor: Dr. Khalil
Mutual Exclusion (Continued)
• A critical section of code is framed by an entry
section at the beginning and an exit section at
the end; these sections act to grab and
release the “lock” on that section.
• One safety property of mutual exclusion is,
no more than one process should have its
program counter (PC) in the critical code at
the same time.
November 22, 2003
SMU School of Engineering
Group 2: Hammad, Mann, Nidgundi, & Zhang
CSE 8343 Advanced Operating Systems
Slide 4
Instructor: Dr. Khalil
Mutual Exclusion (Continued)
Different algorithms for implementing mutual exclusion
• Centralized Approach: One of the processes in the
system is chosen to coordinate the entry to the
critical section.
• Fully Distributed Approach: This algorithm is based
on the event ordering scheme.
• Token Passing Approach: Another method of
providing mutual exclusion is to circulate a token
among the processes in the system.
November 22, 2003
SMU School of Engineering
Group 2: Hammad, Mann, Nidgundi, & Zhang
CSE 8343 Advanced Operating Systems
Slide 5
Instructor: Dr. Khalil
Atomicity
• Atomic transaction is a program that must be
executed atomically. That is, either all the
operations associated with it are executed to
completion, or none are performed.
• The two phase commit protocol is used to
ensure atomicity.
November 22, 2003
SMU School of Engineering
Group 2: Hammad, Mann, Nidgundi, & Zhang
CSE 8343 Advanced Operating Systems
Slide 6
Instructor: Dr. Khalil
Concurrency
Different concurrency control schemes are
modified so that they can be used in a
distributed environment:
• Locking Protocols
• Timestamping
November 22, 2003
SMU School of Engineering
Group 2: Hammad, Mann, Nidgundi, & Zhang
CSE 8343 Advanced Operating Systems
Slide 7
Instructor: Dr. Khalil
Distributed Semaphores
• Semaphores provide a basic synchronization
mechanism in uni and multi processor
systems
• Supporting semaphores in distributed
systems has not received much attention
• Implementation of semaphores very difficult in
a distributed system
November 22, 2003
SMU School of Engineering
Group 2: Hammad, Mann, Nidgundi, & Zhang
CSE 8343 Advanced Operating Systems
Slide 8
Instructor: Dr. Khalil
Distributed Semaphores (Continued)
• Distributed Semaphore is a semaphore-like
mechanism
• It does not require shared memory
• Implemented using conditional synchronous
message-passing mechanism
November 22, 2003
SMU School of Engineering
Group 2: Hammad, Mann, Nidgundi, & Zhang
CSE 8343 Advanced Operating Systems
Slide 9
Instructor: Dr. Khalil
Distributed Semaphores (Continued)
Synchronization is achieved using LEMMA (MESSAGE
QUEUE STABILITY) approach and is used to ensure
consistency in distributed database systems
Once the Lemma equation is satisfied then the following
things are also satisfied:
– A proxy message will not be queued indefinitely
– A request message will not be queued indefinitely
– Every P request message eventually reaches the
semaphore holder
– Two or more nodes will not form a cycle while waiting for a
semaphore
– A node’s request for P and V will not form a cycle
November 22, 2003
SMU School of Engineering
Group 2: Hammad, Mann, Nidgundi, & Zhang
CSE 8343 Advanced Operating Systems
Slide 10
Instructor: Dr. Khalil
Message Passing
• Minimum set of primitives needed for
processes to conduct message passing are:
– Send (destination, message)
– Receive (source, message)
• Process A sends message to process B with
send primitive designating B as destination
• Process B receives message with receive
primitive designating A as the source
November 22, 2003
SMU School of Engineering
Group 2: Hammad, Mann, Nidgundi, & Zhang
CSE 8343 Advanced Operating Systems
Slide 11
Instructor: Dr. Khalil
Message Passing
Process A
Send Message
Shared Data
Recv Message
Process B
November 22, 2003
SMU School of Engineering
Group 2: Hammad, Mann, Nidgundi, & Zhang
CSE 8343 Advanced Operating Systems
Slide 12
Instructor: Dr. Khalil
Common Synchronization Combinations
• Blocking send and blocking receive
– Rendezvous – Both sender and receiver are
blocked until the message is delivered
– Example – Remote Procedure Calls (RPCs)
• Nonblocking send and blocking receive
– Sender can send messages to several different
recipient processes
– Receiver that must obtain data from message
before it can do useful work waits for the data
• Nonblocking send and nonblocking receive
– Neither process waits but recipient should poll
November 22, 2003
SMU School of Engineering
Group 2: Hammad, Mann, Nidgundi, & Zhang
CSE 8343 Advanced Operating Systems
Slide 13
Instructor: Dr. Khalil
Synchronization with Receive Messages
Nonblocking
Blocking
Timeout
pvm_nrecv()
pvm_recv()
pvm_trecv()
Time
Function
Called
Waiting
Time
Expired
Waiting
Running
Message
Arrives
November 22, 2003
SMU School of Engineering
Running
Running
Group 2: Hammad, Mann, Nidgundi, & Zhang
CSE 8343 Advanced Operating Systems
Slide 14
Instructor: Dr. Khalil
Synchronization Point
• Group barrier synchronizes a group of
processes at a point in time
• Indirect message passing via daemons
• Each early member process in a group
performs a virtual blocking receive
• Last member process performs a virtual
nonblocking send to all the other processes
November 22, 2003
SMU School of Engineering
Group 2: Hammad, Mann, Nidgundi, & Zhang
CSE 8343 Advanced Operating Systems
Slide 15
Instructor: Dr. Khalil
Synchronization with a Group Barrier
Process 1
Process 2
Process 3
barrier call
Time
Running
barrier call
Waiting
Waiting
Synchronization
Point
barrier call
Running
Running
Running
Note: Syntax of barrier call is pvm_barrier(“g2”,3) where the group name is g2 and the
number of processes to rendezvous is 3.
November 22, 2003
SMU School of Engineering
Group 2: Hammad, Mann, Nidgundi, & Zhang
CSE 8343 Advanced Operating Systems
Slide 16
Instructor: Dr. Khalil
Deadlock Handling
Processes compete for resources
November 22, 2003
SMU School of Engineering
Group 2: Hammad, Mann, Nidgundi, & Zhang
CSE 8343 Advanced Operating Systems
Slide 17
Instructor: Dr. Khalil
Deadlock Characterization
& Handling Approaches
• Deadlock will happen if four conditions hold
simultaneously
–
–
–
–
Mutual exclusion
Hold and wait
No preemption
Circular wait
• Deadlock Handling Approaches
–
–
–
–
Prevention
Avoidance
Detection
Recovery
November 22, 2003
SMU School of Engineering
Group 2: Hammad, Mann, Nidgundi, & Zhang
CSE 8343 Advanced Operating Systems
Slide 18
Instructor: Dr. Khalil
Deadlock Prevention
Ensure at least one of these conditions cannot hold
• Mutual Exclusion - Not required for sharable
resources, must hold for non-sharable resources
• Hold and Wait - Whenever a process requests a
resource, it does not hold any other resources.
• No Preemption - Preempt resources held by a
process, which is requesting another resource that
cannot be immediately allocated to it.
• Circular Wait - Impose a total ordering of all resource
types, and require that each process requests
resources in an increasing order of enumeration.
November 22, 2003
SMU School of Engineering
Group 2: Hammad, Mann, Nidgundi, & Zhang
CSE 8343 Advanced Operating Systems
Slide 19
Instructor: Dr. Khalil
Deadlock Avoidance
•
•
Wound-Wait Scheme (Preemptive)
Process P0 requests a resource held by process P1,
P0 will be allowed to wait only if it has a larger
timestamp than P1, i.e. P0 is younger than P1.
Otherwise, P1 is rolled back (P1 is wound by P0).
Wait-Die Scheme (Non-preemptive)
Process P0 requests a resource held by process P1,
P0 will be allowed to wait only if it has a smaller
timestamp than P1, i.e. P0 is older than P1.
Otherwise, P0 is rolled back (dies).
November 22, 2003
SMU School of Engineering
Group 2: Hammad, Mann, Nidgundi, & Zhang
CSE 8343 Advanced Operating Systems
Slide 20
Instructor: Dr. Khalil
Deadlock Detection
• Centralized Approach
• Fully Distributed Approach
November 22, 2003
SMU School of Engineering
Group 2: Hammad, Mann, Nidgundi, & Zhang
CSE 8343 Advanced Operating Systems
Slide 21
Instructor: Dr. Khalil
Recovery from Deadlock
• Process Termination
– Abort all deadlocked processes
– Abort one process at a time until the deadlock cycle is
eliminated
– In which order to abort
• Resource Preemption
– Selecting a victim - minimize cost
– Rollback - return to some safe state, restart process from
that state
– Avoid starvation - same process may always be picked as
victim, include number of rollbacks in cost factor
November 22, 2003
SMU School of Engineering
Group 2: Hammad, Mann, Nidgundi, & Zhang
CSE 8343 Advanced Operating Systems
Slide 22
Instructor: Dr. Khalil
References
[1] Comer, D. (2000), Internetworking with TCP/IP: Principles, Protocols,
and Architectures, 4th Ed., Prentice-Hall, Upper Saddle River, NJ.
[2] Coulouris, G.; Dollimore, J.; Kindberg, T. (2001), Distributed Systems:
Concepts and Design, 3rd Ed., Addison-Wesley, Reading, Mass.
[3] El-Rewini, H. (2003), Classroom Lectures, CSE 8380 - Parallel and
Distributed Processing, Southern Methodist University, Spring 2003.
[4] El-Rewini, H. and Lewis, T. (1998), Distributed and Parallel Computing,
Manning & Prentice Hall, Greenwich, CT.
[5] Fiorini, P. "Distributed Deadlock", University of Southern Maine,
Portland, ME.
[6] Holliday, J. and Abbadi, A. “Distributed Deadlock Detection”,
Encyclopedia of Distributed Computing, Kluwer Academic Publishers.
[7] Silberschatz, A. and Galvin, P. (1998), "Operating System Concepts",
5th Ed., Addison-Wesley, Read-ing Mass.
[8] Stallings, W. (2001), "Operating Systems: Internals and Design
Principles", 4th Ed., Prentice-Hall, Up-per Saddle River, NJ.
[9] Tanenbaum, A. and van Steen, M. (2002), "Distributed Systems:
Principles and Paradigms", Prentice-Hall, Upper Saddle River, NJ.
November 22, 2003
SMU School of Engineering
Group 2: Hammad, Mann, Nidgundi, & Zhang
CSE 8343 Advanced Operating Systems
Slide 23
Instructor: Dr. Khalil
Questions & Discussion
November 22, 2003
SMU School of Engineering
Group 2: Hammad, Mann, Nidgundi, & Zhang
CSE 8343 Advanced Operating Systems
Slide 24
Instructor: Dr. Khalil
Thank You!
November 22, 2003
SMU School of Engineering
Group 2: Hammad, Mann, Nidgundi, & Zhang
CSE 8343 Advanced Operating Systems
Slide 25
Instructor: Dr. Khalil