os202

OS202

View on GitHub

HOME


Top 10 List of Week 07

  1. 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.

  2. Cooperating Process
    A cooperating process is one that can affect or be affected by other processes running on the system. Cooperating processes can either directly share a logical address space or be allowed to share data only through shared memory or message passing.

  3. Race Conditition
    A situation where several processes access and manipulate the same data concurrently, but because of the nature of the device or system, the operations must be done in the proper sequence to be done correctly.

  4. Critical section problem
    The critical section is a code segment where the shared variables can be accessed. An atomic action is required in a critical section i.e. only one process can execute in its critical section at a time. All the other processes have to wait to execute in their critical sections. The critical section problem needs a solution to synchronize the different processes. The solution to the critical section problem must satisfy the following conditions
    • Mutual Exclusion
      Mutual exclusion implies that only one process can be inside the critical section at any time. If any other processes require the critical section, they must wait until it is free.
    • Progress
      Progress means that if a process is not using the critical section, then it should not stop any other process from accessing it. In other words, any process can enter a critical section if it is free.
    • Bounded Waiting
      Bounded waiting means that each process must have a limited waiting time. Itt should not wait endlessly to access the critical section.
  5. Semaphore
    Semaphores are integer variables that are used to solve the critical section problem by using two atomic operations, wait and signal that are used for process synchronization.
    • Wait
      The wait operation decrements the value of its argument S, if it is positive. If S is negative or zero, then no operation is performed.
    • Signal
      The signal operation increments the value of its argument S.
  6. Monitors
    Monitors are a synchronization construct that were created to overcome the problems caused by semaphores such as timing errors. Monitors are abstract data types and contain shared data variables and procedures. The shared data variables cannot be directly accessed by a process and procedures are required to allow a single process to access the shared data variables at a time.

  7. Deadlock
    Deadlock is a situation that occurs in OS when any process enters a waiting state because another waiting process is holding the demanded resource. Deadlock is a common problem in multi-processing where several processes share a specific type of mutually exclusive resource known as a soft lock or software.

  8. Deadlock prevention
    Deadlocks can be prevented by eliminating at least one of the four conditions
    • Mutual Exclusion: One or more than one resource are non-shareable (Only one process can use at a time)
    • Hold and Wait: A process is holding at least one resource and waiting for resources.
    • No Preemption: A resource cannot be taken from a process unless the process releases the resource.
    • Circular Wait: A set of processes are waiting for each other in circular form.
  9. Deadlock Avoidance
    Deadlock avoidance can be done with Bankers Algorithm. Bankerss Algorithm is resource allocation and deadlock avoidance algorithm which test all the request made by processes for resources, it checks for the safe state, if after granting request system remains in the safe state it allows the request and if there is no safe state it doesnt allow the request made by the process.

  10. Recovery from Deadlock
    There are two approaches of breaking a Deadlock:
    • Process Termination:
      To eliminate the deadlock, we can simply kill one or more processes. For this, we use two methods:
      a. Abort all the Deadlocked Processes
      b. Abort one process at a time untill deadlock is eliminated
    • Resource Preemption:
      To eliminate deadlocks using resource preemption, we preepmt some resources from processes and give those resources to other processes. This method will raise three issues:
      a. Selecting a victim
      b. Rollback
      c. Starvation