Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In the example of producer-and-consumer problem (slide-31), which semaphore is used to implement a critical section for the shared variable, buffer? s n e all
- In the example of producer-and-consumer problem (slide-31), which semaphore is used to implement a critical section for the shared variable, buffer?
- s
- n
- e
- all of them
- None of tem
- Deadlock may happen due to
- User consumes too much resource
- User holds some resources and waits for more
- System does not have shared resources
- There are no mutual exclusions of user processes
- Users hate each other.
- Which of the following OS scheduling policy has the worst performance (response time)?
- Shortest Job First
- Round Robin with fixed quantum
- Round Robin with variable quantum
- First-Come-First-Serve
- No difference, all are about the same
- How does OS resolve the problem of starvation of low priority jobs in the priority scheduling policy?
- Request the user to resubmit the job with a higher priority
- Continue waiting until the high priority jobs are completed.
- Increate the priority of aging process in the Ready state.
- Allocate more CPU time to do processing.
- Stop the preemptive scheduling when there are too many aging processes.
var s: semaphore (1); /* critical section */ n: semaphore (0); /* underflow */ e: semaphore (sizeofbuffer); /* overflow */ procedure producer; begin repeat produce item for buffer; wait(e); wait(s); append to buffer; signal(s); signal(n); forever; end; procedure consumer; begin repeat wait(n); wait(s); take from buffer; signal(s); signal(e); consume item forever; end; 10/03/2019 TDC411-04
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started