Mutual Exclusion
Definition
A mutual exclusion (mutex) is a software object that stops several users from accessing a shared resource at the same time.How to handle
- Use Token based algorithm, where a unique token is shared among all the sites.
- Non-token based approach, where a site communicates with other sites in order to determine which sites should execute critical section next.
- Quorum based approach. Instead of requesting permission to execute the critical section from all other sites, each site requests only a subset of sites which is called a quorum.
Deadlock
Definition
A deadlock occurs when a collection of processes is stalled because one process is holding a resource and waiting for another resource to be acquired by another process.How to handle
- Prevention, prevent it from happening.
- Avoidance, use resource allocation algorithms.
- Detection and Recovery, examine the state of the system to identify if a deadlock has occurred.
- Timeouts, ensure that a process does not remain blocked indefinitely.
Starvation
Definition
Starvation is an issue that happens when high priority processes continue to run while low priority processes are halted indefinitely.How to handle
- A freelancing manager should be in charge of CPU resource allocation to guarantee that resources are distributed evenly.
- Starvation can develop as a result of random process technique selection.
- To minimize famine, process aging criteria should be considered while allocating resources.
- To deal with famine, a scheduling method with a priority queue might be utilized.
Data Coherence
Definition
Data coherence encompasses both uniformity across shared resource data and logical links and completeness inside and between data sets.How to handle
- Cache coherence protocols are used to ensure that all processors have the same value of a shared variable by maintaining consistency between cached copies of the variable across all processors.
- Memory barriers or synchronization instructions are used to ensure that changes made to a shared variable are visible to all processors by flushing any cached values and updating main memory.
- Locking or semaphores can be used to ensure that only one thread can modify a shared variable at a time, preventing race conditions and ensuring consistency.
Top comments (0)