Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

CPU SCHEDULING ALGORITHMS

Posted on 2004-04-19
3
Medium Priority
?
1,286 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 500 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
When you discover the power of the R programming language, you are going to wonder how you ever lived without it! Learn why the language merits a place in your programming arsenal.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
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…

971 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