diff --git a/README.md b/README.md
index ca92f4a..1d3e494 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,5 @@
# Operating System Algorithms Repository
+
Welcome to the OS Algorithms Repository! This repository contains implementations of various OS algorithms in C++. Whether you're a student studying OS or a developer looking to understand these algorithms better, this repository aims to provide clear and concise implementations along with explanations to aid your learning.
@@ -42,7 +43,7 @@ Contributions to this repository are welcome and encouraged. If you would like t
If you have any feedback, suggestions, or questions regarding this repository, please feel free to open an issue or contact me below on any of the platforms you prefer 😊
-
+
diff --git a/Resource Allocation Graph/rag b/Resource Allocation Graph/rag
index 624513b..bf15f46 100755
Binary files a/Resource Allocation Graph/rag and b/Resource Allocation Graph/rag differ
diff --git a/Resource Allocation Graph/rag.cpp b/Resource Allocation Graph/rag.cpp
index 16f8211..5dc616f 100644
--- a/Resource Allocation Graph/rag.cpp
+++ b/Resource Allocation Graph/rag.cpp
@@ -3,47 +3,44 @@
using namespace std;
-int getCountOfResourceCollisions(int numberOfProcesses, vector processes,
- int numberOfRows, int numberOfColumns, vector> resources, int resourceToCheck) {
- int countOfCollisions = 0;
- for (int i = 0; i < numberOfRows; ++i) {
- for (int j = 0; j < numberOfColumns; ++j) {
- if (resources[i][j] == resourceToCheck) {
- ++countOfCollisions;
+int getCountOfResourceCollisions(int n, vector p, int r, int c, vector> res, int rt) {
+ int count = 0;
+ for (int i = 0; i < r; ++i) {
+ for (int j = 0; j < c; ++j) {
+ if (res[i][j] == rt) {
+ ++count;
}
}
}
- return countOfCollisions;
+ return count;
}
int main() {
- int numberOfProcesses, numberOfRows, numberOfColumns, resourceToCheck;
- cout << "I have implemented a matrix for resource allocation" << endl;
- cout << "Enter the number of processes: " ;
- cin >> numberOfProcesses;
- vector processes(numberOfProcesses);
- cout << "Enter Process Numbers (0-" << numberOfProcesses-1 << " with spaces): " ;
- for (int i = 0; i < numberOfProcesses; ++i) {
- cin >> processes[i];
+ int n, r, c, rt;
+ cout << "Enter the number of processes: ";
+ cin >> n;
+ vector p(n);
+ cout << "Enter Process Numbers (0-" << n-1 << " with spaces): ";
+ for (int i = 0; i < n; ++i) {
+ cin >> p[i];
}
cout << "Enter number of rows for resource array: ";
- cin >> numberOfRows;
+ cin >> r;
cout << "Enter number of columns for resource array: ";
- cin >> numberOfColumns;
- vector> resources(numberOfRows, vector(numberOfColumns));
+ cin >> c;
+ vector> res(r, vector(c));
cout << "Enter resources (with spaces): " << endl;
- for (int i = 0; i < numberOfRows; ++i) {
- for (int j = 0; j < numberOfColumns; ++j) {
- cin >> resources[i][j];
+ for (int i = 0; i < r; ++i) {
+ for (int j = 0; j < c; ++j) {
+ cin >> res[i][j];
}
}
- cout << "Enter a resource to check if collision happens" << endl;
- cin >> resourceToCheck;
+ cout << "Enter a resource to check if collision happens: ";
+ cin >> rt;
- int countOfCollisions = getCountOfResourceCollisions(numberOfProcesses, processes,
- numberOfRows, numberOfColumns, resources, resourceToCheck);
+ int count = getCountOfResourceCollisions(n, p, r, c, res, rt);
- cout << "Counts of deadlock = " << countOfCollisions << endl;
+ cout << "Counts of deadlock = " << count << endl;
return 0;
}
diff --git a/github/FUNDING.yml b/github/FUNDING.yml
new file mode 100644
index 0000000..dd44587
--- /dev/null
+++ b/github/FUNDING.yml
@@ -0,0 +1,4 @@
+# These are supported funding model platforms
+
+github: Pulkit1822
+buy_me_a_coffee: pulkitkumarmathur
\ No newline at end of file
diff --git a/round_robin_scheduler/round_robin_scheduler b/round_robin_scheduler/round_robin_scheduler
index bfb991b..db4bbd0 100755
Binary files a/round_robin_scheduler/round_robin_scheduler and b/round_robin_scheduler/round_robin_scheduler differ