Click here to Skip to main content
15,889,216 members
Home / Discussions / Algorithms
   

Algorithms

 
QuestionRadian angle to Quaternion Pin
shaibee18-Dec-08 3:29
shaibee18-Dec-08 3:29 
AnswerRe: Radian angle to Quaternion Pin
73Zeppelin18-Dec-08 3:42
73Zeppelin18-Dec-08 3:42 
GeneralRe: Radian angle to Quaternion Pin
shaibee18-Dec-08 4:01
shaibee18-Dec-08 4:01 
GeneralRe: Radian angle to Quaternion Pin
73Zeppelin18-Dec-08 4:48
73Zeppelin18-Dec-08 4:48 
QuestionPseudocode implementation of the strict timestamp protocol for ensuring serializability, recoverability and cascadeless roll-backs [modified] Pin
efgtdg17-Dec-08 10:07
efgtdg17-Dec-08 10:07 
AnswerRe: Pseudocode implementation of the strict timestamp protocol for ensuring serializability, recoverability and cascadeless roll-backs Pin
73Zeppelin17-Dec-08 22:17
73Zeppelin17-Dec-08 22:17 
GeneralRe: Pseudocode implementation of the strict timestamp protocol for ensuring serializability, recoverability and cascadeless roll-backs Pin
efgtdg18-Dec-08 0:39
efgtdg18-Dec-08 0:39 
GeneralRe: Pseudocode implementation of the strict timestamp protocol for ensuring serializability, recoverability and cascadeless roll-backs Pin
73Zeppelin18-Dec-08 2:00
73Zeppelin18-Dec-08 2:00 
/ write_item(X) by T

write_item(X)
{
     while(true)
     {
          if( write_TS(X) > TS(T) || read_TS(X) > TS(T) )  // <--THIS LINE
          {
                abort(T); // break or return
          }
          else if( write_TS(X) < TS(T) )
          {
               wait until the transaction T', which TS(T) > TS(T'), has
               either committed or aborted; // write_TS(X) == TS(T')
                  continue;   
          }
          else
          {
                write_item(X);
                write_TS(X) = TS(T);
                break; // or return                
          }
     }
} 


Hmmm, on the indicated line above, shouldn't that be AND and not OR? Also, you might want to consider what would happen if the timestamps were equal.

Also, just to be clear, to avoid cascading rollbacks, you should only be reading committed values. So, given all that, shouldn't the pseudo-code look more like this:

// rmax(X): the max timestamp of a transaction that read that item.
// wmax(X): the max timestamp of a transaction that wrote the item.

// read X:

if t >= wmax(X)
    rmax(X) <- max(t, rmax(X))
    wait for a committed value of X
    perform read
else 
    abort

// write X:

if t >= rmax(X) and t >= wmax(X)
    wmax(X) <- t
    wait until X value is a committed value and
        pending reads are done
    perform write
else
    if t < rmax(X)
    abort
else
    do nothing

GeneralRe: Pseudocode implementation of the strict timestamp protocol for ensuring serializability, recoverability and cascadeless roll-backs Pin
efgtdg19-Dec-08 0:51
efgtdg19-Dec-08 0:51 
GeneralRe: Pseudocode implementation of the strict timestamp protocol for ensuring serializability, recoverability and cascadeless roll-backs Pin
73Zeppelin19-Dec-08 2:30
73Zeppelin19-Dec-08 2:30 
QuestionQuestion from my Phone Interview Pin
BobInNJ15-Dec-08 10:17
BobInNJ15-Dec-08 10:17 
GeneralSum Pin
Luc Pattyn15-Dec-08 11:19
sitebuilderLuc Pattyn15-Dec-08 11:19 
AnswerRe: Question from my Phone Interview Pin
Member 419459315-Dec-08 11:47
Member 419459315-Dec-08 11:47 
AnswerRe: Question from my Phone Interview Pin
Member 419459315-Dec-08 11:49
Member 419459315-Dec-08 11:49 
GeneralRe: Question from my Phone Interview Pin
BobInNJ15-Dec-08 12:43
BobInNJ15-Dec-08 12:43 
GeneralRe: Question from my Phone Interview Pin
Luc Pattyn15-Dec-08 12:52
sitebuilderLuc Pattyn15-Dec-08 12:52 
GeneralRe: Question from my Phone Interview Pin
Member 419459315-Dec-08 13:05
Member 419459315-Dec-08 13:05 
Generalsum &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; Pin
Luc Pattyn15-Dec-08 13:20
sitebuilderLuc Pattyn15-Dec-08 13:20 
GeneralRe: sum &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; Pin
Member 419459315-Dec-08 14:43
Member 419459315-Dec-08 14:43 
GeneralRe: sum &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; Pin
riced18-Dec-08 12:47
riced18-Dec-08 12:47 
GeneralNot Cobol Pin
Luc Pattyn18-Dec-08 12:59
sitebuilderLuc Pattyn18-Dec-08 12:59 
GeneralRe: Not Cobol Pin
riced18-Dec-08 13:27
riced18-Dec-08 13:27 
GeneralRe: Not Cobol Pin
Luc Pattyn18-Dec-08 13:39
sitebuilderLuc Pattyn18-Dec-08 13:39 
GeneralRe: Question from my Phone Interview Pin
leonej_dt15-Dec-08 13:33
leonej_dt15-Dec-08 13:33 
AnswerFinding an extra/missing number Pin
supercat918-Dec-08 9:56
supercat918-Dec-08 9:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.