This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <math.h> | |
| int main() | |
| { | |
| int n, head, total_movement = 0; | |
| printf("Enter the number of requests: "); | |
| scanf("%d", &n); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <unistd.h> | |
| #include <sys/types.h> | |
| #include <stdlib.h> // Included for abs() function | |
| // Sorting function (looks like Bubble Sort) | |
| void sort(int arr[], int n) | |
| { | |
| int i, j, swap; | |
| for (i = 0; i < n - 1; i++) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <unistd.h> | |
| #include <sys/types.h> | |
| #include <stdlib.h> // Included for abs() function | |
| // Sorting function (looks like Bubble Sort) | |
| void sort(int arr[], int n) | |
| { | |
| int i, j, swap; | |
| for (i = 0; i < n - 1; i++) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<stdio.h> | |
| #include<unistd.h> | |
| #include<string.h> | |
| int main() { | |
| int pipefds[2]; | |
| int returnstatus; | |
| pid_t pid; | |
| char writemessages[2][20] = {"Hi", "Hello"}; | |
| char readmessage[20]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<stdio.h> | |
| #include<unistd.h> | |
| #include<string.h> | |
| int main() | |
| { | |
| int pipefds[2]; | |
| int returnstatus; | |
| char writemessages[2][20] = {"Hi", "Hello"}; | |
| char readmessage[20]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| int main() { | |
| int frames[10], pages[30], count[10]; | |
| int no_frames, n, i, j, pos, min, time = 0, fault = 0; | |
| int flag1, flag2; | |
| printf("Enter number of pages: "); | |
| scanf("%d", &n); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| int main() { | |
| int frames[10], pages[30], temp[10]; | |
| int no_frames, n, i, j, k, pos, max, fault = 0; | |
| int flag1, flag2; | |
| printf("Enter number of pages: "); | |
| scanf("%d", &n); | |
| printf("Enter the page reference string: "); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <sys/types.h> | |
| #include <unistd.h> | |
| #include <stdlib.h> // Adding this for clarity, though it might not have been in the image | |
| int main() | |
| { | |
| int n, frame, fault, flag, k = 0; | |
| printf("Enter the number of pages: "); | |
| scanf("%d", &n); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| int main() { | |
| int n = 5; // Number of processes | |
| int m = 3; // Number of resources | |
| int alloc[5][3] = { {0, 1, 0}, {2, 0, 0}, {3, 0, 2}, {2, 1, 1}, {0, 0, 2} }; | |
| int max[5][3] = { {7, 5, 3}, {3, 2, 2}, {9, 0, 2}, {2, 2, 2}, {4, 3, 3} }; | |
| int avail[3] = {3, 3, 2}; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <pthread.h> | |
| #include <semaphore.h> | |
| #include <unistd.h> | |
| #define BUFFER_SIZE 5 | |
| #define MAX_ITEMS 15 | |
NewerOlder