主題： Questions and Answers
Q1. Why is compiled code typically not portable from one platform to another?
Ans.: Compilation creates platform-dependent machine code, targeted at a particular processor, therefore it is not portable.
Q2. What is the purpose of the system bus?
Ans.: The system bus allows the processing unit to communicate with devices through their respective device controllers.
Q3. What is the relationship between registers, main memory, disk storage, and cache?
Ans.: Registers are storage locations inside the CPU which hold a machine instruction and the data that it works on during a fetch-execute cycle. A cache is similar to main memory, but is smaller and can be accessed by the CPU much faster than normal main memory. Main memory consists of the storage locations for holding machine instructions and data that the CPU will transfer into its registers as part of the fetch-execute cycle. Disk storage is a device attached to a computer that holds files and programs which must be loaded into main memory before they can be worked on or executed. It is a form of persistent storage.
Q4. What is a machine code instruction?
Ans.: A machine code instruction is the fundamental instruction that a CPU works with and executes without interruption.
Q5. What are the three software interfaces that link a user program to a device controller?
Ans.: The three interfaces that link a user program to a device controller are:
1. The interface between the program and its runtime system (provided by library calls);
2. The interface between the runtime system and the operating system (provided by system calls);
3. The interface between the operating system and the device controller (provided by device calls).
Q6. How does an operating system interface to a device, and what is the role of a device driver?
Ans.: An operating system provides a high-level interface to hardware that hides the specified details of how the device is programmed. Within the operating system, the device driver for a particular device that knows how to interface with the device controller and translates high-level requests into lower-level interactions with the device.
Q7. What is a device controller and its purpose?
Ans.: A device controller has its own simple processor, memory and registers. It can execute in parallel with the CPU and provide two-way communication with a hardware device. The operating system interfaces with the device controller via a device driver making device calls.