Write a program that can simulate the following CPU scheduling algorithms:

1. FCFS
2. RR (new processes are added at the beginning of the ready queue, the quantum is one time unit)
3. Priority based
4. SJF non-preemptive
5. SRTF

The program can be written in either C or Pascal. Although the platform for development can be one of your choice, the program must be portable (i.e. platform independent) and its final version must run correctly on the server of the computer science department where the grading will be performed.

Specifications:

1. The program must:

1. Ask the user for the name of a file containing its input data. The file will have the following format:
0. Number of processes.
1. A number of lines containing the data for each process. Each process will have one line which will contain in the following order: the burst time, the priority (the lower the number the higher the priority) and the arrival time.
2. The algorithm(s) required. The algorithm will be specified as one of: FCFS, RR, Priority, SJF, SRTF

This is an example of an input file (corresponding to exercise 5.3 page 150):

5

10 3 0

1 1 0

2 3 0

1 4 0

5 2 0

FCFS

SJF

Priority

RR
2. Calculate the Gantt diagram. The diagram will be displayed as follows:

0 -p1- 2 -p2- 5 -p3- 7

The example shows P1 running for 2 time units (from 0 to 2) then P2 running for 3 time units (from 2 to 5) then P3 running for 2 units (from 5 to 7).
3. Calculate the waiting time of each process and the average waiting time for the given algorithms.
my mail: << email address snipped>> plz send in my mail

You don't need to start duplicate threads for same problem. Check this
Scheduling Algorithm

And we're not going to do the homework for lazy kids who can't even be bothered to try and hide that it's homework nor try to come up with a title that's even remotely descriptive.

We WANT such kids to fail so they won't bother us as potential colleagues later.

commented: Works for me :) - Salem +5

An excellent example of how not to post a question, if anyone cares.

> plz help me plz plz plz plz plz plz
Don't sound like an illiterate boob
http://www.catb.org/~esr/faqs/smart-questions.html#writewell

> Write a program that can simulate the following CPU scheduling algorithms:
Don't beg others to do your own homework.
http://www.daniweb.com/techtalkforums/announcement8-2.html
http://www.catb.org/~esr/faqs/smart-questions.html#id273364
http://www.catb.org/~esr/faqs/smart-questions.html#homework

> my mail:loser@crap-isp.com plz send in my mail
Great - you're just going round spamming every board and forum in sight, and just hoping some schmuck is going to save your lazy arse?
http://www.catb.org/~esr/faqs/smart-questions.html#noprivate

Do the world a favour and just fail already, so the rest of us can get on with the future, while you work on the "do you want fries with that" speech.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.