0% found this document useful (0 votes)
15 views89 pages

Computer System and OS Fundamentals

The document provides an overview of operating systems, detailing the basic elements of a computer system, including the CPU, memory, I/O devices, and system bus. It discusses the roles of operating systems, their evolution over time, and various structures and operations, including system calls and memory management. Additionally, it highlights the importance of resource allocation, user interfaces, and the challenges faced in multicore systems.

Uploaded by

Vasanth
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views89 pages

Computer System and OS Fundamentals

The document provides an overview of operating systems, detailing the basic elements of a computer system, including the CPU, memory, I/O devices, and system bus. It discusses the roles of operating systems, their evolution over time, and various structures and operations, including system calls and memory management. Additionally, it highlights the importance of resource allocation, user interfaces, and the challenges faced in multicore systems.

Uploaded by

Vasanth
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

MODULE-1

OPERATING SYSTEM OVERVIEW


Computer System Overview
Basic Elements of a Computer System

 Central Processing Unit (CPU)


 The "brain" of the computer
 Executes instructions and processes data
 Memory
 Storage for data and instructions
 Provides quick access to frequently used information
 Input/Output (I/O) devices
 Hardware for communication between computer and external
world
 Allows data input and output from the computer system
 System bus
 Communication pathway between components
 Transfers data, addresses, and control signals between computer
components
Basic Elements of a Computer System:
CPU

 Arithmetic Logic Unit (ALU)


 Component for arithmetic and logical operations

 Performs calculations and logical comparisons

 Control Unit
 CPU component that directs operations

 Coordinates and controls other computer components

 Registers
 Small, fast storage locations within the CPU

 Holds data being processed or temporary results


Basic Elements of a Computer System:
Memory

 Primary Memory (RAM)


 Volatile, high-speed memory

 Stores currently used data and instructions

 Secondary Memory (e.g., HDD, SSD)


 Non-volatile, larger capacity storage

 Stores data and programs long-term


Basic Elements of a Computer System: I/O
Devices

 Input Devices (e.g., keyboard, mouse)


 Hardware for entering data into the computer

 Converts user actions into digital signals for the computer

 Output Devices (e.g., monitor, printer)


 Hardware for presenting data from the computer

 Converts digital signals into human-readable form


Basic Elements of a Computer System:
System Bus

 Data Bus
 Carries actual data between components

 Transfers data between CPU, memory, and I/O devices

 Address Bus
 Carries memory addresses

 Specifies the location for read/write operations

 Control Bus
 Carries control signals

 Coordinates and controls operations of computer components


Instruction Execution

 Fetch
 Retrieval of instruction from memory
 Brings the next instruction into the CPU
 Decode
 Interpretation of the instruction
 Determines what operation is to be performed
 Execute
 Performing the operation specified by the instruction
 Carries out the actual computation or data manipulation
 Store
 Writing results back to memory if necessary
 Updates memory with new data from the execution
Interrupts

 Hardware Interrupts
 Signals from hardware devices

 Alerts CPU to events requiring immediate attention

 Software Interrupts
 Signals generated by software

 Requests service from the operating system


Interrupt Handling

 Interrupt Detection
 Recognition of an interrupt signal
 Alerts CPU to pause current execution
 State Saving
 Storing current CPU state
 Preserves context of interrupted process
 Interrupt Service Routine (ISR) Execution
 Running specific code to handle the interrupt
 Performs necessary actions in response to the interrupt
 State Restoration
 Reloading saved CPU state
 Prepares CPU to resume interrupted process
Memory Hierarchy

 CPU Registers
 Fastest, smallest capacity memory in CPU
 Holds immediately accessible data
 Cache Memory
 High-speed memory between CPU and main memory
 Stores frequently accessed data to reduce access time
 Main Memory (RAM)
 Primary storage for running programs
 Holds active programs and data
 Secondary Storage (HDD/SSD)
 Non-volatile, large capacity storage
 Stores programs and data long-term
Cache Memory Levels

 L1 Cache
 Smallest, fastest cache, closest to CPU

 Provides immediate access to most frequently used data

 L2 Cache
 Larger, slightly slower than L1

 Backs up L1, holding next most frequently used data

 L3 Cache
 Largest on-chip cache, shared among cores

 Further reduces main memory access, improving overall


performance
Direct Memory Access (DMA)

 DMA Controller
 Hardware component managing direct memory transfers

 Coordinates data transfer between I/O devices and memory

 DMA Transfer
 Process of direct data movement bypassing CPU

 Responsibility: Reduces CPU overhead for large data


