Sunteți pe pagina 1din 3

CS 307 Homework Questions

1) A computer has a pipeline with four stages. Each stage takes the same time to do its work, namely, 1 nsec.

a) How many instructions per second can this machine execute?

b) How many instructions per second can dual-core and quad-core machines execute?

2) What is the key difference between a trap and an interrupt?

3) Why is the process table needed in a timesharing system? Is it also necessary in which only one process exists and that process taking over the entire machine until it is finished?

4) Is multi-process system suitable to be a file server using a cache in memory? Why? Could each process have its own cache?

5)

thread _yield? After all, since there is no periodic clock interrupt, it may never get the CPU back.

by calling

ever voluntarily give

Why

would

a thread

up

the

CPU

6) In this problem you are to compare reading a file using a single- threaded file server and a multithreaded server. It takes 15 msec to get a request for work, dispatch it, and do the rest of the necessary processing, assuming that the data needed are in the block cache. If a disk operation is needed, as is the case one-third of the time, an additional 75 msec is required, during which time the thread sleeps. How many requests/sec can the server handle if it is single threaded? If it is multithreaded?

7) Can the priority inversion problem happen with user-level threads? Why or why not?

8) Can the priority inversion occur in Round-Robin scheduling?

9) What is a race condition?

in Round-Robin scheduling? 9) What is a race condition? 10) Does the busy waiting solution using

10) Does the busy waiting solution using the turn variable work when the two processes are running on a shared-memory multiprocessor, that is, two CPUs, sharing a common memory? (See the code fragment above)

11) A computer has six tape drives, with n processes competing for them. Each process may need two drives. For which values of n is the system deadlock free?

12) The banker’s algorithm is being run in a system with m resource classes and n processes. In the limit of large m and n, the number of operations that must be performed to check a state for safety is proportional to ! ! . What are the values of a and b?

13) A computer system has enough room to hold four programs in its main memory. These programs are idle waiting for I/O half the time. What fraction of the CPU time is wasted?

14) If an instruction takes 10 nsec and a page fault takes an additional n nsec, give a formula for the effective instruction time if page faults occur every k instructions.

15) A machine has 48-bit virtual addresses and 32-bit physical addresses. Pages are 8 KB. How many entries are needed for the page table?

16) How long does it take to load a 64-KB program from a disk whose average

seek time is 10 msec, whose rotation time is 10 msec, data transfer rate is

1.6KB/msec

(a)

for a 2-KB page size?

(b)

for a 4-KB page size?

The pages are spread randomly around the disk and the number of cylinders is so large that the chance of two pages being on the same cylinder is negligible.

17) It has been observed that the number of instructions executed between page faults is directly proportional to the number of page frames allocated to a program. If the available memory is doubled, the mean interval between page faults is also doubled. Suppose that a normal instruction takes 1 microsec, but if a page fault occurs, it takes 2001 µ sec (i.e., 2 msec to handle the fault). If a program takes 60 sec to run, during which time it gets 15.000 page faults, how long would it take to run if twice as much memory were available?

18) Explain the difference between internal fragmentation and external fragmentation. Which one occurs in paging systems? Which one occurs in systems using pure segmentation?

19) A RAID can fail if two or more of its drives crash within a short time interval. Suppose that the probability of one drive crashing in a given hour is p . What is the probability of a k -drive RAID failing in a given hour?

20) Disk requests come in to the disk driver for cylinders 10, 22, 20, 2, 40, 6, and 38, in that order. A seek takes 6 msec per cylinder moved. How much seek time is needed for

(a)

First-Come, first served.

(b)

Closest cylinder next.

(c)

Elevator algorithm (initially moving upward).

In all cases, the arm is initially at cylinder 20.

21) Secret-key cryptography is more efficient than public-key cryptography, but requires the sender and receiver to agree on a key in advance. Suppose that the sender and receiver have never met, but there exists a trusted third party that shares a secret key with the sender and also shares a (different) secret key with the receiver. How can the sender and receiver establish a new shared secret key under these circumstances?

22) Not having the computer echo the password is safer than having it echo an asterisk for each character typed since the latter discloses the password length to anyone nearby who can see the screen. Assuming that passwords consist of upper and lower case letters and digits only,

and that passwords must be a minimum of five characters and a maximum of eight characters, how much safer is not displaying anything?

23) As Internet cafes become more widespread, people are going to want ways of going to one anywhere in the world and conducting business from them. Describe a way to produce signed documents from one using a smart card (assume that all the computers are equipped with smart card readers). Is your scheme secure?

24) When a file is removed, its blocks are generally put back on the free list, but they are not erased. Do you think it would be a good idea to have the operating system erase each block before releasing it? Consider both security and performance factors in your answer, and explain the effect of each.

25) How can a parasitic virus

(a)

ensure that it will be executed before its host program and

(b)

pass control back to its host after doing whatever it does?

26) Some operating systems require that disk partitions must start at the beginning of a track. How does this make life easier for a boot sector virus?

27) To verify that an applet has been signed by a trusted vendor, the applet vendor may include a certificate signed by trusted third party that contains its public key. However, to read the certificate, the user needs the trusted third party’s public key. This could be provided by a trusted fourth party, but then the user needs that public key. It appears that there is no way to bootstrap the verification system, yet existing browsers use it. How could it work?