Escolar Documentos
Profissional Documentos
Cultura Documentos
Computer System
1.1 Introduction
1. User interface: It allows the user to interact with the operating system in
order to access the hardware resources.
2. Memory management: The OS manages memory by allocating memory to
the currently running programs
3. Process management: OS schedules the processing power of the processor,
the memory and the hardware to programs it is running.
4. Device management: OS initiates the hardware devices and controls the
sending or receiving of data
5. File management: OS also controls the opening, closing and access
permissions to a file.
OS classification is either based on based on the number of users using the system
simultaneously or on the number of tasks being performed by the computer
simultaneously.
1. Single user OS: it is an OS where only one user can access the resources of
the computer at one time.
2. Multi-user OS: it is an OS where more than one user can access the computer
resources simultanoeusly.
According to the number of tasks being performed at the same time, we have
1
1. The Processor: This controls the operations of the computer and performs
its data processing functions. When there is only one processor, it is often
referred to as the central processing unit (CPU).
3. I/O modules: This moves data between the computer and its external
environment. The external environment may consist of a variety of devices,
including secondary memory devices, communications equipment, and
terminals.
4. System bus: This provides for communication among the processors, the
main memory, and the I/O modules.
The figure below depicts these top-level components. One of the processor’s
functions is the exchange of data with the memory. For this purpose, among other
registers that it might contain, it typically makes use of two internal (to the
processor) registers. The memory address register (MAR), which specifies the
address in the memory for the next read or write operation, and the memory
buffer register (MBR),which contains the data to be written into the memory or
which receives the data read from the memory. Similarly, an I/O address register
(I/OAR) specifies a particular I/O device. An I/O buffer register (I/OBR) is used for the
exchange of data between an I/O module and the processor.
2
Control and status registers: These are used by the processor to control the
operations of the processor and by privileged OS routines to control the execution
of programs. They are not accessible to programmers.
Index register: Keeps only an index to add to a base value to get the effective
address.
Segment pointer: Memory is divided into segments. Reference is made to a
particular segment only to get location. This mode of addressing is important in
memory management.
Stack pointer: If there is user-visible stack addressing, then there is a dedicated
register that points to the top of the stack. This allows the use of instructions like as
push and pop.
Different processors may have different register organizations and use different
terminologies. An almost complete list of these types of registers is given here in
addition to the MAR, MBR, I/OAR, and I/OBR registers mentioned earlier. These are:
4
The processing required for a single instruction is called an instruction cycle. Using
a simplified two-step description, the instruction cycle is depicted in the Figure
below.
The two steps are referred to as the fetch stage and the execute stage. Program
execution halts only if either the processor is turned off, some sort of unrecoverable
error occurs, or a program instruction is encountered that halts the processor.
At the beginning of each instruction cycle, the processor fetches an instruction from
memory. Typically, the program counter (PC) holds the address of the next
instruction to be fetched. Unless instructed otherwise, the processor always
increments the PC after each instruction fetch so that it will fetch the next
instruction in sequence. Assume that the program counter is set to location
300.The processor will fetch the next instruction at location 300. On succeeding
instruction cycles, it will fetch instructions from locations 301, 302, 303, and so on.
This sequence may be altered, whenever the need arises.
The fetched instruction is loaded into the instruction register (IR). The instruction
contains bits that specify the action the processor is to take. The processor
interprets the instruction and performs the required action. In general, these actions
fall into four categories:
5
An instruction’s execution may involve a combination of these actions
The Figure below illustrates a partial program execution, showing the relevant
portions of memory and processor registers. The program fragment shown adds the
contents of the memory word at address 940 to the contents of the memory word at
address 941 and stores the result in the latter location.
Three instructions, which can be described as three fetch and three execute stages,
are required:
1. The PC contains 300, the address of the first instruction. This instruction (the
value 1940 in hexadecimal) is loaded into the IR and the PC is incremented.
2. The first 4 bits (first hexadecimal digit) in the IR indicate that the AC is to be
loaded from memory. The remaining 12 bits (three hexadecimal digits)
specify the address, which is 940.
3. The next instruction (5941) is fetched from location 301 and the PC is
incremented.
4. The old contents of the AC and the contents of location 941 are added and
the result is stored in the AC.
5. The next instruction (2941) is fetched from location 302 and the PC is
incremented.
6. The contents of the AC are stored in location 941.
In this example, three instruction cycles, each consisting of a fetch stage and an
execute stage, are needed to add the contents of location 940 to the contents of
941. With a more complex set of instructions, fewer instruction cycles would be
needed.
Most modern processors include instructions that contain more than one address.
Thus the execution stage for a particular instruction may involve more than one
reference to memory. Also, instead of memory references, an instruction may
specify an I/O operation.
6
I/O Function
Data can be exchanged directly between an I/O module (e. g., a disk controller) and
the processor. Just as the processor can initiate a read or write with memory,
specifying the address of a memory location, the processor can also read data from
or write data to an I/O module. In this latter case, the processor identifies a specific
device that is controlled by a particular I/O module. Thus, an instruction sequence
similar in form to the one seen above could occur, with I/O instructions rather than
memory-referencing instructions.
In some cases, it is desirable to allow I/O exchanges to occur directly with main
memory to relieve the processor of the I/O task. In such a case, the processor
grants to an I/O module the authority to read from or write to memory, so that the
I/O memory transfer can occur without tying up the processor. During such a
transfer, the I/O module issues read or write commands to memory, relieving the
processor of the responsibility for the exchange. This operation is known as direct
memory access (DMA).
1.3 Interrupts
Virtually all computers provide a mechanism by which other modules (I/O, memory)
may interrupt the normal sequencing of the processor. Table 1.1 lists the most
7
common classes of interrupts. Interrupts are provided primarily as a way to improve
processor utilization. For example, most I/O devices are much slower than the
processor. Suppose that the processor is transferring data to a printer using an
instruction cycle scheme. After each write operation, the processor must pause and
remain idle until the printer catches up. The length of this pause may be on the
order of many thousands or even millions of instruction cycles. Clearly, this is a very
wasteful use of the processor.
To give a specific example, consider a PC that operates at 1 GHz, which would allow
roughly 109 instructions per second. A typical hard disk has a rotational speed of
7200 revolutions per minute for a half-track rotation time of 4 ms, which is 4 million
times slower than the processor.