Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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,

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions