LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 01-30-2009, 08:37 AM   #1
manolakis
Member
 
Registered: Nov 2006
Distribution: xubuntu
Posts: 376

Rep: Reputation: 30
Java Clock Synchronization in a Distributed System


Hi there,

I would be glad if anyone could give me an idea how clocks can be synchronized in a distributed system.

Thank you.
 
Old 01-30-2009, 08:40 AM   #2
jimbo1954
Member
 
Registered: Oct 2006
Location: High Wycombe, Bucks, UK.
Distribution: Debian and Fedora Core in equal measure
Posts: 258

Rep: Reputation: 33
Java Clock Synchronisation

First thing to do is to run NTP, Network Time Protocol, on each system in the network, and point the NTP daemon towards a network time source. This will ensure that all systems in your network have the same clock time. From this, if Java uses the system clock on the host upon which it runs, all Java processes will run to the same clock.

HTH!
 
Old 01-31-2009, 06:59 AM   #3
manolakis
Member
 
Registered: Nov 2006
Distribution: xubuntu
Posts: 376

Original Poster
Rep: Reputation: 30
jimbo1954,

Thanks for your reply. Because I am not good in networking could you please explain me this a little more. In particular, can you please tell me how it is possible as you said to make each system to point to the NTP daemon towards a network time source using a Java program.


Thank you.
 
Old 02-01-2009, 04:21 PM   #4
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi, manolakis -

It's not a Java issue, it's not a network issue - it's a simple system configuration issue. Just go into your system management GUI (for example, Yast2 on Suse Linux) and configure "network time" (aka "NTP client").

For example:
http://www-uxsup.csx.cam.ac.uk/pub/d...xntp.yast.html

.. or ..

http://www.cyberciti.biz/faq/set-dat...-protocol-ntp/

.. or ..

http://www.debianadmin.com/keeping-y...tocol-ntp.html
 
Old 02-03-2009, 03:06 AM   #5
jimbo1954
Member
 
Registered: Oct 2006
Location: High Wycombe, Bucks, UK.
Distribution: Debian and Fedora Core in equal measure
Posts: 258

Rep: Reputation: 33
Beat me to it!

Thanks to PaulSM4, for a very complete answer...sorry I didn't get back before, but it snowed, and here in the UK, when it snows, our transport systems fail, so I didn't get near a PC for a couple of days

Later!
 
Old 02-03-2009, 09:33 AM   #6
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,397

Rep: Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114
ntp is the "network time protocol." Various companies and government agencies run atomic clocks, and they publish a time-synchronization service.

For instance, my computers synchronize with time.nist.gov (or a couple of backup servers).

Now... let's say that you had several hundred servers to deal with. You might not want every one of them to be pinging time.nist.gov to get their time-of-day. (That would be a lot of traffic, and it would presuppose the existence of an open channel to the Internet.) What you'd probably prefer to do, instead, is to have one or two computers on your internal network which synchronize themselves with one of these known-good external sources; and then act as a time-synchronization service for the rest of the internal network.

In fact, this is very common. In a Windows network, say, the "domain controller" computer(s) act as an authoritative time-source for the internal sub-network that they control.

All computers provide this time-synchronization capability and they do it the same way.

A user-level program (in Java or what-have-you) not only doesn't maintain the system time-clock; it isn't allowed to do so.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Failed to set system clock to hardware clock jrtayloriv Linux - Newbie 2 09-25-2008 07:06 AM
hardware-clock synchronization fariborz Programming 3 05-02-2008 07:54 AM
clock synchronization rasejo Linux - General 12 07-12-2007 06:53 PM
Slow system clock and stray hardware clock, pleas help! Epox Linux - General 6 01-02-2007 02:43 PM


All times are GMT -5. The time now is 06:03 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration