Reputation: 71
I am newbie to computer architecture and I have the following questions,
Upvotes: 1
Views: 373
Reputation: 23659
Which unit or component controls operations such as incrementing program counter, loading the instruction to the IR and the other Fetch- decode-execute-write cycle?
A processor can either have a centralized control unit or a distributed control unit. Processors that are not pipelined or that have a two-stage pipeline (i.e., fetch and execute) use a centralized control unit. More sophisticated processors use distributed control where each stage of the pipeline may generate control signals. The term control refers to operations such as fetching instructions, reading data from and writing data to memory, determining the execution unit that can execute a given instruction, and determining dependencies between instructions. This is in contrast to the term datapath, which refers to the part of the CPU that contains the execution units and registers.
Ancient CPUs consisted of two components called the control path (aka control unit) and the datapath. You might have seen these terms in computer architecture textbooks. An example of such CPUs is the Intel 8086. In the 8086, the control unit is called the bus interface unit (BIU) and is responsible for the following tasks:
The datapath of the 8086 is also called the execution unit and is responsible for the following tasks:
The 8086 can be described as a pipelined processor with two stages corresponding to the two units. There is basically no decoding; the instruction bytes are hardwired to the ALU and register file to perform the specified operation.
If it is the control unit, how does it know when to perform the operations?
Every instruction has an opcode, which is just a bunch of bits that identify the operation that needs to be performed by the ALU (on the 8086). The opcode bits can be simply hardwired by design to the ALU so that it does the right thing automatically. Other bits of the instruction may specify the operands or register identifiers, which may be passed to the register file to perform a register read or write operation.
Is the Operating system involved in any of these tasks except scheduling which program to execute?
No.
Why does it matter if the OS is 32 bit or 64 bit? Shouldn't we worry about the compiler or interpreter in this case?
It depends on whether the processor supports a 32-bit operating mode and a 64-bit operating mode. The number and/or size of registers and the supported features are different in different modes, which is why the instruction encoding is different. For example, the 32-bit x86 instruction set defines 8 32-bit general-purpose architectural registers while the 64-bit x86 instruction set (also called x86-64) defines 16 64-bit general-purpose architectural registers. In addition, the size of a virtual memory address is 64-bit on x86-64 and 32-bit on x86, which not only impacts the instruction encoding but also the format of an executable binary (See Executable and Linkable Format). A modern x86 processor generally supports both modes of operation. Since the instruction encoding is different, then the binary executables that contain them are different for different modes and can only run in the mode they are compiled for. A 32-bit OS means that the binaries of the OS require the processor to operate in 32-bit. This also poses a restriction that any application to be run on the OS must also be 32-bit because a 32-bit OS doesn't know how to run a 64-bit application (because the ABI is different). On the other hand, typically, a 64-bit OS is designed to run both 32-bit and 64-bit applications.
The gcc compiler will by default emit 64-bit x86 binaries if the OS it is running on is 64-bit. However, you can override that by specifying the -m32
compiler switch so that it emits a 32-bit x86 binary instead. You can use objdump
to observe the many differences between a 32-bit executable and a 64-bit executable.
Upvotes: 2