transfers
Multiprocessor Organization

 Symmetric Multiprocessing (SMP)


 Multiple identical processors sharing resources

 Distributes processing load among multiple CPUs

 Asymmetric Multiprocessing (AMP)


 Processors with specialized roles

 Assigns specific tasks to dedicated processors


Multicore Organization

 Core
 Individual processing unit within a CPU chip

 Executes instructions independently

 Shared Resources
 Components used by multiple cores (e.g., cache, memory
controller)
 Facilitates efficient use of chip resources
Benefits of Multicore Systems

 Increased Performance
 Ability to execute multiple tasks simultaneously

 Improves overall system speed and responsiveness

 Power Efficiency
 Better performance per watt of power consumed

 Reduces energy consumption relative to performance

 Enhanced Parallel Processing


 Improved handling of parallel workloads

 Speeds up applications designed for parallel execution


Challenges in Multicore Systems

 Heat Dissipation
 Managing thermal output of multiple cores

 Ensures system stability and longevity

 Parallel Programming Complexity


 Difficulty in writing efficient multi-threaded software

 Impacts the ability to fully utilize multicore capabilities

 Resource Sharing and Synchronization


 Managing access to shared resources among cores

 Prevents conflicts and ensures data integrity in parallel


operations
Operating System Overview
What is an Operating System?

 Definition: A program that manages computer


hardware and software resources
 Acts as an intermediary between computer hardware
and user programs
 Provides an environment for other programs to do
useful work
Components of a Computer System

 Hardware (CPU, memory, I/O devices)


 Operating System
 Application Programs
 Users
Roles of an Operating System

 Resource Allocator
 Manages and allocates system resources (CPU time, memory,
storage, I/O devices)
 Control Program
 Manages execution of user programs and I/O devices

 Prevents errors and improper use of the computer


User Views of Operating Systems

 Personal Computer: Designed for ease of use,


optimized for single-user experience
 Terminal/Mainframe: Designed to maximize
resource utilization among multiple users
 Workstation/Network: Balances individual usability
and resource sharing
 Mobile Devices: Optimized for touch interfaces and
mobility
 Embedded Systems: Minimal user interaction,
designed for specific tasks
System View of Operating Systems

 Resource Allocator: Efficiently distributes resources


among programs and users
 Control Program: Manages I/O devices and user
programs to prevent errors
OS Evolution: Early Days (1950s-1960s)

 First-generation computers had no operating


systems, programs were executed directly on the
hardware.
 Simple batch processing systems emerged, allowing
multiple jobs to be queued and executed
sequentially.
OS Evolution: Mainframe Era (1960s-
1970s)

 Multiprogramming was introduced, allowing


multiple programs to run concurrently.
 Time-sharing systems allowed multiple users to
interact with the computer simultaneously.
 Notable OS: IBM's OS/360
OS Evolution: Minicomputer Era (1970s-
1980s)

 More interactive systems developed.


 UNIX was created at Bell Labs, introducing concepts
like hierarchical file systems and multi-user support.
OS Evolution: Personal Computer Era
(1980s-1990s)

 Graphical User Interfaces (GUIs) became prevalent.


 Microsoft's MS-DOS and later Windows dominated
the PC market.
 Apple introduced the Macintosh with its innovative
GUI.
OS Evolution: Network and Internet Era
(1990s-2000s)

 Operating systems incorporated networking


capabilities.
 Linux, an open-source UNIX-like OS, gained
popularity.
 Microsoft Windows evolved with versions like 95,
XP, and later.
OS Evolution: Mobile and Cloud Era
(2000s-present)

 Mobile OS like iOS and Android emerged for


smartphones and tablets.
 Cloud computing led to the development of
distributed operating systems.
 Virtualization technologies allowed multiple OS
instances on a single machine.
OS Evolution: Current Trends

 Focus on security and privacy features.


 Integration of AI and machine learning capabilities.
 Development of lightweight OS for Internet of
Things (IoT) devices.
Operating System Structures
Background

 Modern operating systems are large and complex


 Careful engineering is required for proper function
and easy modification
 Common approach: Partition into small components
or modules
Simple Structure

 Examples: MS-DOS and early UNIX


 Characteristics:
 Not well-defined structures

 Grew beyond original scope

 Interfaces and functionality levels not well separated

 Limitations:
 Vulnerable to errant programs

 Difficult to implement and maintain


Layered Approach

 Operating system broken into layers (levels)


