Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer System Overview

Similar presentations


Presentation on theme: "Computer System Overview"— Presentation transcript:

1 Computer System Overview
Chapter 1

2 Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users Manages secondary memory and I/O devices Provides support for networking/communications

3 Basic Elements Processor Main Memory (real memory/primary memory)
I/O modules secondary memory devices communications equipment terminals System bus communication among processors, memory, and I/O modules

4 Top-Level Components

5 User-Visible Registers
May be referenced by machine language Available to all programs - application programs and system programs Types of registers Data Address Index Segment pointer Stack pointer

6 Control and Status Registers
Program Counter (PC) has the address of the instruction to be fetched Instruction Register (IR) Contains the instruction most recently fetched Program Status Word (PSW) condition codes / flags e.g. Interrupt enable/disable, supervisor/user mode Can be accessed by a program but not altered

7 Instruction Cycle The processor fetches the instruction from memory where the Program Counter (PC) is pointing PC is incremented after each fetch Fetched instruction is placed in the instruction register and then decoded for execution Types of instructions Processor-memory - transfer data between processor and memory Processor-I/O - data transferred to or from a peripheral device Data processing - arithmetic or logic operation on data Control - alter sequence of execution (e.g. jump, branch etc.)

8 Interrupts An interruption of the normal sequence of execution
A suspension of a process caused by an event external to that process and performed in such a way that the process can be resumed Improves processing efficiency Allows the processor to execute other instructions while an I/O operation is in progress

9 Interrupt Cycle At the end of each cycle, processor checks for interrupts If no interrupts  fetch the next instruction If an interrupt is pending, suspend execution of the current program, and execute the interrupt handler

10 Classes of Interrupts Program interrupts arithmetic overflow division by zero execute illegal instruction reference outside user’s memory space Timer I/O interrupt Hardware failure Interrupt Handler (ISR – interrupt Service Routine) Whenever there is an interrupt, control is transferred to this program. It determines the nature of the interrupt and performs the necessary actions to handle it.

11 Transfer of Control via Interrupts
For the user program, an interrupt suspends the normal sequence of execution. When the interrupt processing is completed, execution resumes. Thus, the user program does not have to contain any special code to accommodate interrupts; the processor and the OS are responsible for suspending the user program and then resuming it at the same point.

12 Simple Interrupt Processing
An interrupt triggers a number of events, both in the processor hardware and in software. This figure shows a typical sequence. When an I/O device completes an I/O operation, the following sequence of hardware events occurs: 1. The device issues an interrupt signal to the processor. 2. The processor finishes execution of the current instruction before responding to the interrupt. 3. The processor tests for a pending interrupt request, determines that there is one, and sends an acknowledgment signal to the device that issued the interrupt. The acknowledgment allows the device to remove its interrupt signal. 4.The processor next needs to prepare to transfer control to the interrupt routine. 5. The processor then loads the program counter with the entry location of the interrupt-handling routine that will respond to this interrupt. 6. At this point, the program counter and PSW relating to the interrupted program have been saved on the control stack. Next slide shows more detail on this step 7. The interrupt handler may now proceed to process the interrupt. 8. The saved register values are retrieved from the stack and restored to the registers 9. The final act is to restore the PSW and program counter values from the stack. It is important to save all of the state information about the interrupted program for later resumption. Because the interrupt is not a routine called from the program. Rather, the interrupt can occur at any time and therefore at any point in the execution of a user program. Its occurrence is unpredictable.

13 Changes in Memory and Registers for an Interrupt
From step 6 in previous diagram In this case, a user program is interrupted after the instruction at location N. The contents of all of the registers plus the address of the next instruction (N + 1), a total of M words, are pushed onto the control stack. The stack pointer is updated to point to the new top of stack, and the program counter is updated to point to the beginning of the interrupt service routine.

14 Multiple Interrupts Disable interrupts while an interrupt is being processed Interrupts remain pending until the processor enables interrupts After interrupt handler routine completes, the processor checks for additional interrupts OR Lower-priority interrupt handler can be interrupted (nested)

15 I/O Techniques When the processor encounters an instruction relating to I/O, it executes that instruction by issuing a command to the appropriate I/O module. Three techniques are possible for I/O operations: Programmed I/O Interrupt-driven I/O Direct memory access (DMA)

