Question
Operating System Consider the following scenarios using semaphores. As you know semaphores are used for synchronization. (a) (10 points) Suppose that a process interchanges the
Operating System Consider the following scenarios using semaphores. As you know semaphores are used for synchronization. (a) (10 points) Suppose that a process interchanges the order in which the wait() and signal() operations on the semaphore mutex are executed, resulting in the following execution: signal (mutex); critical section wait (mutex); Describe the problem that will occur. How can the violation be detected if it occurs? (b) (10 points) Suppose that a process replaces signal (mutex) with wait (mutex). The execution would be as follows. wait (mutex); critical section wait (mutex); Describe the problem that will occur in a single processor system with multiple processes. Part2 Given the five memory partitions of 100 kb, 500 kb, 200 kb, 300 kb, and 600 kb (in order), how would the first-fit, best-fit, and worst-fit algorithms place processes of 212 kb, 417 kb, 112 kb, and 426 kb (in order)? Which algorithm makes the most efficient use of memory? Explain your answer and use a diagram. Part3 The ability of one process to spawn a new process is an important capability. However, it can also be dangerous. Consider the consequences of allowing a user to run the process given below. Answer each of the questions. a) What would be the consequences to a system of allowing such a process to run? Explain your answer. b) If the while loop is changed and only allowed to execute 7 times, how many processes will be active in the system? Explain your answer. #include #include int main( ) { // fork a child process While (true) { fork( ); } }
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