What happens when an application (desktop/game) hangs or it is forced to be closed, or when electricity fails? -


i've been coding years time ago asked myself question. never saw solved in university. i'm curious this.

so, happens talking code, cpu? i'm curious code.

for example, if running desktop program , inserting data in data base, happens in scenarios tha mentioned above?

mydbconnection cn = new mydbconnection(); cn.start(); cn.begintransaction(); cn.insertdata("insert t_table vavlues(1,2,'white lies')"); cn.insertdata("insert t_table vavlues(1,3,'black lies')"); ------------------------------------------------------------------- enery power off, application hang whatever reason. ------------------------------------------------------------------- cn.insertdata("insert t_table vavlues(1,4,'void lies')"); cn.commit(); cn.close(); 

what happens after that? nothing?

data gets corrupted(according guy know)? there rollback or ram gets free or hanged? os tries restore process?

anyone knows procedures endure these accidents?

power fails, if major bank running dual power supplies per server , taking of other precautions 1 can take (e.g. ups, backup generator).

for reason, databases designed survive sudden failure when use database transaction. when database powered on after sudden power failure, use journal / transaction log ensure database in consistent state.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -