2018-05-01

May 2 In-Class Exercise Thread.

Post your solutions to the May 2 In-Class Exercise to this Thread.
Best,
Chris
Post your solutions to the May 2 In-Class Exercise to this Thread. Best, Chris

-- May 2 In-Class Exercise Thread
`s` can be relatively low because it’s not too terrible if the transaction incorrectly assumes it has a shared lock — probably `s\approx {n}/{2} + 1`.
`x` should be a large portion of `n` because the transaction has to be reasonably sure nobody else has a lock — almost certainly `x\gt {n}/{2}`, and possibly as high as `n`.
This is useful in that there is no single point of failure from a primary lock.
This is also bothersome in that multiple requests must be sent, increasing traffic, but the transaction might be wrong about whether it can acquire a lock.
(Edited: 2018-05-02)
@BT@s@BT@ can be relatively low because it’s not too terrible if the transaction incorrectly assumes it has a shared lock — probably @BT@s\approx {n}/{2} + 1@BT@. @BT@x@BT@ should be a large portion of @BT@n@BT@ because the transaction has to be reasonably sure nobody else has a lock — almost certainly @BT@x\gt {n}/{2}@BT@, and possibly as high as @BT@n@BT@. This is useful in that there is no single point of failure from a primary lock. This is also bothersome in that multiple requests must be sent, increasing traffic, but the transaction might be wrong about whether it can acquire a lock.

-- May 2 In-Class Exercise Thread
Using the "Read-Locks-One; Write-Locks-All" approach could work:
For s, a good choice would be to choose one machine to check for shared locks.
For x, a good choice would be to choose all machines to check for exclusive locks.
An advantage for this approach is that checking for shared locks or read-only transactions could be found by randomly selecting a machine.
A disadvantage is checking for exclusive requires requests from all machines.
(Edited: 2018-05-02)
Using the "Read-Locks-One; Write-Locks-All" approach could work: For s, a good choice would be to choose one machine to check for shared locks. For x, a good choice would be to choose all machines to check for exclusive locks. An advantage for this approach is that checking for shared locks or read-only transactions could be found by randomly selecting a machine. A disadvantage is checking for exclusive requires requests from all machines.

-- May 2 In-Class Exercise Thread
 S - We only need to check n/2 + 1 machines to make sure that there are shared locks. We can risk being wrong because we would only be allowing a read during the transaction. 
 X - We need to check every machine to make sure that each machine has an exclusive lock and then we will allow for a transaction to assume it has an exclusive lock.
Advantages - Since there is no primary-copy, if any of the machines go down, it won't affect checking for other copies of the database element.
Disadvantage - More messages are being sent when there are a lot of transactions that require writes. Reads can possibly send less messages, but it's not substantially less than the writes.
S - We only need to check n/2 + 1 machines to make sure that there are shared locks. We can risk being wrong because we would only be allowing a read during the transaction. X - We need to check every machine to make sure that each machine has an exclusive lock and then we will allow for a transaction to assume it has an exclusive lock. Advantages - Since there is no primary-copy, if any of the machines go down, it won't affect checking for other copies of the database element. Disadvantage - More messages are being sent when there are a lot of transactions that require writes. Reads can possibly send less messages, but it's not substantially less than the writes.

User Icon
-- May 2 In-Class Exercise Thread
  • Cole Sakamoto
  • What are some good choices for s and x? Why? For s we could require that we need the majority or more than half of the locks. Holding this number of locks will most of the time work for only reading. For x we need to acquire all of the locks. If all the locks are held then no other transaction could also have an exclusive lock.
  • Give an advantage of this approach. Give a disadvantage of this approach. An advantage is that there is less risk of the entire database stopping because there is no primary copy. The disadvantage is that multiple machines need to be accessed for locks.
* Cole Sakamoto * What are some good choices for s and x? Why? For s we could require that we need the majority or more than half of the locks. Holding this number of locks will most of the time work for only reading. For x we need to acquire all of the locks. If all the locks are held then no other transaction could also have an exclusive lock. * Give an advantage of this approach. Give a disadvantage of this approach. An advantage is that there is less risk of the entire database stopping because there is no primary copy. The disadvantage is that multiple machines need to be accessed for locks.

User Icon
-- May 2 In-Class Exercise Thread
For shared locking, we might want to assume at least half the copies are locked so, >n/2.
For exclusive locking, we would want a overwhelming majority, or even all copies.
An advantage for this approach is no need to rely on one machine with the primary copy, which could be a bottleneck.
A disadvantage would be the communication overhead, which would come from the the increased amount of messages.
For shared locking, we might want to assume at least half the copies are locked so, >n/2. For exclusive locking, we would want a overwhelming majority, or even all copies. An advantage for this approach is no need to rely on one machine with the primary copy, which could be a bottleneck. A disadvantage would be the communication overhead, which would come from the the increased amount of messages.

-- May 2 In-Class Exercise Thread
For `s`, because shared locks can be held by multiple transactions all at once, require at least greater than 50% of the entire machines with the logical element (value of `n`) to grant a shared lock.
For `x`, because exclusive lock ensures only 1 transaction to modify the corresponding data, it is important to check with all machines.
The advantage is, unlike the primary copy locking technique, it avoids one machine currently holding the lock to undergo heavy traffic, caused by all other machines sending requests to it, which may lead to crash. The time it takes for the lock-requesting-machine to check with all other machines (especially if there are a lot of them) could be thought of as the disadvantage, however.
(Edited: 2018-05-02)
For @BT@s@BT@, because shared locks can be held by multiple transactions all at once, require at least greater than 50% of the entire machines with the logical element (value of @BT@n@BT@) to grant a shared lock.<br /> For @BT@x@BT@, because exclusive lock ensures only 1 transaction to modify the corresponding data, it is important to check with all machines.<br /> The advantage is, unlike the primary copy locking technique, it avoids one machine currently holding the lock to undergo heavy traffic, caused by all other machines sending requests to it, which may lead to crash. The time it takes for the lock-requesting-machine to check with all other machines (especially if there are a lot of them) could be thought of as the disadvantage, however.

-- May 2 In-Class Exercise Thread
S can be one because shared locks are used for reading X should be all of n to ensure that the write is exclusive An advantage of this is that for a read, any machine can get just one shared lock and no one source of failure compared to primary copy locking A disadvantage is that for writes, all of the machines must request and obtain an exclusive lock
S can be one because shared locks are used for reading X should be all of n to ensure that the write is exclusive An advantage of this is that for a read, any machine can get just one shared lock and no one source of failure compared to primary copy locking A disadvantage is that for writes, all of the machines must request and obtain an exclusive lock

-- May 2 In-Class Exercise Thread
For s, one machine to check for shared locks would be a good idea. For x, every machines should be checked for exclusive locks. A disadvantage of this would be having to check all machines for exclusives but checking for shared lock, you can check randomly.
For s, one machine to check for shared locks would be a good idea. For x, every machines should be checked for exclusive locks. A disadvantage of this would be having to check all machines for exclusives but checking for shared lock, you can check randomly.

-- May 2 In-Class Exercise Thread
S could be more than half of the copies. So when checking for shared lock, if one of the copies is found then there is a shared lock. For x, every copies should be requested to make sure there is a exclusive lock
S could be more than half of the copies. So when checking for shared lock, if one of the copies is found then there is a shared lock. For x, every copies should be requested to make sure there is a exclusive lock
[ Next ]
X