CmSc 335 Operation Systems
Homework 01, due 09/07Solution
- Problem 1.1. page 37:
Suppose the hypothetical processor of Figure 1.3 also has two I/O instructions:
0011 = Load AC from I/O
0111 = Store AC to I/O
In these cases, the 12-bit address identifies a particular external device. Show the program execution (using the format of Figure 1.4) for the following program:
- Load AC from I/O device 5
- Add contents of memory location 940
- Store AC to I/O device 6
Assume that the next value retrieved from device 5 is 3, and that location 940 contains a value of 2.
#1. Fetch: The instruction at memory location 300 (this is the content of PC) is loaded into IR. This instruction is 3005 (load AC from I/O device 5)
Memory / CPU Registers300 / 3005 / 300 / PC
301 / 5940 / AC
302 / 7006 / 3005 / IR
940 / 0002 / I/O Device
005 / 0003
#2. Execute : AC is loaded with the content of I/O device 5. PC is incremented.
Memory / CPU Registers300 / 3005 / 301 / PC
301 / 5940 / 0003 / AC
302 / 7006 / 3005 / IR
940 / 0002 / I/O Device
005 / 0003
#3. Fetch: The instruction at memory location 301 (this is the content of PC) is loaded into IR. This instruction is 5940 (add AC to the content of location 940)
Memory / CPU Registers300 / 3005 / 301 / PC
301 / 5940 / 0003 / AC
302 / 7006 / 5940 / IR
940 / 0002 / I/O Device
005 / 0003
#4. Execute: The content of AC is added to the content of location 940. The result is in AC. PC is incremented
Memory / CPU Registers300 / 3005 / 302 / PC
301 / 5940 / 0005 / AC
302 / 7006 / 5940 / IR
940 / 0002 / I/O Device
005 / 0003
#5. Fetch: The instruction at memory location 302 (this is the content of PC) is loaded into IR. This instruction is 7006 (store AC at I/O device 6)
Memory / CPU Registers300 / 3005 / 302 / PC
301 / 5940 / 0005 / AC
302 / 7006 / 7006 / IR
940 / 0002 / I/O Device
005 / 0003
#6. Execute: The content of AC is stored into I/O device 6. PC is incremented.
Memory / CPU Registers300 / 3005 / 303 / PC
301 / 5940 / 0005 / AC
302 / 7006 / 7006 / IR
940 / 0002 / I/O Device
005 / 0003
006 / 0005
- Describe the evolution of operating systems (300 – 500 words)
See Section 2.2 p.52
- Read Chapter 2 and give answers to the following questions (Review questions 2.1 and 2.4 on p. 103):
- What are three objectives of an OS design?
Convenience: An operating system makes a computer more convenient to use.
Efficiency: An operating system allows the computer system resources to be used in an efficient manner.
Ability to evolve: An operating system should be constructed in such a way as to permit the effective development, testing, and introduction of new system functions without interfering with service.
- What is a process?
A process has many definitions that are discussed in the book.
- A program in execution
- An instance of a program running on a computer
- The entity that can be assigned to and executed on a processor
- A unit of activity characterized by a single sequential thread of execution, a current state, and an associated set of system resources.
Stallings mentions that a process consists of three components:
- An executable program
- The associated data needed by the program (variables, work space, buffers, etc.)
- The execution context of the program
The glossary defines the term process as: “A program in execution. A process is controlled and scheduled by the operating system. Same as task.”