synchronization

What will it take for Transactional Memory to be viable?

痞子三分冷 提交于 2019-12-04 11:00:49
I've been doing some work on transactional memory and its viability for systems programming (databases, operating systems, servers, etc.). My own experience employing transactions, together with having seen how few communities use transactions in real code, has raised a question: What would convince you, a developer writing production code, to employ transactional memory in your work? Would it be general adoption? High speed? Improved reliability? By how much? For those that haven't seen them, memory transactions act like database transactions: operations proceed (apparently) in parallel, and

WinForms multithreading issue

孤者浪人 提交于 2019-12-04 10:56:59
Ive got a thread that does some work in the background and passes updates to the Form using the Invoke, BeginInvoke methods. The thread is created after the form is displayed so no issue there. The issue is how to correctly shutdown. My worker thread has the ability to be asked to exit, and will exit some time soon after that (miliseconds). However if the form has closed first the Invoke stuff breaks. I tried adding a Thread.Join to the forms closing event, but of course this causes a deadlock, even for BeginInvoke since somhow a Thread.Join blocks a BeginInvoke on that thread... What is the

Java synchronization between different JVMs

别等时光非礼了梦想. 提交于 2019-12-04 10:38:29
问题 The project I am working on would trigger various asynchronous jobs to do some work. As I look into it more these asynchronous jobs are actually being run as separate JVMs (separate java processes). Does it mean I would not be able to use any of the following if I need to synchronize between these processes: synchronized methods/blocks any lock that implements java.util.concurrent.locks Because it seems to me they are all thread-level? Does Java provide support for IPC like semaphores between

How to synchronize TPL Tasks, by using Monitor / Mutex / Semaphore? Or should one use something else entirely?

柔情痞子 提交于 2019-12-04 10:03:03
I'm trying to move some of my old projects from ThreadPool and standalone Thread to TPL Task , because it supports some very handy features, like continuations with Task.ContinueWith (and from C# 5 with async\await ), better cancellation, exception capturing, and so on. I'd love to use them in my project. However I already see potential problems, mostly with synchronization. I've written some code which shows a Producer / Consumer problem, using a classic stand-alone Thread : class ThreadSynchronizationTest { private int CurrentNumber { get; set; } private object Synchro { get; set; } private

How to synchronize media playback over an unreliable network?

旧街凉风 提交于 2019-12-04 09:37:07
问题 I wish I could play music or video on one computer, and have a second computer playing the same media, synchronized. As in, I can hear both computers' speakers at the same time, and it doesn't sound funny. I want to do this over Wi-Fi, which is slightly unreliable. Algorithmically, what's the best approach to this problem? EDIT 1 Whether both computers "play" the same media, or one "plays" the media and streams it to the other, doesn't matter to me. I am certain this is a tractable problem

C++ Access to vector from multiple threads

徘徊边缘 提交于 2019-12-04 09:34:05
In my program I've some threads running. Each thread gets a pointer to some object (in my program - vector). And each thread modifies the vector. And sometimes my program fails with a segm-fault. I thought it occurred because thread A begins doing something with the vector while thread B hasn't finished operating with it? Can it bee true? How am I supposed to fix it? Thread synchronization? Or maybe make a flag VectorIsInUse and set this flag to true while operating with it? vector , like all STL containers, is not thread-safe. You have to explicitly manage the synchronization yourself. A std:

Using a central database server for many sites: plausible?

淺唱寂寞╮ 提交于 2019-12-04 09:26:50
Basically, I need some parts of database data synchronized on up to several dozens of sites. The perfect solution would be creating a central server to host that data. Each pageload will have to fetch data from both database servers - the local and remote one and writes to the remote server will be quite common too. While the db server can be as fast as desired hardware-wise, I'm cautious of the bottlenecks: Multiple database connections must be established on each pageload. Latency of the signal traveling between two physical locations. Am I right to worry? Would it be wiser to synch the

Audio Sync problems using DirectShow.NET

若如初见. 提交于 2019-12-04 09:24:28
I have started a thread on this at DirectShow.NET's forum, here is the link http://sourceforge.net/projects/directshownet/forums/forum/460697/topic/5194414/index/page/1 but unfortunately the problem still persists... I have an application that captures video from a webcam and audio from the microphone and save it to a file, for some reason the audio and video are never in-sync, i tried the following: 1. Started with ffdshow encoder and changed to AVI Mux - problem persists, audio is delayed and at the end of the video the picture remains frozen and the audio continues 2. Changed from AVI Mux

iOS: Synchronizing frames from camera and motion data

為{幸葍}努か 提交于 2019-12-04 09:03:39
I'm trying to capture frames from camera and associated motion data. For synchronization I'm using timestamps. Video and motion is written to a file and then processed. In that process I can calculate motion-frames offset for every video. Turns out motion data and video data for same timestamp is offset from each other by different time from 0.2 sec up to 0.3 sec. This offset is constant for one video but varies from video to video. If it was same offset every time I would be able to subtract some calibrated value but it's not. Is there a good way to synchronize timestamps? Maybe I'm not

locking a resource via lock within try. Is it wrong?

旧城冷巷雨未停 提交于 2019-12-04 08:58:52
问题 Is there anything wrong with using lock with a try block? I remember reading somewhere that we should always try to put minimum amount of code within try block and lock itself internally uses a try-finally block, do you guys see something wrong here.I need to deal with the fact that the code within that lock block can throw exception try { lock(syncblk) { // do some processing } } catch(Exception e) { // do something with exception } 回答1: I need to deal with the fact that the code within that