OS-202 midterm
OS-202代写 Please enter your answers directly in nyu classes as if this was a homework or lab. The fifirst two problems ask you to draw diagrams.
Please enter your answers directly in nyu classes as if this was a homework or lab. The fifirst two problems ask you to draw diagrams. As discussed in class, draw them with pencil and paper, take a picture, convert the picture to a pdf, and attach it as you would attach a pdf for a homework. Good Luck!
1 (10 points).
Consider a system with two processes and three resource types, A, B, and C. The system has 3 units of A, 1 unit of B, and 5 units of C. Draw a resource allocation graph for this system that represents a state that is NOT deadlocked and NOT safe.
2 (10 points). OS-202代写
Draw the process state diagram given in the notes. This diagram contains nodes (circles) showing process states and arcs (arrows) showing the possible state transitions. Remember to label the nodes and arcs.
3 (10 points).
Defifine, but do NOT solve, the producer-consumer problem.
4 (15 points). OS-202代写
The processes in the table on the right are run with a round robin scheduler having a quantum q = 10ms (all times are in milliseconds).
A starts at t = 0ms and requires 18ms of CPU time to complete.
B starts at 4ms and requires 12ms. C starts at 8ms and requires 14ms.
A never blocks.
A fter B runs for 8ms, it blocks for 5ms and never blocks again.
A fter C runs for 10ms, it blocks for 1ms and never blocks again.
At what time does each process fifinish? Show your work and use our standard tie-breaking rule if ties occur.
5 (10 points). OS-202代写
The program below consists of two tasks that share a common variable X. Before execution begins, X is initialized to 50. The author included the (binary) semaphore S to force each line of each task to be atomic. Unfortunately, the program still would sometimes print difffferent answers.
What are all the possible printouts that can occur? That is, assume the program is run many times. Each run will print two lines, but the two lines will not always be the same from run to run. List all the possibilities, making clear for each possibility which line is printed first.
6 (35 points). OS-202代写
Fill in the blanks with the appropriate technical term or phrase.
i. When the OS moves a process from the running state to ready, a __________________ has occurred.
ii. The diagram used to model deadlock that contains squares, circles, and arrows is called a __________________ .
iii. A program in execution is called a __________________ .
iv. A hardware instruction that makes solving the critical section problem easy is __________________ .
v. The coordination problem where some processes just query a datebase while other processes modify the database is called __________________ .
vi. The Banker’s algorithm ensures that all processes remain in a __________________ state.
vii. A disadvantage of the “shortage job fifirst” process scheduling algorithm is the possibility of __________________ .
7 (10 points). OS-202代写
Consider a system containing 8 units of resource R and 20 units of resource S managed by the banker’s algorithm. There are three processes X, Y, and Z. X’s claim is 6 units of R and 4 units of S, written (6,4). Y’s claim is (4,16). Z’s claim is (8,16). Currently X has 2 unit of R and 4 units of S, written (2,4). Y has (0,0). Z has (0,8). There are no outstanding requests.
i What is the maximum number of units of R that X can request at this point that the banker will grant?
ii If Y instead of X makes a request for R, what is the maximum number of units that the banker will grant?
iii If Z instead of X or Y makes a request for R, what is the maximum number of units that the banker will grant?
Justify your answers.
其他代写:作业加急 北美代写 北美作业代写 assignment代写 essay代写 analysis代写 code代写 assembly代写 homework代写 Exercise代写 加拿大代写 英国代写 作业代写 CS代写 Data Analysis代写 data代写 澳大利亚代写 app代写 algorithm代写