Structure:
 Bottom layer (0): Hardware
 Highest layer (N): User interface
 Advantages:
 Simplicity of construction and debugging

 Each layer uses only lower-level functions

 Challenges:
 Appropriately defining layers

 Potential efficiency issues


Microkernel Approach

 Removes non-essential components from the kernel


 Implements them as system and user-level programs
 Key features:
 Minimal process and memory management in kernel
 Communication facility
 Message passing between client programs and services

 Advantages:
 Easier to extend OS
 More security and reliability

 Disadvantage:
 Potential performance overhead
Modules

 Uses loadable kernel modules


 Structure:
 Core kernel components

 Additional services linked via modules

 Advantages:
 Flexible

 Dynamic loading of services

 No need for kernel recompilation for new features

 Examples: Solaris, Linux, Mac OS X, Windows


Hybrid Systems

 Combine different structures


 Address performance, security, and usability issues
 Examples:
 Linux and Solaris: Monolithic + Modular

 Windows: Primarily monolithic with microkernel features


Operating System Operations
Background

 Modern operating systems are interrupt-driven


 Events signaled by interrupts or traps
 OS structure defined by interrupt-driven nature
Interrupts and Traps

 Interrupt: Hardware-generated signal


 Trap (Exception): Software-generated interrupt
 Caused by error or specific request for OS service

 Each type of interrupt has a corresponding service


routine
Protection and Error Handling

 OS must protect against user program errors


 Errors in one program shouldn't affect others
 Proper OS design ensures incorrect programs can't
cause others to execute incorrectly
Dual-Mode Operation

 Hardware support to differentiate execution modes


 Two main modes:
 User mode

 Kernel mode (supervisor/system/privileged mode)

 Mode bit: 0 for kernel mode, 1 for user mode


Mode Transitions

 System boot: Starts in kernel mode


 User applications start in user mode
 Transition to kernel mode:
 System calls

 Interrupts

 Traps

 Always return to user mode for user programs


Privileged Instructions

 Some instructions designated as privileged


 Can only be executed in kernel mode
 Attempts to execute in user mode result in a trap
 Examples:
 Switching to kernel mode

 I/O control

 Timer management

 Interrupt management
Multi-Mode Operation

 Some CPUs support more than two modes


 Example: Virtualization support
 Separate mode for virtual machine manager (VMM)

 VMM has more privileges than user processes, fewer than


kernel
System Calls

 Interface for user programs to request OS services


 Typically implemented as a trap
 Execution:
 User program initiates system call

 Hardware switches to kernel mode

 OS executes system call service routine

 OS returns control to user program (in user mode)


Timer

 Ensures OS maintains control over CPU


 Can be set to interrupt after a specified period
 Implementation:
 Fixed-rate clock

 Counter set by OS

 Prevents user programs from running indefinitely


Timer Usage

 OS sets timer before giving control to user program


 Timer interrupt transfers control back to OS
 Privileged instructions protect timer settings
 Can be used to limit program execution time
 Counter initialized with time limit

 Decremented at regular intervals

 Program terminated if counter becomes negative


System Calls in Operating Systems
What are System Calls?

 Interface to services provided by the operating


system
 Generally available as routines in C and C++
 Some low-level tasks may require assembly language
Purpose of System Calls

 Allow programs to interact with the operating system


 Provide access to hardware resources
 Manage files, processes, and memory
Example: File Copy Program

 Get input and output file names


 Open input file, create output file
 Read from input, write to output
 Handle errors and close files
System Call Usage

 Even simple programs may use many system calls


 Thousands of system calls can be executed per
second
 Most programmers work with APIs instead of direct
system calls
Application Programming Interface (API)

 Specifies functions available to programmers


 Common APIs: Windows API, POSIX API, Java API
 APIs typically invoke actual system calls behind the
scenes
 Benefits of Using APIs
 Improved program portability
 Easier to use than direct system calls
 Abstracts complex details of system interactions
System Call Interface

 Links API functions to actual system calls


 Maintains a table of system call numbers
 Invokes appropriate system call in the kernel
Parameter Passing to System Calls

 Through registers
 Storing in a memory block and passing the address
 Pushing onto the stack
Types of System Calls

 Process Control
 end, abort
 load, execute
 create process, terminate process
 get process attributes, set process attributes
 wait for time
 wait event, signal event
 allocate and free memory
 File management
 create file, delete file
 open, close
 read, write, reposition
 get file attributes, set file attributes
