Chat with us, powered by LiveChat operating system | Writedemy

operating system

operating system

Prof. Pitts CS554AH1: Operating Systems Spring 2018

Assignment 3

This is an individual assignment; the work you submit should be your own work and not that of any other person. Be sure to cite the sources for any information you use to answer the questions below. Do not copy and paste your answers as you will lose marks; use your own words to rephrase the information you use from other sources. Label each answer in your submission with the number of the homework question it belongs to. Do not copy the questions to your PDF document. Submit your answers in a PDF document through Canvas.

1. Let mySem be a semaphore and let P1, P2, P3 be three processes that use the semaphore. For each of the three sequences of semaphore calls (acquire() to take the semaphore, release() to give up the semaphore), provide the following information for each call

▪ for acquire() calls show the new value of count and indicate whether the calling process blocks on the semaphore or proceeds to its critical section

▪ for release() calls show the new value of count and indicate whether a process is removed from the semaphore blocked queue (and if so which one)

▪ show the semaphore queue for each call

Assume the processes make the semaphore calls in the order given and that the semaphore count is initialized as specified.

Initial semaphore count is 1 Initial semaphore count is 2 Initial semaphore count is 0

P1: acquire() P1: acquire() P1: acquire()

P2: acquire() P2: acquire() P2: acquire()

P3: acquire() P3: acquire() P3: release()

P1: release() P1: release() P2: release()

P1: acquire() P1: acquire() P1: release()

P2: release() P2: release() P3: acquire()

P3: release() P3: release() P2: acquire()

2. Let mutexOne and mutexTwo be a binary semaphores (count is initially 1). Consider the partial code sequences for two processes P1 and P2. Assume that mutexOne and mutexTwo are free (their counts are still 1), when the code below is executed and that the order given below is the order in which the semaphore calls occurs. What happens?

P1: mutexOne.aacquire()

P2: mutexTwo.acquire()

P2: mutexOne.acquire()

P1: mutexTwo.acquire()

1/2

Prof. Pitts CS554AH1: Operating Systems Spring 2018

3. Consider the code for three processes shown below. The code attempts to ensure that only one process at a time is in critical sections A and B using the semaphore mutex. What is the problem with code?

Process 1 { . . .

mutex.acquire()

//Critical section A

mutex.release() . . .

}

Process 2 { . . .

mutex.acquire()

//Critical section B

mutex.release() . . .

}

Process 3 { . . .

mutex.release()

mutex.acquire() . . .

}

2/2

Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.

Do you need an answer to this or any other questions?

About Writedemy

We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.

How It Works

To make an Order you only need to click on “Order Now” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Are there Discounts?

All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.

Hire a tutor today CLICK HERE to make your first order