Welcome to our detailed explanation of the Strict Alternation Approach, a classic method in concurrent programming!

In this video, we'll delve into:

What is the Strict Alternation Approach?
How it enforces orderly access to shared resources
Its role in managing concurrent processes
Practical examples and real-world applications
Benefits and limitations

The Strict Alternation Approach is a fundamental technique for developers working with multi-threaded applications, ensuring processes take turns accessing shared resources effectively.

If you find this video helpful, don't forget to like, subscribe, and hit the notification bell for more programming tutorials and insights!

Follow Me On Social Media -
Facebook - https://www.facebook.com/asad.nomanee

Software Engineering Full Course Link :https://www.youtube.com/playlist?list=PLncy2sD7w4YqcWltmTBXgCiyLB9llT703

Theory Of Computation Full Course Link : https://youtube.com/playlist?list=PLncy2sD7w4YqBniaSEkOtzcZa3UNtWpMF

Operating System Full Course Link:
https://youtube.com/playlist?list=PLncy2sD7w4Yr3ZbiP_ipAjgjDRn86N_tT

Computer Networks | Data Communication | Communication Engineering Full Course Link:
https://youtube.com/playlist?list=PLncy2sD7w4YpQ1xYzwuf8-IFWlks7V6uo

Database Management System Full Course Link:
https://youtube.com/playlist?list=PLncy2sD7w4Yq3p7qS9UjMrRXrS2_FgUrA

---------------------------------------------
#Chapter3
#TurnVariable

• Turn variable is a synchronization mechanism that provides synchronization among two processes.
• It uses a turn variable to provide the synchronization.

Initially, turn value is set to 0.
• Turn value = 0 means it is the turn of process P0 to enter the critical section.
• Turn value = 1 means it is the turn of process P1 to enter the critical section.
Working-

This synchronization mechanism works as explained in the following scenes-

Scene-01:

• Process P0 arrives.
• It executes the turn!=0 instruction.
• Since turn value is set to 0, so it returns value 0 to the while loop.
• The while loop condition breaks.
• Process P0 enters the critical section and executes.
• Now, even if process P0 gets preempted in the middle, process P1 can not enter the critical section.
• Process P1 can not enter unless process P0 completes and sets the turn value to 1.

Scene-02:

• Process P1 arrives.
• It executes the turn!=1 instruction.
• Since turn value is set to 0, so it returns value 1 to the while loop.
• The returned value 1 does not break the while loop condition.
• The process P1 is trapped inside an infinite while loop.
• The while loop keeps the process P1 busy until the turn value becomes 1 and its condition breaks.

Scene-03:

• Process P0 comes out of the critical section and sets the turn value to 1.
• The while loop condition of process P1 breaks.
• Now, the process P1 waiting for the critical section enters the critical section and execute.
• Now, even if process P1 gets preempted in the middle, process P0 can not enter the critical section.
• Process P0 can not enter unless process P1 completes and sets the turn value to 0.


Characteristics-

The characteristics of this synchronization mechanism are-
• It ensures mutual exclusion.
• It follows the strict alternation approach.
• It does not guarantee progress since it follows strict alternation approach.
• It ensures bounded waiting since processes are executed turn wise one by one and each process is guaranteed to get a chance.
• It ensures processes does not starve for the CPU.
• It is architectural neutral since it does not require any support from the operating system.
• It is deadlock free.
• It is a busy waiting solution which keeps the CPU busy when the process is actually waiting.



#StrictAlternationApproach

In strict alternation approach,
• Processes have to compulsorily enter the critical section alternately whether they want it or not.
• This is because if one process does not enter the critical section, then other process will never get a chance to execute again.





#StrictAlternation #ConcurrentProgramming #ComputerScience
#OperatingSystem #OS #asadnomanee #banglalecture #CSE
#Lecturelia #MBSTU #MBSTU_CSE
#lecturelia #banglatutorial #bangla