CS计算机代考程序代写 (1)

(1)

Spring 2020 CS 450 Midterm Page 1 of 11

Student Name: ___________________________________
This is an open book exam. You have 75 minutes to complete all the questions.
You will be graded on whether your answer is concise and clear. At the end of the
exam, you have 10 minutes to submit your answer. Exceeding that you get a 15%
deduction to your total score. You will not be able to submit your midterm after
another 5 minutes.

Part 1: Questions (1) to (10) are multiple choices; fill in the blanks and short
questions. Each is worth three points. In multiple choice questions, you choose
one or more statements or terms that are true.
(1) xv6 is an interrupt driven operating system.

a) Give an interrupt that will cause a process to change from Running to
Blocked.
_____________________________________________________________

b) Why is there no transition from Blocked to Running?
_____________________________________________________________

(2) The address space of a process contains a stack segment, a heap segment, a .bss
segment, a .data segment and a .txt segment. Where are the following stored?
a) An integer variable declared in a code block ___________________
b) An initialized static variable declared in a code block ___________________
c) The code for the system call close() _____________________.

(3) Give one statement each on how software interrupts is different from and similar
to hardware interrupts.
Difference:

_________________________________________________________________
Similarity:

_________________________________________________________________

(4) Give two reasons why an operating system give priority to short jobs’

_________________________________________________________________

_________________________________________________________________

(5) Give an advantage and a disadvantage of the Worst Fit free space management
policy.
__________________________________________________________________

__________________________________________________________________

Spring 2020 CS 450 Midterm Page 2 of 11

Student Name: ___________________________________
This is an open book exam. You have 75 minutes to complete all the questions.
You will be graded on whether your answer is concise and clear. At the end of the
exam, you have 10 minutes to submit your answer. Exceeding that you get a 15%
deduction to your total score. You will not be able to submit your midterm after
another 5 minutes.
(6) The following picture given by the textbook shows the format of a virtual address

with segmentation.
a) How big is the largest segment size with this address format?
b) What is the maximum number of segments a program can have?

(7) Give one advantage and one disadvantage of pure paging as compare to pure

segmentation.
__________________________________________________________________

__________________________________________________________________

(8) Indicate whether the following statements are True or False:
a) Hybrid segmentation/paging makes no sense. (T/F)
b) The R/W bits of a page table entry protects the page from reading and writing

by another process. (T/F)
c) The validity bit of a page directory entry indicates that the content of its

corresponding page makes no sense. (T/F)

(9) Give one advantage and one disadvantage of an inverted page table over a regular
page table.
__________________________________________________________________

__________________________________________________________________

(10) In this course, we assert that the Unix operating system has an object-oriented
design consisting of entity objects, boundary objects and control objects. A control
object usually executes rules (policies) implemented on some mechanism.
Connect the following operating system concepts with their corresponding
object-oriented design concepts. The first one was done for you.
a) Best fit is a control rule.
b) A free list of heap space is ___________________
c) A process is ___________________
d) A multi-level priority queue is __________________

Spring 2020 CS 450 Midterm Page 3 of 11

Student Name: ___________________________________
This is an open book exam. You have 75 minutes to complete all the questions.
You will be graded on whether your answer is concise and clear. At the end of the
exam, you have 10 minutes to submit your answer. Exceeding that you get a 15%
deduction to your total score. You will not be able to submit your midterm after
another 5 minutes.
(11) (10 points) Round-robin schedulers normally maintain a list of all runnable

processes, with each process occurring exactly once in the list and each allocated a
single time slice with a value t. Suppose that we have 5 processes each requiring
the same amount of time (T) to execute and T/t = n.
a) What happens to the turn around time of process A if we increase its time

slice value to 3t at the starting line?
b) What happens to the turn around time of the other processes?
c) If we give l processes the time slice boost, what happens to their turn around

time?
d) What happens to the turn around time of the other (5 – l) processes?

Mobile User

Mobile User

Mobile User

Mobile User

Mobile User

Mobile User

Mobile User

Mobile User

Mobile User

Mobile User

Mobile User

Mobile User

Mobile User

Mobile User

Mobile User

Spring 2020 CS 450 Midterm Page 4 of 11

Student Name: ___________________________________
This is an open book exam. You have 75 minutes to complete all the questions.
You will be graded on whether your answer is concise and clear. At the end of the
exam, you have 10 minutes to submit your answer. Exceeding that you get a 15%
deduction to your total score. You will not be able to submit your midterm after
another 5 minutes.
(12) (10 points) The following are the five original rules of the MLFQ policy. What

