The University of Texas at Dallas--Computer Science Program
CS 4348.501—Exam I
UTD ID#:_________________
Notes: 1. Answer all 6 questions within
the space provided.2. Anything written outside the provided space will be
ignored. 3. Use the back side as scratch pad.
4. Write
your name and UTD_ID on all sheets you use.
1.
Memory
access time is 10 nanoseconds, instruction decode/execution time is 5
nanoseconds. 50% of the instructions executed require no operands from memory
and the rest of the executed instructions require one operand from the memory.
What is the number of instructions executed in one second? Show the steps in
arriving at your answer.
2.
What
is the need for two modes of operations: user mode and system/kernal/monitor
mode?
3.
In
multiprogrammed OS, how do you ensure that one program does not access memory
which belongs to another program?
4.
Describe
the important steps involved in migrating a process from computer system A to
computer system B. State important assumptions you make.
5.
Write
a multi-threaded program that creates 20 threads. Thread i (i=1, 2, …, 20) must
print the numbers i*100, i*100+1, …, i*100+50.
6.
There
is a parking lot P that has space for 250 vehicles with one entry gate and one
exit gate, both of which are operated automatically. If the lot is full, all
vehicles wishing to enter are to be stopped at the entrance. Every time a vehicle arrives at the entry gate, an
appropriately placed sensor performs a signal operation on semaphore sem_entry.
(The sensors do not do anything if the vehicle is stationary near the
entrance.) Similarly, when a vehicle arrives at the exit gate, an appropriately
placed sensor performs a signal operation on semaphore sem_exit. Two
appropriately names functions raise_entry_gate() and raise_exit_gate() are
available. (As soon as one vehicle enters/exits, the entry/exit gate
automatically lowers.)
Develop a solution using semaphores to operate the
two gates. Specify initial values for all semaphores used. Give brief
explanation of the important steps of your program.