Anda di halaman 1dari 3

CmSc 335 Operation Systems

Homework 01, due 09/07

Solution

1. 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:
1. Load AC from I/O device 5
2. Add contents of memory location 940
3. 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
300
3005
301
5940
302
7006

CPU Registers
300
PC
AC
3005 IR

940

I/O Device
005
0003

0002

#2. Execute : AC is loaded with the content of I/O device 5. PC is


incremented.

300
301
302

Memory
3005
5940
7006

940

0002

CPU Registers
301
PC
0003 AC
3005 IR
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
300
3005
301
5940
302
7006

CPU Registers
301
PC
0003 AC
5940 IR

940

I/O Device
005
0003

0002

#4. Execute: The content of AC is added to the content of location 940.


The result is in AC. PC is incremented
Memory
300
3005
301
5940
302
7006

CPU Registers
302
PC
0005 AC
5940 IR

940

I/O Device
005
0003

0002

#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
300
3005
301
5940
302
7006

CPU Registers
302
PC
0005 AC
7006 IR

940

I/O Device
005
0003

0002

#6. Execute: The content of AC is stored into I/O device 6. PC is


incremented.
300
301
302

Memory
3005
5940
7006

940

0002

CPU Registers
303
PC
0005 AC
7006 IR
I/O Device
005
0003
006
0005

2. Describe the evolution of operating systems (300 500 words)


See Section 2.2 p.52
3. Read Chapter 2 and give answers to the following questions (Review questions 2.1
and 2.4 on p. 103):
a. 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.
b. 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.