Answered step by step
Verified Expert Solution
Question
1 Approved Answer
operating systems questions please solve this clearly 7. A student makes a typo in typing Peterson's algorithm. Show that with this typo mutual exclusion is
operating systems questions please solve this clearly
7. A student makes a typo in typing Peterson's algorithm. Show that with this typo mutual exclusion is not guaranteed by writing the sequence of operations illustrating the problem. No need to tell where the typo is, just illustrate the problem. (20 points) initialize flag[0] and flag[1] to false; initialize turn =0 A B A0:do{A1:flag[0]=true;A2:turn=1A3:while(flag[1]andturn=1){};A4:criticalsectionA5:flag[1]=false;A6:remaindersectionA7:}while(true);B0:do{B1:flag[1]=true;B2:turn=0B3:while(flag[0]andturn=0)f};B4:criticalsectionB5:flag[1]=false;B6:remaindersectionB7:}while(true); 8. Consider the philosopher problem with three phiosophers. Write the pseudo code for philosophers thread to illustrate a deadlock is possible. (10 points) Philosopher 0 Philosopher 1 Philosopher 2 4. Memory is divided into 4 pages. Find the optimum (minimum) number of page interrupts for memory management for the following page requests Illustrate your work (10 points) 7,0,1,2,0,3,0,4,2,3,0,3,2,1,2,0,1,7,0,1 5. Memory is divided into 4 pages. Use the least recently used (LRU) algorithm to find the number of page interrupts for memory management for the following page requests. Illustrate your work ( 10 points) 7,0,1,2,0,3,0,4,2,3,0,3,2,1,2,0,1,7,0,1 6. Initial value of shared variable m is equal to 0 and it is stored at memory address 1100 . Four threads A,B,Y,Z use this variable as follows: Processes A and B increase the value of m by 1 . Processes Y and Z decrease the value of m by 1 . Since m is shared, each process protects the critical region using semaphore S initialized to 2 . Write the sequence of operations so that after each thread is executed once, the value of m is equal to 2. (15 points) 3. Show that the system is in a safe state using Banker's algorithm (10 points) If P1 requests one resource A and two resource C, should the operating system grant this request. Illustrate how OS makes that decision (5 points) 1. Calculate the waiting time for each process if Non-Preemptive Shortest Job First algorithm is used to schedule processes. Illustrate how you calculated by showing the crhedule in detail. ( 10 points) 2. Calculate the waiting time for each process if Preemptive Shortest Job First algorithm is used to schedule processes. Illustrate how you calculated by showing the schedule in detail. (10 points)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