Question: 1) Implement the counting semaphores using binary semaphores. Pseudo-code for the implementation is given in the attached notes on BB: 10x- countingSemUsingBinarySem.pdf In your main0,

 1) Implement the counting semaphores using binary semaphores. Pseudo-code for the

1) Implement the counting semaphores using binary semaphores. Pseudo-code for the implementation is given in the attached notes on BB: 10x- countingSemUsingBinarySem.pdf In your main0, spawn three threads; in each thread function, you will need a call to wait(counting semaphore) and signal(counting semaphore). For the critical section, you can just have sleep0 to make the thread wait for some time. The incorrect implementation output from the attached notes will help you in writing the code. Turn in the output for BOTH the incorrect and correct implementations. Also, attach your codes (two versions: for incorrect and correct solutions) on BB. (10+10 points) 2) Prove that SJF is optimal in terms of average wait times of the processes. (5 points) 3) For what types of workloads does SJF deliver the same turnaround times as FIFO? (5 points) 4) For what types of workloads and quantum lengths does SJF deliver the same response (5 points) times as RR? 5) What happens to response time with SJF as job lengths increase? (5 points) 6) What happens to response time with RR as quantum lengths increase? Explain in words (5 and write an equation that gives the worst-case response time, given Njobs. points) 7) "Preemptive schedulers are always less efficient than non-preemptive schedulers." Explain how this statement can be true if you define efficiency one way and how it is false if you define efficiency another way (5 points) 8) What is the priority inversion problem? Does this problem occur if round-robin scheduling is used instead of priority scheduling? Discuss. (5 points) 1) Implement the counting semaphores using binary semaphores. Pseudo-code for the implementation is given in the attached notes on BB: 10x- countingSemUsingBinarySem.pdf In your main0, spawn three threads; in each thread function, you will need a call to wait(counting semaphore) and signal(counting semaphore). For the critical section, you can just have sleep0 to make the thread wait for some time. The incorrect implementation output from the attached notes will help you in writing the code. Turn in the output for BOTH the incorrect and correct implementations. Also, attach your codes (two versions: for incorrect and correct solutions) on BB. (10+10 points) 2) Prove that SJF is optimal in terms of average wait times of the processes. (5 points) 3) For what types of workloads does SJF deliver the same turnaround times as FIFO? (5 points) 4) For what types of workloads and quantum lengths does SJF deliver the same response (5 points) times as RR? 5) What happens to response time with SJF as job lengths increase? (5 points) 6) What happens to response time with RR as quantum lengths increase? Explain in words (5 and write an equation that gives the worst-case response time, given Njobs. points) 7) "Preemptive schedulers are always less efficient than non-preemptive schedulers." Explain how this statement can be true if you define efficiency one way and how it is false if you define efficiency another way (5 points) 8) What is the priority inversion problem? Does this problem occur if round-robin scheduling is used instead of priority scheduling? Discuss. (5 points)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!