Homework #1
CMPS 111, Spring 2008
| Assigned: | April 15th @ 11:51pm | |
| Due: | April 22nd @ 11:59pm |
Please read the general homework page for guidelines and submission information. Homework must be submitted online.
All work on this homework must be your own. Please read (and follow!) the academic honesty policy for this class.
- A computer has a pipeline with four stages. Each stage takes the same time time to do its work—0.8 ns (nanoseconds). How many instructions can this machine execute per second, assuming that the pipeline is already full?
- What is a trap instruction? What is its use in operating systems? What is the key difference between a trap and an interrupt?
-
Which of the following operations should be allowed only in
kernel mode? Briefly explain your decision for each one.
- Cause a trap
- Disable all interrupts
- Write the memory map for the current process
- Read the time-of-day clock
- Receive a packet of data from the network
- Shutdown the computer
-
What is the difference between the following two function
calls? Assume that str is a properly
null-terminated string. Also, file descriptor 2 (in Unix)
is the same as the stdio file stderr.
HINT: what does the operating system do for each function?
fprintf (stderr,
%s
, str); write (2, str, strlen (str)); - While there are many different processor architectures, most desktop computers and servers use the Intel x86 architecture. From the point of view of operating systems, what are the advantages to this approach? Are there any disadvantages?
- Why is the process table needed in a timesharing system? Is it also needed in personal computer systems in which only one process exists, that process taking over the entire machine until it is finished?
-
For each of the following system calls, give a condition
that causes it to fail:
- read()
- write()
- close()
- fork()
- execvp()
- waitpid()
- There are several different approaches to operating system design.
- Describe one advantage the monolithic modular approach has over the microkernel approach.
- Describe one advantage the microkernel approach has over the monolithic modular approach.
- If security is a bigger concern than speed (as it perhaps is today), which operating system design approach would you choose?
- Here are some questions for practicing unit conversions:
- How long is a microyear in seconds?
- If a car is traveling 25200 miles per fortnight, fast is it traveling in inches per second?
- Micrometers are called microns. How long is a gigamicron?
- How many bytes are there in 1 terabyte of memory?
- The mass of the earth is 6000 yottagrams. What is that in kilograms?
- On all current computers, at least part of the interrupt handlers are written in assembly language. Why?
- When an interrupt or a system call transfers control to the operating system, a kernel stack area separate from the stack of the interrupted process is generally used. Why?
- What is the biggest advantage of implementing threads in user space? What is the biggest disadvantage?
- Suppose that we have a message-passing system using mailboxes. When sending to a full mailbox or trying to receive from an empty one, a process does not block. Instead, it gets an error code back. The process responds to the error code by just trying again, over and over, until it succeeds. Does this scheme lead to race conditions? Why or why not?
Last updated 15 Apr 2008 by Darrell Long or perhaps by Stephanie Jones