Menu_634641185555058750_CS4108 Operating System Lab Assignment
-
Upload
mahesh-borkar -
Category
Documents
-
view
221 -
download
0
Transcript of Menu_634641185555058750_CS4108 Operating System Lab Assignment
-
7/29/2019 Menu_634641185555058750_CS4108 Operating System Lab Assignment
1/4
SEMESTER-IV
CS 4108 OPERATING SYSTEM LAB ASSIGNMENT
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA
1. Write a program that will simulate FCFS, SJF, SRT (shortest remaining tine first), and round robinscheduling algorithm. For each algorithm, the program should compute waiting time, turnaround
time of every job as well as the average waiting time and the average turn around time. The
average values should be consolidated in a table for easy comparison. You may use the following
data to test your program. The time quantum for round robin is 4 ms and the context switching
time is zero.
Arrival time CPU cycle(in ms)
0 6
3 2
5 1
9 7
10 5
12 314 4
16 5
17 7
19 2
Table 1
2. Using your program1, change the context switching time to 0.4 ms. Compare outputs from both
runs and print which is a better policy.
3. Using the information give in table 2 and table 3 to complete the following program
Job list
Job stream number Time Job Size
1 5 5760
2 4 4190
3 8 3290
4 2 2030
5 2 2550
6 6 6990
7 8 8940
8 10 740
9 7 3930
10 6 6890
11 5 658012 8 3820
13 9 9140
14 10 420
15 10 220
16 7 7540
17 3 3210
18 1 1380
19 9 9850
-
7/29/2019 Menu_634641185555058750_CS4108 Operating System Lab Assignment
2/4
20 3 3610
21 7 7540
22 2 2710
23 8 8390
24 5 5950
25 10 760
Table2
Memory list
Memory Block Size
1 9500
2 7000
3 4500
4 8500
5 3000
6 9000
7 1000
8 5500
9 1500
10 500Table 3
At one large batch- processing computer installation the management wants to decide what storage
placement strategy will yield the best possible performance. The installation runs a large real storage
computer under fixed partition multiprogramming. Each user program runs in a single group of contiguousstorage locations. Users state their storage requirements and time units for CPU usage on their job control
card. The operating system allocates to each user the appropriate partition and starts up the users jobs. The
jobs remain in memory until completion. A total of 50,000 memory locations are available, divided into
block as indicated in the table above.
a. Write a event driven simulation to help you decide which storage placement strategy should be
used at this installation. Your program would use the job stream and memory partitioning as
indicate previously. Rum the program until all jobs have been executed with the memory as is (inorder by address). This will give you the first fit type performance results.
b. Sort the memory partitions by size and run the program a second time; this will give the best fit
performance results. For both parts a. and b. you are investigating the performance of the system
using a typical job stream by measuring:
(i) throughput ( how many jobs are processed per given time unit)
(ii) storage utilization (percentage of partitions never used, percentage of partitions heavily used,
etc)
(iii) waiting queue length
(iv) waiting time in queue
(v) internal fragmentation
4. Suppose your system (as explained in program 3) now has a spooler (storage area in which to
temporarily hold jobs) and the job scheduler can choose which will be served from among 25resident jobs. Suppose also that the FCFS policy is replaced with SJF policy. This would require
that a sort by time be performed on the job list before running the program. Dose this make a
difference in the results. The program should be run twice to test this new policy with both best fit
and first fit.
5. Suppose your spooler (as describe in program 4) replace the previous policy with one of
Smallest Job First Served. This should require that a sort by job size be performed on the job list
before running the program. The program should be run twice to test this new policy with both
best fit and first fit. Print the result.
-
7/29/2019 Menu_634641185555058750_CS4108 Operating System Lab Assignment
3/4
6. The following sequence of requests for program words is taken from a 460 word program:
10,11,104,170,73,309,185,245,246,434,458,364. Main memory can hold a total of 200words for
this program and the page frame size will match the size of the pages into which the program has
been divided. Calculate the page number according to the page size; divide by the page size, andthe quotient gives the page number. The number of page frames in memory is the total number,
200, divided by the page size.
a. Find the success frequency for the request list using FIFO replacement algorithm and a page size
of 100 words. (There are two page frames).
b. Find the success frequency for the request list using a FIFO replacement algorithm and a page
size of 20 words. (10 pages. 0 through 9)
c. Find the success frequency for the request list using FIFO replacement algorithm and a page sizeof 200 words.
d. Repeat a. through c. above, using a main memory of 400 words. The size of each page frame will
again correspond to the size of the page.
Optional Questions
7. Given the following information for an assembly language program:
Job size = 3126 bytes
Page size = 1042 bytesInstruction at memory location 532: LOAD 1, 2098
Instruction at memory location 1156: ADD 1, 2087Instruction at memory location 2086: SUB 1, 1052
Data at memory location 1052: 015672
Data at memory location 2098: 114321
Data at memory location 2087: 077435
a. Find the number of pages needed to store the entire job?
b. Compute the page number and displacement for each of the byte addresses where the
data is stored.c. Determine whether the page number and displacements legal for this job.
8. writ a program that will simulate the FCFS, SSTF, LOOK, and C-LOOK seek optimizationstrategies. Assume that:
a. The disks outer track is the 0 track and the disk contains 200 tracks per surface.
Each track holds 8 sectors numbered 0 through 7.
b. A seek takes 10+0.1* T ms, where T is the number of tracks of motion from one request to the
next, and 10 is movement time constant.c. One full rotation takes 8 ms.
d. Transfer time is 1ms.
Use the data in table 4 to test your program.
For comparison purposes, compute the average, variance, standard deviation of time required to
accommodate all request under each of the strategies. Consolidate your result into a table.
Arrival Time Track requested Sector requested
0 45 0
23 132 6
25 20 2
29 23 1
35 198 7
45 170 5
-
7/29/2019 Menu_634641185555058750_CS4108 Operating System Lab Assignment
4/4
57 180 3
83 78 4
88 73 5
95 150 7
Table 4