wisemonkeys logo
FeedNotificationProfileManage Forms
FeedNotificationSearchSign in
wisemonkeys logo

Blogs

Dekkers Algorithm

profile
Priti Pandav
Sep 09, 2024
0 Likes
0 Discussions
160 Reads

Dekker's Algorithm is a solution to the mutual exclusion problem in computer science. It allows multiple processes to share a common resource without conflicts.




*Problem Statement:*




Two or more processes want to access a shared resource, but only one process can access it at a time.




*Dekker's Algorithm:*




1. Two processes, P0 and P1, want to access the shared resource.

2. Each process has a flag variable (flag0 and flag1) initialized to false.

3. Process P0 sets flag0 to true and checks flag1. If flag1 is true, P0 waits.

4. Process P1 sets flag1 to true and checks flag0. If flag0 is true, P1 waits.

5. If a process finds the other process's flag false, it enters the critical section (accesses the shared resource).

6. After accessing the resource, the process sets its flag to false.




*Key Points:*




1. Dekker's Algorithm ensures mutual exclusion (only one process accesses the resource at a time).

2. It uses flag variables to communicate between processes.

3. A process waits if it finds the other process's flag true.




*Example:*

```

// Process P0

flag0 = true;

while (flag1) { /* wait */ }

// Critical section

flag0 = false;




// Process P1

flag1 = true;

while (flag0) { /* wait */ }

// Critical section

flag1 = false;

```

Dekker's Algorithm is a simple and efficient solution to the mutual exclusion problem, but it has some limitations, such as:




- It only works for two processes.

- It uses busy-waiting, which can waste CPU cycles.




More advanced algorithms, like Peterson's Algorithm and Lamport's Bakery Algorithm, have been developed to address these limitations.


Comments ()


Sign in

Read Next

semaphores

Blog banner

Charcoal, Lemon, and DIY Kits: Which “Viral” Dental Trends Are Actually Dangerous?

Blog banner

Ethical Hacking

Blog banner

Music

Blog banner

Multiprocessor and scheduling

Blog banner

Paginng In OS

Blog banner

INDIAN CHEAPEST COSMETICS BRAND

Blog banner

The Peephole

Blog banner

Footprinting

Blog banner

DNS Cache

Blog banner

Expert System In AI

Blog banner

Hypothesis Testing in Data Science

Blog banner

Big O Notation

Blog banner

What are the different types of E-mail crime and process of email forensic?

Blog banner

"Can Lisp do Machine Learning?"

Blog banner

Sage business cloud accounting

Blog banner

Solving Problems with AI: The Power of Search Algorithms

Blog banner

The Five Steps of Data Science

Blog banner

Atlantis - The Lost Island.........

Blog banner

City of Mumbai (Bombay):

Blog banner

What Makes Patola the Queen of Silk?

Blog banner

Cache memory

Blog banner

How to write a cover letter

Blog banner

Denial-of-Service and Distributed Denial-of-Service Attack Techniques

Blog banner

Race Conditions

Blog banner

virtual machines and virtualization

Blog banner

Global versus Indian Mental Health Differences

Blog banner

Business Intelligence v/s Big Data

Blog banner

OS DESIGN CONSIDERATIONS FOR MULTIPROCESSOR

Blog banner

5 People who claimed to have Time Traveled

Blog banner

Malware

Blog banner

Bitcoin sent using radio waves! No internet!

Blog banner

A Day in the Life at Elzee: What Your Child Does Between Drop-Off and Pick-Up

Blog banner

Sarasota Polo Club, Myakka City — A Luxury Day Trip from Oak Tree Hotel, Arcadia

Blog banner

TAILS OS

Blog banner

Modern Operating System - Suren Kotian

Blog banner

Security in Operating Systems

Blog banner

Modern operating system

Blog banner

Landslide Hazard

Blog banner

Mumbai famous street food

Blog banner

Fashion design

Blog banner

Why Oak Tree Hotel Is Arcadia’s Hidden Gem?

Blog banner