Distributed systems face challenges with time ordering and synchronization due to a lack of a global clock. Logical clocks provide a way to determine event ordering without precise time information. Lamport's algorithm uses logical clocks and the "happens before" relation to ensure proper synchronization. Physical clocks also require synchronization methods like Cristian's algorithm to limit clock drift between distributed nodes. Mutual exclusion in distributed systems can be achieved through centralized coordination of access to critical sections.
Synchronization Pradeep K Sinha
Introduction
Issues in Synchronization
Clock synchronization
Event Ordering
Mutual Exclusion
Deadlock
Election algorithms
Clock Synchronization
How Computer Clocks are Implemented
Drifting of Clocks
Types of Clock Synchronization and issues in them
Clock Synchronization Algorithms
Distributed and Centralized Algorithms
Case Study
Event Ordering
Happened Before Relation
Logical Clocks Concept and Implementation
Mutual Exclusion
Centralized Approach, Distributed Approach, Token Passing Approach
Deadlocks
Election algorithms
This ppt covers different aspects about timing issues and various algorithms involved in having better sync between different systems in a distributed environment
Synchronization Pradeep K Sinha
Introduction
Issues in Synchronization
Clock synchronization
Event Ordering
Mutual Exclusion
Deadlock
Election algorithms
Clock Synchronization
How Computer Clocks are Implemented
Drifting of Clocks
Types of Clock Synchronization and issues in them
Clock Synchronization Algorithms
Distributed and Centralized Algorithms
Case Study
Event Ordering
Happened Before Relation
Logical Clocks Concept and Implementation
Mutual Exclusion
Centralized Approach, Distributed Approach, Token Passing Approach
Deadlocks
Election algorithms
This ppt covers different aspects about timing issues and various algorithms involved in having better sync between different systems in a distributed environment
this presentation explains chapter 3 of the distributed operating system book for Andrew S.tanenbaum in addition to other related topics in the synchronization of the distributed operating system
A distributed system is a network that consists of autonomous computers that are connected using a distribution middleware. They help in sharing different resources and capabilities to provide users with a single and integrated coherent network.
Introduction: What is clock synchronization?
The challenges of clock synchronization.
Basic Concepts: Software and hardware clocks. Basic clock synchronization algorithm
Algorithms: Deep dive into landmark papers
NTP: Internet scale time synchronization
This is a presentation for Chapter 7 Distributed system management
Book: DISTRIBUTED COMPUTING , Sunita Mahajan & Seema Shah
Prepared by Students of Computer Science, Ain Shams University - Cairo - Egypt
this presentation explains chapter 3 of the distributed operating system book for Andrew S.tanenbaum in addition to other related topics in the synchronization of the distributed operating system
A distributed system is a network that consists of autonomous computers that are connected using a distribution middleware. They help in sharing different resources and capabilities to provide users with a single and integrated coherent network.
Introduction: What is clock synchronization?
The challenges of clock synchronization.
Basic Concepts: Software and hardware clocks. Basic clock synchronization algorithm
Algorithms: Deep dive into landmark papers
NTP: Internet scale time synchronization
This is a presentation for Chapter 7 Distributed system management
Book: DISTRIBUTED COMPUTING , Sunita Mahajan & Seema Shah
Prepared by Students of Computer Science, Ain Shams University - Cairo - Egypt
Clock synchronization: Clocks, events and process states, Synchronizing physical clocks,
Logical time and logical clocks, Lamport’s Logical Clock, Global states, Distributed mutual
exclusion algorithms: centralized, decentralized, distributed and token ring algorithms,
election algorithms, Multicast communication.
Synchronization in distributed computingSVijaylakshmi
Synchronization in distributed systems is achieved via clocks. The physical clocks are used to adjust the time of nodes. Each node in the system can share its local time with other nodes in the system. The time is set based on UTC (Universal Time Coordination).
International Journal of Engineering Research and Applications (IJERA) is an open access online peer reviewed international journal that publishes research and review articles in the fields of Computer Science, Neural Networks, Electrical Engineering, Software Engineering, Information Technology, Mechanical Engineering, Chemical Engineering, Plastic Engineering, Food Technology, Textile Engineering, Nano Technology & science, Power Electronics, Electronics & Communication Engineering, Computational mathematics, Image processing, Civil Engineering, Structural Engineering, Environmental Engineering, VLSI Testing & Low Power VLSI Design etc.
About TrueTime, Spanner, Clock synchronization, CAP theorem, Two-phase lockin...Subhajit Sahu
TrueTime is a service that enables the use of globally synchronized clocks, with bounded error. It returns a time interval that is guaranteed to contain the clock’s actual time for some time during the call’s execution. If two intervals do not overlap, then we know calls were definitely ordered in real time. In general, synchronized clocks can be used to avoid communication in a distributed system.
The underlying source of time is a combination of GPS receivers and atomic clocks. As there are “time masters” in every datacenter (redundantly), it is likely that both sides of a partition would continue to enjoy accurate time. Individual nodes however need network connectivity to the masters, and without it their clocks will drift. Thus, during a partition their intervals slowly grow wider over time, based on bounds on the rate of local clock drift. Operations depending on TrueTime, such as Paxos leader election or transaction commits, thus have to wait a little longer, but the operation still completes (assuming the 2PC and quorum communication are working).
Distributed computing is a field of computer science that studies distributed systems. A distributed system is a system whose components are located on different networked computers, which communicate and coordinate their actions by passing messages to one another from any system.
International Journal of Engineering and Science Invention (IJESI) is an international journal intended for professionals and researchers in all fields of computer science and electronics. IJESI publishes research articles and reviews within the whole field Engineering Science and Technology, new teaching methods, assessment, validation and the impact of new technologies and it will continue to provide information on the latest trends and developments in this ever-expanding subject. The publications of papers are selected through double peer reviewed to ensure originality, relevance, and readability. The articles published in our journal can be accessed online.
Final project report on grocery store management system..pdfKamal Acharya
In today’s fast-changing business environment, it’s extremely important to be able to respond to client needs in the most effective and timely manner. If your customers wish to see your business online and have instant access to your products or services.
Online Grocery Store is an e-commerce website, which retails various grocery products. This project allows viewing various products available enables registered users to purchase desired products instantly using Paytm, UPI payment processor (Instant Pay) and also can place order by using Cash on Delivery (Pay Later) option. This project provides an easy access to Administrators and Managers to view orders placed using Pay Later and Instant Pay options.
In order to develop an e-commerce website, a number of Technologies must be studied and understood. These include multi-tiered architecture, server and client-side scripting techniques, implementation technologies, programming language (such as PHP, HTML, CSS, JavaScript) and MySQL relational databases. This is a project with the objective to develop a basic website where a consumer is provided with a shopping cart website and also to know about the technologies used to develop such a website.
This document will discuss each of the underlying technologies to create and implement an e- commerce website.
Cosmetic shop management system project report.pdfKamal Acharya
Buying new cosmetic products is difficult. It can even be scary for those who have sensitive skin and are prone to skin trouble. The information needed to alleviate this problem is on the back of each product, but it's thought to interpret those ingredient lists unless you have a background in chemistry.
Instead of buying and hoping for the best, we can use data science to help us predict which products may be good fits for us. It includes various function programs to do the above mentioned tasks.
Data file handling has been effectively used in the program.
The automated cosmetic shop management system should deal with the automation of general workflow and administration process of the shop. The main processes of the system focus on customer's request where the system is able to search the most appropriate products and deliver it to the customers. It should help the employees to quickly identify the list of cosmetic product that have reached the minimum quantity and also keep a track of expired date for each cosmetic product. It should help the employees to find the rack number in which the product is placed.It is also Faster and more efficient way.
About
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
• Remote control: Parallel or serial interface.
• Compatible with MAFI CCR system.
• Compatible with IDM8000 CCR.
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
• Easy in configuration using DIP switches.
Technical Specifications
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
Key Features
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
• Remote control: Parallel or serial interface
• Compatible with MAFI CCR system
• Copatiable with IDM8000 CCR
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
Application
• Remote control: Parallel or serial interface.
• Compatible with MAFI CCR system.
• Compatible with IDM8000 CCR.
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
• Easy in configuration using DIP switches.
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxR&R Consult
CFD analysis is incredibly effective at solving mysteries and improving the performance of complex systems!
Here's a great example: At a large natural gas-fired power plant, where they use waste heat to generate steam and energy, they were puzzled that their boiler wasn't producing as much steam as expected.
R&R and Tetra Engineering Group Inc. were asked to solve the issue with reduced steam production.
An inspection had shown that a significant amount of hot flue gas was bypassing the boiler tubes, where the heat was supposed to be transferred.
R&R Consult conducted a CFD analysis, which revealed that 6.3% of the flue gas was bypassing the boiler tubes without transferring heat. The analysis also showed that the flue gas was instead being directed along the sides of the boiler and between the modules that were supposed to capture the heat. This was the cause of the reduced performance.
Based on our results, Tetra Engineering installed covering plates to reduce the bypass flow. This improved the boiler's performance and increased electricity production.
It is always satisfying when we can help solve complex challenges like this. Do your systems also need a check-up or optimization? Give us a call!
Work done in cooperation with James Malloy and David Moelling from Tetra Engineering.
More examples of our work https://www.r-r-consult.dk/en/cases-en/
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Dr.Costas Sachpazis
Terzaghi's soil bearing capacity theory, developed by Karl Terzaghi, is a fundamental principle in geotechnical engineering used to determine the bearing capacity of shallow foundations. This theory provides a method to calculate the ultimate bearing capacity of soil, which is the maximum load per unit area that the soil can support without undergoing shear failure. The Calculation HTML Code included.
2. CANONICAL PROBLEMS IN DISTRIBUTED SYSTEMS
Time ordering and clock synchronization
Election
Mutual exclusion
Distributed transactions
3. THE IMPORTANCE OF SYNCHRONIZATION
Because various components of a distributed
system must cooperate and exchange information,
synchronization is a necessity.
Constraints, both implicit and explicit, are therefore
enforced to ensure synchronization of components.
4. CLOCK SYNCHRONIZATION
As in non-distributed systems, the knowledge
of “when events occur” is necessary.
However, clock synchronization is often more
difficult in distributed systems because there
is no ideal time source.
Distributed algorithms must overcome:
Scattering of information
Local, rather than global, decision-making.
5. Conti....
Time is unambiguous in centralized systems
Distributed systems: each node has own
system clock.
Crystal-based clocks are less accurate (1 part in
million)
Problem: An event that occurred after another
may be assigned an earlier time
6. LACK OF GLOBAL TIME IN DS (Clock syn.)
It is impossible to guarantee that
physical clocks run at the same
frequency
Lack of global time, can cause problem.
Example: UNIX make
Edit output.c at a client
output.o is at a server (compile at server)
Client machine clock can be lagging behind
the server machine clock
7. LACK OF GLOBAL TIME – EXAMPLE
When each machine has its own clock, an
event that occurred after another event may
nevertheless be assigned an earlier time.
8. LOGICAL CLOCKS
Often, it is not necessary for a computer to know the exact
time, only relative time. This is known as “logical time”.
Logical time is not based on timing but on the ordering of
events.
Logical clocks can only advance forward, not in reverse.
Non-interacting processes cannot share a logical clock.
Computers generally obtain logical time using interrupts to
update a software clock. The more interrupts (the more
frequently time is updated), the higher the overhead.
9. LAMPORT’S LOGICAL CLOCK
SYNCHRONIZATION ALGORITHM
The most common logical clock synchronization algorithm
for distributed systems is Lamport‟s Algorithm. It is used in
situations where ordering is important but global time is not
required.
Based on the “happens-before” relation:
Event A “happens-before” Event B (A→B) when all
processes involved in a distributed system agree that
event A occurred first, and B subsequently occurred.
This DOES NOT mean that Event A actually occurred
before Event B in absolute clock time.
10. LAMPORT’S LOGICAL CLOCK SYNCHRONIZATION
ALGORITHM
A distributed system can use the “happens-before”
relation when:
Events A and B are observed by the same
process, or by multiple processes with the same
global clock
Event A acknowledges sending a message and
Event B acknowledges receiving it, since a
message cannot be received before it is sent
If two events do not communicate via messages,
they are considered concurrent – because order
cannot be determined and it does not matter.
Concurrent events can be ignored.
11. LAMPORT’S LOGICAL CLOCK SYNCHRONIZATION
ALGORITHM (CONT.)
In the previous examples, Clock C(a) < C(b)
If they are concurrent, C(a) = C(b)
Concurrent events can only occur on the same system,
because every message transfer between two systems
takes at least one clock tick.
In Lamport‟s Algorithm, logical clock values for events may
be changed, but always by moving the clock forward. Time
values can never be decreased.
12. LAMPORT’S LOGICAL CLOCK
SYNCHRONIZATION ALGORITHM (CONT.)
Lamport‟s Algorithm can thus be used in distributed
systems to ensure synchronization:
A logical clock is implemented in each node in
the system.
Each node can determine the order in which
events have occurred in that system’s own point
of view.
The logical clock of one node does not need to
have any relation to real time or to any other
node in the system.
13. PROCESS EACH WITH ITS OWN CLOCK
•At time 6 , Process 0 sends message A to Process 1
•It arrives to Process 1 at 16( It took 10 ticks to make journey
•Message B from 1 to 2 takes 16 ticks
•Message C from 2 to 1 leaves at
60 and arrives at 56 -Not Possible
•Message D from 1 to 0 leaves at
64 and arrives at 54 -Not Possible
14. LAMPORT’S ALGORITHM CORRECTS THE CLOCKS
Use „happened-before‟
relation
Each message carries the
sending time (as per sender‟s
clock)
When arrives, receiver fast
forwards its clock to be one
more than the sending time.
(between every two events,
the clock must tick at least
once)
15. PHYSICAL CLOCKS
The time difference between two computers is known as
drift. Clock drift over time is known as skew. Computer
clock manufacturers specify a maximum skew rate in their
products.
Computer clocks are among the least accurate modern
timepieces.
Inside every computer is a chip surrounding a quartz
crystal oscillator to record time. These crystals cost 25
seconds to produce.
Average loss of accuracy: 0.86 seconds per day
This skew is unacceptable for distributed systems. Several
methods are now in use to attempt the synchronization of
physical clocks in distributed systems:
16. PHYSICAL CLOCKS
17th Century: time has been measured
astronomically
Solar Day: interval between two consecutive
transit of sun
Solar Second: 1/86400th of solar day
17. PHYSICAL CLOCKS
1948: Atomic Clocks are invented
Accurate clocks are atomic oscillators (one part in 1013)
BIH decide TAI(International Atomic Time)
TAI seconds is now about 3 msec less than solar day
BIH solves the problem by introducing leap seconds
Whenever discrepancy between TAI and solar time grow to
800 msec
This time is called Universal Coordinated Time(UTC)
When BIH announces leap second, the power companies
raise their frequency to 61 & 51 Hz for 60 & 50 sec, to
advance all the clocks in their distribution area.
18. PHYSICAL CLOCKS - UTC
Coordinated Universal Time
(UTC) is the international
time standard.
UTC is the current term for
what was commonly
referred to as Greenwich
Mean Time (GMT).
Zero hours UTC is midnight in
Greenwich, England, which
lies on the zero longitudinal
meridian.
UTC is based on a 24-hour
clock.
19. CLOCK SYNCHRONIZATION
Each clock has a maximum drift rate
1- dC/dt <= 1+
Two clocks may drift by 2 t in time t
To limit drift to resynchronize after every
2 seconds
20. CHRISTIAN’S ALGORITHM
Assuming there is one time server with UTC(Coordinated universal
time):
Each node in the distributed system periodically polls the time server.
Time( treply) is estimated as t + (Treply + Treq)/2
This process is repeated several times and an average is provided.
Machine Treply then attempts to adjust its time.
Disadvantages:
Must attempt to take delay between server Treply andtime
server into account
Single point of failure if time server fails
21. CRISTIAN’S ALGORITHM
Synchronize machines to a
time server with a UTC
receiver
Machine P requests time from
server every seconds
Receives time t from
server, P sets clock to
t+treply where treply is the
time to send reply to P
Use (treq+treply)/2 as an
estimate of treply
Improve accuracy by
making a series of
measurements
22. PROBLEM WITH CRISTIAN’S ALGORITHM
Time must never run
backward
If sender‟s clock is
fast, CUTC will be
smaller than the
sender‟s current value
of C
Major Problem Minor Problem
It takes nonzero time
for the time server‟s
reply
This delay may be large
and vary with network
load
23. SOLUTION
Major Problem
Control the clock
Suppose that the timer set
to generate 100 intrpt/sec
Normally each interrupt
add 10 msec to the time
To slow down add only 9
msec
To advance add 11 msec to
the time
Minor Problem
Measure it
Make a series of
measurements for accuracy
Discard the measurements
that exceeds the threshold
value
The message that came
back fastest can be taken to
be the most accurate.
24. BERKELEY ALGORITHM
Used in systems without UTC receiver
Keep clocks synchronized with one another
One computer is master, other are slaves
Master periodically polls slaves for their times
Average times and return differences to slaves
Communication delays compensated as in Cristian‟s
algo
Failure of master => election of a new master
25. BERKELEY ALGORITHM
a)
b)
c)
The time daemon asks all the other machines for their clock values
The machines answer
The time daemon tells everyone how to adjust their clock
26. 30
DECENTRALIZED AVERAGING ALGORITHM
Each machine on the distributed system has a daemon
without UTC.
Periodically, at an agreed-upon fixed time, each machine
broadcasts its local time.
Each machine calculates the correct time by averaging
all results.
27. TERMINATION DETECTION
Detecting the end of a distributed computation
Notation: let sender be predecessor, receiver be successor
Two types of markers: Done and Continue
After finishing its part of the snapshot, process Q sends a
Done or a Continue to its predecessor
Send a Done only when
All of Q‟s successors send a Done
Q has not received any message since it check-pointed its local state
and received a marker on all incoming channels
Else send a Continue
Computation has terminated if the initiator receives Done
messages from everyone
28. DISTRIBUTED SYNCHRONIZATION
Distributed system with multiple processes may
need to share data or access shared data
structures
Use critical sections with mutual exclusion
Single process with multiple threads
Semaphores, locks, monitors
How do you do this for multiple processes in a
distributed system?
Processes may be running on different machines
Solution: lock mechanism for a distributed
environment
Can be centralized or distributed
29. CENTRALIZED MUTUAL EXCLUSION
Assume processes are numbered
One process is elected coordinator (highest ID
process)
Every process needs to check with coordinator
before entering the critical section
To obtain exclusive access: send request, await
reply
To release: send release message
Coordinator:
Receive request: if available and queue empty, send
grant; if not, queue request
Receive release: remove next request from queue and
send grant
30. MUTUAL EXCLUSION:
A CENTRALIZED ALGORITHM
a) Process 1 asks the coordinator for permission to enter a
critical region. Permission is granted
b) Process 2 then asks permission to enter the same critical
region. The coordinator does not reply.
c) When process 1 exits the critical region, it tells the
coordinator, when then replies to 2
31. PROPERTIES
Simulates centralized lock using blocking calls
Fair: requests are granted the lock in the order they were
received
Simple: three messages per use of a critical section
(request, grant, release)
Shortcomings:
Single point of failure
How do you detect a dead coordinator?
A process can not distinguish between “lock in use” from a dead
coordinator
No response from coordinator in either case
Performance bottleneck in large distributed systems
32. DISTRIBUTED ALGORITHM
[Ricart and Agrawala]: needs 2(n-1) messages
Based on event ordering and time stamps
Process k enters critical section as follows
Generate new time stamp TSk = TSk+1
Send request(k,TSk) all other n-1 processes
Wait until reply(j) received from all other processes
Enter critical section
Upon receiving a request message, process j
Sends reply if no contention
If already in critical section, does not reply, queue request
If wants to enter, compare TSj with TSk and send reply if TSk<TSj,
else queue
33. A DISTRIBUTED ALGORITHM
a)
b)
c)
Two processes want to enter the same critical region at the same
moment.
Process 0 has the lowest timestamp, so it wins.
When process 0 is done, it sends an OK also, so 2 can now enter
the critical region.
34. PROPERTIES
Fully decentralized
N points of failure!
All processes are involved in all decisions
Any overloaded process can become a
bottleneck
35. ELECTION ALGORITHMS
Many distributed algorithms need one process
to act as coordinator
Doesn‟t matter which process does the job, just
need to pick one
Election algorithms: technique to pick a unique
coordinator (aka leader election)
Examples: take over the role of a failed
process, pick a master in Berkeley clock
synchronization algorithm
Types of election algorithms: Bully and Ring
algorithms
36. BULLY ALGORITHM
Each process has a unique numerical ID
Processes know the Ids and address of every other
process
Communication is assumed reliable
Key Idea: select process with highest ID
Process initiates election if it just recovered from
failure or if coordinator failed
3 message types: election, OK, I won
Several processes can initiate an election
simultaneously
Need consistent result
O(n2) messages required with n processes
37. BULLY ALGORITHM DETAILS
Any process P can initiate an election
P sends Election messages to all process with
higher Ids and awaits OK messages
If no OK messages, P becomes coordinator and
sends I won messages to all process with lower Ids
If it receives an OK, it drops out and waits for an I
won
If a process receives an Election msg, it returns an
OK and starts an election
If a process receives a I won, it treats sender an
coordinator
38. BULLY ALGORITHM EXAMPLE
The bully election algorithm
Process 4 holds an election
Process 5 and 6 respond, telling 4 to stop
Now 5 and 6 each hold an election
40. RING-BASED ELECTION
Processes have unique Ids and arranged in a logical ring
Each process knows its neighbors
Select process with highest ID
Begin election if just recovered or coordinator has failed
Send Election to closest downstream node that is alive
Sequentially poll each successor until a live node is found
Each process tags its ID on the message
Initiator picks node with highest ID and sends a coordinator
message
Multiple elections can be in progress
Wastes network bandwidth but does no harm
42. A TOKEN RING ALGORITHM
a)
b)
An unordered group of processes on a network.
A logical ring constructed in software.
• Use a token to arbitrate access to critical section
• Must wait for token before entering CS
• Pass the token to neighbor once done or if not interested
• Detecting token loss in non-trivial
43. COMPARISON
A comparison of three mutual exclusion
algorithms.
Algorithm
Messages per
entry/exit
Delay before entry (in
message times) Problems
Centralized 3 2 Coordinator crash
Distributed 2 ( n – 1 ) 2 ( n – 1 )
Crash of any
process
Token ring 1 to 0 to n – 1
Lost token, process
crash
44. TRANSACTIONS
Transactions provide higher
level mechanism for atomicity
of processing in distributed
systems
Have their origins in databases
Banking example: Three
accounts A:$100, B:$200,
C:$300
Client 1: transfer $4 fromA to
B
Client 2: transfer $3 from C to
B
Result can be inconsistent
unless certain properties are
Client 1 Client 2
Read A:$100
Write A: $96
Read C: $300
Write C:$297
Read B: $200
Read B: $200
Write B:$203
Write B:$204
45. Trans..ACID PROPERTIES
Atomic: all or nothing
Consistent: transaction takes
system from one consistent
state to another
Isolated: Immediate effects
are not visible to other
(serializable)
Durable: Changes are
permanent once transaction
completes (commits)
Client 1 Client 2
Read A:$100
Write A: $96
Read B: $200
Write B:$204
Read C: $300
Write C:$297
Read B: $204
Write B:$207