Html/Javascript widget

Saturday, 14 September 2024

deadlock

A deadlock is a situation in which the alternatives to solve a dilemma are blocked by each other, causing a stalemate. In the field of computer sciences, a deadlock means an impasse where multiple processes are blocked as they keep indefinitely waiting for each other. More specifically, a deadlock occurs when a process or thread enters a waiting state because a requested system resource is held by another waiting process, which in turn is waiting for another resource held by another waiting process. related issues include: phantom reads- A phantom read occurs when a transaction retrieves a set of rows twice and new rows are inserted into or removed from that set by another transaction that is committed in between. Its often an issue of isolation in the DBMS. What mostly differentiates phantom reads from nonrepeatable reads and sirty reads is that it involves insertion and deleting operations on rows being read between commits. The new rows are referred to as "phantoms" Nonrepeatable Reads- A nonrepeatable read occurs when a transaction reads the same row twice but gets different data each time. Keyword here to differentiate from phantom and dirty reads is SAME ROW. Lost update - Writing access from parallel transactions modify the same row. The changes of the first transaction are overridden by the second. dirty read - A Dirty Read in SQL occurs when a transaction reads data that has been modified by another transaction, but not yet committed. It means to read uncommitted changes. It's closely related to temporary updates. Temporary updates describe the state of the data, while dirty reads describe the action of accessing that data by another transaction. Dirty reads are a direct consequence of transactions reading temporary (uncommitted) updates from other transactions. Incorrect summary: a transaction performs aggregate functions (like SUM, COUNT, etc.) over a dataset. In the meantime, other transactions are inserting, updating or deleting rows in that dataset, leading to an inaccurate summary. When you come across a problem with incosistent wage reports, chances are it's an incorrect summary issue. Techniques to handle said issues: shared lock - allows multiple transactions to read a resource without writing to it. exclusive lock - is granted to a transaction when it wants to write or modify a resource. 2-phase commit - is a protocol used in distributed databases to ensure all nodes in a distributed system either commit or abort a transaction consistently, even in the presence of failures. It has two phases: 1-vPrepare Phase: The coordinator asks all participating nodes if they can commit the transaction. If all nodes agree, they respond with a "yes." If any node cannot commit, they respond with a "no." 2- Commit Phase: If all nodes agree to commit, the coordinator instructs them to do so. If any node cannot commit, the coordinator instructs all nodes to roll back the transaction. 3-phase commit - same as the 2-phase commit with an extra stage (pre-commit) added in between

No comments:

Post a Comment