0% found this document useful (0 votes)
34 views39 pages

Chapter 1

The document discusses operating systems and their key concepts. It defines what an operating system is, its goals and components. It describes the roles of hardware, operating system, application programs and users. It also explains concepts like system boot, interrupts, context switching and different types of operating systems.

Uploaded by

armaan khan
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)
34 views39 pages

Chapter 1

The document discusses operating systems and their key concepts. It defines what an operating system is, its goals and components. It describes the roles of hardware, operating system, application programs and users. It also explains concepts like system boot, interrupts, context switching and different types of operating systems.

Uploaded by

armaan khan
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
You are on page 1/ 39

Chapter 1

INTRODUCTION
What is an Operating System?
 A program that acts as an intermediary between a computer user and the
computer hardware
 High level interface between user and machine

 Operating system goals:


 Execute users programs
 Make the computer system (i.e., hardware) convenient and efficient to use
Computer System Structure
 Computer system can be divided into four components:
 Hardware
 Provides the basic computing resources for the system
– CPU, memory, I/O devices
 Operating system
 Controls the hardware and coordinates its use among the various
applications programs for the various users
 Application programs
 Define the ways in which the system resources are used to solve users
computing problems
– Word processors, compilers, web browsers, database systems, video
games
 Users
 People, machines, other computers
Four Components of a Computer System
Operating System (OS) Definition
 OS is a resource allocator
 Manages all resources
 Decides between conflicting requests for efficient and fair resource utilization

 OS is a control program
 Controls the execution of the programs to prevent errors and improper use of the
computer

 “The one program running at all times on the computer” is the kernel. Everything
else is either a system program or an application program.
System Boot
 Bootstrap program is loaded at power-up or reboot
 Typically stored in ROM or EEPROM, generally known as firmware
 Initializes all aspects of system
 Locates and loads operating system kernel into memory and starts execution
 Sometimes two-step process where boot block at fixed location loaded by ROM
code, which loads bootstrap loader from disk

 Kernel loads and system is then running


Computer System Organization
 Computer-system operation
 One or more CPUs and device controllers connected through common bus
providing access to the shared memory
 Concurrent execution of CPUs and devices competing for memory access
Computer-System Operation

 I/O devices and the CPU can execute concurrently


 Each device controller is in-charge of a particular device type
 Each device controller has a local buffer
 CPU moves data from/to main memory to/from local buffers
 I/O is from the device to local buffer of controller
 Device controller informs CPU that it has finished its operation by causing an interrupt
Interrupt Handling
 An Interrupt is an event that alters the sequence in which the processor executes instructions.
 On occurrence of an interrupt, the processor finishes the execution of the current instruction
before responding to the interrupt.
 The operating system preserves the state of the CPU and the interrupted process by saving
the address of the interrupted instruction using storing registers and the program counter.
 The OS analyses the type of interrupt and passes the control to the appropriate interrupt
handling routine which handles the interrupt.
 Separate segments of code determines necessary action for each type of interrupt
 e.g. on completion of an I/O operation, the device issue an interrupt signal to the CPU.
 A trap is a software-generated interrupt caused either by an error or a user request
 Interrupt transfers control to the interrupt service routine generally, through the interrupt
vector, which contains the addresses of all the service routines
 After servicing the interrupt, the state of the interrupted process is restored.
 The interrupted process is then executed.

 An operating system is interrupt driven


Interrupt Handling
 While executing a process, an interrupt triggers.
 It is handled by the IHR.
 The process starts its execution again.

 However what will happen if while handling an interrupt, another interrupt triggers?

 It can be handled using two approaches


 Sequential approach
 Nested approach
Sequential Interrupt Handling
Nested Interrupt Handling
Context switching
 A context switch is the computing process of storing and restoring the state (context)
of a CPU so that execution can be resumed from the same point at a later time.

 This enables multiple processes to share a single CPU.

 The context switch is an essential feature of a multitasking operating system.

 Context switches are usually computationally intensive and much of the design of
operating systems is to optimize the use of context switches
Operating-System Operations
 Interrupt driven by hardware
 Software error or request creates exception or trap
 Division by zero, request for operating system service
 Other process problems include infinite loop, processes modifying each other or the
operating system
 Dual-mode operation allows OS to protect itself and other system components
 User mode and Kernel mode
 Mode bit provided by hardware
 Provides ability to distinguish when system is running user code or kernel code
 Some instructions designated as privileged, only executable in kernel mode
