Skip to content

Instantly share code, notes, and snippets.

View Karim-Monir's full-sized avatar
🎯
Focusing

Karim Monir Karim-Monir

🎯
Focusing
View GitHub Profile

Privacy Policy for "Gold Masr"

Effective Date: 24/02/2026

Thank you for choosing Gold Masr. This Privacy Policy explains how we collect, use, and protect your personal information within our app.

By using Gold Masr, you consent to the practices described in this policy.

Privacy Policy for "The Kind Radio"

Effective Date: 24/02/2026

Thank you for choosing The Kind Radio. This Privacy Policy explains how we collect, use, and protect your personal information within our app.

By using The Kind Radio, you consent to the practices described in this policy.

@Karim-Monir
Karim-Monir / Peterson's Algorithm
Created January 18, 2022 02:37
This is an implementation of Peterson's Algorithm for two threads trying to access the same array with two different processes. one is to sort the array in ascending order, and the other one is sort the array is a descending order. Is this implementation right?
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <stdbool.h>
#include <unistd.h>
//Sorting Ascending
void bubbleSortAsc(int array[], int size) {
for (int step = 0; step < size - 1; ++step) {