LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-08-2007, 06:38 PM   #1
xeon123
Member
 
Registered: Sep 2006
Posts: 374

Rep: Reputation: 16
Java concurrency


1 - In programming, especially in threads, there's the term "happens-before relationship". Does anyone know what it means? How can we establish a "happens-before relationship" between two threads?

2 - Does Sun Java VM, or any other java VM can switch the order of instructions? If so, what's the reason?
For example;
int a = 0;
int b = 1;
a = b;

becoming,

int a = 0;
a = b;
int b = 1;

Isn't it an error-prone situation?

Thanks,
Pedro
 
Old 07-08-2007, 09:00 PM   #2
IBall
Senior Member
 
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088

Rep: Reputation: 62
Is this homework? We are not allowed to help with homework.

I would suggest getting a good book on Java programming, which should include a section on concurrency.

I don't think the Java VM will switch the order of the instructions, the main issue with concurrency is the instruction being interrupted mid-way through.

--Ian
 
Old 07-09-2007, 05:13 AM   #3
xeon123
Member
 
Registered: Sep 2006
Posts: 374

Original Poster
Rep: Reputation: 16
This isn't homework. It's just a question, that I saw google videos and I didn't understand, how to relate an "happens-before relationship" between two threads.

Thanks,
 
Old 07-09-2007, 05:18 AM   #4
xeon123
Member
 
Registered: Sep 2006
Posts: 374

Original Poster
Rep: Reputation: 16
For the second question, if you want, please see the following video:

http://video.google.com/videoplay?do...arch&plindex=1
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i let dhclient3 run at a later runlevel with concurrency active? MrInept Debian 6 03-29-2007 08:33 AM
LXer: Java news met with cautious optimism in free Java community LXer Syndicated Linux News 0 11-14-2006 10:21 PM
Postfix Concurrency Problem redwolf3 Linux - Software 1 04-13-2005 09:54 AM
qmail low concurrency problem -- SLOW! PLEASE HELP mrtwice Linux - Software 0 06-26-2003 02:41 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration