0% found this document useful (0 votes)
3 views

Introduction to Operating Systems

The document provides an overview of operating systems, detailing their structure, organization, and functions. It discusses the components of computer systems, the role of interrupts, and various architectures of operating systems, including monolithic and microkernel designs. Additionally, it covers operating system services, resource management, and the distinction between single-user and multi-user systems.
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)
3 views

Introduction to Operating Systems

The document provides an overview of operating systems, detailing their structure, organization, and functions. It discusses the components of computer systems, the role of interrupts, and various architectures of operating systems, including monolithic and microkernel designs. Additionally, it covers operating system services, resource management, and the distinction between single-user and multi-user systems.
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/ 74

Introduction to Operating

Systems
Overview of computer systems and operating system

G. Asante
Outline

• Computer-System Structure
• Computer-System Organization
• Computer-System Operation
• Interrupts
• Storage structure
• Computer-System Architecture
• Concept of O/S
• O/S goals, Structures, operations, functions, types, components, services.
• System calls
• Virtual machines
Objectives
• Describe the general organization of a computer system and the role
of interrupts
• Describe the components in a modern, multiprocessor computer
system
• Illustrate the transition from user mode to kernel mode
• Discuss how operating systems are used in various computing
environments
• Provide examples of free and open-source operating systems
Computer System Structure
• Computer system can be divided into four components:
• Hardware – provides basic computing resources
• CPU, memory, I/O devices
• Operating system
• Controls and coordinates use of hardware among various applications and users
• Application programs – define the ways in which the system resources are
used to solve the computing problems of the users
• Word processors, compilers, web browsers, database systems, video games
• Users
• People, machines, other computers
Abstract View of Components of Computer System
Four Components of a Computer System
Basic Elements of Computer
Computer System Organization

• Computer-system operation
• One or more CPUs, device controllers connect through common
bus providing access to shared memory
• Concurrent execution of CPUs and devices competing for
memory cycles
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
• Each device controller type has an operating system device driver to
manage it
• 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
Instruction execution

• Two parts:
• Processor reads (fetches)
• Processor executes
Instruction execution
• Instruction Execution actions fall into four categories:
• Processor – Memory
• Processor – I/O
• Data Processing
• Control

• Note: An instruction’s execution may involve a combination of these actions.


Interrupt
• Other modules (I/O, memory) may interrupt the normal processing of
the processor.
• Interrupt improves the utilization of the CPU
Interrupt Handling
• The operating system preserves the state of the CPU by storing
registers and the program counter
• Determines which type of interrupt has occurred:
• polling
• vectored interrupt system
• Separate segments of code determine what action should be taken
for each type of interrupt
Interrupt-drive I/O Cycle
Interrupt Timeline
Storage Structure
• Main memory – only large storage media that the CPU can access directly
• Random access
• Typically volatile
• Typically random-access memory in the form of Dynamic Random-access Memory (DRAM)
• Secondary storage – extension of main memory that provides large
nonvolatile storage capacity
• Hard Disk Drives (HDD) – rigid metal or glass platters covered with
magnetic recording material
• Disk surface is logically divided into tracks, which are subdivided into sectors
• The disk controller determines the logical interaction between the device and the computer

• Non-volatile memory (NVM) devices– faster than hard disks, nonvolatile


• Various technologies
• Becoming more popular as capacity and performance increases, price drops
Storage Hierarchy
• Storage systems organized in hierarchy
• Speed
• Cost
• Volatility
• Caching – copying information into faster storage system; main
memory can be viewed as a cache for secondary storage
• Device Driver for each device controller to manage I/O
• Provides uniform interface between controller and kernel
Storage-Media Hierarchy
Computer-System Architecture
• Most systems use a single general-purpose processor
• Most systems have 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
2. Economy of scale
3. Increased reliability – graceful degradation or fault tolerance
• Two types:
1. Asymmetric Multiprocessing – each processor is assigned a special task.
2. Symmetric Multiprocessing – each processor performs all tasks
Symmetric Multiprocessing Architecture
A Dual-Core Design
• Multi-chip and multicore
• Systems containing all chips
• Chassis containing multiple separate systems
Non-Uniform Memory Access System
Clustered Systems
• Like multiprocessor systems, but multiple systems working together
• Usually sharing storage via a storage-area network (SAN)
• Provides a high-availability service which survives failures
• Asymmetric clustering has one machine in hot-standby mode
• Symmetric clustering has multiple nodes running applications, monitoring each other
• Some clusters are for high-performance computing (HPC)
• Applications must be written to use parallelization
• Some have distributed lock manager (DLM) to avoid conflicting operations
Clustered Systems
Operating System
• An OS is a program which acts as an intermediary between computer
system users and the computer hardware.
• It provides a user-friendly environment in which a user may easily
develop and execute programs.
• Otherwise, hardware knowledge would be mandatory for computer
programming.
• So, it can be said that an OS hides the complexity of hardware from
uninterested users.
Operating System
• In general, a computer system has some resources which may be
utilized to solve a problem. They are
• Memory
• Processor(s)
• I/O
• File System
• etc.
Operating System
The OS manages these resources and allocates them to specific
programs and users.
With the management of the OS, a programmer is rid of difficult
hardware considerations.
 An OS provides services for
 Processor Management
 Memory Management
 File Management
 Device Management
 Concurrency Control
Operating System
• An Operating System (OS) can be defined as a set of computer
programs that manage the hardware and software resources of a
computer and allows the application programs to run.
• OS is a resource allocator
• Manages all resources
• Decides between conflicting requests for efficient and fair resource use
• OS is a control program
• Controls execution of programs to prevent errors and improper use of the
computer
Components of OS
• Kernel
• libraries
• Shell
Core Operating System Components
• User interaction with operating system
• Often, through special application called a shell
• Kernel
• Software that contains core components of operating system
• Typical operating system components include:
• Processor scheduler
• Memory manager
• I/O manager
• Interprocess communication (IPC) manager
• File system manager
Operating System Architectures
• Today’s operating systems tend to be complex
• Provide many services
• Support variety of hardware and software
• Operating system architectures help manage this complexity
• Organize operating system components
• Specify privilege with which each component executes
Monolithic Architecture
• Monolithic operating system
• Every component contained in kernel
• Any component can directly communicate with any other
• Tend to be highly efficient
• Disadvantage is difficulty determining source of subtle errors
Monolithic Architecture
Layered Architecture
• Layered approach to operating systems
• Tries to improve on monolithic kernel designs
• Groups components that perform similar functions into layers
• Each layer communicates only with layers immediately above and below it
• Processes’ requests might pass through many layers before completion
• System throughput can be less than monolithic kernels
• Additional methods must be invoked to pass data and control
Layered Architecture
Layered Approach
• The operating system is divided into a number of layers (levels), each
built on top of lower layers. The bottom layer (layer 0), is the
hardware; the highest (layer N) is the user interface.
• With modularity, layers are selected such that each uses functions
(operations) and services of only lower-level layers
Microkernel Architecture
• Microkernel operating system architecture
• Provides only small number of services
• Attempt to keep kernel small and scalable
• High degree of modularity
• Extensible, portable and scalable
• Increased level of intermodule communication
• Can degrade system performance
Microkernel Architecture
Microkernel System Structure
Modes of Operation

User Mode Kernel Mode


• user program executes in user • monitor executes in kernel
mode mode
• certain areas of memory are • privileged instructions may be
protected from user access executed
• certain instructions may not be • protected areas of memory may
executed be accessed
Dual-mode and Multimode Operation
• 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
• Increasingly CPUs support multi-mode operations
• i.e. virtual machine manager (VMM) mode for guest VMs
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 gets to zero, generate an interrupt
• Set up before scheduling process to regain control or terminate program that
exceeds allotted time
What an Operating System Does
• Depends on the point of view
• Users want convenience, ease of use and good performance
• Don’t care about resource utilization
• But shared computer such as mainframe or minicomputer must keep all users happy
• Operating system is a resource allocator and control program making efficient use of HW and
managing execution of user programs
• Users of dedicate systems such as workstations have dedicated resources but frequently
use shared resources from servers
• Mobile devices like smartphones and tables are resource poor, optimized for usability
and battery life
• Mobile user interfaces such as touch screens, voice recognition
• Some computers have little or no user interface, such as embedded computers in devices
and automobiles
• Run primarily without user intervention
What an Operating System Does
• Four functions common to all operating systems
• Providing a user interface
• Managing files
• Managing applications
• Managing hardware
Multiprogramming and Multitasking

• Multiprogramming (Batch system) needed for efficiency


• Single user cannot keep CPU and I/O devices busy at all times
• Multiprogramming organizes jobs (code and data) so CPU always has one to execute
• A subset of total jobs in system is kept in memory
• One job selected and run via job scheduling
• When it has to wait (for I/O for example), OS switches to another job

• Timesharing (multitasking) is logical extension in which CPU switches jobs so frequently that users can interact
with each job while it is running, creating interactive computing
• Response time should be < 1 second
• Each user has at least one program executing in memory process
• If several jobs ready to run at the same time  CPU scheduling
• If processes don’t fit in memory, swapping moves them in and out to run
• Virtual memory allows execution of processes not completely in memory
Uniprogramming

• The processor spends a certain amount of time executing, until it


reaches an I/O instruction; it must then wait until that I/O
instruction concludes before proceeding
Multiprogramming
• There must be enough memory to hold the OS (resident monitor) and one user program
• When one job needs to wait for I/O, the processor can switch to the other job, which is likely not waiting for
I/O
Multiprogramming
• Multiprogramming
• memory is expanded to hold three, four, or more
programs and switch among all of them
Multiprogramming Example
Operating System Services
• Program development
• Program execution
• Access I/O devices
• Controlled access to files
• System access
• Error detection and response
• Accounting
• Security
• protection
A View of Operating System Services
Program development
• The OS provides a variety of facilities and services, such as editors
and debuggers, to assist the programmer in creating programs.
• Typically, these services are in the form of utility programs that, while
not strictly part of the core of the OS, are supplied with the OS and
are referred to as application program development tools.
Program execution

• A number of steps need to be performed to execute a program.


Instructions and data must be loaded into main memory, I/O devices
and files must be initialized, and other resources must be prepared.
The OS handles these scheduling duties for the user.
Access to I/O devices
• Each I/O device requires its own peculiar set of instructions or
control signals for operation. The OS provides a uniform interface that
hides these details so that programmers can access such devices
using simple reads and writes.
Controlled access to files
• For file access, the OS must reflect a detailed understanding of not
only the nature of the I/O device (disk drive, tape drive) but also the
structure of the data contained in the files on the storage medium.
• In the case of a system with multiple users, the OS may provide
protection mechanisms to control access to the files.
System access
• For shared or public systems, the OS controls access to the system as
a whole and to specific system resources. The access function must
provide protection of resources and data from unauthorized users
and must resolve conflicts for resource contention.
Error detection and response
• A variety of errors can occur while a computer system is running. These include
internal and external hardware errors, such as a memory error, or a device failure
or malfunction; and various software errors, such as division by zero, attempt to
access forbidden memory location, and inability of the OS to grant the request of
an application. In each case, the OS must provide a response that clears the error
condition with the least impact on running applications. The response may range
from ending the program that caused the error, to retrying the operation, to
simply reporting the error to the application.
Accounting

• A good OS will collect usage statistics for various resources and


monitor performance parameters such as response time. On any
system, this information is useful in anticipating the need for future
enhancements and in tuning the system to improve performance. On
a multiuser system, the information can be used for billing purposes.
Operating System Services (Cont.)
• Another set of OS functions exists for ensuring the efficient operation of the system itself
via resource sharing
• Resource allocation - When multiple users or multiple jobs running concurrently,
resources must be allocated to each of them
• Many types of resources - CPU cycles, main memory, file storage, I/O devices.
• Logging - To keep track of which users use how much and what kinds of computer
resources
• Protection and security - The owners of information stored in a multiuser or
networked computer system may want to control use of that information, concurrent
processes should not interfere with each other
• Protection involves ensuring that all access to system resources is controlled
• Security of the system from outsiders requires user authentication, extends to
defending external I/O devices from invalid access attempts
• File-system manipulation - The file system is of particular interest.
Programs need to read and write files and directories, create and
delete them, search them, list file Information, permission
management.
• Communications – Processes may exchange information, on the
same computer or between computers over a network
• Communications may be via shared memory or through
message passing (packets moved by the OS)
Functions of the O/S
• An operating system must be able
to perform the following
functions, amongst others:
• Scheduling
• Job scheduling
• Memory management
• Job control language
interpretation • Resource control
• Error handling • Protection
• Input/Output (I/O) handling • Inter process communication
• Interrupt handling
Types of Modern operating system
• Single-user operating system eg. DOS, windows 3.1 etc
• Multi-user operating system eg UNIX
• Single-tasking operating system eg. DOS
• Multi-tasking operating system eg. Windows XP, windows 7 etc
• Stand-alone operating system eg Windows XP, windows 7 etc
• Network operating system eg windows 2003 server. Novel Netware,
UNIX , Linux etc.
• Real-time operating system
• Embedded operating system
System Call
• System calls: The mechanism used by an application program to
request service from the operating system. System calls often use a
special machine code instruction which causes the processor to
change mode (e.g. to "supervisor mode" or "protected mode"). This
allows the OS to perform restricted actions such as accessing
hardware devices or the memory management unit.
From The Free Online Dictionary of Computing
(http://foldoc.doc.ic.ac.uk/) is edited by Denis Howe
<dbh@doc.ic.ac.uk>.
System Calls
• Programming interface to the services provided by the OS
• Typically written in a high-level language (C or C++)
• Mostly accessed by programs via a high-level Application
Programming Interface (API) rather than direct system call use
• Three most common APIs are Win32 API for Windows, POSIX API for
POSIX-based systems (including virtually all versions of UNIX, Linux,
and Mac OS X), and Java API for the Java virtual machine (JVM)
Example of System Calls
• System call sequence to copy the contents of one file to
another file
System Call Implementation
• Typically, a number associated with each system call
• System-call interface maintains a table indexed according to these numbers
• The system call interface invokes the intended system call in OS
kernel and returns status of the system call and any return values
• The caller need know nothing about how the system call is
implemented
• Just needs to obey API and understand what OS will do as a result call
• Most details of OS interface hidden from programmer by API
• Managed by run-time support library (set of functions built into libraries included with
compiler)
API – System Call – OS Relationship
Virtual Machine
• A Virtual Machine is a software that creates a virtualized
environment between the computer platform and the end user in
which the end user can operate software.
Description
• A virtual machine provides an interface identical to the underlying
bare hardware.
• The operating system creates the illusion of multiple processes, each
executing on its own processor with its own (virtual) memory.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy