How to write code for round robin scheduling
I want to write code for round robin scheduling
Any help will appreciateCode:#include<stdio.h> int main(void) { while (1) { } return 0; }
How to write code for round robin scheduling
I want to write code for round robin scheduling
Any help will appreciateCode:#include<stdio.h> int main(void) { while (1) { } return 0; }
Last edited by Player777; 09-07-2021 at 02:21 AM.
Why are you trying to write your own, when there are many open source ones -> OSRTOS
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I am not thinking of making real time operating system. I just want to understand the process of how multiple files work together to decide which task should be run on schedule time. Like if you have to set the schedule time then which function will you call? What function do you call if you want to make a priority ? there is a source file for list and queue why is it used and when should it be called from main.
I know all related documentation is available on internet but I am having trouble to figure out it. you gave me the paper and pencil idea i like it but i don't know how to start.
I'm trying understand how can I figure out all these problems on paper firstly
Google (or Duckduck Go) is your friend: Completly fair scheduler
> I am not thinking of making real time operating system.
Oh yes you are.
> I want to write code for round robin scheduling
Without a scheduler, your code runs like this.
You need a scheduler to be able to slice and dice into T1,T2,T3,T1,T2,T3,T1,T2,T3,T2Code:P1(); P2(); P3();
> I just want to understand the process of how multiple files work together to decide which task should be run on schedule time
These are completely independent.
You can have a single threaded program spread across many files.
You can have a multi-threaded program in a single file.
Code organisation into files is something you do to be organised.
But if your idea is wrong, then no matter how you arrange the code, it will still be wrong.
> Like if you have to set the schedule time then which function will you call?
You can fake it somewhat using pthreads.
But don't expect super-fine time-based switching between the different processes.
> What function do you call if you want to make a priority ?
You're probably out of luck, unless you're root on your Linux box or using an RTOS.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
The first task is to describe the problem you are trying to solve.
Then, describe each part/step/sub-task of the problem.
Of the three you listed (flowchart, block diagram, state diagram); block diagram would be the first of the three I would try.
Tim S.
"...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson
What is Context Switching in Operating System?
Context switch - Wikipedia
How you are going to do context switching is likely a very important thing to decide.
Tim S.
"...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson