0% found this document useful (0 votes)
2 views

Algorithms

The document discusses various scheduling algorithms, including multilevel queue scheduling and multilevel feedback queue scheduling, which classify processes into foreground and background categories. It also covers approaches to multi-processor scheduling, such as asymmetric and symmetric multiprocessing, along with concepts like processor affinity and load balancing. Additionally, it addresses deadlock scenarios, methods for handling deadlocks, and the Banker's algorithm for resource allocation to ensure safe states in multi-processing environments.

Uploaded by

sleeppls79
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Algorithms

The document discusses various scheduling algorithms, including multilevel queue scheduling and multilevel feedback queue scheduling, which classify processes into foreground and background categories. It also covers approaches to multi-processor scheduling, such as asymmetric and symmetric multiprocessing, along with concepts like processor affinity and load balancing. Additionally, it addresses deadlock scenarios, methods for handling deadlocks, and the Banker's algorithm for resource allocation to ensure safe states in multi-processing environments.

Uploaded by

sleeppls79
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Algorithms

Multilevel queue scheduling – another class of scheduling algorithms has been created for situations has
been created for situations in which processes are easily classified into different groups

 Foreground (interactive)
 Background (batch)

Multilevel feedback queue scheduling

- Allows a process to move between queues

- Sperate processes according to the characteristics of their CPU bursts

 If process uses too much CPU time, it will be moved to a lower priority queue
 Leaves I/O-bound and interactive processes in the higher-priority queues
 A process that waits too long in a lower-priority queue may be move to a higher-priority
queue to prevent starvation

Parameters

 The number of queues


 The scheduling algorithm for each queue
 The method used to determine when to upgrade a process to higher-priority queue

Approached to multiple-processor scheduling

- asymmetric multiprocessing

 One processor handles all system activities while other is for user only

- symmetric multiprocessing

 Each processor is self-scheduling


 All processors access one data structure

Processor affinity

Attempt to keep a process running on the same processor

A process has an affinity for the processor on which it is currently running

 Soft affinity – OS has a policy of attempting to keep a process running on the same processor –
but not guaranteeing that it will do so
 Hard affinity – allowing a process to specify a subset of processors on which it may run
Load balancing

Attempts to keep the workload evenly distributed across all processors in an SMP system

 Push migration - involves the operating system proactively moving processes from a heavily
loaded processor to a less loaded one, attempting to balance the workload without waiting for
processes to finish.
 Pull migration - allows underloaded processors to request processes from overloaded ones,
effectively pulling tasks to balance the load when they notice a performance drop. Both
methods aim for optimal resource utilization in a multi-processor system.

Multicore processors

 Memory stall – an event wherein processor accesses memory

Latency

- The amount of time that elapses from when an event occurs to when it is serviced

Interrupt latency

- is the time interval between the arrival of an interrupt signal and the start of the corresponding
interrupt handler's execution.

Deadlock - A deadlock is a situation in a multi-processing environment where two or more processes are
unable to proceed because each is waiting for resources held by the other. In this state, none of the
involved processes can continue execution, leading to a complete standstill. Deadlocks typically occur
when the necessary conditions for deadlock—mutual exclusion, hold and wait, no preemption, and
circular wait—are present

Methods for handling deadlocks:

We can use a protocol to prevent or avoid deadlocks, ensuring that the system will never enter a
deadlocked state.

We can allow the system to enter a deadlocked state

Deadlock avoidance

Requires that the operating system be given additional information in advance concerning which
resources a process will request and use during its lifetime

 Each process declares of resources of each type that it may need


 Safe state
 Resource-allocation-graph algorithm
 Resource-request algorithm
Banker’s algorithm

- When process enters the system, it must declare the maximum number of instances of each resource
type that it may need

- When resources are requested, the system must determine whether the allocation of these resources
will leave the system in a safe state

 If it will, the resources are allocated; otherwise, the process must wait until some other process
releases enough resources

Available

 A vector of length m indicates the number of available resources of each type. If available[i]
equals k, then k instances of resources type Rj are available

Max

 An n x m matrix defines the maximum demand of each process. If max[i][j] equals k, then
process P, may request at most k instances of resource type Rj,

Allocation

 An n x m matrix defines the number of resources of each type currently allocated to each
process, if allocation[i][j] equals k, then process P, is currently allocated k instances of resource
type rj

Need

 an n x m matrix indicates the remaining resource need of each process, if need[i][j] equals k,
then process P, may need k more instances of resource type rj to complete its task. Note that
need[i][j] equal max[i][j] – allocates[i][j].

deadlock detection

single instance of each resource types

You might also like