synchronization

Client-server synchronization pattern / algorithm?

I have a feeling that there must be client-server synchronization patterns out there. But i totally failed to google up one. Situation is quite simple - server is the central node, that multiple clients connect to and manipulate same data. Data can be split in atoms, in case of conflict, whatever is on server, has priority (to avoid get...

Equivalent code for instance method synchronization in Java

While discussing a Java synchronization question, someone made a comment that the following snippets are not equivalent (and may compile to different bytecodes): public synchronized void someMethod() { //stuff } and public void someMethod() { synchronized (this) { //stuff } } Are they equivalent? ...

Best way to instantly mirror/sync files from Windows to Linux server

I have a directory on a Windows machine with a large number of files and folders that I need to watch and have the files mirrored/synced instantly (or as near to as possible), to a Linux machine over the local network. I've investigated: - Rsync, not realtime enough - WinSCP 'Keep directories up to date' feature, which was OK but limite...

Should you lock resources when reading values?

When doing thread synchronization in C# should I also lock an object when I read a value or just changing it? for example I have Queue<T> object. Should I just lock it when doing the Enqueue and Dequeue or should I also lock it when checking values like Count? ...

Distributed time synchronization and web applications.

Hi there, I'm currently trying to build an application that inherently needs good time synchronization across the server and every client. There are alternative designs for my application that can do away with this need for synchronization, but my application quickly begins to suck when it's not present. In case I am missing something,...

What strategy do you use to sync your code when working from home

At my work I currently have my development environment inside a Virtual Machine. When I need to do work from home I copy my VM and any databases I need onto a laptop drive sized external USB drive. After about 10 minutes of copying I put the drive in my pocket and head home, copy back the VM and databases onto my personal computer and I'...

FIFO queue synchronization

Should FIFO queue be synchronized if there is only one reader and one writer? ...

Avoid synchronized(this) in Java?

Whenever a question pops up on SO about Java synchronization, some people are very eager to point out that synchronized(this) should be avoided. Instead, they claim, a lock on a private reference is to be preferred. Some of the given reasons are: some evil code may steal your lock (very popular this one, also has an "accidentally" var...

PostMessage occasionally loses a message

I wrote a multi-threaded windows application where thread: A – is a windows form that handles user interaction and process the data from B. B – occasionally generates data and passes it two A. A thread safe queue is used to pass the data from thread B to A. The enqueue and dequeue functions are guarded using a windows critica...

Locking HttpRuntime.Cache for lazy loading

We have a website running .NET 2.0 and have started using the ASP.Net HttpRuntime.Cache to store the results of frequent data lookups to cut down our database access. Snippet: lock (locker) { if (HttpRuntime.Cache[cacheKey] == null) { HttpRuntime.Cache.Insert(cacheKey, GetSomeDataToCache(), null, DateTime.Today.AddDa...

Recommended books on concurrency / synchronization mechanisms

Do you guys know a more theoretical book/articles about concurrent access / sync methods? I am mostly interested of how semaphores, mutexes and other synchronization mechanisms are implemented. I did grasp the basics of Steven's second volume of Unix Network Programming, but I feel that I need something more abstract to really get the o...

What are synchronizing strategies for Prevayler?

Prevayler guarantees that all the writes ( through its transactions) are synchronized. But what about reads? Is it right that dirty reads are possible if no explicit synchronizing is used (in user code)? Are they possible if a business object is read as: // get the 3rd account Accont account = (Bank)prevayler.prevalentSystem().getAc...

Syncronize two databases schema in MySQL

I was looking for a portable script or command line program that can syncronize two MySQL databases schema. I am not looking for a GUI based solution because that can't be automated or run with the buid/deployment tool. Basically what it should do is scan database1 and database2. Check the schema difference (tables and indexes) and prop...

JTree gives ArrayIndexOutOfBoundsException?

I try to dynamically add nodes to a Java Swing JTree, and the user should be able to browse and to collapse hierarchy while nodes are constantly added. When I add a Thread.sleep(10) in my loop, it works fine; but this is a dirty hack... Here is the stripped down code that triggers this problem. Whenever I run this and doubleclick on the...

When does windows signal a process handle?

I have a self upgrade process implemented where my main application exe launches an updater exe passing a handle to itself on the command line. The application exe then calls ExitProcess to exit, and the updater calls WaitForSingleObject on the passed in handle to wait for the application exe to terminate. The WaitForSingleObject does w...

How can I synchronize two processes accessing a file on a NAS?

Here's the thing: I have two applications, written in C++ and running on two machines with different OS (one Linux and one Windows). One of this process is in charge of updating an XML file on a NAS (Network Attached Storage) while the other one reads this file. Is it possible to synchronize these two processes in order to avoid readin...

Most bandwidth efficient unidirectional synchronise (server to multiple clients)

What is the most bandwidth efficient way to unidirectionally synchronise a list of data from one server to many clients? I have sizeable chunk of data (perhaps 20,000, 50-byte records) which I need to periodically synchronise to a series of clients over the Internet (perhaps 10,000 clients). Records may added, removed or updated only at...

fine db comparer program for mysql

working with ms sql I have several tools I use to compare DB structure and data, like sql-compare, sql-delta, SqlClarity Effects, etc... is there some equivalent program for mysql??? I need a programa that can show me differences and, if possible, prepare the synchronize scripts... if it's free it would be better... ...

How to lock a file on different application levels?

Here's the scenario: I have a multi threaded java web application which is running inside a servlet container. The application is deployed multiple times inside the servlet container. There are multiple servlet containers running on different servers. Perhaps this graph makes it clear: server1 +- servlet container +- application1 ...

Modifying files on remote Ubuntu server from Windows PC

I am developing some Python programs that I'm running on a remote Ubuntu Linux server (hosted on Slicehost). I would like to work on the source in an IDE on my Windows Vista PC, and have all file modifications sent directly to the Linux box without my intervention (i.e. without having to manually SFTP the files each time I change them). ...