关键词 > CSCI-UA.0202

CSCI-UA.0202-002: Operating Systems Final Exam 2020

发布时间:2024-05-13

Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

CSCI-UA.0202-002: Operating Systems

Final Exam (Dec 16th, 2020)

Important Notes- READ BEFORE SOLVING THE EXAM

•    If you perceive any ambiguity in any of the questions, state your assumptions clearly and solve  the problem based on your  assumptions. We will grade both your solutions and your assumptions.

•    This exam is take-home.

•    The exam is posted, on NYU classes, at 10am EST of Wed Dec 16th.

•    You have up to 23 hours and 55 minutes to submit on NYU classes.

•    You are allowed only one submission, unlike assignments and labs.

•    Your answers must be very focused. You may be penalized for wrong answers and for putting irrelevant information in your answers.

•    This exam contains five problems, with a total of 100 points.

•    Your answer sheet must be organized as follows:

-      The very first page of your answer must contain:

You Last Name

Your First Name

Your NetID

Copy and paste the honor code showed in the rectangle at the bottom of this page.

-     In your  answer sheet, answer one problem per page (even if your answer takes one line).

Honor code (copy and paste to the first page of your exam)

•    You may use the textbook, slides, and any notes you have. But you may not use the internet, except to access course material from NYU classes.

•    You may NOT use communication tools to collaborate with other humans. This includes but is not limited to G-Chat, Messenger, E-mail, etc.

•    Do not try to search for answers on the internet it will show in your answer and you will earn an immediate grade of 0.

•    Anyone found sharing answers or communicating with another student during the exam period will earn an immediate grade of 0.

•    “I understand the ground rules and agree to abide by them. I will not share answers or assist another student during this exam, nor will I seek assistance from another

student or attempt to view their answers.”

Problem 1

Suppose we have a system that implements virtual memory as a two-level page table. The processor is single core (i.e. single CPU). When a process wants to access the memory,

the MMU takes the address from the CPU and divides the bits of that address into several fields, as we saw in class.

a)   [2 points] Is the address generated by the CPU a physical address or virtual address?

b)   [8 points] How many fields does the MMU need to divide the address into? What are these fields?

c)   [4 points] Which field(s) is/are used to access the TLB?

d)   [4 points] If we have eight cores in the system instead of one, which of your answers in a, b, and c above will change, if any, and why?

e)   [2 points] If we have a system with eight cores, how many MMUs dowe have?

Problem 2

Answer the following questions about virtual memory.

a)   [5 points] Can a page fault in one process result in a page fault in another process in the future? Explain.

b)   [5 points] What is/are the piece(s) of hardware that must  exist for a system to support  virtual  memory  using  pages?  For  each  piece  you  cite,  explain  what happens if it this piece did not exist. If your answer is that no hardware support is needed and the OS can take care of the whole virtual memory scheme, state, in a bulleted  list,  the  steps  that  will  be  done  by  the  OS  from  the  time  the  CPU generates the virtual address till the physical address is ready.

c)   [10 points] A  2D integer array, A[64][64],   is  stored  in memory in row-major order (i,e, A[0][0] is followed by A[0][1], then A[0][2],  … etc). Which of the following two pieces of code results in more page faults? Justify your choice. Assume the whole physical memory can hold only four pages and that the size of each page is 512 bytes.

Piece A

Piece B

for (intj = 0; j < 64; j++)

for (int i = 0; i < 64; i++)

X[i][j] = 0;

for (int i = 0; i < 64; i++)

for (intj = 0; j < 64; j++)

X[i][j] = 0;

Problem 3

[20 points]

Suppose you wrote a multithreaded program where you spawn x threads. During execution time we may see less than x threads, from that process, executing in parallel. That is, as a programmer, you want, for example, five threads to be executing in parallel. But, during execution, you see that there are less than five threads really executing. State five scenarios that may cause this to happen.

Problem 4

[20 points]

Suppose we have p processes in the system. Each one of the p processes requires m instances of resource R. What is the minimum number of instances of resource R (e.g. if R is a printer, then how many printers) that we need to have to ensure no deadlock? Give an answer in terms of m and p and explain your logic how you reached this conclusion.

Problem 5

a)   [5 points] As we  saw in class, an i-node contains file attributes, addresses of disk blocks containing the file, and address of block pointers. If a disk block size is 4KB. What is the largest file size that this system can support? Explain your logic. [Hint: You can assume that the disk itself is of unlimited size.]

b)   [5 points] We have studied the part of the OS that implements virtual memory. We have also studied the part of the OS that deals with file systems. Do you think these two parts may need to interact together? If yes, state a scenario. If not, explain why not.

c)   [5 points] When we started discussing I/O, we categorized I/O devices into human- readable, machine readable, and   communication.  Why is this categorization important?

d)   [5 points] When do PIC and DMA chip have to interact together? [Important: The question does NOT ask for a definition of DMA and PIC].