Anda di halaman 1dari 5

CST 232 Operating Systems 2017

Assignment 1 (due on 2-11-2017. Submit your report in DKG31 before the lecture
starts)

At one large computer centre, the management wants to decide what storage
placement strategy will yield the best possible performance. The management asks
you to write an event-driven simulation program to study the performance of each
storage placement strategy. The following is a list of jobs submitted by the users. The
users state the storage requirements and time units for CPU usage for their jobs.

Job list
Job number Arrival time Processing Time Job size
1 0 5 5760
2 0 4 4190
3 1 8 3290
4 1 2 2030
5 1 2 2550
6 2 8 6990
7 2 8 8940
8 3 10 740
9 3 7 3930
10 3 6 6890
11 4 5 6580
12 4 8 3820
13 4 9 9140
14 4 10 420
15 5 10 220
16 5 7 7540
17 7 3 3210
18 7 1 1380
19 7 9 9850
20 9 3 3610
21 9 7 7540
22 9 2 2710
23 10 8 8390
24 11 5 5950
1
25 11 12 9850
26 12 6 610
27 12 9 8540
28 12 2 1710
29 13 8 9390
30 13 10 950
31 18 13 9050
32 18 3 880
33 18 7 6540
34 18 6 3710
35 20 5 8890
36 21 9 6750
37 22 2 310
38 24 11 840
39 25 8 4710
40 25 12 8390
The above data are stored in a text input file, named as Joblist.txt. The first line is the
total number of jobs. The second line is the first job number, a space, then the arrival
time, space, processing time, space, and the job size. The third line is the information
about the second job and so on. The sample input is:

40
1 0 5 5760
2 0 4 4190
3 1 8 3290
4 1 2 2030
..

The management wants you to study fixed partition multiprogramming by dividing


the 50 000 memory locations into blocks as indicated in the following table.

Memory list
Memory block Size
1 9500
2 7000
3 4500
2
4 8500
5 3000
6 9000
7 1000
8 5500
9 1500
10 500

The memory list is stored in a text input file, named as MemoryList.txt. The sample
input is

10
9500
7000
4500

where the first line is the total number of memory blocks, the second line is the first
memory block size, the third line is the second memory block size, and so on.

Your program will read the jobs from the job list and assign jobs into the partitions
according to the order in the memory list. If the first memory block encountered is
big enough, then the job is loaded into this partition. If not, the next memory block is
checked. If all the memory blocks are not big enough, put the job in a waiting queue.
Run your program until all jobs have been executed. This will give you the first-fit
type performance results.

Before you write your program, try out the first-fit algorithm manually so that you
understand exactly what happens when an event occurs. An event is something that
causes your computer to move to another stage, such as completion of a job, a
partition is freed, and so on. You need to prove that your program works by tracing
the events whether they match with your manual calculation.

Note: event driven simulation versus time driven simulation. Time driven simulation
advances time with fixed increment. At every time unit increment, the simulation
program updates all the state variables according to the behavior of the system. It is
3
efficient if events occur at every time unit that elapses. If events do not occur at
regular intervals, it is more appropriate to use event driven simulation where the
simulation makes the time jump to the time of the next event. For example, if we want
to simulate the paying counters at a supermarket, the customers may arrive at the
counters in the following time units: 1, 10, 25, 46, 66, . Obviously, it is more efficient
to advance the time based on the time when next event occur.

Next storage placement strategy that you need to investigate is best-fit algorithm. All
you need to do is to sort the memory partition by size in ascending order. The first
partition encountered in the sorted memory list big enough for a job is the best fit
partition. Hence the results that you get are the best-fit performance results.

Your management also asks you to investigate dynamic partition storage placement
strategy. The computer has a total of 50000 memory locations. You have to study 3
allocation algorithms which are first-fit, best-fit and worst-fit. You will use the same
job list given above. Relocatable dynamic partition scheme is not required in this
assignment.

For all the above, you are investigating the performance of the system using the given
job stream by measuring:

1. Throughput (how many jobs are processed per given time unit)
2. Storage utilization (percentage of partitions under used for fixed partitions,
percentage of partitions heavily used for fixed partitions and average storage
utilization). Note: under used is less than 20% being used. Heavily used is
greater than 80% being used.
3. Average waiting queue length (note: average over time), minimum and
maximum queue length
4. Average waiting time in queue(note: average over time), minimum and
maximum queue length
5. Internal or external fragmentation (note: average percentage over total storage)

Explain what the results indicate about the performance of the system for this
job mix and memory organization. Is one method of partitioning better than
others? Why or why not? Could you recommend one method over others given
4
your sample run? Would this hold in all cases? Write some conclusions and
recommendations.

After finishing your assignment, write a report which consists of

1. Explain how you organize your program. How many modules (functions or
objects or classes) are there? What are their functions? How do they work?
Provide a flow chart for the whole program.
2. Output of your programs which trace the events to prove that your programs
work perfectly. You dont have to trace all the events but to select special
events which show that your programs can handle these special cases.
(example of the output: at time 5, job 3 finishes, waiting time for job 3 is 4 unit
time, the waiting queue consists of the jobs: 4, and 5. Fixed partition 1 has job
2, fixed partition 2 has job 6. .) The output should be detailed enough for you
to debug and verify your program works perfectly.
3. Results of your investigations
4. Discussion of your results
5. Conclusion and recommendations to your top management.

This is a group assignment and therefore everyone must contribute to the program.
Explain how you divide your programming work among yourself and who is
responsible for what module.

E.g.

Module or function Done by

Your report must include a CD which contains your programs and their .exe files
and also their input files and output results.

Anda mungkin juga menyukai