Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.78 KB | None | 0 0
  1. List of Questions:
  2.  
  3. Ques. 1. Considering 4 processes with the arrival time and the burst time requirement of the
  4. processes the scheduler schedules the processes by interrupting the processor after every 3 units
  5. of time and does consider the completion of the process in this iteration. The schedulers then
  6. checks for the number of processes waiting for the processor and allots the processor to the
  7. process but interrupting the processor after every 6 units of time and considers the completion of
  8. the process in this iteration. The scheduler after the second iteration checks for the number of
  9. processes waiting for the processor and now provides the processor to the process with the least
  10. time requirement to go in the terminated state.
  11. The inputs for the number of requirements, arrival time and burst time should be provided by the
  12. user.
  13.  
  14. Consider the following units for reference.
  15. Process Arrival time Burst time
  16. P1 0 18
  17. P2 2 23
  18. P3 4 13
  19. P4 13 10
  20. Develop a scheduler which submits the processes to the processor in the above defined scenario,
  21. and compute the scheduler performance by providing the waiting time for process, turnaround
  22. time for process and average waiting time and turnaround time.
  23.  
  24. Ques. 2. Considering the arrival time and burst time requirement of the process the scheduler
  25. schedules the processes by interrupting the processor after every 6 units of time and does
  26. consider the completion of the process in this iteration. The scheduler than checks for the number
  27. of process waiting for the processor and allots the processor to the process but interrupting the
  28. processor every 10 unit of time and considers the completion of the processes in this iteration.
  29. The scheduler checks the number of processes waiting in the queue for the processor after the
  30. second iteration and gives the processor to the process which needs more time to complete than
  31. the other processes to go in the terminated state.
  32. The inputs for the number of requirements, arrival time and burst time should be provided by the
  33. user.
  34. Consider the following units for reference.
  35. Process Arrival time Burst time
  36. P1 0 20
  37. P2 5 36
  38. P3 13 19
  39. P4 26 42
  40. Develop a scheduler which submits the processes to the processor in the defined scenario, and
  41. compute the scheduler performance by providing the waiting time for process, turnaround time
  42. for process and average waiting time and turnaround time.
  43.  
  44. Ques. 3. Consider a scheduler which schedules the job by considering the arrival time of the
  45. processes where arrival time if given as 0 is discarded or displayed as error. The scheduler
  46. implements the shortest job first scheduling policy, but checks the queue of the processes after
  47. the every process terminates and time taken for checking and arranging the process according to
  48. the shortest job is 2 time unit. Compute the waiting time, turnaround time and average waiting
  49. time and turnaround time of the processes. Also compute the total time taken by the processor to
  50. compute all the jobs.
  51.  
  52. The inputs for the number of requirements, arrival time and burst time should be provided by the
  53. user.
  54.  
  55. Consider the following units for reference.
  56. Process Arrival time Burst Time
  57. 1 0 6
  58. 2 3 2
  59. 3 5 1
  60. 4 9 7
  61. 5 10 5
  62. 6 12 3
  63. 7 14 4
  64. 8 16 5
  65. 9 17 7
  66. 10 19 2
  67. Develop a scheduler which submits the processes to the processor in the defined scenario, and
  68. compute the scheduler performance by providing the waiting time for process, turnaround time
  69. for process and average waiting time and turnaround time.
  70.  
  71.  
  72. Ques. 4. Consider a scheduling approach which is non pre-emptive similar to shortest job next in
  73. nature. The priority of each job is dependent on its estimated run time, and also the amount of
  74. time it has spent waiting. Jobs gain higher priority the longer they wait, which prevents indefinite
  75. postponement. The jobs that have spent a long time waiting compete against those estimated to
  76. have short run times. The priority can be computed as :
  77. Priority = 1+ Waiting time / Estimated run time
  78. Using the data given below compute the waiting time and turnaround time for each process and
  79. average waiting time and average turnaround time.
  80.  
  81.  
  82. Process Arrival time Burst time
  83.  
  84. P1 0 20
  85.  
  86. P2 5 36
  87.  
  88. P3 13 19
  89.  
  90. P4 17 42
  91. Ques. 5. CPU schedules N processes which arrive at different time intervals and each process is
  92. allocated the CPU for a specific user input time unit, processes are scheduled using a preemptive
  93. round robin scheduling algorithm. Each process must be assigned a numerical priority, with a
  94. higher number indicating a higher relative priority. In addition to the processes one task has
  95. priority 0. The length of a time quantum is T units, where T is the custom time considered as
  96. time quantum for processing. If a process is preempted by a higher-priority process, the
  97. preempted process is placed at the end of the queue. Design a scheduler so that the task with
  98. priority 0 does not starve for resources and gets the CPU at some time unit to execute. Also
  99. compute waiting time, turn around.
  100.  
  101. Ques. 6. Design a scheduling program that is capable of scheduling many processes that comes
  102. in at some time interval and are allocated the CPU not more that 10 time units. CPU must
  103. schedule processes having short execution time first. CPU is idle for 3 time units and does not
  104. entertain any process prior this time. Scheduler must maintain a queue that keeps the order of
  105. execution of all the processes. Compute average waiting and turnaround time.
  106.  
  107. Ques. 7. Design a scheduling program to implements a Queue with two levels:
  108. Level 1 : Fixed priority preemptive Scheduling
  109. Level 2 : Round Robin Scheduling
  110. For a Fixed priority preemptive Scheduling (Queue 1), the Priority 0 is highest priority. If one
  111. process P1 is scheduled and running , another process P2 with higher priority comes. The New
  112. process (high priority) process P2 preempts currently running process P1 and process P1 will go
  113. to second level queue. Time for which process will strictly execute must be considered in the
  114. multiples of 2..
  115. All the processes in second level queue will complete their execution according to round robin
  116. scheduling.
  117. Consider: 1. Queue 2 will be processed after Queue 1 becomes empty.
  118. 2. Priority of Queue 2 has lower priority than in Queue 1.
  119.  
  120. Ques. 8. Sudesh Sharma is a Linux expert who wants to have an online system where he can
  121. handle student queries. Since there can be multiple requests at any time he wishes to dedicate a
  122. fixed amount of time to every request so that everyone gets a fair share of his time. He will log
  123. into the system from 10am to 12am only. He wants to have separate requests queues for students
  124. and faculty. Implement a strategy for the same. The summary at the end of the session should
  125. include the total time he spent on handling queries and average query time.
  126.  
  127. Ques. 9. Design a scheduler that uses a preemptive priority scheduling algorithm based on
  128. dynamically changing priority. Larger number for priority indicates higher priority.
  129. Assume that the following processes with arrival time and service time wants to execute (for
  130. reference):
  131. ProcessID Arrival Time Service Time
  132. P1 0 4
  133. P2 1 1
  134. P3 2 2
  135. P4 3 1
  136.  
  137. When the process starts execution (i.e. CPU assigned), priority for that process changes at the
  138. rate of m=1.When the process waits for CPU in the ready queue (but not yet started execution),
  139. its priority changes at a rate n=2. All the processes are initially assigned priority value of 0 when
  140. they enter ready queue for the first time . The time slice for each process is q = 1. When two
  141. processes want to join ready queue simultaneously, the process which has not executed recently
  142. is given priority. Calculate the average waiting time for each process. The program must be
  143. generic i.e. number of processes, their burst time and arrival time must be entered by user.
  144.  
  145. Ques. 10. Design a scheduler with multilevel queue having two queues which will schedule the
  146. processes on the basis of pre-emptive shortest remaining processing time first algorithm (SROT)
  147. followed by a scheduling in which each process will get 2 units of time to execute. Also note that
  148. queue 1 has higher priority than queue 2. Consider the following set of processes (for
  149. reference)with their arrival times and the CPU burst times in milliseconds.
  150. -------------------------------------
  151. Process Arrival-Time Burst-Time
  152. -------------------------------------
  153. P1 0 5
  154. P2 1 3
  155. P3 2 3
  156. P4 4 1
  157. -------------------------------------
  158. Calculate the average turnaround time and average waiting time for each process. The input for
  159. number of processes and their arrival time, burst time should be given by the user.
  160.  
  161. Ques. 11. Reena’s operating system uses an algorithm for deadlock avoidance to manage the
  162. allocation of resources say three namely A, B, and C to three processes P0, P1, and P2. Consider
  163. the following scenario as reference .user must enter the current state of system as given in this
  164. example :
  165. Suppose P0 has 0,0,1 instances , P1 is having 3,2,0 instances and P2 occupies 2,1,1 instances of
  166. A,B,C resource respectively.
  167. Also the maximum number of instances required for P0 is 8,4,3 and for p1 is 6,2,0 and finally for
  168. P2 there are 3,3,3 instances of resources A,B,C respectively. There are 3 instances of resource A,
  169. 2 instances of resource B and 2 instances of resource C available. Write a program to check
  170. whether Reena’s operating system is in a safe state or not in the following independent requests
  171. for additional resources in the
  172. current state:
  173. 1. Request1: P0 requests 0 instances of A and 0 instances of B and 2 instances of C.
  174. 2. Request2: P1 requests for 2 instances of A, 0 instances of B and 0 instances of C.
  175. All the request must be given by user as input.
  176.  
  177. Ques. 12. Three students (a, b, c) are arriving in the mess at the same time. The id numbers of
  178. these students are 2132, 2102, 2453 and the food taken time from the mess table is 2, 4 and 8
  179. minutes. If the two students have same remaining time so it is broken by giving priority to the
  180. students with the lowest id number. Consider the longest remaining time first (LRTF) scheduling
  181. algorithm and calculate the average turnaround time and waiting time.
  182.  
  183. Ques. 13. Write a program for multilevel queue scheduling algorithm. There must be three
  184. queues generated. There must be specific range of priority associated with every queue. Now
  185. prompt the user to enter number of processes along with their priority and burst time. Each
  186. process must occupy the respective queue with specific priority range according to its priority.
  187. Apply Round robin algorithm with quantum time 4 on queue with highest priority range. Apply
  188. priority scheduling algorithm on the queue with medium range of priority and First come first
  189. serve algorithm on the queue with lowest range of priority. Each and every queue should get a
  190. quantum time of 10 seconds. Cpu will keep on shifting between queues after every 10
  191. seconds i.e. to apply round robin algorithm OF 10 seconds on over all structure.
  192. Calculate Waiting time and turnaround time for every process. The input for number of
  193. processes should be given by the user.
  194.  
  195. Ques. 14. Write a program to implement priority scheduling algorithm with context switching
  196. time. Prompt to user to enter the number of processes and then enter their priority, burst time and
  197. arrival time also. Now whenever operating system preempts a process and shifts cpu’s control to
  198. some another process of higher priority assume that it takes 2 seconds for context
  199. switching(dispatcher latency).Form a scenario, where we can give the processes are assigned
  200. with priority where the lower integer number is higher priority and then context switch .. as the
  201. process waits the priority of the process increase at rate of one per 2 time units of wait.
  202. Calculate waiting time and turnaround time for each process.
  203.  
  204. Ques. 15. A uniprocessor system has n number of CPU intensive processes, each process has its
  205. own requirement of CPU burst. The process with lowest CPU burst is given the highest priority.
  206. A late-arriving higher priority process can preempt a currently running process with lower
  207. priority. Simulate a scheduler that is scheduling the processes in such a way that higher priority
  208. process is never starved due to the execution of lower priority process. What should be its
  209. average waiting time and average turnaround time if no two processes are arriving are arriving at
  210. same time.
  211.  
  212. Ques. 16. Design a scheduler that can schedule the processes arriving system at periodical
  213. intervals. Every process is assigned with a fixed time slice t milliseconds. If it is not able to
  214. complete its execution within the assigned time quantum, then automated timer generates an
  215. interrupt. The scheduler will select the next process in the queue and dispatcher dispatches the
  216. process to processor for execution. Compute the total time for which processes were in the queue
  217. waiting for the processor. Take the input for CPU burst, arrival time and time quantum from the
  218. user.
  219.  
  220. Ques. 17. Design a scheduler following non-preemptive scheduling approach to schedule the
  221. processes that arrives at different units and having burst time double the arrival time. Scheduler
  222. selects the process with largest burst time from the queue for the execution. Process is not being
  223. preempted until it finishes its service time. Compute the average waiting time and average
  224. turnaround time. What should be the average waiting time if processes are executed according to
  225. Shortest Job First scheduling approach with the same attribute values.
  226.  
  227. Ques. 18. Ten students (a,b,c,d,e,f,g,h,i,j) are going to attend an event. There are lots of gift
  228. shops, they all are going to the gift shops and randomly picking the gifts. After picking the gifts
  229. they are randomly arriving in the billing counter. The accountant gives the preference to that
  230. student who has maximum number of gifts. Create a C or Java program to define order of billed
  231. students?
  232.  
  233. Ques. 19. There are 5 processes and 3 resource types, resource A with 10 instances, B with 5
  234. instances and C with 7 instances. Consider following and write a c code to find whether the
  235. system is in safe state or not?
  236.  
  237. Available Processes Allocation Max
  238. A B C A B C A B C
  239. 3 3 2 P0 0 1 0 7 5 3
  240. P1 2 0 0 3 2 2
  241. P2 3 0 2 9 0 2
  242. P3 2 1 1 2 2 2
  243. P4 0 0 2 4 3 3
  244.  
  245.  
  246. Ques. 20. Consider that a system has P resources of same type. These resources are shared by Q
  247. processes time to time. All processes request and release the resources one at a time. Generate a
  248. solution to demonstrate that, the system is in safe state when following conditions are satisfied.
  249. Conditions:
  250.  
  251. 1. Maximum resource need of each process is between 1 and P.
  252. 2. Summation of all maximum needs is less than P+Q
  253.  
  254. Ques. 21. Consider a scenario of demand paged memory. Page table is held in registers. It takes
  255. 8 milliseconds to service a page fault if an empty page is available or the replaced page is not
  256. modified and 20 milliseconds if the replaced page is modified. Memory access time is 100
  257. nanoseconds. Assume that the page to be replaced is modified 70 percent of the time. Generate a
  258. solution to find maximum acceptable page-fault rate for access time that is not more than 200
  259. nanoseconds.
  260.  
  261. Ques. 22. Consider following and Generate a solution to find whether the system is in safe state
  262. or not?
  263.  
  264. Available Processes Allocation Max
  265. A B C D A B C D A B C D
  266. 1 5 2 0 P0 0 0 1 2 0 0 1 2
  267. P1 1 0 0 0 1 7 5 0
  268. P2 1 3 5 4 2 3 5 6
  269. P3 0 6 3 2 0 6 5 2
  270. P4 0 0 1 4 0 6 5 6
  271.  
  272.  
  273. Ques. 23. Write a multithreaded program that implements the banker's algorithm. Create n
  274. threads that request and release resources from the bank. The banker will grant the request only
  275. if it leaves the system in a safe state. It is important that shared data be safe from concurrent
  276. access. To ensure safe access to shared data, you can use mutex locks.
  277. Ques 24. Design a scheduling program to implements a Queue with two levels:
  278. Level 1 : Fixed priority preemptive Scheduling
  279. Level 2 : Round Robin Scheduling
  280. For a Fixed priority preemptive Scheduling (Queue 1), the Priority 0 is highest priority. If one
  281. process P1 is scheduled and running, another process P2 with higher priority comes. The New
  282. process (high priority) process P2 preempts currently running process P1 and process P1 will go
  283. to second level queue. Time for which process will strictly execute must be considered in the
  284. multiples of 2.
  285.  
  286. All the processes in second level queue will complete their execution according to round
  287. robin scheduling.
  288. Consider: 1. Queue 2 will be processed after Queue 1 becomes empty.
  289. 3. Priority of Queue 2 has lower priority than in Queue 1.
  290. Ques 25. Write a program for multilevel queue scheduling algorithm. There must be three queues
  291. generated. There must be specific range of priority associated with every queue. Now prompt the
  292. user to enter number of processes along with their priority and burst time. Each process must
  293. occupy the respective queue with specific priority range according to its priority. Apply Round
  294. Robin algorithm with quantum time 4 on queue with highest priority range. Apply priority
  295. scheduling algorithm on the queue with medium range of priority and First come first serve
  296. algorithm on the queue with lowest range of priority. Each and every queue should get a
  297. quantum time of 10 seconds. CPU will keep on shifting between queues after every 10 seconds.
  298. Ques 26. Write a program in C which will accept5 positive integers as command line
  299. arguments. Performs check whether there are 5 arguments or not. If number of arguments are
  300. lesser or greater than 5 then it will print a relevant message to the user. If you enter 5 positive
  301. integers from command line then the program treat those argument as required CPU bust for
  302. P1, P2, P3, P4, andP5 process and calculate average waiting time and average turnaround
  303. time. Consider used scheduling algorithm as FCFS and same arrival time for all the
  304. processes.
  305.  
  306. Ques 27. Write a program in C which reads input CPU bursts from a the first line of a text file
  307. named as CPU_BURST.txt. Validate the input numbers whether the numbers are positive
  308. integers or not. Consider the numbers as CPU burst. If there are 5 positive integers in the first
  309. line of the text file then the program treat those argument as required CPU bust for P1, P2, P3,
  310. P4, and P5 process and calculate average waiting time and average turnaround time. Consider
  311. used scheduling algorithm as SJF and same arrival time for all the processes.
  312.  
  313.  
  314. Ques 28. Given five memory partitions of 100 KB, 500 KB, 200 KB, 300 KB, and 600 KB
  315. (in order), how would each of the first-fit, best-fit, and worst-fit algorithms place processes
  316. of 212 KB, 417 KB, 112 KB, and 426 KB (in order)? Write a program in C which will print
  317. the mapping of processes with memory partitions for both the algorithms.(for conceptual
  318. clarity refer the textbook)
  319.  
  320.  
  321.  
  322. Ques 29. Write a C program to create a page table for a program of 5MB. Consider page size
  323. as 2KB. Assign frame numbers randomly in page table. (for conceptual clarity refer the
  324. textbook)
  325.  
  326.  
  327. Ques 30. Write a C program to solve the following problem:
  328. Suppose that a disk drive has 5,000 cylinders, numbered 0 to 4999. The drive is currently
  329. serving a request at cylinder143, and the previous request was at cylinder 125. The queue of
  330. pending requests, in FIFO order,is:
  331.  
  332.  
  333. 86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130
  334.  
  335.  
  336. Starting from the current head position, what is the total distance (in cylinders) that the disk
  337. arm moves to satisfy all the pending requests for each of the FCFS disk-scheduling
  338. algorithms? (for conceptual clarity refer the textbook)
  339.  
  340. Q31. Write a C program to solve the following problem:
  341.  
  342. Suppose that a disk drive has 5,000 cylinders, numbered 0 to 4999. The drive is currently
  343. serving a request at cylinder143, and the previous request was at cylinder 125. The queue of
  344. pending requests, in FIFO order is:
  345.  
  346. 86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130
  347.  
  348. Starting from the current head position, what is the total distance (in cylinders)that the disk
  349. arm moves to satisfy all the pending requests for each of the SSTF disk-scheduling
  350. algorithms? (for conceptual clarity refer the textbook)
  351.  
  352. Q32. Write a C program to solve the following problem:
  353.  
  354. Suppose that a disk drive has 5,000 cylinders, numbered 0 to 4999. The drive is currently
  355. serving a request at cylinder143, and the previous request was at cylinder 125. The queue of
  356. pending requests, in FIFO order is:
  357.  
  358. 86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130
  359.  
  360. Starting from the current head position, what is the total distance (in cylinders) that the disk
  361. arm moves to satisfy all the pending requests for each of the SCAN disk-scheduling
  362. algorithms?
  363.  
  364. Q33. Write a C program to solve the following problem:
  365.  
  366. Suppose that a disk drive has 5,000 cylinders, numbered 0 to 4999. The drive is currently
  367. serving a request at cylinder143, and the previous request was at cylinder 125. The queue of
  368. pending requests, in FIFO order is
  369.  
  370. 86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130
  371. Starting from the current head position, what is the total distance (in cylinders) that the disk
  372. arm moves to satisfy all the pending requests for each of the CSCAN disk-scheduling
  373. algorithms?
  374.  
  375. Q34. Write a C program to solve the following problem:
  376.  
  377. Suppose that a disk drive has 5,000 cylinders, numbered 0 to 4999. The drive is currently
  378. serving a request at cylinder143, and the previous request was at cylinder 125. The queue of
  379. pending requests, in FIFO order is:
  380.  
  381.  
  382. 86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130
  383.  
  384.  
  385. Starting from the current head position, what is the total distance (in cylinders) that the disk
  386. arm moves to satisfy all the pending requests for each of the LOOK disk-scheduling
  387. algorithms?
  388.  
  389.  
  390.  
  391. Q35. Write a C program to solve the following problem:
  392.  
  393. Suppose that a disk drive has 5,000 cylinders, numbered 0 to 4999. The drive is currently
  394. serving a request at cylinder143, and the previous request was at cylinder 125. The queue of
  395. pending requests in FIFO order is:
  396.  
  397.  
  398. 86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130
  399.  
  400.  
  401. Starting from the current head position, what is the total distance (in cylinders)that the disk
  402. arm moves to satisfy all the pending requests for each of the C-LOOK disk-scheduling
  403. algorithms?
  404.  
  405.  
  406. Q36. Consider the following set of processes, with the length of the CPU burst given in
  407. milliseconds:
  408. Schedule the processes using SJF scheduling, and print the outlook of Gant Chart on the
  409. computer screen.
  410.  
  411.  
  412. Example:
  413.  
  414.  
  415. |________________|_________________|___________________________|___|
  416.  
  417.  
  418.  
  419.  
  420. Q37. Consider the following four processes, with the length of the CPU burst given in
  421. milliseconds
  422.  
  423.  
  424.  
  425.  
  426. Write a C program to calculate average waiting time using shortest-remaining-time-first
  427. scheduling.
  428.  
  429.  
  430. Q38. consider the following set of processes, assumed to have arrived at time 0, in the
  431. orderP1, P2, • • • , P5, with the length of the CPU burst given in milliseconds:
  432.  
  433.  
  434.  
  435.  
  436. Write a C program to schedule the processes using priority scheduling and calculate
  437. average waiting time. Consider Lower the number higher the priority.
  438.  
  439.  
  440. Q39.Thereare five processes in the system. All five processes arrive at time 0, in the order
  441. given, with the length of the CPU burst given in milliseconds:
  442. Write a C program which will incorporate SFJ scheduling and print the ending time of
  443. process Pi.
  444.  
  445. Q40. Consider the following set of processes, with the length of the CPU burst given in
  446. milliseconds:
  447.  
  448.  
  449.  
  450.  
  451. The processes are assumed to have arrived in the order Pi, P2, P3, P4, P5, all at time 0. Write a C
  452. program to calculate the turnaround time of each process by incorporating SJF scheduling.
  453.  
  454. Q41. Write a program which incorporate Peterson's solution for synchronizing two processes
  455. those are simultaneously trying to write on a shared file named as File.txt. (use system calls
  456. only)
  457.  
  458.  
  459. Q42. The Sleeping-Barber Problem. A barbershop consists of a waiting room with n chairs
  460. and a barber room with one barber chair. If there are no customers to be served the barber
  461. goes to sleep. If a customer enters the barbershop and all chairs are occupied then the
  462. customer leaves the shop. If the barber is busy but chairs are available, then the customer sits
  463. in one of the free chairs. If the barber is asleep, the customer wakes up the barber. Write a
  464. program to coordinate the barber and the customers.
  465. Q43. Develop a scheduler which submits processes to the processor in the following
  466. scenario and compute the scheduler performance by providing the waiting time for
  467. process, turnaround time for process and average waiting time and turnaround time.
  468.  
  469. Considering the arrival time and the burst time requirement of the processes the scheduler
  470. schedules the processes by interrupting the processor after every 3units of time and does
  471. consider the completion of the process in this iteration. The scheduler then checks for the
  472. number of processes waiting for the processor and allots the processor to the process but
  473. interrupting the processor after every 6 units of time and considers the completion of the
  474. process in this iteration. The scheduler after these iteration checks for the number of processes
  475. waiting for the processor and now provides the processor to the process with the least time
  476. requirement to go in the terminated state.
  477.  
  478. The inputs for the number of requirements, arrival time and burst time should be
  479. provided by the user.
  480.  
  481. Q44. Develop a scheduler which submits processes to the processor in the following scenario
  482. and compute the scheduler performance by providing the waiting time for process, turnaround
  483. time for process and average waiting time and turnaround time.
  484.  
  485. Considering the arrival time and burst time requirement of the process the scheduler schedules
  486. the processes by interrupting the processor after every 6 units of time and does consider the
  487. completion of the process in this iteration. The scheduler then checks for the number of
  488. process waiting for the processor and allots the processor to the process but interrupting the
  489. processor every 10 unit of time and considers the completion of the processes in this iteration.
  490. The scheduler checks the number of processes waiting in the queue for the processor after the
  491. second iteration and gives the processor to the process which needs more time to complete
  492. than the other processes to go in the terminated state.
  493.  
  494. The inputs for the number of requirements arrival time and burst time should be
  495. provided by the user.
  496.  
  497. Q45.If a teacher is being served and during the period when he is being served another
  498. teacher comes, then that teacher would get the service next. This process might continue
  499. leading to increase in waiting time of students. Write a C program to ensure in your program
  500. that the waiting time of students is minimized. Assume values of arrival time, burst time by
  501. your own.
  502. Q46.Consider a scheduling approach which is nonpre-emptive similar to shortest job next in
  503. nature. The priority of each job is dependent on its estimated run time and also the amount of
  504. time it has spent waiting. Jobs gain higher priority the longer they wait which prevents
  505. indefinite postponement. The jobs that have spent a long time waiting compete against those
  506. estimated to have short run times. The priority can be computed as :
  507.  
  508. Priority =1+ Waiting time / Estimated run time
  509.  
  510. Write a C program which will use the data given below and compute the waiting time and
  511. turnaround time for each process and average waiting time and average turnaround time.
  512.  
  513.  
  514. Process Arrival time Burst time
  515.  
  516. P1 0 20
  517.  
  518. P2 5 36
  519.  
  520. P3 13 19
  521.  
  522. P4 17 42
  523.  
  524.  
  525.  
  526. Q47. For SJF algorithm,
  527.  
  528. (i) We randomly generate the number of jobs. There must be a limit on the number of jobs in a
  529. system. (ii)The execution time of the generated jobs is also not known. Here, we are
  530. generating the CPU burst of each job making use of the past history.
  531.  
  532. (iii)All the jobs are then arranged in a queue where searching is done to find the one with the
  533. least CPU burst. There may be two jobs in queue with the same execution time then FCFS
  534. approach is to be performed.
  535.  
  536. Case a) If the algorithm is non-preemptive in nature, then the newly arriving job is to be added
  537. to the job queue even though it is of lesser execution time than the one running on the
  538. processor.
  539.  
  540. Case b) Otherwise pre-emption is performed.
  541.  
  542.  
  543. Assume values of arrival time, burst time (when required) by your own.
  544. Q48.CPU schedules N processes which arrive at different time intervals and each process is
  545. allocated
  546.  
  547.  
  548. The CPU for a specific user input time unit, processes are scheduled using a preemptive round
  549. robin scheduling algorithm. Each process must be assigned a numerical priority, with a higher
  550. number indicating a higher relative priority. In addition to the processes one task has priority 0.
  551. The length of a time quantum is T units, where T is the custom time considered as time quantum
  552. for processing .If a process is pre-empted by a higher priority process, the pre-empted process is
  553. placed at the end of the queue. Design a scheduler so that the task with priority 0 does not starve
  554. for resources and gets the CPU at some time unit to execute. Also compute waiting time, turn
  555. around.
  556.  
  557. Q49.Design a scheduling program that is capable of scheduling many processes that comes in at
  558. some time interval and are allocated the CPU not more than10 time units. CPU must schedule
  559. processes having short execution time first. CPU is idle for 3 time units and does not entertain
  560. any process prior this time. Scheduler must maintain a queue that keeps the order of execution of
  561. all the processes. Compute average waiting and turnaround time.
  562.  
  563. Q50. Design a scheduling program to implements a Queue with two levels:
  564.  
  565.  
  566. Level 1: Fixed priority pre-emptive Scheduling
  567.  
  568. Level 2: Round Robin Scheduling
  569.  
  570. For a Fixed priority preemptive Scheduling (Queue1), thePriority 0 is highest priority. If one
  571. process P1 is scheduled and running, another process P2 with higher priority comes. The New
  572. process (high priority) process P2 preempts currently running process P1 and process P1will go
  573. to second level queue. Time for which process will strictly execute must be considered in the
  574. multiples of 2.
  575.  
  576. All the processes in second level queue will complete their execution according to round robin
  577. scheduling.
  578.  
  579. Consider: 1. Queue 2 will be processed after Queue 1 becomes empty.
  580.  
  581. 2. Priority of Queue 2 has lower priority than in Queue 1.
  582.  
  583. Q51. Design a scheduler that uses a pre-emptive priority scheduling algorithm based on
  584. dynamically changing priority. Larger number for priority indicates higher priority.
  585. Assume that the following processes with arrival time and service time wants to execute (for
  586. reference):
  587.  
  588. Process AT Service Time (BT)
  589.  
  590. P1 0 4
  591. P2 1 1
  592. P3 2 2
  593. P4 3 1
  594. When the process starts execution (i.e.CPU assigned) priority for that process changes at the
  595. rate of m=1. When the process waits for CPU in the ready queue (but not yet started
  596. execution), its priority changes at a rate n=2. All the processes are initially assigned priority
  597. value of 0 when they enter ready queue for the first time. The time slice for each process is
  598. q=1. When two processes want to join ready queue simultaneously, the process which has not
  599. executed recently is given priority. Calculate the average waiting time for each process. The
  600. program must be generic i.e. number of processes, their burst time and arrival time must be
  601. entered by user.
  602.  
  603. Q52.Design a scheduler with multilevel queue having two queues which will schedule the
  604. processes on the basis of pre-emptive shortest remaining processing time first algorithm
  605. (SROT) followed by a scheduling in which each process will get 2 units of time to execute.
  606. Also note that queue 1 has higher priority than queue2. Consider the following set of
  607. processes (for reference) with the arrival times and the CPU burst times in milliseconds.
  608.  
  609. Pro AT BT
  610.  
  611.  
  612. P1 0 5
  613.  
  614. P2 1 3
  615.  
  616. P3 2 3
  617.  
  618. P4 4 1
  619.  
  620.  
  621. Calculate the average turnaround time and average waiting time for each process. The input for
  622. number of processes and their arrival time, burst time should be given by the user.
  623. Q53.consider a system with five processes P0 through P4 and three resource types A, B and C.
  624. Resource type A has10 instances, resource type B has 5 instances, and resource type C has 7
  625. instances.
  626.  
  627. Suppose that, at time T0, the following snap shot of the system has been taken
  628.  
  629.  
  630.  
  631.  
  632. Implement the Banker's algorithm to claim that the system is in safe state or not?
  633.  
  634. Q54. ASSIGNMENT COMPLETION PROBLEM
  635.  
  636. There are 3 student processes and 1 teacher process. Students are supposed to do their
  637. assignments and they need 3 things for that-pen, paper and question paper. The teacher has an
  638. infinite supply of all the three things. One students has pen, another has paper and another has
  639. question paper. The teacher places two things on a shared table and the student having the
  640. third complementary thing makes the assignment and tells the teacher on completion. The
  641. teacher then places an other two things out of the three and again the student having the third
  642. thing makes the assignment and tells the teacher on completion. This cycle continues. WAP to
  643. synchronise the teacher and the students.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement