Critical section: A section of code within a process that requires access to sha
ID: 3557655 • Letter: C
Question
Critical section: A section of code within a process that requires access to shared resources and that may not be executed while another process is in a corresponding section of code.
Deadlock: A situation in which two or more processes are unable to proceed because each is waiting for one of the others to do something.
Livelock: A situation in which two or more processes continuously change their state in response to changes in the other process(es) without doing any useful work.
Mutual Exclusion: The requirement that when one process is in a critical section that accesses shared resources, no other process may be in a critical section that accesses any of those shared resources.
Race Condition: A situation in which multiple threads or processes read and write a shared data item and the final result depends on the relative timing of their execution.
Starvation: A situation in which a runnable process is overlooked indefinitely by the scheduler; although it is able to proceed, it is never chosen.
Discuss an example for each of the concurrency key terms
Explanation / Answer
Semaphore is a synchronization tool which can be used to deal with the critical-section problem.
A simple bank example would explain the deadlock principle. When the same account is trying to transfer maoney at the same time with two different parameters or from different locations, a deadlock occurs.
If two threads detect a deadlock, and try to step aside for each other, without care they will end up being stuck in a loop always "stepping aside" and never managing to move forwards.
This can be explained with a simple online ticket reservation system. Whne one passenger is making transactions for a particular seat in a train, no other passenger must be able to access or make transactions on that seat.
The subscriber whose username begins with the earlier letter of the alphabet may get priority by default when two subscribers attempt to access the system within a prescribed increment of time.
Consider a situation in which 10 systems are connected to a single printer. Among these, the 8th system is given least priority basing on some criteria. Hence, even if an importan tcopy is to be taken from that system, the processor needs to wait and check until it finds out that none of the systems need the printer at that moment. If this happens in a larger environment, the system may never get a chance to acess its resources.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.