Download Understanding Computer Hardware: Processors, Memory, and I/O Devices and more Study notes Operating Systems in PDF only on Docsity!
2004 Deitel & Associates, Inc. All rights reserved.
Chapter 2 – Hardware and Software Concepts
Outline 2.1 Introduction 2.2 Evolution of Hardware Devices 2.3 Hardware Components 2.3.1 Mainboards 2.3.2 Processors 2.3.3 Clocks 2.3.4 Memory Hierarchy 2.3.5 Main Memory 2.3.6 Secondary Storage 2.3.7 Buses 2.3.8 Direct Memory Access (DMA) 2.3.9 Peripheral Devices 2.4 Hardware Support for Operating Systems 2.4.1 Processor 2.4.2 Timers and Clocks
2004 Deitel & Associates, Inc. All rights reserved.
Chapter 2 – Hardware and Software Concepts
Outline (continued) 2.4.3 Bootstrapping 2.4.4 Plug and Play 2.5 Caching and Buffering 2.6 Software overview 2.6.1 Machine Language and Assembly Language 2.6.2 Interpreters and Compilers 2.6.3 High-Level Languages 2.6.4 Structured Programming 2.6.5 Object-Oriented Programming 2.7 Application Programming Interfaces (APIs) 2.8 Compiling, Linking and Loading 2.8.1 Compiling 2.8.2 Linking 2.8.3 Loading 2.9 Firmware 2.10 Middleware
2004 Deitel & Associates, Inc. All rights reserved.
Objectives
• After reading this chapter, you should understand:
- hardware components that must be managed by an operating system.
- how hardware has evolved to support operating system functions.
- how to optimize performance of various hardware devices.
- the notion of an application programming interface (API).
- the process of compilation, linking and loading.
2004 Deitel & Associates, Inc. All rights reserved.
2.1 Introduction
• An operating system is primarily a resource manager
- Design is tied to the hardware and software resources the operating system must manage - processors - memory - secondary storage (such as hard disks) - other I/O devices - processes - threads - files - databases
2004 Deitel & Associates, Inc. All rights reserved.
2.3 Hardware Components
• A computer’s hardware consists of:
- processor(s)
- main memory
- input/output devices
2004 Deitel & Associates, Inc. All rights reserved.
2.3.1 Mainboards
• Printed Circuit Board
- Hardware component that provides electrical connections between devices
- The mainboard is the central PCB in a system
- Devices such as processors and main memory are attached
- Include chips to perform low-level operations (e.g., BIOS)
2004 Deitel & Associates, Inc. All rights reserved.
2.3.2 Processors
• A processor is hardware that executes machine-
language
- CPU executes the instructions of a program
- Coprocessor executes special-purpose instructions
- Ex., graphics or audio coprocessors
- Registers are high-speed memory located on processors
- Data must be in registers before a processor can operate on it
- Instruction length is the size of a machine-language instruction
- Some processors support multiple instruction lengths
2004 Deitel & Associates, Inc. All rights reserved.
Figure 2.2 Processor components.
2.3.2 Processors
2004 Deitel & Associates, Inc. All rights reserved.
Figure 2.3 Memory hierarchy.
2.3.4 Memory Hierarchy
2004 Deitel & Associates, Inc. All rights reserved.
2.3.5 Main Memory
• Main memory consists of volatile random access
memory (RAM)
- Processes can access data locations in any order
- Common forms of RAM include:
- dynamic RAM (DRAM) – requires refresh circuit
- static RAM (SRAM) – does not require refresh circuit
- Bandwidth is the amount of data that can be transferred per unit of time
2004 Deitel & Associates, Inc. All rights reserved.
2.3.6 Secondary Storage
• Secondary storage stores large quantities of persistent data at
low cost
- Accessing data on a hard disk is slower than main memory
- Mechanical movement of read/write head
- Rotational latency
- Transfer time
- Removable secondary storage facilitates data backup and transfer
- CDs (CD-R, CD-RW)
- DVDs (DVD-R, DVD+R)
- Zip disks
- Floppy disks
- Flash memory cards
- Tapes
2004 Deitel & Associates, Inc. All rights reserved.
2.3.7 Buses
• A bus is a collection of traces
- Traces are thin electrical connections that transport information between hardware devices
- A port is a bus that connects exactly two devices
- An I/O channel is a bus shared by several devices to perform I/O operations - Handle I/O independently of the system’s main processors
- Example, the frontside bus (FSB) connects a processor to main memory
2004 Deitel & Associates, Inc. All rights reserved.
2.3.9 Peripheral Devices
• Peripheral devices
- Any device not required for a computer to execute software instructions
- Internal devices are referred to as integrated peripheral devices
- Network interface cards, modems, sound cards
- Hard disk, CD and DVD drives
- Character devices transfer data one bit at a time
- Can be attached to a computer via ports and other buses
- Serial ports, parallel ports, USB, IEEE 1394 ports and SCSI
2004 Deitel & Associates, Inc. All rights reserved.
Figure 2.5 Peripheral devices (1 of 2).
2.3.9 Peripheral Devices
2004 Deitel & Associates, Inc. All rights reserved.
Figure 2.5 Peripheral devices (2 of 2).
2.3.9 Peripheral Devices
2004 Deitel & Associates, Inc. All rights reserved.
2.4 Hardware Support for Operating Systems
• Computer architectures contain:
- Features that perform operating system functions quickly in hardware to improve performance
- Features that enable the operating system to rigidly enforce protection
2004 Deitel & Associates, Inc. All rights reserved.
2.4.2 Timers and Clocks
• Timers
- An interval timer periodically generates an interrupt
- Operating systems use interval timers to prevent processes from monopolizing the processor
• Clocks
- Provide a measure of continuity
- A time-of-day clock enables an OS to determine the current time and date
2004 Deitel & Associates, Inc. All rights reserved.
2.4.3 Bootstrapping
• Bootstrapping: loading initial OS components into
memory
- Performed by a computer’s Basic Input/Output System (BIOS)
- Initializes system hardware
- Loads instructions into main memory from a region of secondary storage called the boot sector
- If the system is not loaded, the user will be unable to access any of the computer’s hardware
2004 Deitel & Associates, Inc. All rights reserved.
Figure 2.6 Bootstrapping.
2.4.3 Bootstrapping
2004 Deitel & Associates, Inc. All rights reserved.
2.4.4 Plug and Play
• Plug and Play technology
- Allows operating systems to configure newly installed hardware without user interaction
- To support plug and play, a hardware device must:
- Uniquely identify itself to the operating system
- Communicate with the OS to indicate the resources and services the device requires to function properly
- Identify the driver that supports the device and allows software to configure the device (e.g., assign the device to a DMA channel)
2004 Deitel & Associates, Inc. All rights reserved.
2.6 Software Overview
• Programming languages
- Some are directly understandable by computers, others require translation
- Classified generally as either:
- Machine language
- Assembly language
- High-level language
2004 Deitel & Associates, Inc. All rights reserved.
2.6.1 Machine Language and Assembly Language
• Machine language
- Defined by the computer’s hardware design
- Consists of streams of numbers (1s and 0s) that instruct computers how to perform elementary operations
- A computer can understand only its own machine language
• Assembly language
- Represents machine-language instructions using English-like abbreviations
- Assemblers convert assembly language to machine language
- Speeds programming, reduces potential for bugs
2004 Deitel & Associates, Inc. All rights reserved.
2.6.2 Interpreters and Compilers
• High-level languages
- Instructions look similar to everyday English
- Accomplish more substantial tasks with fewer statements
- Require compilers and interpreters
• Compiler
- Translator program that converts high-level language programs into machine language
• Interpreter
- Program that directly executes source code or code that has been reduced to a low-level language that is not machine code
2004 Deitel & Associates, Inc. All rights reserved.
2.6.3 High-level languages
• Popular high-level languages
- Typically are procedural or object-oriented
- Fortran
- Used for scientific and engineering applications
- COBOL
- For business applications that manipulate large volumes of data
- C
- Development language of the UNIX OS
- C++/Java
- Popular object-oriented languages
- C#
- Object-oriented development language for the .NET platform
2004 Deitel & Associates, Inc. All rights reserved.
2.7 Application Programming Interfaces (APIs)
• A set of routines
- Programmers use routines to request services from the operating system
- Programs call API functions, which may access the OS by making system calls
- Examples of APIs include:
- Portable Operating System Interface (POSIX) standard
- Windows API
2004 Deitel & Associates, Inc. All rights reserved.
Figure 2.7 Application programming interface (API).
2.7 Application Programming Interfaces (APIs)
2004 Deitel & Associates, Inc. All rights reserved.
2.8 Compiling, Linking and Loading
• Before a high-level-language program can execute, it
must be:
- Translated into machine language
- Linked with various other machine-language programs on which it depends
- Loaded into memory
2004 Deitel & Associates, Inc. All rights reserved.
2.8.1 Compiling
• Translating high-level code to machine code
- Accepts source code as input and returns object code
- Compilation phases include:
- Lexer
- Separates the characters of a program’s source into tokens
- Parser
- Groups tokens into syntactically correct statements
- Intermediate code generator
- Converts statements into a stream of simple instructions
- Optimizer
- Improves code execution efficiency and memory requirements
- Code generator
- Produces the object file containing the machine-language