# homework作业 | 代做arm | Algorithm代做 – Arm lab

### Arm lab

homework作业 | 代做arm | Algorithm代做 – 这是一个关于arm的题目, 主要考察了关于arm的内容,是一个比较经典的题目, 是比较典型的arm/Algorithm等代写方向, 这是值得参考的homework代写的题目

``````Page 1
``````

Please enter your answers directly in nyu classes as if this were a homework or lab. Some problems ask you to draw diagrams. As discussed in class, you may 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 or lab. Good Luck!

### 1 Reusable Resource Graph (5 Points)

Consider a system with two processes and three resource types, A, B, and C. The system has 2 units of A, 2 units of B, and 4 units of C. Draw a resource allocation graph for this system that represents a state that isNOTdeadlockedand NOT safe.

### 2 Process state diagram (5 Points)

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 Disk arm Scheduling Algorithms (5 Points)

Assume a disk is currently accessing cylinder 600. The pending disk requests are for cylinders 1, 500, 950, 540, and 650. What order would the requests be serviced using the Shortest Seek Time First (SSTF) Algorithm?

### 4 Classic Coordination Algorithms (5 Points)

Define, but doNOTsolve, the producer-consumer problem.

### 5 Round Robbin Scheduling (15 Points)

The processes in the table on the right are run with a round robin scheduler having a quantumq= 10ms(all times are in milliseconds). Astarts att=0msand requires 24msof CPU time to complete. Bstarts at 6msand requires 30ms.Cstarts at 15msand requires 13ms.

AfterAruns for 22ms, it blocks for 5msand never blocks again. Bnever blocks. AfterCruns for 12ms, it blocks for 1msand never blocks again.

At what time does each process finish? Show your work and use our standard tie-breaking rule if ties occur.

``````Process
Start
time
``````

#### CPU

``````time
``````
``````Blocks
after for
A 0 24 22 5
B 6 30 never
C 15 13 12 1
``````

The program below consists of two threads that share a common variableX. Before execution begins,Xis initialized to 50. The author included the (binary) semaphoreSto force each line of each task to be atomic. Unfortunately, the program still would sometimes print dierent answers.

What areallthe 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.

Task #1 | Task # | P(S); X = X*5; V(S); | P(S); X=X-7; V(S) P(S); Print Task 1:, X; V(S); | P(S); Print Task 2:, X; V(S);

``````OS-202 final 2020-21 Fall Allan Gottlieb Page 2
``````

### 7 Fill in the Blanks (30 Points Total)

Fill in the blanks with the appropriate technical term or phrase.

1. In early OSes a job once started was run to completion before starting another job; in contrast modern systems are .
2. The preemptive analogue of FCFS processor scheduling is.
3. Race conditions can occur if one interleaves sections of code that are.
4. To speed up address translation, paging systems use a cache of the page table called a.
5. The page replacement policy chooses victims that have not been used for the longest time.
6. A merely creates anothernamefor an already existing file.

### 8 Bankers Algorithm (10 Points Total)

Consider a system containing 7 units of resource R and 7 units of resource S managed by the bankers algorithm. There are three processes X, Y, and Z. Xs claim is 4 units of R and 3 units of S, written (4,3). Ys claim is (6,5). Zs claim is (4,6). Currently X has 2 units of R and 1 unit of S, written (2,1). Y has (0,2). Z has (1,1). There are no outstanding requests.

1. What is the maximum number of units of R that X can request at this point that the banker will grant?
2. If Y instead of X makes a request for R, what is the maximum number of units that the banker will grant?
3. If Z instead of X or Y makes a request for R, what is the maximum number of units that the banker will grant?

### 9 A Simple (i.e., non-demand) Paging System (5 Points)

Consider a paging system with 10 frames each of size = 2000 bytes. This is a simple (i.e., non-demand) paging system so each PTE just contains the frame number. Process A has size 6666 bytes; its page table is shown on the right. The bottom entry is for page 0, the top entry is for page 3. The first three memory references of process A are tovirtualaddresses 1234, 5555, and 2000 respectively. What are the correspondingphysical addresses?

### 10 Demand Paging with LRU Replacement (5 Points)

Consider a system with three page frames running a process with 10 pages. Assume the initial set of pages referenced are 8-2-9-8-2-3-8-9-2-9Which of these references cause page faults if the LRU replacement algorithm is used? Assume the frames initially contain no pages. So the first reference must be a page fault since there are no pages in memory.

### 11 File Names in Unix (5 Points)

Consider a Unix inode-based filesystem that initially contains just the root inode and an empty root directory. The commands on the right are then executed. Give 4 names for the file created bytouch /X/Y/fwith each name beginning with / and none of the names containing . or … One such name is/X/Y/fyou need 3 others.

``````mkdir /A
mkdir /A/B
mkdir /X
mkdir /X/Y
touch /X/Y/f
ln /X/Y/f /X/Y/h
ln -s /X /A/B/s
``````