Operating system Assignment 2 Handwriting Ch1 1.7, 1.14, 1.24

advertisement
Operating system Assignment 2
Handwriting
Ch1
1.7, 1.14, 1.24 (Foreign students’ bonus: 1.3, 1.18)
Ch2
2.3, 2.15, 2.18 (Foreign students’ bonus: 2.8, 2.19)
Ch3
3.5, 3.10, 3.11 (Foreign students’ bonus: 3.6)
Due: 10/26
THE
QUESTIONS:
1.3
Give two reasons why caches are useful. What problem do they solve? What
problem do they cause? If a cache can be made as large as the device for which it is
catching (for instance, a cache as large as a disk),why not make it that large and
eliminate the device?
1.7
In a multiprogramming and time-sharing environment, several users share the
system simultaneously. This situation can result in various security problems.
a. What are two such problems?
b. Can we ensure the same degree of security in a time-shared machine as in a
dedicated machine? Explain your answer.
1.14
Discuss, with examples, how the problem of maintaining coherence of cached
data manifests itself in the following processing environment:
a. Single-processor systems
b. Multiprocessor systems
c. Distributed systems
1.18
Direct memory access is used for high-speed I/O device in order to avoiding
increasing the CPU’s execution load.
a. How does the CPU interface with the device to coordinate the transfer?
b. How does the CPU know when the memory operations are complete?
c. The CPU is allowed to execute other programs while the DMA controller is
transferring data. Does this process interface with the execution of the user
program? If so, describe what forms of interference are caused.
1.24
What is the purpose if interrupt? What are the difference between a trap and an
interrupt? Can trap be generated intentionally by a user program? If so, for what
purpose?
2.3
Why is a just-in-time complier useful for executing Java programs?
2.8
What’s the main advantage for an operating-system designer of using a
virtual-machine architecture? What’s the main advantage for a user?
2.15
What are the two models of interprocess communication? What are the
strengths and weaknesses of the two approaches?
2.18
How could a system be designed to allow a choice of operating systems from
which to boot? What would the bootstrap program need to do?
2.19
What are the advantages and disadvantages of using the same system-call
interface for manipulating both files and devices?
3.5
Describe the actions taken by a kernel to context-switch between processes.
3.6
The Sun UltraSPARC processor has multiple register sets. Describe what happens
when a context switch occurs if the new context is already loaded into one of the
register sets. What happens if the new context is in memory rather than in a register
set and all the register sets are in use?
3.10
Including the initial parent process, how many processes are created by the
program shown in Figure 3.28?
#include <stdio.h>
#include <unistd.h>
Int main(){
/*fork a child process */
Fork();
/*fork another child process */
Fork();
/*and fork another*/
Fork();
Return 0;
}
Figure 3.28 ↑
3.11
Using the program in Figure 3.29,identify the values of pid at lines A,B,C and
D.(Assume that the actual pids of the parent and child are 2600 and 2603,
respectively)
Download