16 Direct Memory Access (1) Initiate Block Read Processor Cache
I/O exchanges occur directly with memory without processor involvement Processor grants I/O module authority to read from or write to memory Relieves the processor responsibility for the exchange. Processor is free to do other things The processor is only involved at the beginning and end of the transfer. An interrupt is sent when the task is complete (1) Initiate Block Read Processor Reg Cache (3) Read Done, interrupt! Memory-I/O bus (2) DMA Transfer I/O controller Memory disk Disk disk Disk

17 Multiprogramming Processor has more than one program to execute
The sequence that the programs are executed depends on their relative priority and whether they are waiting for I/O After an interrupt handler completes, control may not return to the program that was executing at the time of the interrupt

18 Memory Hierarchy Going Down the Hierarchy Cost per bit decreases
Capacity increases Access time increases Frequency of access by the processor decreases

19 Cache Memory Processor speed is much faster than memory speed. Therefore, Increase the speed of memory by adding a small fast memory Cache contains a portion of main memory Processor first checks cache. If not found in cache, the block of memory containing the needed information is moved to the cache Because of locality of reference, likely future memory references are in that block Transfers are not visible to the OS (i.e. no OS involvement)

20 Figure 1. 18 illustrates the read operation
Figure 1.18 illustrates the read operation. The processor generates the address, RA, of a word to be read. If the word is contained in the cache, it is delivered to the processor. Otherwise, the block containing that word is loaded into the cache and the word is delivered to the processor.

21 replacement algorithm
Main categories are: cache size block size mapping function replacement algorithm write policy number of cache levels Cache Design A detailed discussion of cache design is beyond the scope of this book. Key elements are briefly summarized here. We will see that similar design issues must be addressed in dealing with virtual memory and disk cache design. They fall into the following categories: • Cache size • Block size • Mapping function • Replacement algorithm • Write policy • Number of cache levels

22 Mapping Function Determines which cache location the block will occupy
Two constraints affect design: when one block is read in, another may have to be replaced the more flexible the mapping function, the more complex is the circuitry required to search the cache When a new block of data is read into the cache, the mapping function determines which cache location the block will occupy. Two constraints affect the design of the mapping function. First, when one block is read in, another may have to be replaced. We would like to do this in such a way as to minimize the probability that we will replace a block that will be needed in the near future. The more flexible the mapping function, the more scope we have to design a replacement algorithm to maximize the hit ratio. Second, the more flexible the mapping function, the more complex is the circuitry required to search the cache to determine if a given block is in the cache.

23 Cache Design Cache size Block size Mapping function
the unit of data exchanged between cache and main memory hit means the information was found in the cache Mapping function determines which cache location the block will occupy Replacement algorithm determines which word in the block to replace Least-Recently-Used (LRU)

24 Initializing the Machine
Power up  fetch-execute cycle begins Initial (or hardware) process begins to run Executes ROM diagnostic program Then bootstrap loads the OS OS initialization Setup & initialize all system data structures Initialize all devices Start daemons – including idle process Branches to the scheduler BIOS ABCs Every computer with a motherboard includes a special chip referred to as the BIOS or ROM BIOS (Read Only Memory Basic Input/Output System). The BIOS includes instructions on how to load basic computer hardware. The BIOS also includes a test referred to as a POST (Power On Self Test) which will ensure that the computer meets requirements to boot up properly. If the computer does not pass the POST you will receive a combination of beeps indicating what is malfunctioning within the computer. In most PCs, the BIOS has 4 main functions: POST - Test computer hardware insuring hardware is properly functioning before starting process of loading Operating System. Additional information on the POST can be found our POST / Beep Codes page. Bootstrap Loader - Process of locating the operating system. If capable OS is located and BIOS passes the control to it. BIOS - Software / Drivers which interfaces between the OS and your hardware. When running DOS or Windows you are using complete BIOS support. BIOS / CMOS Setup - Configuration program. Which allows you to configure hardware settings including system settings such as computer passwords, time, and date.

