Web Requests, Concurrency Control & Distributed Systems

Classified in Computers

Written at on English with a size of 2.53 KB.

Web Requests: GET vs. POST

GET: The request displays the password in the browser URL.

POST: Does not remain in history and does not display the password or on the web server log, not displayed in URL.

Controlling Access to Resources

Lock: Use the database.

  • Implement file lock.

Optimistic Concurrency Control

When using locks, there is a possibility of deadlocks.

Solution:

Use timeout: When starting the processing of a request, set a maximum execution timeout. When the timeout expires, the system suspects that a possible problem (such as a deadlock) has occurred.

When the timeout expires, which request should be aborted?

We may end up canceling a request that is almost complete.

Deadlock Prevention

To prevent deadlock, the system can set all the locks the request needs. If all can be set, proceed with the execution. If at least one lock cannot be set, the request has to wait.

Strict Two-Phase Locking

Strict two-phase locking means that between each lock or during each lock, no new requests are accepted. No locks are released until the request is completed.

Optimistic Concurrency Control

Each request is assigned a timestamp. The execution is divided into three phases: working, validate, update.

Ring-Based Election Algorithm

Each process can be either a participant or a non-participant.

All processes are non-participants at the beginning:

  • Pi starts the election by setting its state to participant.
  • Sending the message to its neighbors.

The Bully Election Algorithm

One process notices that the primary process has failed and:

  • Sends a message to all other processes, requesting to be appointed leader, including its processor number.

A process with a higher process number can bully the first process. The process with the highest ID wins the election and sends out a message to that effect.

Multicast Message

  • Order the multicast message so that the processes execute the message in the same order.
  • Each process updates a local vector timestamp.
  • When a process sends a message, it attaches its local timestamp to the message after incrementing its component by 1.
  • If the sender has a higher state value for any of the other processes, the receiver is missing a message, so buffer the received message.

Entradas relacionadas: