CS439: Principles of Computer Systems
Discussion Section 8 Problem Set
Due in Section on April 12, 2024
The problem set must be completed before section and brought to section. To
ensure that your problem set is turned in correctly and that you receive credit
for discussion section, you must follow these guidelines exactly.
-
What are "privileged instructions"? Name three situations
in which privileged instructions are required.
-
Given the following pseudocode:
int i = 0;
int main(void)
{
fork();
if(/*CHILD*/)
{
i = i - 1;
return SUCCESS;
}
if(/*PARENT*/)
{
i = i + 1;
wait for child to terminate;
printf("i = %d\n", i);
}
}
- What is the output? Describe in detail why it is that way.
- Are there other possible outputs? Why or why not? If so, give
another example of what the printed values of ``i'' might be and
explain how to force the program to execute the same way each time.
- Now consider this pseudocode involving kernel threads:
int i = 0;
void thread1(void *)
{
i = i - 1;
}
void thread2(void *)
{
i = i + 1;
}
int main(void)
{
createThread(thread1);
createThread(thread2);
/* wait for thread 1 and thread 2 to end */
printf("i = %d\n", i);
}
- What is the output? Describe in detail why it is that way.
-
Are there other possible outputs? Why or why not? If so, give
another example of what the printed values of ``i'' might be and
explain how to force the program to execute the same way each time.
-
Considering all the pieces of the operating system we have discussed,
describe the steps the OS takes when performing a context switch.
Assume that processes are waiting in the ready queue.
-
Which is the best (fastest) network on which to implement a remote-memory read
that sends a 100 byte packet from machine A to machine B and then sends a
8000 byte packet from machine B to machine A?
- A network with 200 microsecond processing overhead, 10 Mbyte/s bandwidth,
20 microsecond latency
- A network with 20 microsecond processing overhead, 10 Mbyte/s bandwidth, 200
microsecond latency
- A network with 20 microsecond processing overhead, 1 Mbyte/s bandwidth, 2
microsecond latency
- A network with 2 microsecond processing overhead, 1 Mbyte/s bandwidth,
20 microsecond latency
-
Using the traceroute command, trace the hops a packet takes
from one of the UTCS machines to a website in Europe. Inspect the
trace. What do you notice? Do you see any machines you recognize?
ISPs? Cities? Please be sure to tell us what website you used.
Perform the trace again. How does the second time affect the output?
-
Describe the steps necessary to prepare a server to accept
connections. How does it accept a connection?
|