Homework 1 Solutions


 1. Silberschatz 1.4
A) Lots of possible conflicts arise when we are in a timeshare environment. The most obvious ones are preventing processes from reading/overwriting each others memory or files, synchronization issues with shared resources and sharing the CPU.

B) Can a timeshared computer have the same degree of security as a dedicated one? Yes and No. Theoretically I say we can. This doesn't take into account malicious users purposefully trying to break it. But at a theoretical OS level we can prevent processes from interefering with each other. However, practically, a multiuser computer can't obtain the same level of security due to passwords. If someone grabbed one user's password to login then he compromised the system. Since a dedicated machine doesn't use passwords it is inherently more secure. Feel free to debate this among yourselves, the purpose of this question was just to make you think. If you encounter more problems like this in the quarter (as you will) just make sure you support your opinion.

2) Silberschatz 2.5
A) Yes, if this wasn't priveleged a user-level program could keep reseting the timer and hog the CPU.
B) No, there isn't any reason why this needs to be priveleged since it doesn't modify the system.
C) Yes, we don't want to allow user programs to clear other program's memory. Although a program should be allowed to clear its own memory.
D) Yes, if a user-level program could disable interrupts they could hog the CPU (among other things).
E) Yes, if we could switch to monitor mode in a user-level program then we can do anything we want. This is not the same as the ability to transfer control over to monitor. A user-level program neseds that ability, but it shouldn't be able to do it in its own code.

3) Silberschatz 2.9
Caches are useful when we want faster memory access. They solve the problem of latency in memory (and disk) access. By keep copies of recently used data in high speed caches we greatly diminish our average access time. This is done because caches exploit the temporal and spatial locality of data found in most programs. We don't make caches as large as normal devices because then they would slow down (search time) and would cost too much money.

4) Silberschatz 3.6
The convenience each of the services an OS provides is pretty self-explanatory. As far as the second part of the question goes a user-level program cannot provide the services of an OS. It could emulate them, but not provide the actual service in the place of an OS.