– System call changes mode to kernel, return from call resets it to user
Transition from User to Kernel Mode
 Timer to prevent infinite loop / process hogging resources
 Timer is set to interrupt the computer after some time period
 Keep a counter that is decremented by the physical clock.
 Operating system set the counter (privileged instruction)
 When counter zero generate an interrupt
 Set up before scheduling process to regain control or terminate program that
exceeds allotted time
I/O Structure
 After I/O starts, control returns to user program only upon I/O completion
 Wait instruction idles the CPU until the next interrupt
 Wait loop (contention for memory access)
 At most one I/O request is outstanding at a time, no simultaneous I/O
processing
 After I/O starts, control returns to user program without waiting for I/O
completion
 System call – request to the OS to allow user to wait for I/O completion
 Device-status table contains entry for each I/O device indicating its type,
address, and state
 OS indexes into I/O device table to determine device status and to modify
table entry to include interrupt
Evolution of Operating Systems

 Early Systems (1950)


 Simple Batch Systems (1960)
 Multi-programmed Batch Systems (1970)
 Time-Sharing and Real-Time Systems (1970)
 Personal/Desktop Systems (1980)
 Multiprocessor Systems (1980)
 Networked/Distributed Systems (1980)
 Handheld (1990)
Available operating systems in the market
Types of Operating Systems
 Within the broad family of operating systems, following are few well known OS’s
 Real time Operating System (RTOS)
 Single User, single task OS
 Single User, Multitasking OS
 Multiuser OS
 Distributed OS
 Embedded OS
 Mobile OS
 Batch OS.
RTOS
 RTOS are used to control machinery, scientific instruments and industrial systems

 The main objective of real-time operating systems is their quick and predictable
response to events.

 It is a multitasking operating system.

 An RTOS typically has very little user-interface capability, and no end-user


utilities, since the system will be a "sealed box" when delivered for use (e. g.,
HDTV receiver and display)
Single User, Single Task
 This type of operating systems are designed to manage the computer so that one user
can effectively do one thing at a time.

 The Palm OS for Palm handheld computers is a good example of a modern


single-user, single-task operating system (e.g., PDA and MS-DOS)
Single User, Multitask

 This type of operating systems are mostly used in desktop or/and laptop computers
today.
 Microsoft's Windows and Apple's Mac OS platforms are both examples of
operating systems that will let a single user have several programs in operation at
the same time.
Multi-user OS

 A multi-user operating system allows many different users to use computer's resources
simultaneously.

 Various users should be balanced, and that each of the programs they are
using/executing has sufficient and separate resources.

 For example Unix, VMS and mainframe operating systems, are examples of multi-user
operating systems.
Mobile OS

 A mobile OS controls a mobile device and its design to supports wireless


communication and mobile applications.

 It has built-in support for mobile multimedia formats. Tablet PCs and smart
phones run on mobile operating systems.
Computer-System Architecture
 Most systems contain a single general-purpose processor
 Few systems contain special-purpose processors as well

 Multiprocessors systems growing in use and importance


 Also known as parallel systems, tightly-coupled systems
 Advantages include:
1. Increased throughput- more work done in less time
 Speed up ratio with N processor is not N
 Overhead of keep all component working correctly
 Contention for shared resources
2. Economy of scale
3. Increased reliability – graceful degradation or fault tolerance
 The ability of a system to maintain limited functionality even when a large
portion of it has been destroyed or rendered inoperative
Computer-System Architecture
 Multiprocessor systems are of two types:
1. Asymmetric Multiprocessing– each processor assigned a specific task
 Master-slave relationship
 The tasks are strictly divided by their types on processors
 Typically, each processor has its own memory address space
 These features make asymmetric multiprocessing difficult to implement.
2. Symmetric Multiprocessing (SMP)– each processor performs all tasks within
the OS or they can do anything the others can.
 All processor are peers
 Contain own set of registers and private or local caches
 Shared physical memory

Asymmetric multiprocessing; one processor doing all I/O Symmetric multiprocessing


Computer-System Architecture
 Multiprocessor systems are of two types:
1. Asymmetric Multiprocessing– each processor assigned a specific task
 Master-slave relationship
 The tasks are strictly divided by their types on processors
 Typically, each processor has its own memory address space
 These features make asymmetric multiprocessing difficult to implement.
2. Symmetric Multiprocessing (SMP)– each processor performs all tasks within
the OS or they can do anything the others can.
 All processor are peers
 Contain own set of registers and private or local caches
 Shared physical memory

Asymmetric multiprocessing; one processor doing all I/O Symmetric multiprocessing


A Dual-Core Design
 Cores- Multiprocessor chips
 on-chip communication is faster
 well suited for server (i.e., database, Web servers)
 Multicore CPUs appear to the operating system as N standard processors