concerns are addressed by R2, R3, and R5 respectively?
R1: If priority(A) > priority(B), A runs
R2: If priority (A) = priority(B), A, B runs in RR
R3: new job at highest priority
R4a: If a job uses up all time slice T, its priority is reduced
R4b: If a job gives up the CPU before its time slice, it stays at the same priority
R5: After some time S, move all the jobs to the topmost queue

R3: ___________________________________________________________

R4a: ____________________________________________________________

R4b:____________________________________________________________

R5: ____________________________________________________________

Spring 2020 CS 450 Midterm Page 5 of 11

Student Name: ___________________________________
This is an open book exam. You have 75 minutes to complete all the questions.
You will be graded on whether your answer is concise and clear. At the end of the
exam, you have 10 minutes to submit your answer. Exceeding that you get a 15%
deduction to your total score. You will not be able to submit your midterm after
another 5 minutes.
Part 2: Longer questions
(13) (12 points) Fill in the following table to show what will happen while process A is

executing, a timer interrupt occurs indicating process A has used up its time slice,
and the operating system chooses process B to execute.

Kernel Mode Hardware User Mode

Process A executes

Spring 2020 CS 450 Midterm Page 6 of 11

Student Name: ___________________________________
This is an open book exam. You have 75 minutes to complete all the questions.
You will be graded on whether your answer is concise and clear. At the end of the
exam, you have 10 minutes to submit your answer. Exceeding that you get a 15%
deduction to your total score. You will not be able to submit your midterm after
another 5 minutes.
(14) (12 points) Your task is to design a 2-level page table for a 32-bit microprocessor.

You have decided that the page size is 4KB and the virtual address space is 232B.
Answer the following questions. You need to show all your calculations.

a) A virtual address space will have _________ pages.

b) A 1-level page table (or a linear page table) will have _________ entries.

c) If a page table entry (PTE) is 4B, a page contains __________ PTEs.

d) It will require ______ bits to select an PTE in such a page.

e) How many pages are needed for the linear page table? ____________

f) How many entries will be needed in the directory table? ___________

g) How many bits are needed to address an entry in the directory table?
__________

h) Describe how you would organize a virtual address to meet the above needs.

i) Discuss possible issues with a 2KB page size.

Spring 2020 CS 450 Midterm Page 7 of 11

Student Name: ___________________________________
This is an open book exam. You have 75 minutes to complete all the questions.
You will be graded on whether your answer is concise and clear. At the end of the
exam, you have 10 minutes to submit your answer. Exceeding that you get a 15%
deduction to your total score. You will not be able to submit your midterm after
another 5 minutes.
(15) (12 points) We used fork()to implement nonohup and whatIf in PA1. (a)

What would you do when fork()returns EAGAIN (not sufficient memory) and
ENOSYS (system call not supported)? (b) Change the code in the following to
handle these two errors. (hint: use a while statement).

Spring 2020 CS 450 Midterm Page 8 of 11

Student Name: ___________________________________
This is an open book exam. You have 75 minutes to complete all the questions.
You will be graded on whether your answer is concise and clear. At the end of the
exam, you have 10 minutes to submit your answer. Exceeding that you get a 15%
deduction to your total score. You will not be able to submit your midterm after
another 5 minutes.

(This page intentionally blank)

Spring 2020 CS 450 Midterm Page 9 of 11

Student Name: ___________________________________
This is an open book exam. You have 75 minutes to complete all the questions.
You will be graded on whether your answer is concise and clear. At the end of the
exam, you have 10 minutes to submit your answer. Exceeding that you get a 15%
deduction to your total score. You will not be able to submit your midterm after
another 5 minutes.
(16) (15 points) For each of the following test cases of PA1, describe all possible

output. Be mindful that we have programs that execute concurrently and share io
streams.
a) nonohup echo A; nonohup echo B; echo C
b) nonohup ls; nonohup ls; echo C
c) nonohup ls; echo A; nonohup ls; echo B; nonohup ls
d) nonohup whatIf (command line input)
e) nonohup echo A; nonohup whatIf file.txt; echo B

Spring 2020 CS 450 Midterm Page 10 of 11

Student Name: ___________________________________
This is an open book exam. You have 75 minutes to complete all the questions.
You will be graded on whether your answer is concise and clear. At the end of the
exam, you have 10 minutes to submit your answer. Exceeding that you get a 15%
deduction to your total score. You will not be able to submit your midterm after
another 5 minutes.

(Intentionally blank)