Multilevel Feedback Queues and Process Management

Planning Processor Queues: Multi-Level Feedback

Provide a structure to achieve the following objectives:

  • Encourage shorter works.
  • Encourage work limited by input/output to optimize the use of devices for input/output.
  • Determine the nature of the work as quickly as possible and plan the work (process) accordingly.

A new process enters the ready list at the end of the upper tail. It moves through the FIFO queue until the CPU. If the job ends or leaves the CPU to wait for the completion of an input/output transaction or the termination of some other event, the job exits the ready list.

Two-Level Planning

The operational scheme of a two-level planner is as follows:

  1. A subset of executable processes is loaded into the main memory.
  2. The planner is restricted to them for some time.
  3. Periodically call a senior planner to perform the following tasks:
    • (a) Remove processes that have been in memory long enough.
    • (b) Load processes that have been waiting for too long into memory.
  4. The lower-level planner is again restricted to processes that are executable in memory.
  5. The senior planner is responsible for moving the process from memory to disk and vice versa.

Interrupts

An interrupt is an event that alters the sequence in which the processor executes instructions. It is a fact generated by the hardware of the computer.

When an interrupt occurs, the operating system:

  • Gets control.
  • Saves the state of the interrupted process, usually in its process control block.
  • Analyzes the interruption.
  • Transfers control to the appropriate routine for handling the interruption.

Process Types

There are two types of processes:

  • Independent: These do not affect or are affected by any other process.
  • Cooperative: These can affect and be affected by some other operating system process.

Mutual Exclusion and Critical Section

Processes often need to communicate with each other. For this, there are some setbacks that should be overcome. To prevent this problem, in situations involving any share, more than one process should be prevented from making use of the share at the same time. What is needed is mutual exclusion. The part of the program to access the shared resource is called the critical section.

Conditions of Race or Competition

The race (race condition) occurs when two or more processes access a shared resource without control so that the combined result of this access depends on the order of arrival.

Indefinite Postponement or Adjournment

This is the fact that one or more processes never receive enough run time to finish their homework.

Circular Wait Condition

This occurs when two or more processes form a chain expected to involve all.

No Ownership Status

This condition is not precisely of concurrency but plays an important role in this environment. This condition specifies that if a process is assigned a resource, this remedy may not be taken away for any reason and will be available until the process ‘drops’ it by its will.

Busy Waiting Condition

This condition is that a process requests a resource that is already assigned to another process, and the condition of ownership must be met. Then, the process will be spending the rest of its time slice checking if the application was released. That is, its running time is wasted waiting.

Mutual Exclusion Condition

When a process uses a system resource, it performs a series of operations on the resource and then stops. A section of code that uses this resource is called a ‘critical region’. The condition of mutual exclusion states that only one process is allowed to be within the same critical region.

Busy Condition and Wait for a Resource

It is when a process requests a resource that is assigned. Before releasing it, it asks for another resource that another process already has allocated.

Deadlock

The most serious problem that can occur in an environment of competition is a ‘deadly embrace’, also called ‘interlock’. There are four necessary conditions:

  • The condition of non-appropriation.
  • The standby-circular.
  • The condition of mutual exclusion.
  • The condition of occupying and waiting for a resource.

Conditions

  • Mutual exclusion: Processes claim the exclusive use of the resources requested.
  • Use and waiting: Processes hold resources already assigned to them while waiting for additional resources.
  • No preemption: Resources cannot be removed from processes that use them until they are completed.
  • Circular wait: There is a circular chain of processes in which each holds one or more resources.