Archive for September 2012
Pessimistic Locking :
Pessimistic locking is when a transaction occurs, and then the resource is locked from the time it is first accessed. Until the transaction finished another transaction cant accessed the resources.
Optimistic Locking :
Optimistic locking applied a fail safe way. The state of resource is locked as soon the transaction occurs. But when another transaction occurs and attempting to accessed the resource it will result a delayed. Until the first accessed resources finished and unlock the resources.
The lock exists until the transaction committed or rolled back. If the resource is released. It will be compare the state which has been changed to the state when the time its locked. If the state differ it will rolled back the resource.
It compare the state of resource instead compare the changed data.
Some article defined a state as a version.
• What is the difference between “pass by value” and “pass by reference”? How are these ideas different in object-oriented systems and procedural systems?
Pass by value :
Pass by value mean it passing a copy of the value to be passed.
If a variable is passed, the variable receives the copy of the variable value. The value of the original variable can’t be changed within this method, because the variable which passed only has a copy of value from the original variable.
Pass by reference
Pass by reference mean it passing a reference of address in memory.
When it comes to object, it mean passing by references to an object.
Note for JAVA:
Java does manipulates object by reference, and all object variables are references.
However, java doesn’t pass method arguments by reference. It passes them by value.
what is the difference between Equality and Equivalence :
a variable can be equal when a value of variable are the same. example of equal variable but doesn’t equivalent :
int a = 3;
double b = 3.0;
variable a is equal to variable b, but the both variable are not equivalent, because each variable represent the different type.
variable a represent integer type, and variable b represent the double type.
example of equal variable and equivalent variable:
int a = 3;int b = 3;
variable a and variable b are equal and equivalent, because both variable has the same value and data type, integer type
equality or equal is about symbol = , equivalent is about symbol >, <
a = 3;
b = 3;
a = b (a is equal or equality with b)