Questions tagged [synchronization]

Synchronization refers to using controls to maintain a coherent representation, either a group of processes running the same program (process synchronization), or representations of data (data synchronization).

In computer science, synchronization refers to one of two distinct but related concepts: synchronization of processes, and synchronization of data. Process synchronization refers to the idea that multiple processes are to join up or handshake at a certain point, so as to reach an agreement or commit to a certain sequence of action. Data synchronization refers to the idea of keeping multiple copies of a dataset in coherence with one another, or to maintain data integrity. Process synchronization primitives are commonly used to implement data synchronization.

-from Synchronization (computer science) - Wikipedia

12446 questions
56
votes
1 answer

How to Synchronize Android Database with an online SQL Server?

I am developing an Android App that stores different types of data in the built-in SQLite provided by the Android Platform. Inside the App I have placed a "Sync" button which is supposed to Sync the data between the local SQLite Database, with an…
Wassim Taher
  • 966
  • 1
  • 9
  • 26
55
votes
11 answers

Do lock-free algorithms really perform better than their lock-full counterparts?

Raymond Chen has been doing a huge series on lockfree algorithms. Beyond the simple cases of the InterlockedXxx functions, it seems like the prevailing pattern with all of these is that they implement their own locks. Sure, there are not processor…
Billy ONeal
  • 104,103
  • 58
  • 317
  • 552
53
votes
6 answers

Difference between Hashtable and Collections.synchronizedMap(HashMap)

As far as I know, java.util.Hashtable synchronizes each and every method in the java.util.Map interface, while Collections.synchronizedMap(hash_map) returns a wrapper object containing synchronized methods delegating calls to the actual hash_map…
Vinoth Kumar C M
  • 10,378
  • 28
  • 89
  • 130
52
votes
3 answers

How Do I Sync My Sublime Text 3 Settings Using Dropbox?

I would like to sync Sublime Text 3's Settings across multiple machines using Dropbox. How should I set this up?
Undistraction
  • 42,754
  • 56
  • 195
  • 331
51
votes
3 answers

What is the most clever and easy approach to sync data between multiple entities?

In today’s world where a lot of computers, mobile devices or web services share data or act like hubs, syncing gets more important. As we all know solutions that sync aren’t the most comfortable ones and it’s best not to sync at all. I’m still…
Rafael Bugajewski
  • 1,702
  • 3
  • 22
  • 37
50
votes
4 answers

What feature corresponds to 'synchronized' in Java?

synchronized in Java can guarantee thread-safety when accessing a shared object. What about C++?
Don Lun
  • 2,717
  • 6
  • 29
  • 35
50
votes
3 answers

How pthread_mutex_lock is implemented

I am just curious to know how functions related to synchronization between threads are implemented inside Unix. For example, what happens when I call pthread_mutex_lock? Are there any pointers in use? A reference to the source code would really…
avd
  • 13,993
  • 32
  • 78
  • 99
49
votes
6 answers

std::mutex performance compared to win32 CRITICAL_SECTION

how does the performance of std::mutex compared to CRITICAL_SECTION? is it on par? I need lightweight synchronization object (doesn't need to be an interprocess object) is there any STL class that close to CRITICAL_SECTION other than std::mutex ?
uray
  • 11,254
  • 13
  • 54
  • 74
49
votes
8 answers

How to make a multiple-read/single-write lock from more basic synchronization primitives?

We have found that we have several spots in our code where concurrent reads of data protected by a mutex are rather common, while writes are rare. Our measurements seem to say that using a simple mutex seriously hinders the performance of the code…
sbi
  • 219,715
  • 46
  • 258
  • 445
49
votes
7 answers

Ensure that Spring Quartz job execution doesn't overlap

I have a Java program that executes from Spring Qquartz every 20 seconds. Sometimes it takes just few seconds to execute, but as data gets bigger I'm sure it run for 20 seconds or more. How can I prevent Quartz from firing/triggering the job while…
ant
  • 22,634
  • 36
  • 132
  • 182
46
votes
13 answers

How to synchronize development and production database

Do you know any applications to synchronize two databases - during development sometimes it's required to add one or two table rows or new table or column. Usually I write every sql statement in some file and during uploading path I evecute those…
pbrodka
  • 1,137
  • 1
  • 11
  • 23
46
votes
3 answers

Is it safe for more than one goroutine to print to stdout?

I have multiple goroutines in my program, each of which makes calls to fmt.Println without any explicit synchronization. Is this safe (i.e., will each line appear separately without data corruption), or do I need to create another goroutine with…
Taymon
  • 24,950
  • 9
  • 62
  • 84
46
votes
4 answers

getJSON Synchronous

GOAL: What I'm after is to get data from database and refresh main.php (more evident through draw_polygon) every time something is added in database (after $.ajax to submit_to_db.php). So basically I have a main.php that will ajax call another php…
Fred
  • 595
  • 2
  • 5
  • 12
45
votes
7 answers

Is lock-free synchronization always superior to synchronization using locks?

In C++, there is one atomic type std::atomic. This atomic type may be lock-free or maybe not depending on the type T and on the current platform. If a lock-free implementation for a type is available in a platform for a type T, then most…
Sourav Kannantha B
  • 2,860
  • 1
  • 11
  • 35
45
votes
1 answer

Thread Safe Singletons in Java

The wikipedia article on Singletons mentions a few thread safe ways to implement the structure in Java. For my questions, let's consider Singletons that have lengthy initialization procedures and are acccessed by many threads at once. Firstly, is…
donnyton
  • 5,874
  • 9
  • 42
  • 60