wisemonkeys logo
FeedNotificationProfileManage Forms
FeedNotificationSearchSign in
wisemonkeys logo

Blogs

Dekkers Algorithm

profile
Priti Pandav
Sep 09, 2024
0 Likes
0 Discussions
161 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

10 Reasons Why Guy BestFriends are the Must in Every Girl's Life

Blog banner

Why White Bedding Has Become a Hotel Industry Standard?

Blog banner

WHAT IS SNAPCHAT AND HOW DOES IT WORK?

Blog banner

Process in OS

Blog banner

OS Evolution Achievements

Blog banner

Sessions In OS.

Blog banner

CYBERPEACEKEEPING: NEW WAYS TO PREVENT AND MANAGE CYBERATTACKS

Blog banner

Linker

Blog banner

security controls

Blog banner

Simple AI Symptom Diagnosis Using LISP – Rule-Based Expert System

Blog banner

RAID - LEVELS OF RAID

Blog banner

Celebrate Raksha Bandhan with Premium Dry Fruit Gift Hampers

Blog banner

MODERN OPERATING SYSTEM

Blog banner

Processes: Process Description and Control.

Blog banner

virtual machines and virtualization

Blog banner

Fault Tolerance

Blog banner

File management

Blog banner

Memory Management

Blog banner

How Preschool Annual Day Shapes Confidence, Emotions, and Growth

Blog banner

Lifestyle of a photographer

Blog banner

CRISP-DM Methodology

Blog banner

Human factor, a critical weak point in the information security of an organization’s IOT

Blog banner

Evolution of Operating Sytems

Blog banner

Cyber Forensics in a Ransomware Attack Recovery

Blog banner

Palm Vein Biometric Technology; Contactless vein authentication

Blog banner

Business Intelligence v/s Big Data

Blog banner

Types of E-Commerce

Blog banner

Points to consider if you're planning to visit Florida in 2026

Blog banner

Importance of Network Security Risk

Blog banner

Google classroom

Blog banner

Multiprocessor and Multicore Organization

Blog banner

?What Children Learn Between Activities: The Hidden Learning Moments in a Preschool Day

Blog banner

How to Prepare Your Child for Their First Day of School?

Blog banner

Memory management

Blog banner

MoSCoW METHOD IN DATA SCIENCE

Blog banner

Navigation With Indian Constellation(NavIC) by ISRO in Geographic Information Systems

Blog banner

File management -disha parekh

Blog banner

The Power of Cyber Forensic in Solving Crimes

Blog banner

USES OF WHATSAPP

Blog banner

GIS

Blog banner

?Why Does My Breath Still Smell After Brushing?

Blog banner

OS DESIGN CONSIDERATIONS FOR MULTIPROCESSOR

Blog banner