os202

Repository for Operating Systems 202 Course 2020/2021

View project on GitHub

HOME
« PREVIOUS | | NEXT »

Top 10 List of Week 07

  1. What is Process Synchronization?
    Process Synchronization is the task of coordinating the execution of processes in a way that no two processes can have access to the same shared data and resources. It is specially needed in a multi-process system when multiple processes are running together, and more than one processes try to gain access to the same shared resource or data at the same time. This can lead to the inconsistency of shared data. So the change made by one process not necessarily reflected when other processes accessed the same shared data. To avoid this type of inconsistency of data, the processes need to be synchronized with each other.

  2. Classical Problems of Synchronization
    Here are some of the classical problem depicting flaws of process synchronaization in systems where cooperating processes are present: 1. Bounded Buffer (Producer-Consumer) Problem, 2. Dining Philosophers Problem, and 3. The Readers Writers Problem.

  3. The Critical Section Problem
    A critical section is a segment of code which can be accessed by a signal process at a specific point of time. The section consists of shared data resources that required to be accessed by other processes. The entry to the critical section is handled by the wait() function, and it is represented as P(). The exit from a critical section is controlled by the signal() function, represented as V(). In the critical section, only a single process can be executed. Other processes, waiting to execute their critical section, need to wait until the current process completes its execution.

  4. Peterson’s Algorithm in Process Synchronization
    The producer consumer problem (or bounded buffer problem) describes two processes, the producer and the consumer, which share a common, fixed-size buffer used as a queue. Producer produce an item and put it into buffer. If buffer is already full then producer will have to wait for an empty block in buffer. Consumer consume an item from buffer. If buffer is already empty then consumer will have to wait for an item in buffer. Implement Peterson’s Algorithm for the two processes using shared memory such that there is mutual exclusion between them. The solution should have free from synchronization problems.

  5. What is Semaphore?
    Semaphore is defined as a variable that is non-negative and shared between threads. It is a mechanism that can be used to provide synchronization of tasks. Counting semaphore uses a count that helps task to be acquired or released numerous times. The binary semaphores are quite similar to counting semaphores, but their value is restricted to 0 and 1. Wait operation helps you to control the entry of a task into the critical section Signal semaphore operation is used to control the exit of a task from a critical section. Semaphore allows more than one thread to access the critical section. One of the biggest limitations of a semaphore is priority inversion.

  6. Mutex vs Semaphore: What’s the Difference?
    The basic difference between semaphore and mutex is that semaphore is a signalling mechanism i.e. processes perform wait() and signal() operation to indicate whether they are acquiring or releasing the resource, while Mutex is locking mechanism, the process has to acquire the lock on mutex object if it wants to acquire the resource. Semaphore is a better option in case there are multiple instances of resources available. In the case of single shared resource mutex is a better choice.

  7. What is a Deadlock?
    Deadlock Definition: It is a situation that occurs in OS when any process enters a waiting state because another waiting process is holding the demanded resource. A deadlock occurrence can be detected by the resource scheduler. It’s important to prevent a deadlock before it can occur. A resource can be released only voluntarily by the process holding it after that process has finished its task. Hold and wait is a condition where processes must be stopped from holding single or multiple resources while simultaneously waiting for one or more others. Deadlock avoidance is the simplest and most useful model that each process declares the maximum number of resources of each type that it may need.

  8. Deadlock vs Starvation: What’s the Difference?
    Deadlock and Starvation both are the conditions where the processes requesting for a resource has been delayed for a long. Although deadlock and starvation both are different from each other in many aspects. Deadlock is a condition where no process proceeds for execution, and each waits for resources that have been acquired by the other processes. On the other hands, in Starvation, process with high priorities continuously uses the resources preventing low priority process to acquire the resources. Both Deadlock and Starvation delays the process execution by blocking it. On one hand where deadlock can cause processes to starve, and on the other hands starvation can get the processes out of the deadlock.

  9. Banker’s Algorithm in Operating System
    Banker’s algorithm is used majorly in the banking system to avoid deadlock. It helps you to identify whether a loan will be given or not. Notations used in banker’s algorithms are 1) Available 2) Max 3) Allocation 4) Need. Resource request algorithm enables you to represent the system behavior when a specific process makes a resource request. Banker’s algorithm keeps many resources that satisfy the requirement of at least one client. The biggest drawback of banker’s algorithm this that it does not allow the process to change its Maximum need while processing.

  10. Message Passing Model of Process Communication
    Process communication is the mechanism provided by the operating system that allows processes to communicate with each other. This communication could involve a process letting another process know that some event has occurred or transferring of data from one process to another. One of the models of process communication is the message passing model. Message passing model allows multiple processes to read and write data to the message queue without being connected to each other. Messages are stored on the queue until their recipient retrieves them. Message queues are quite useful for interprocess communication and are used by most operating systems.