Computer Hardware Flashcards
What is the role of an operating system in relation to computer hardware?
- extends the computer’s instruction set,
- manages its resources, and
- must have knowledge about the hardware.
What are the main components of a personal computer as described in the text?
The main components are the CPU (Central Processing Unit), memory, and I/O (Input/Output) devices, which are connected by a system bus.
What is the function of the CPU in a computer?
CPUs have registers to hold key variables and temporary results. Accessing memory is slower than executing an instruction, so registers provide a faster way to store and retrieve data during computation.
What are some of the special registers found in most computers?
program counter: which holds the memory address of the next instruction to be fetched;
the stack pointer: which points to the top of the current stack in memory;
and the PSW (Program Status Word): which contains condition code bits, CPU priority, mode (user or kernel), and other control bits.
Why is the PSW important for the operating system?
plays an important role in system calls and I/O operations. It contains information about the program’s execution state, such as the mode (user or kernel) and condition code bits set by comparison instructions.
Why does the operating system need to save and restore registers?
When time multiplexing the CPU (switching between programs), the operating system often stops a running program and starts another. To ensure the program’s state is preserved, the operating system needs to save all the registers of the current program so they can be restored when the program runs again.
What is the purpose of a pipeline in CPU design?
Pipelining allows CPUs to execute multiple instructions simultaneously. By dividing the fetch, decode, and execute stages into separate units, instructions can be processed in parallel, improving overall performance.
How does a superscalar CPU differ from a pipeline design?
A superscalar CPU has multiple execution units specialized for different types of operations.
It fetches and decodes multiple instructions at once and executes them as soon as an execution unit becomes available.
Instructions may be executed out of order, which introduces additional complexity for both compiler and operating system writers.
What are the two modes found in most CPUs, and what are their purposes?
Kernel mode: allows the CPU to execute every instruction and access all hardware features. The operating system typically runs in kernel mode, providing complete control over the hardware.
User mode: restricts the instructions that can be executed and the features that can be accessed, ensuring user programs cannot interfere with critical system operations.
How does a user program interact with the operating system?
- To obtain services from the operating system, a user program must make a system call.
- This traps the program into kernel mode and invokes the operating system.
- After completing the requested task, control is returned to the user program.
What approach is taken to address the conflicting goals of memory speed, capacity, and cost?
The memory system is constructed as a hierarchy of layers, with each layer having different characteristics in terms of speed, capacity, and cost per bit. This hierarchy includes registers, cache memory, and main memory.
What is the top layer of the memory hierarchy, and how is it accessed?
The top layer consists of registers internal to the CPU. They are made of the same material as the CPU and are accessed without any delay.
What is cache memory, and how does it work?
Cache memory is a high-speed memory located close to the CPU. It stores frequently accessed data from the main memory in cache lines.
When a memory word is requested, the cache hardware checks if the corresponding cache line is present (cache hit). If found, the request is satisfied from the cache, avoiding the need to access the main memory.
Why is cache memory limited in size?
higher cost compared to main memory.
How is caching used in operating systems?
Operating systems often utilize caching to improve performance. For example, frequently accessed files are kept in main memory to avoid repeated disk access.