CS 3733 Operating Systems, Fall 2011 Exam 1 Comments
Grade Distribution:
90-100: 3
80-89: 7
70-79: 7
60-69: 7
50-59: 7
below 50:2
Average: 70
- Problem 1: A CPU burst is not the total amount of CPU time used by a process
and an I/O burst is not the total amount of time spent in the waiting queue.
If you said that an I/O burst is the time spent waiting for I/O, this is not
correct. It is the time spent waiting for one I/O request.
- Problem 2: Do not say "a semaphore is when ...". When is used to describe a time,
and a semaphore is not a time. For Part a) do not say what a semaphore is used for,
say what it is. For part b), do not say how the wait and signal are used, say what
they do. You should not mention critical section in part b).
- Problems 3-6. Do not explain these by saying that the file descriptors or
file descriptor tables are the same. The relevant item is the file offset.
- Problem 3: The read will not return 0 in this case because the file is not empty.
The possibilities for the return values are 1 and 2. If one byte is read, buf[1]
will contain its previous value. Do not say it will contain nothing. A memory location
always contains something, unless the memory chip is bad. In this problem you are asked
about the contents of buf[0] and buf[1]. It is not sufficient to just say what values
the processes read, you need to indicate what is in buf[0] and what is in buf[1].
- Problem 4: The key here is that a FIFO does not use the file offset in the same way that
a regular file does. You cannot do a seek on a FIFO, and you can only read from its
start. Also, reading from a FIFO removes data from the FIFO, unlike a file which
retains its contents when it is read. Note that reading from a pipe or FIFO does
not have to be atomic.
- Problem 5: Since each process is writing either the first or first two bytes of the
string "abcdefg", they can only write a or b, but never c or d.
- Problem 6: Writing 2 bytes to a pipe or FIFO is always atomic. PIPE_BUF is at least
256. This means that the writing from two processes is not interleaved and that exactly
2 bytes will be written unless an error is reported. You always write to the end of
a pipe or FIFO. Note that opening a FIFO is not the same is creating a FIFO.
- Problem 7a: Bounded waiting puts a bound on the number of times something can happen,
not a bound on the time (which is hardware dependent) or the number of processes
that do something (for which there is almost always a limit). It is also not a bound
on the number of times a process can do something, except indirectly when the number
of processes is limited. When asked for the bound, you are asked for a number, not
a variable.
- Problem 7 b, c, and d: You can always say something about the variables, even if their
values are not known, since they are each either 0 or 1.
- Problem 7e: It is not a requirement that the event you are waiting for cannot take place
while you have the CPU.
- Problem 8: Everyone got this one correct.
- Problem 9: Most got this completely correct.