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
5
votes
1 answer

How synchronized keyword in java have been implemented?

I'm reading operating system and I came across several problems for inter-process communication. These can be solved by using monitor concepts which java provide via synchronized keyword. I wish to know how synchronized keyword have been…
sriram
  • 8,562
  • 19
  • 63
  • 82
5
votes
3 answers

Auto Sync Azure Blob to local file system

I would like to know if there is a way through which I can auto-sync an Azure blob to the local file system, so that whenever a blob gets added to a container an event is fired so it can be downloaded to a local folder. So far I can sync from the…
5
votes
1 answer

Why does MSDN sample from Threading Tutorial crash?

From sample example 4 of MSDN "Threading Tutorial" Following code errors out at the line commented with "---errors is here---". What is wrong? using System; using System.Threading; public class MutexSample { static Mutex gM1; static Mutex…
5
votes
1 answer

Shared memory objects synchronization

I want to create a simple Tic Tac Toe game, to be played between users of a SAP system. I have a CL_TTT_MANAGER class with a SIGNUP method that assigns players to a game. My class is a shared-memory enabled class, because it's purpose is to…
vlad-ardelean
  • 7,480
  • 15
  • 80
  • 124
5
votes
4 answers

Java: What is the different between AtomicBoolean and a static boolean variable when locking a thread?

I write a thread class called T. My purpose is to make sure only one thread object running at a time. So when the thread object is called, it would check a boolean flag called BUSY. My question is what is the different between private static…
Hexor
  • 525
  • 1
  • 8
  • 22
5
votes
4 answers

Atomic write to multiple files

Suppose I have a set of files. How do I ensure that writing to all these files is atomic. I thought about writing to temp files and only after the writing is successful, perform an atomic rename of each file. However renaming all the files at once…
Alex Ksikes
  • 369
  • 2
  • 11
5
votes
6 answers

C program - checking whether two enums are in sync at compile time

The problem that I have is that I have two enums in two different files which should have the same sets of constants (two different processes are generated by the two files along with other files). I want the enums to be in sync i.e. when some one…
Sajiv Selvaraj
5
votes
3 answers

Creating a cross-computer mutex using SQL Server

I have a few computers using the same database (SQL Server 2008) I'm trying to synchronize a task between all these computers using the database. Each task is represented by a guid that is the lock-id (if comparing to Mutex, that would be the Mutex…
Roy Reznik
  • 2,040
  • 4
  • 22
  • 28
5
votes
4 answers

Behaviour of TMultiReadExclusiveWriteSynchronizer when promoting read-lock to write-lock

How can I achieve a synchronization structure like that: Lock.BeginRead try if Changed then begin Lock.BeginWrite; try Update; finally Lock.EndWrite; end; // ... do some other stuff ... end; finally …
jpfollenius
  • 16,456
  • 10
  • 90
  • 156
5
votes
2 answers

Cannot sync with MacPorts from SVN

Running 10.7.4, I ran the following: mkdir -p /opt/mports cd /opt/mports svn checkout https://svn.macports.org/repository/macports/trunk cd trunk/base ./configure --enable-readline make sudo make install make distclean Then I ran nano…
Spoony
  • 51
  • 4
5
votes
4 answers

Synchronized data read/write to/from main memory

When a synchronized method is completed, will it push only the data modified by it to main memory, or all the member variables, similarly when a synchronized method executes, will it read only the data it needs from main memory or will it clear all…
5
votes
1 answer

Synchronizing client-side and server-side times

I have a webservices that collects realtime market data and displays it in a web frontend. My frontend (jQuery) needs to display a clock, somewhat synchronized with the server clock (+- a few seconds is fine). I was thinking of delivering a UTC…
user1094786
  • 6,402
  • 7
  • 29
  • 42
5
votes
1 answer

What are the various ways by which the 'this' can escape in Java?

There is a question on Stack Overflow on why starting a thread inside the constructor is not a good idea . I realised that the result of such a thing will be that 'this' can escaped.I also read that publishing a EventListener from constructor is…
Inquisitive
  • 7,476
  • 14
  • 50
  • 61
5
votes
6 answers

What happens if synchronization variable is reassigned in java?

What happens in the following code? Does the synchronization work? This is an interview question. class T { public static void main(String args[]) { Object myObject = new Object(); synchronized (myObject) { …
codefx
  • 9,872
  • 16
  • 53
  • 81
5
votes
1 answer

File sync with node.js: unision== tcp==node-----[http]-----node==tcp==unison

If you have node running and I have node running, has anyone seen a solution that will allow us to keep a set of files in sync. Synchronisation is complicated, so I thought that could be left to a tool like unison (which is like rsync) and then all…