25 Bootstrapping Bootstrap loader (“boot sector”) Primary Memory PC IR 1
Fetch Unit Decode Unit Execute Unit PC IR BIOS loader 0x 0x BIOS ABCs Every computer with a motherboard includes a special chip referred to as the BIOS or ROM BIOS (Read Only Memory Basic Input/Output System). The BIOS includes instructions on how to load basic computer hardware. The BIOS also includes a test referred to as a POST (Power On Self Test) which will ensure that the computer meets requirements to boot up properly. If the computer does not pass the POST you will receive a combination of beeps indicating what is malfunctioning within the computer. In most PCs, the BIOS has 4 main functions: POST - Test computer hardware insuring hardware is properly functioning before starting process of loading Operating System. Additional information on the POST can be found our POST / Beep Codes page. Bootstrap Loader - Process of locating the operating system. If capable OS is located and BIOS passes the control to it. BIOS - Software / Drivers which interfaces between the OS and your hardware. When running DOS or Windows you are using complete BIOS support. BIOS / CMOS Setup - Configuration program. Which allows you to configure hardware settings including system settings such as computer passwords, time, and date. Primary Memory

26 Bootstrapping Bootstrap loader (“boot sector”) Loader Primary Memory
1 0x 2 BIOS loader 0x Fetch Unit Decode Unit Execute Unit PC IR 0x Loader BIOS ABCs Every computer with a motherboard includes a special chip referred to as the BIOS or ROM BIOS (Read Only Memory Basic Input/Output System). The BIOS includes instructions on how to load basic computer hardware. The BIOS also includes a test referred to as a POST (Power On Self Test) which will ensure that the computer meets requirements to boot up properly. If the computer does not pass the POST you will receive a combination of beeps indicating what is malfunctioning within the computer. In most PCs, the BIOS has 4 main functions: POST - Test computer hardware insuring hardware is properly functioning before starting process of loading Operating System. Additional information on the POST can be found our POST / Beep Codes page. Bootstrap Loader - Process of locating the operating system. If capable OS is located and BIOS passes the control to it. BIOS - Software / Drivers which interfaces between the OS and your hardware. When running DOS or Windows you are using complete BIOS support. BIOS / CMOS Setup - Configuration program. Which allows you to configure hardware settings including system settings such as computer passwords, time, and date. Primary Memory

27 Bootstrapping Bootstrap loader (“boot sector”) Loader OS PC IR 1
0x 2 BIOS loader 0x Fetch Unit Decode Unit Execute Unit PC IR 0x Loader BIOS ABCs Every computer with a motherboard includes a special chip referred to as the BIOS or ROM BIOS (Read Only Memory Basic Input/Output System). The BIOS includes instructions on how to load basic computer hardware. The BIOS also includes a test referred to as a POST (Power On Self Test) which will ensure that the computer meets requirements to boot up properly. If the computer does not pass the POST you will receive a combination of beeps indicating what is malfunctioning within the computer. In most PCs, the BIOS has 4 main functions: POST - Test computer hardware insuring hardware is properly functioning before starting process of loading Operating System. Additional information on the POST can be found our POST / Beep Codes page. Bootstrap Loader - Process of locating the operating system. If capable OS is located and BIOS passes the control to it. BIOS - Software / Drivers which interfaces between the OS and your hardware. When running DOS or Windows you are using complete BIOS support. BIOS / CMOS Setup - Configuration program. Which allows you to configure hardware settings including system settings such as computer passwords, time, and date. 3 0x000A000 OS Primary Memory 4. Initialize hardware 5. Create user environment 6. …

28 Windows 7 Startup BIOS ABCs Every computer with a motherboard includes a special chip referred to as the BIOS or ROM BIOS (Read Only Memory Basic Input/Output System). The BIOS includes instructions on how to load basic computer hardware. The BIOS also includes a test referred to as a POST (Power On Self Test) which will ensure that the computer meets requirements to boot up properly. If the computer does not pass the POST you will receive a combination of beeps indicating what is malfunctioning within the computer. In most PCs, the BIOS has 4 main functions: POST - Test computer hardware insuring hardware is properly functioning before starting process of loading Operating System. Additional information on the POST can be found our POST / Beep Codes page. Bootstrap Loader - Process of locating the operating system. If capable OS is located and BIOS passes the control to it. BIOS - Software / Drivers which interfaces between the OS and your hardware. When running DOS or Windows you are using complete BIOS support. BIOS / CMOS Setup - Configuration program. Which allows you to configure hardware settings including system settings such as computer passwords, time, and date.

29 Hardware Process Starts
BIOS Idle Process Kernel ISRs Process i Process j Program I/O Process running Switch to Another program


Download ppt "Computer System Overview"

Similar presentations


Ads by Google