June 13, 2008
I found a nice entry about three important concepts in concurrent programming by Jeremy Manson.
http://jeremymanson.blogspot.com/2007/08/atomicity-visibility-and-ordering.html
atomicity, visibility and ordering…
I wanted to add some extras: side effects of optimizations and data duplications .
These two sources of evils play an important role on concurrent programing.
-
Atomicity is important for data integrity.
When objects transit from one state to other,
they should not expose the moment in which invariants are broken.
girl comes in to the room and catch her boyfriend
he was half-naked and hugging another girl.
she got pretty upset and run away without saying anything.
but however it was a misunderstanding,
there wont be any problem if she was there a few seconds before or few seconds later.
Another prominent area of the concept is Databases.
Database programmers use transactions and transaction isolation levels,
to achive both acceptable correctness and performance.
This sort of problems are hard to figure out,
but they have logical explanations in source-code-level.
-
Visibility is a hidden enemy.
In source-code-level, there is not any reason why it happens.
But it’s related both optimizations and hardware-design.
There are several levels of memories.
Fastest ones are more expensive and they are embedded into cpu.
If data resides on the fast one, code will run faster.
So it’s desirable, compilers get benefit of that fast memory as well as much.
But since this special memory is very limited in size,
most of the code will reside on slow memory.
Parts of data will be copied to faster memory on demand,
processed(probaby changed) and copied back to the slower one.
This means : our data is duplicated between different kind of memories in runtime.
( also computers may have more than one cpu, means more duplications. )
Altough it does not cause any problem in single-threaded applications.
Concurrent applications are not protected by default.
Without proper syncronization, threads may see the stale data.
-
Ordering another result of optimization.
Compiler re-organizes the instructions into more efficient ones.
It’s understandable, we mostly re-organize instructions in daily-life.
mom’s shopping instructions :
- buy 6 eggs.
- buy 3 package of margarine.
- buy 1 bread.
- buy 6 eggs more.
- leave back 2 packages of margarines, it’ too much.
- buy 1 bread more.
actual shopping list:
- 2 breads (i buy them first, becos they are in the enterance.)
- 12 eggs.
- 1 package of margarine.
I want to suggest this great book for java developers,
i was totally blind before reading it.
http://www.amazon.com/Java-Concurrency-Practice-Brian-Goetz/dp/0321349601
Leave a Comment » |
java | Tagged: java, programming |
Permalink
Posted by mr1yh1
February 26, 2007
Sun is sending their famous operating system Solaris 10
via mail for free. ( similar to what Ubuntu project did ).http://www2.sun.de/dc/forms/reg_us_2211_391.jsp
They say it’s a limited-time offer.
This offer is valuable specialy if you have not a fast and unlimited net connection.
Solaris was free since june 2005.
There are 2 options you can choose:
- Sun Solaris 10 :
- it’s cost-free OS from Sun.
- Solaris Express :
- Open Solaris based , it includes some developer resources. But if you ask for only Solaris 10, you wont miss anything since all of them freely available from Sun.
-
As well as i know, open-sourced part of the Solaris named as open-solaris.
Leave a Comment » |
Uncategorized |
Permalink
Posted by mr1yh1
December 12, 2006
If you are searching a free and quality IDE for C/C++ development,
you may look at eclipse. ( specially if you are a java programmer too … )
check up-to-date versions of software before download.
i keep version numbers for simplicity.
-
first of all, eclipse needs Java Runtime Environment (JRE) installed.
if you want to develop java applications too, install only JDK …
http://java.sun.com/javase/downloads/index.jsp
-
JDK downloaders, put java excutables on your path,
( forexample C:\Sun\SDK\jdk\bin in my machine. )
-
smallest size eclipse is Platform Runtime Binary
this does not include plug-ins to develop anything ,
we will download plug-ins later.
http://download.eclipse.org/eclipse/downloads/drops/R-3.2.1-200609210945/
-
install mingw ( gcc for windows ).
download and run MinGW-5.0.2.exe
it will download and install everything needed,
since mingw can compile java, objective C, etc..
no need to check anything else than you needed ( gcc and g++ ).
http://mingw.org/download.shtml
-
put mingw executables on your path.
( forexample C:\MinGW\bin in my machine )
-
download and install MSYS-1.0.11-2004.04.30-1
Snapshot, bottom of page http://mingw.org/download.shtml
it will ask your mingw installation path ( C:\MinGW in my machine )
-
put MSYS excutables on your path.
( forexample C:\msys\1.0\bin in my machine )
-
same page, download gdb-6.3-2 for debugging C/C++ programs.
by default it will install inside mingW directory, so no need to add it in path.
otherwise put bin directory in your path.
-
to install eclipse CDT ( C development Tools )
-
run eclipse,
-
click menu item Help/Software Updates/Find and Install
-
select search for new features to install
-
click on new remote site and add url http://download.eclipse.org/tools/cdt/releases/callisto
-
after some monotonous steps you will see features available
select only “Eclipse C/C++ Development Tools”
hint : eclipse managed C/C++ projects means
eclipse will manage the makefile.
Otherwise we need to write and update a makefile.
after this point you need to learn about eclipse.( look at the help menu ).
some of people dont like eclipse
only becos they didnt spend time to learn about it.
additional info :
http://www-128.ibm.com/developerworks/opensource/library/os-ecc/
Leave a Comment » |
Uncategorized |
Permalink
Posted by mr1yh1