Menu_634641185555058750_CS4108 Operating System Lab Assignment
Short Description
Zczsc...
Description
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 simulate FCFS, FCFS, SJF, SJF, SRT (shortest remaining remaining tine first), and round robin robin scheduling 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 0 3 5 9 10 12 14 16 17 19
CPU cycle(in ms) 6 2 1 7 5 3 4 5 7 2 Table 1
2.
Using Using your program1 program1,, change change the context context switching switching time time to 0.4 ms. ms. Compare Compare outputs outputs from from both runs and print which is a better policy.
3.
Using Using the informa information tion give give in table table 2 and table table 3 to comple complete te the follow following ing program program
Job list Job stream number 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Time 5 4 8 2 2 6 8 10 7 6 5 8 9 10 10 7 3 1 9
Job Size 5760 4190 3290 2030 2550 6990 8940 740 3930 6890 6580 3820 9140 420 220 7540 3210 1380 9850
20 21 22 23 24 25
3 7 2 8 5 10
3610 7540 2710 8390 5950 760 Table2
Memory Block 1 2 3 4 5 6 7 8 9 10
Memory list Size 9500 7000 4500 8500 3000 9000 1000 5500 1500 500 Table 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 contiguous storage 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 user’s 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 (in order 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 25 resident 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.
6.
a. b. c. d.
7.
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, and the quotient gives the page number. The number of page frames in memory is the total number, 200, divided by the page size. Find the success frequency for the request list using FIFO replacement algorithm and a page size of 100 words. (There are two page frames). 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) Find the success frequency for the request list using FIFO replacement algorithm and a page size of 200 words. 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 Given the following information for an assembly language program: Job size = 3126 bytes Page size = 1042 bytes Instruction at memory location 532: LOAD 1, 2098 Instruction at memory location 1156: ADD 1, 2087 Instruction 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. b. c.
Find the number of pages needed to store the entire job? Compute the page number and displacement for each of the byte addresses where the data is stored. 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 optimization strategies. Assume that: a. The disk’s 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 0 23 25 29 35 45
Track requested 45 132 20 23 198 170
Sector requested 0 6 2 1 7 5
57 83 88 95
180 78 73 150
3 4 5 7 Table 4
View more...
Comments