سلام
دوستان بعد از کلی کلنجار فهمیدیم دیتابیس درست کانفیگ نشده است
و سرعت پایین و مصرف نا مناسب از دیتابیس
حالا امدیم ماریا دیبی رو کانفیگ کردیم بالا آمد و مشکل درست شد و سرعت به میلی ثانیه رسوندیم
اما باز به مشکل خوردیم ماریا دیبی فایل جیسون رو نمیخونه و همین موضوع باعث میشه کرش کنه سرور یا همون هنگ کردن
خب الان دوباره با در دیوار یکی شدیم و در به در 😢🥲🫠
کسی میتونه راهنمایی کنه ما رو یا بیاد این کار رو انجام بده ؟
بله داستان های راستان من ادامه دارد و پدرمون درآمده است
البته بگم این غول رو رد کنیم فکر کنم دیگه 90% کارمون تموم شده ریز کاری مونده
لطفا از همه تقاضا دارم اگر فرد حرفه ای هم میشناسین که آدم حسابی باشه و وقت نگیره و اذیت نکنه و سر تایم کار تحویل بده معرفی کنید
با سپاسسسسسسسسسسسســـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــس
24 نوامبر 2023
Implement the Multi-Level Feedback Queue (MLFQ) scheduling algorithm and calculate the average waiting time and turnaround time for a set of processes by:
Defining Process and Queue Structures:
Create a Process structure to store necessary information for each process, such as process ID, duration, remaining time, waiting time, and turnaround time.
Create a Queue structure to represent a queue in the MLFQ, which holds processes, has a front and rear indicator, and a time quantum associated with it.
Initializing Queues:
Implement a function to initialize your queues with appropriate time quanta. For example, a high-priority queue might have a smaller time quantum, and a low-priority queue might have a larger time quantum.
Gathering Input:
Prompt the user to enter the number of processes.
For each process, ask the user to input the process ID and its duration.
Initialize the remaining time for each process and enqueue them to the high-priority queue.
MLFQ Implementation:
Implement the MLFQ scheduling algorithm. Processes start in the high-priority queue and move to lower-priority queues if they do not finish within their time quantum.
Ensure that you update the waiting time, turnaround time, and remaining time for each process as they are scheduled and executed.
Print informative messages to show the state of the system, such as when a process is running, when it is moved to a different queue, and when it finishes execution.
Calculating Averages and Displaying Results:
After all processes have finished execution, calculate the average waiting time and average turnaround time.
Display the waiting time, turnaround time, and other relevant information for each process.
Present the calculated averages to the user.
Testing Your Implementation:
Test your implementation with various sets of processes and time quanta to ensure that it behaves as expected.
You can use the provided example to verify the correctness of your implementation.
Example output:
Process 1 is running in high priority queue
Process 1 finished execution
Process 2 is running in high priority queue
Process 2 is rescheduled with 18 remaining time
Process 3 is running in high priority queue
Process 3 is rescheduled with 28 remaining time
Process 2 is running in medium priority queue
Process 2 is rescheduled with 14 remaining time
Process 3 is running in medium priority queue
Process 3 is rescheduled with 24 remaining time
Process 2 is running in low priority queue
Process 2 is rescheduled with 6 remaining time
Process 3 is running in low priority queue
Process 3 is rescheduled with 16 remaining time
Process 2 is running in low priority queue
Process 2 finished execution
Process 3 is running in low priority queue
Process 3 is rescheduled with 8 remaining time
Process 3 is running in low priority queue
Process 3 finished execution
Process Duration Waiting Time Turnaround Time
1 10 0 10
2 20 10 30
3 30 30 60
Average Waiting Time: 13.33
Average Turnaround Time: 33.33
#include <stdio.h>
#include <stdlib.h>
struct node {
int data;
struct node* next;
};
struct node* head = NULL;
void add_node(int data) {
struct node* new_node = (struct node*)malloc(sizeof(struct node));
new_node->data = data;
new_node->next = head;
head = new_node;
}
void delete_node(int data) {
struct node* temp = head;
struct node* prev = NULL;
while (temp != NULL && temp->data != data) {
prev = temp;
temp = temp->next;
}
if (temp == NULL) {
printf("Node not found\n");
return;
}
if (prev == NULL) {
head = temp->next;
} else {
prev->next = temp->next;
}
free(temp);
}
struct node* find_node(int data) {
struct node* temp = head;
while (temp != NULL && temp->data != data) {
temp = temp->next;
}
return temp;
}
int main() {
add_node(1);
add_node(2);
add_node(3);
struct node* node_to_delete = find_node(2);
delete_node(node_to_delete->data);
struct node* node_to_find = find_node(3);
printf("Found node with data %d\n", node_to_find->data);
return 0;
}