Posted on 2004-04-19
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
Question by:sh7tot
LVL 45

Accepted Solution

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

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
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…

856 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