A dual-core design with two cores places on the same chip


Clustered Systems
 Another type of multiple-CPU system is clustered system
 Usually sharing storage via a storage-area network (SAN)
 Provides a high-availability service which survives failures
 Asymmetric clustering; One machine in hot-standby mode while the other is
running the applications
 Symmetric clustering; multiple machines are running the applications as well as
monitoring each other
 Some clusters are for high-performance computing (HPC)
 Applications must be written to use parallelization

General structure of a clustered system


Computing Environments - Traditional

 Stand-alone general purpose machines


 But blurred as most systems interconnect with others (i.e., the Internet)
 Portals provide web access to internal systems
 Network computers (thin clients) are like Web terminals
 Mobile computers interconnect via wireless networks
 Networking becoming ubiquitous – even home systems use firewalls to protect
home computers from Internet attacks
Computing Environments – Distributed

 Distributed computing
 Collection of separate, possibly heterogeneous, systems networked together
 Network is a communications path, TCP/IP most common
– Local Area Network (LAN)
– Wide Area Network (WAN)
– Metropolitan Area Network (MAN)
– Personal Area Network (PAN)
 Network Operating System provides features between systems across network
 Communication scheme allows systems to exchange messages
 Illusion of a single system
Computing Environments – Client-Server

 Client-Server Computing
 Dumb terminals supplanted by smart PCs
 Many systems now servers, responding to requests generated by clients
 Compute-server system provides an interface to client to request services
(i.e., database)
 File-server system provides interface for clients to store and retrieve files
Computing Environments - Peer-to-Peer

 Another model of distributed system


 P2P does not distinguish clients and servers
 Instead all nodes are considered peers
 May each act as client, server or both
 Node must join P2P network
 Registers its service with central lookup
service on network, or
 Broadcast request for service and respond
to requests for service via discovery
protocol
 Examples include Napster and Gnutella,
Voice over IP (VoIP) such as Skype
Computing Environments - Virtualization

 Allows operating systems to run applications within other OSes


 Vast and growing industry
 Emulation used when source CPU type different from target type (i.e. PowerPC to
Intel x86)
 Generally slowest method
 When computer language not compiled to native code – Interpretation
 Virtualization – OS natively compiled for CPU, running guest OSes also natively
compiled
 Consider VMware running WinXP guests, each running applications, all on native
WinXP host OS
 VMM (virtual machine Manager) provides virtualization services
Computing Environments - Virtualization
 Use cases involve laptops and desktops running multiple OSes for exploration or
compatibility
 Apple laptop running Mac OS X host, Windows as a guest
 Developing apps for multiple OSes without having multiple systems
 QA testing applications without having multiple systems
 Executing and managing compute environments within data centers
 VMM can run natively, in which case they are also the host
 There is no general purpose host then (VMware ESX and Citrix XenServer)
Computing Environments – Cloud Computing

 Delivers computing, storage, even apps as a service across a network


 Logical extension of virtualization because it uses virtualization as the base for it
functionality.
 Amazon EC2 has thousands of servers, millions of virtual machines, petabytes of
storage available across the Internet, pay based on usage
 Many types
 Public cloud – available via Internet to anyone willing to pay
 Private cloud – run by a company for the company’s own use
 Hybrid cloud – includes both public and private cloud components
 Software as a Service (SaaS) – one or more applications available via the Internet
(i.e., word processor)
 Platform as a Service (PaaS) – software stack ready for application use via the
Internet (i.e., a database server)
 Infrastructure as a Service (IaaS) – servers or storage available over Internet (i.e.,
storage available for backup use)
Computing Environments – Cloud Computing

 Cloud computing environments composed of traditional OSes, plus


VMMs, plus cloud management tools
 Internet connectivity requires security like firewalls
 Load balancers spread traffic across multiple applications
Comparison
 Multiprogramming
 There is only one processor
 More than one user
 It is the function of OS to share CPU time among all the users equally
 Example: A computer running Excel and Firefox simultaneously

 Multiprocessing
 Multiprocessing is the use of two or more CPUs within a single computer system
 Symmetric and asymmetric multiprocessing
 Multitasking
 There is only one processor and one user.
 User can activate more than one program/task at a time.
 OS schedule multiple jobs for their fair share processing.
 Multithreading
 Execute different parts of a program called threads at the same time
 Threads: The light wait processes which are independent part of a process or program.
Comparison

Memory layout for Multiprogramming Multi-processing System Multi-tasking System


System

Multithreading System

You might also like