Solved

CPU SCHEDULING ALGORITHMS

Posted on 2004-04-19
3
1,275 Views
Last Modified: 2008-02-01
I would like to write a programme of a process scheduling system that have three queues [SJF,Round Robin RR, and FCFS].  I do have a file of list of processes with the following attribuates  [processes ID, burst time, start time, n file size] to be inserted in the three queues.  a process is placed in a queue when its start time is >=  to the clock time. The CPU attempts to read the processes in the following order :-
 i) Execute all processes in SJF-Q first.
ii) If SJF-Q is empty then execute all processes in RR-Q. If a new job is entered into SJF-Q then
once the existing RR-Q job finishes, or completes it’s quantum, RR-Q cannot access the
CPU until all the processes in SJF-Q have been completed.
iii) Likewise processes in FCFS-Q can start once  SJF-Q and RR-Q are empty, although if a new job
is placed into SJF-Q or RR-Q then upon completion of the current job (from FCFS-Q) in the
CPU, FCFS-Q cannot access to the CPU until both SJF-Q and RR-Qare empty again.
The queue where a process should go is determined by its burst time.
 

I need also to compute the average waiting time of the processes to start over the entire  3 Qs . and also an average waiting time of each queue.

please I need hints on how to implement the code.  I'm lost and I donn't know how to start.

Thank you very much
0
Comment
Question by:sh7tot
3 Comments
 
LVL 45

Accepted Solution

by:
sunnycoder earned 125 total points
ID: 10865874
check the /usr/src/linux/kernel/sched.c file in any linux machine ... It has source code for round robin and FCFS algorithms .... once you get a hang of it, implementing SJF should not be much difficult

>please I need hints on how to implement the code.
Break down your problem into smaller sized, manageable chunks e.g.
1. read information from file
2. form queues
3. execute tasks

Since in your problem, requests are not arriving dynamically, the task is considerably easier ...

Since this is system programming homework assignment, I assume that you would be using C on a linux/solaris box

Reading information from file is trivial enough ... it is devising a data structure in which to store information that needs some thought ... Do you use arrays or linked lists or doubly linked lists and why ?

the problem is relatively strainght-forward ... think along these lines and if you get stuck, ask here
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
firstswap challenge 20 68
how to split this type of line? 5 84
Adoquery sql  left join does not work 25 80
Check folder every for files and print them 5 25
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now