Contd…

 Device management
 request device, release device

 read, write, reposition

 get device attributes, set device attributes

 logically attach or detach devices

 Information maintenance
 get time or date, set time or date

 get system data, set system data

 get process, file, or device attributes

 set process, file, or device attributes


Contd…

 Communications
 create, delete communication connection

 send, receive messages

 transfer status information

 attach or detach remote devices


System Programs in Operating Systems
What are System Programs?

 Also known as system utilities


 Provide a convenient environment for program
development and execution
 Range from simple user interfaces to system calls to
complex utilities
Categories of System Programs

 File Management
 Create, delete, copy, rename, print, dump, list files and directories
 Manipulate file system structures
 Status Information
 Display date, time, available memory, disk space, number of users
 Provide performance, logging, and debugging information
 May use a registry for configuration information
 File Modification
 Text editors for creating and modifying file contents
 Search commands and text transformation tools
 Programming-Language Support
 Compilers, assemblers, debuggers, interpreters
 Support for common languages (C, C++, Java, PERL)
Contd…

 Program Loading and Execution


 Absolute and relocatable loaders
 Linkage editors and overlay loaders
 Debugging systems for various language levels
 Communications
 Create virtual connections among processes, users, and systems
 Enable message sending, web browsing, email, remote login, file
transfer
 Background Services
 Also known as services, subsystems, or daemons
 Launch at boot time, some run continuously
 Examples: network daemons, process schedulers, error monitoring
services
Additional System Components

 Application Programs
 Web browsers, word processors, spreadsheets, databases

 Compilers, plotting and statistical analysis packages, games

 User Interface
 Defined by application and system programs

 Can vary greatly (e.g., GUI vs. command-line interface)

 Same system calls may look and act differently in different


interfaces
Multiple Operating Systems

 Dual-booting allows multiple OSes on the same


hardware
 Provides different interfaces and application sets
 Uses the same physical resources
Operating System Generation
Background

 Definition: Process of configuring an OS for specific


hardware
 Also known as SYSGEN (System Generation)
 Typically uses a special SYSGEN program
 OS usually distributed on disk, CD-ROM, DVD-
ROM, or as an ISO image
Information Required for SYSGEN

 CPU type and installed options


 Boot disk formatting and partitioning
 Available memory
 Available devices and their specifications
 Desired OS options and parameter values
Methods of System Generation

 Source Code Modification:


 Modify OS source code
 Compile the entire OS
 Tailored but time-consuming
 Module Selection:
 Create tables and select pre-compiled modules
 Link selected modules
 Faster, but may be overly general
 Table-Driven Approach:
 All code included in the system
 Selection occurs at runtime
 Only requires creating appropriate tables
Factors to Consider in SYSGEN Approach

 Size of the generated system


 Generality of the system
 Ease of modification for hardware changes
 Frequency of hardware configuration changes
 Trade-off between tailoring and modification ease
SYSGEN Process Steps

 Gather system information (manually or


automatically)
 Choose SYSGEN approach
 Configure or generate the OS
 Test and verify the generated system
 Install on the target machine
System Boot
Background

 Definition: Process of starting a computer by loading


the kernel
 Also known as "booting the system"
 Initiated by a bootstrap program or bootstrap loader
Bootstrap Program

 Small piece of code that locates and loads the kernel


 Stored in Read-Only Memory (ROM)
 Benefits of ROM:
 No initialization needed

 Difficult to infect with viruses

 Some systems use a two-step process:


 Simple loader fetches complex boot program

 Complex program then loads the kernel


Bootstrap Program Functions

 Run system diagnostics


 Initialize system components:
 CPU registers

 Device controllers

 Main memory contents

 Start the operating system


OS Storage Methods

 Entire OS in ROM:
 Suitable for small OS and simple hardware

 Challenging to update

 Used in phones, tablets, game consoles

 OS on disk, bootstrap in firmware:


 Used for larger, frequently changing OS

 Allows easier updates

 Examples: Windows, Mac OS X, UNIX

 OS initially in firmware, copied to RAM:


 Combines stability with execution speed
Boot Process for Disk-Based OS

 Bootstrap loads from firmware


 Runs diagnostics
 Reads boot block from disk
 Loads full bootstrap program
 Locates OS kernel on disk
 Loads kernel into memory
 Starts kernel execution
Key Concepts and Terms

 Firmware: Code stored in ROM or EPROM


 Boot disk/System disk: Disk with a boot partition
 GRUB: Example of an open-source bootstrap for
Linux
 Boot block: Fixed disk location containing initial
loader code
Thank You

You might also like