0

A transaction has ACID properties, where "I" stands for isolation:

Transactions are often executed concurrently (e.g., multiple transactions reading and writing to a table at the same time). Isolation ensures that concurrent execution of transactions leaves the database in the same state that would have been obtained if the transactions were executed sequentially. Isolation is the main goal of concurrency control; depending on the method used, the effects of an incomplete transaction might not even be visible to other transactions.

Is it correct that isolation is about concurrent execution of multiple transactions by different processes/threads? (e.g. process/thread P1 executes transaction T1, and P2 executes T2, concurrently.)

Does isolation cover concurrent execution of the same transaction by multiple processes/threads? (e.g. processes/threads P1 and P2 execute the same transaction T concurrently.)

If yes, does isolation require that concurrent execution of the same transaction by multiple processes/threads should have the same effect as only one process/thread is allowed to execute the transaction at a time (i.e. the transaction is treated as a critical section with requirement of mutual exclusive access?)

I am unsure about the relation and difference between transaction and critical section, after reading book *Operating System Concepts" which says

a transactional memory system can identify which statements in atomic blocks can be executed concurrently, such as concurrent read access to a shared variable. It is, of course, possible for a programmer to identify these situations and use reader–writer locks, but the task becomes increasingly difficult as the number of threads within an application grows.

Does the quote refer to the isolation property of a transaction?

Thanks.

2

Does a transaction have the effect of a critical section?

No, they are different concepts. A transaction is a series of steps carried out in a specific order to achieve a desired result. A critical section is a "keep out" sign set by one process to tell others that it is about to perform a transaction. The "keep out" sign is only taken down at the end of the transaction, when it is safe for another process to start its transaction.

Is it correct that isolation is about concurrent execution of multiple transactions by different processes/threads?

It's about making sure that if two processes are carrying out transactions at the same time, then they aren't interfering with each other. That's not easy if both are modifying the same table in a database.

Does isolation cover concurrent execution of the same transaction by multiple processes/threads?

That depends on what you mean by "the same". In one sense, it is not possible for two processes to carry out the same transaction (in the sense that two golf balls may look the same, but that doesn't make them the same golf ball).

But even if you mean "the same" to be "carry out the same set of steps", you still have to be careful if they modify anything in the database. Suppose a transaction is "add $10 to my bank account". That splits into 3 steps: read the current balance of my account, add $10 to the number you got, then write the result back to the balance on my account. Without isolation, if two processes try to do that at the same time, on the same account, it will probably give the wrong answer - you will end up with $10 being added, not $20.

Does the quote refer to the isolation property of a transaction?

Yes, it's talking about a memory system that ensures isolation. But don't assume all memory systems are transactional.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.