首页 > > 详细

CS 570课程作业代写、program作业代做、c++语言作业代写、代做Java,Python编程作业代做数据库SQL|帮做C/C++编程

CS 570 OPERATING SYSTEMS
Shen & ROCH
Page 1 of 2
Quiz 1 – 20 points each
1. You are designing a new microprocessor for Anukool Microdevices. You are
assigned three instructions to implement:
RESET – Disables the memory management unit, clears all caches, and sets the
program counter to 0xF0.
CALL X – Subroutine call: pushes the program counter onto the stack and
branches to argument X.
MMUROOT X – Sets the root address of a multilevel page table to X.
a. Justify whether each of these instructions should be privileged or not.
b. How does the CPU determine whether or not we are in supervisory mode?
c. How does the CPU transition from user to supervisory mode?
2. Assume a process is executing under a round robin scheduling policy. The process
does not complete before its time quantum expires, triggering a timer interrupt. In
detail, describe:
a. How the interrupt is handled (general mechanism for handling interrupts)
b. and:
i. What happens to the running process (state and queuing diagrams)?
ii. How the next process to execute is selected?
3. For parts a and b, assume two types of processes:
1) A messaging application where I/O-bound threads serve pairs of users transferring
messages between them over a network.
2) A machine learning application with multiple CPU-bound threads working on a
common problem.
a. Given the choice in a single-core uniprocessor machine, would you use userlevel
or kernel-level threads for each of these two processes. Justify.
b. How would your answer change if the machine had multiple cores (if at all)?
Justify.
c. Suppose one of these processes was running in a hybrid threading scheme
with 6 user-level threads and 2 kernel-level threads.
i. Must user-level thread 1 always be associated with the same kernellevel
thread? Justify your answer.
ii. What happens when a user-level thread blocks?
Page 2 of 2
4. Assume that the following program has been executed on a machine with a nonpreemptive
scheduling policy. Write down any process state transitions (assume 3
state model discussed in class) that occur throughout the program’s execution. Copy
the program to your answer document. Write the transition before each line that will
be executed, e.g READY->RUN. When multiple state transitions occur, list them
all.
Assume that the printf library routine is configured to flush stdout at the end of each
call and that malloc needs to request memory from the OS.
#define SUCCESS 0
/* program for examining state transitions */
int main() {
int counter = 1;
int Ntimes = 10;
/* increment the counter Ntimes */
while (counter < Ntimes)
counter++;
/* show counter’s value then double */
printf("Total count: %d\n", counter);
counter *= 2;
printf("Double the count: %d\n", counter);

/* pointer demonstration */
int a = 5;
int *p = (int *) malloc(sizeof(int));
*p = a;
printf("%d\n", *p);
return SUCCESS;
}
5. Scheduling:
a. Devise a policy to prevent starvation in a priority scheduler.
b. Processes on a machine have an average CPU burst time of 8 ms. The first
three processes of a specific process are 7, 10 and 4 ms. Given that the
prediction for the first CPU burst is the average CPU burst time, estimate the
CPU bursts for the second and third CPU bursts using exponential
averaging. The weight used for the last observed burst is .75.

联系我们 - QQ: 99515681 微信:codinghelp2
© 2014 www.7daixie.com
程序代写网!