4 Solved Topics

Remove Filter
Member Avatar for
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 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 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.