13 Topics

Member Avatar for
Member Avatar for saurabh.mehta.33234

I am trying to learn Volatile keyword in Multi Threading and I came across this statement: *Volatile is preferred in cases when one thread reads and writes a shared variable and other threads just read the same. Whereas if there are more than 2 threads performing read and write both …

Member Avatar for JamesCherrill
0
207
Member Avatar for saurabh.mehta.33234

I am trying to understand the SynchronizedMap and I ran the below code. I get the below Output with an exception. According to my understanding the exception is caused when the get() methods are trying to access the syncmap when a thread is still executing a write on the map …

Member Avatar for JamesCherrill
0
671
Member Avatar for saurabh.mehta.33234

I am trying to run the below concurrency code: import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; public class TestThread { public static void main(final String[] arguments) throws InterruptedException { ExecutorService executor = Executors.newSingleThreadExecutor(); try { executor.submit(new Task()); System.out.println("Shutdown executor"); executor.shutdown(); executor.awaitTermination(5, TimeUnit.SECONDS); } catch (InterruptedException e) { System.err.println("tasks interrupted"); } finally …

Member Avatar for JamesCherrill
0
419
Member Avatar for fo2sh

Hello, I am running a software on a Linux machine, I am synchronizing time via default ntpd configurations available in Linux (/etc/ntp.conf). I am connecting to the customer NTP server. Now i was requested to tell which synchronization type is used on my machine (Frequency Synchronization/ Time Synchronization or Time-of-day …

Member Avatar for rproffitt
0
516
Member Avatar for nitin1

Hey, I have been reading Java oracle tutorials. I read this thing. Suppose, for example, class MsLunch has two instance fields, c1 and c2, that are never used together. All updates of these fields must be synchronized, but there's no reason to prevent an update of c1 from being interleaved …

Member Avatar for JamesCherrill
0
271
Member Avatar for moaz.amin.37

Hello to all first look this code class Square1 implements Runnable{ int a; public void run(){ a=10; } } class Square2 implements Runnable{ Square1 ob=new Square1(); public void run(){ System.out.println("Square Of this number is = "+(ob.a*ob.a)); } } class SquareThread{ public static void main(String args[]){ Thread t1=new Thread(new Square1()); Thread …

Member Avatar for moaz.amin.37
0
1K
Member Avatar for rchawdhari

Hello all, My master master synchronization working properly but from yesterday after 4pm my sinking get stopped. My uplink working properly but downlink not working.I failed to found any issues. Please tell me why such master master get stopped and any solution for it.

Member Avatar for hericles
0
150
Member Avatar for nikolaos

In the following example two threads share int counter. The increment_thread thread increases counter by one . The decrement_thread thread decreases counter by one . I use semaphore to control access to counter instead of making the two methods synchronized. Is this the proper way of using semaphore? When should …

Member Avatar for nikolaos
0
382
Member Avatar for ManthanB

Hi freinds i have developed a sync service by using MS sync SDK. It was working fine few days before but its not working. It does not showing any error in log. Please friends let me know if you are having useful suggestios to make the thing working. Thanks in …

Member Avatar for LastMitch
0
204
Member Avatar for rgrs2007

Hi I am new to this forum and i was just wondering if the following scenario is implementable. Suppose a thread is reading a file and dividing it into chunks of data(lets say in the form of arraylist, where each line corresponds to a value in arraylist). Each chunk of …

Member Avatar for JamesCherrill
0
296
Member Avatar for karandeepmalik

I was looking at the possible solution to synchronise a bounded buffer ( like queue) using condition variables and think that we probably need two condition variables to correctly implement the synchronisation, one condition varaible will have a queue where the consumer thread(s) will be waiting to see if the …

Member Avatar for rubberman
0
221
Member Avatar for Ard26

Hi, I'm trying to synchronize two processes but I get a deadlock that I can't manage to solve. To be more specific, my program has to do the following: 1. Parent creates a process and waits using sigsuspend. 2. Child creates a process. 3. Grandchild performs an execvp and gets …

Member Avatar for I_m_rude
0
238
Member Avatar for rahul.ch

Here when I execute the program, the output I'm getting on all the tries is 342 (naturally first 34 prints together then 2 seconds later 2 prints). My doubts is that is the order of start() [x.start() followed by y.start()] important in order of execution? Shouldn't the output be 234? …

Member Avatar for rahul.ch
0
262

The End.