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

Lecture 1

The document provides an overview of operating systems, detailing their role as intermediaries between users and hardware, and their function in managing system resources. It covers computer organization, including single and multiprocessor systems, and discusses key concepts such as interrupts, storage structures, and resource management. Additionally, it highlights the importance of operating systems in various computing environments and provides examples of free and open-source operating 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)
2 views89 pages

Lecture 1

The document provides an overview of operating systems, detailing their role as intermediaries between users and hardware, and their function in managing system resources. It covers computer organization, including single and multiprocessor systems, and discusses key concepts such as interrupts, storage structures, and resource management. Additionally, it highlights the importance of operating systems in various computing environments and provides examples of free and open-source operating 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

1

Operating Systems

CS2022: Operating Systems

Introduction to Operating Systems


Sandali Goonatilleke
Department of Computer Engineering
General Sir John Kotelawala Defence University
Lecture Objectives
• Describe the general organization of a computer
system
• 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

1/16/2023 Operating Systems 2


What is an Operating System?

1/16/2023 Operating Systems 3


What is an Operating System (OS)?
In simple words…
A software that manages a computer’s hardware

Provides a basis for application programs and acts as an


intermediary between the computer user and the
computer hardware

1/16/2023 Operating Systems 4


What is an Operating System (OS)?
Definition:

Operating system is a program that controls the


execution of application programs and acts as an
interface between the user of a computer and the
computer hardware

1/16/2023 Operating Systems 5


What Operating System Do?
Let’s begin with the computer system…

A computer system can be divided roughly into four


components;
➢ Hardware
➢ Operating system
➢ Application programs
➢ User

1/16/2023 Operating Systems 6


What Operating System Do?
• Hardware: provides the basic computing resources
(Central Processing Unit (CPU), memory, input/output
(I/O) devices)
• The application programs: Define the ways in which
these resources are used to solve users’ computing
problems (word processors, spreadsheets, compilers,
and web browsers
• Operating System (OS): Controls the hardware and
coordinates its use among the various application
programs for the various users

1/16/2023 Operating Systems 7


What Operating System Do?

Figure 1: Abstract view of the components of a computer system

1/16/2023 Operating Systems 8


Role of the Operating System
The role of the operating system can be understand from
two viewpoints;
• User view
• System view

1/16/2023 Operating Systems 9


Role of the Operating System
Users View
❑ The operating system is designed mostly for ease of
use, with some attention paid to performance and
security and none paid to resource utilization

System View
❑ The operating system is view as a resource allocator
❑ A computer system has many resources and the
operating system acts as the manager of these
resources

1/16/2023 Operating Systems 10


Computer System Organization
• A modern general-purpose computer system contains
one or more CPUs and a number of device controller

• They are connected through a common bus that


provides access between components and shared
memory

• Each device controller is in charge of a specific type of


device (for example, a disk drive, audio device, or
graphics display)

1/16/2023 Operating Systems 11


Computer System Organization

Figure: Typical PC System

1/16/2023 Operating Systems 12


Computer System Organization (Cont’d)
• Depending on the controller, more than one device
may be attached

• A device controller maintains some local buffer storage


and a set of special-purpose registers

• The device controller is responsible for moving the


data between the peripheral devices that it controls
and its local buffer storage

1/16/2023 Operating Systems 13


Computer System Organization (Cont’d)
• Typically, operating systems have a device driver for
each device controller

• This device driver understands the device controller


and provides the rest of the operating system with a
uniform interface to the device

1/16/2023 Operating Systems 14


Computer System Organization (Cont’d)
Interrupts

What is an interrupt?

1/16/2023 Operating Systems 15


Computer System Organization (Cont’d)
Interrupts
❖ Consider a typical computer operation: a program
performing I/O

• The device driver loads the appropriate registers in the


device controller

• The device controller, in turn, examines the contents of


these registers to determine what action to take (such
as “read a character from the keyboard”)

1/16/2023 Operating Systems 16


Computer System Organization (Cont’d)
Interrupts

• The controller starts the transfer of data from the


device to its local buffer

• Once the transfer of data is complete, the device


controller informs the device driver that it has finished
its operation

1/16/2023 Operating Systems 17


Computer System Organization (Cont’d)
Interrupts

• The device driver then gives control to other parts of


the operating system, possibly returning the data or a
pointer to the data if the operation was a read

• For other operations, the device driver returns status


information such as “write completed successfully” or
“device busy”

1/16/2023 Operating Systems 18


Computer System Organization (Cont’d)
Interrupts

But how does the controller inform the device driver


that it has finished its operation?

This is accomplished via an interrupt

1/16/2023 Operating Systems 19


Computer System Organization (Cont’d)
Interrupts

Exercise 1: Explore about basic interrupt mechanism and


briefly describe it using your own words

1/16/2023 Operating Systems 20


Storage Structure
• The CPU can load instructions only from memory and
programs must first be loaded into memory to run

• General-purpose computers run most of their


programs from rewritable memory or main memory
(also called random-access memory, or RAM)

• Computers use other forms of memory as well

1/16/2023 Operating Systems 21


Storage Structure (Cont’d)
• Also, the computer uses electrically erasable
programmable read-only memory (EEPROM) and other
forms of firmware

• All the programs and data need to reside in main


memory permanently

1/16/2023 Operating Systems 22


Storage Structure (Cont’d)
• This arrangement usually is not possible on most
systems for two reasons:

i. Main memory is usually too small to store all needed


programs and data permanently
ii. Main memory is volatile—it loses its contents when
power is turned off or otherwise lost

1/16/2023 Operating Systems 23


Storage Structure (Cont’d)
• Most computer systems provide secondary storage as
an extension of main memory

• Main requirement: Hold large quantities of data


permanently

• Hard-disk drives (HDDs) and nonvolatile memory


(NVM) devices are most common secondary storage
devices

1/16/2023 Operating Systems 24


Storage Structure (Cont’d)
• Most programs are stored in secondary storage until
they are loaded into memory

• Many programs then use secondary storage as both


the source and the destination of their processing

• Secondary storage is also much slower than main


memory

1/16/2023 Operating Systems 25


Storage Structure (Cont’d)
• Tertiary storage is used to store backup copies of
material stored on other devices

• The main differences among the various storage


systems lie in speed, size, and volatility

1/16/2023 Operating Systems 26


Storage Structure (Cont’d)

1/16/2023 Operating Systems 27


Storage Structure (Cont’d)
Exercise 2: Explain the characteristics of the storage
structure using a diagram

1/16/2023 Operating Systems 28


Computer System Architecture
Single Processor Systems

• Many years ago, most computer systems used a single


processor containing one CPU with a single processing
core
• The core is the component that executes instructions
and registers for storing data locally
• The one main CPU with its core is capable of executing
a general-purpose instruction set, including
instructions from processes

1/16/2023 Operating Systems 29


Computer System Architecture
Multiprocessor Systems

• Modern computers (from mobile devices to servers)


use multiprocessor systems
• They have two (or more) processors, each with a
single-core CPU
• The processors share the computer bus and
sometimes the clock, memory, and peripheral devices
• The primary advantage of multiprocessor systems is
increased throughput

1/16/2023 Operating Systems 30


Computer System Architecture
Multiprocessor Systems

• That is, by increasing the number of processors, we


expect to get more work done in less time
• The most common multiprocessor systems use
symmetric multiprocessing (SMP), in which each peer
CPU processor performs all tasks, including operating-
system functions and user processes
• The benefit of this model is that many processes can
run simultaneously

1/16/2023 Operating Systems 31


Computer System Architecture

Figure: Symmetric Multiprocessing Architecture

1/16/2023 Operating Systems 32


Computer System Architecture
Multiprocessor Systems

• Multiprocessor’s definition has evolved over time and


now includes multicore systems, in which multiple
computing cores reside on a single chip
• They are more efficient than multiple chips with
single cores because on-chip communication is faster
than between-chip communication
• one chip with multiple cores uses significantly less
power than multiple single-core chips

1/16/2023 Operating Systems 33


Computer System Architecture
What are the advantages of multi-core systems over
generic multi-processor systems?

1/16/2023 Operating Systems 34


Computer System Architecture

Figure: Dual Core Design with Two Cores on the Same Chip

1/16/2023 Operating Systems 35


Computer System Architecture
Clustered Systems
• Another type of multiprocessor system
• Gathers together multiple CPUs
• Differ from the multiprocessor systems
• They are composed of two or more individual systems
or nodes joined together
• Each node is typically a multicore system
• Clustering provide high-availability service (service
will continue even if one or more systems in the
cluster fail)

1/16/2023 Operating Systems 36


Computer System Architecture
Clustered Systems
• Another type of multiprocessor system
• Gathers together multiple CPUs
• Differ from the multiprocessor systems
• They are composed of two or more individual systems
or nodes joined together
• Each node is typically a multicore system
• Clustering provide high-availability service (service
will continue even if one or more systems in the
cluster fail)

1/16/2023 Operating Systems 37


Computer System Architecture
Clustered Systems
• Clustering can be structured asymmetrically or
symmetrically
• In asymmetric clustering, one machine is in hot-
standby mode while the other is running the
applications
• The hot-standby host machine does nothing but
monitor the active server
• If that server fails, the hot-standby host becomes the
active

1/16/2023 Operating Systems 38


Computer System Architecture
Clustered Systems
• In symmetric clustering, two or more hosts are
running applications and are monitoring each other
• This structure is obviously more efficient, as it uses all
of the available hardware
• However, it does require that more than one
application be available to run

1/16/2023 Operating Systems 39


Computer System Architecture
Clustered Systems
• Clusters are used to provide high-performance
computing environments
• Accordingly, cluster contains several computer systems
connected via a network
• They supply significantly greater computational power
than single-processor or even SMP systems
• Also achieve the technique known as parallelization
(divides a program into separate components that run
in parallel on individual cores in computers in a cluster

1/16/2023 Operating Systems 40


Computer System Architecture
Clustered Systems

Figure: General Structure of a Clustered System

1/16/2023 Operating Systems 41


Operating System Operations
• An operating system provides the environment within
which programs are executed
• When the computer is powered up or rebooted, it
needs to have an initial program to run
• This initial program, or bootstrap program, tends to be
simple
• Typically, it is stored within the computer hardware in
firmware

1/16/2023 Operating Systems 42


Operating System Operations
• The bootstrap program must know how to load the
operating system and how to start executing that
system
• To accomplish this goal, the bootstrap program must
locate the operating-system kernel and load it into
memory
• Once the kernel is loaded and executing, it starts
providing services to the system and its users

1/16/2023 Operating Systems 43


Operating System Operations
• Some services are provided outside of the kernel by
system programs
• These programs are loaded into memory at boot time
to become system daemons
• Once this phase is complete, the system is fully
booted, and the system waits for some event to occur
• If there are no processes to execute, no I/O devices to
service, and no users to whom to respond, an
operating system will sit quietly, waiting for something
to happen

1/16/2023 Operating Systems 44


Multiprogramming and Multitasking
Multiprogramming
• Multi-programming increases CPU utilization by
organizing jobs (code and data)
• Therefore, the CPU always has one program to execute
• The idea is to keep multiple jobs in main memory
• If one job gets occupied with IO, CPU can be assigned
to other job

1/16/2023 Operating Systems 45


Multiprogramming and Multitasking
Multitasking
• It is a logical extension of multiprogramming
• Multitasking is the ability of an OS to execute more
than one task simultaneously on the CPU
• These multiple tasks share common resources (like
CPU and memory)
• In multi-tasking systems, the CPU executes multiple
jobs by switching quickly among them using a small
time quantum, so that the users feel like interact with
each executing task at the same time

1/16/2023 Operating Systems 46


Multiprogramming and Multitasking
Exercise 3: Compare and contrast multiprogramming
and multitasking

1/16/2023 Operating Systems 47


Resource Management
• An operating system is a resource manager
• Operating system manage the system’s CPU, memory
space, file-storage space, and I/O devices

1/16/2023 Operating Systems 48


Resource Management
Process Management
• A process is a program in execution
• Program is a passive entity, process is an active entity
• Process needs resources to accomplish its task : CPU,
memory, I/O, files and Initialization data
• Process termination requires reclaim of any reusable
resources
• Process executes instructions sequentially, one at a
time, until completion

1/16/2023 Operating Systems 49


Resource Management
Process Management
• Single-threaded process has one program counter
specifying location of next instruction to execute and
Multi-threaded process has one program counter per
thread

1/16/2023 Operating Systems 50


Resource Management
Process Management Activities:

• Creating and deleting both user and system


processes
• Suspending and resuming processes
• Providing mechanisms for process synchronization
• Providing mechanisms for process communication
• Providing mechanisms for deadlock handling

1/16/2023 Operating Systems 51


Resource Management
Memory Management
• All data should be in memory before and after
processing
• All instructions should be in memory in order to
execute
• Memory management determines what is in memory
when to optimize CPU utilization and computer
response to users

1/16/2023 Operating Systems 52


Resource Management
Memory Management Activities :
• Keep track of which parts of memory are currently
being used and by whom
• Decide which processes and data to move into and
out of memory
• Allocating and de allocating memory space as
needed

1/16/2023 Operating Systems 53


Resource Management
File System Management
• A file is a collection of related information defined by
its creator
• Represent programs (both source and object forms)
and data
• File management is one of the most visible
components of an operating system
• Files usually organized into directories for ease of use

1/16/2023 Operating Systems 54


Resource Management
File-System Management Activities :
• Creating and deleting files and directories
• Primitives to manipulate files and directories
• Mapping files onto secondary storage
• Backup files onto stable (non-volatile) storage media

1/16/2023 Operating Systems 55


Resource Management
Mass Storage Management
• Usually disks used to store data that does not fit in
main memory or data that must be kept for a “long”
period of time
• Entire speed of computer operation is on disk
subsystem and algorithms
Mass-Storage Management Activities :
• Free-space management
• Storage allocation
• Disk scheduling

1/16/2023 Operating Systems 56


Resource Management
Mass-Storage Management Activities :
• Free-space management
• Storage allocation
• Disk scheduling
• Mounting and unmounting
• Partitioning
• Protection

1/16/2023 Operating Systems 57


Resource Management
Cache Management
• Caching is an important principle of computer systems
• Information is normally kept in some storage system
(such as main memory)
• As it is used, it is copied into a faster storage system the
cache on a temporary basis
• When a particular piece of information is needed, first
check whether it is in the cache. If it is, use the
information directly from the cache

1/16/2023 Operating Systems 58


Resource Management
Cache Management
• If not, data will be copied to cache and will be used
from cache

1/16/2023 Operating Systems 59


Characteristics of Various Types of Storage

1/16/2023 Operating Systems 60


Resource Management
I/O System Management
• One of the purposes of an operating system is to hide
the peculiarities of specific hardware devices from the
user
Example: In UNIX, the peculiarities of I/O devices are
hidden by the I/O subsystem

1/16/2023 Operating Systems 61


Resource Management
I/O System Management

The I/O subsystem consists of several components


• A memory-management component that includes
buffering, caching, and spooling
• A general device-driver interface
• Drivers for specific hardware devices

Only the device driver knows the peculiarities of the


specific device to which it is assigned

1/16/2023 Operating Systems 62


Security and Protection
Protection
Mechanism for controlling the access of processes or users
to the resources defined by a computer system

Security
Defense of the system against internal and external attacks

1/16/2023 Operating Systems 63


Security and Protection
Systems generally first distinguish users, to determine who
can do what
• User identities (user IDs, security IDs) associated with
all files, processes of that user to determine access
control

• Group identifier (group ID) allows set of users to be


defined and managed, then also associated with each
process, file

1/16/2023 Operating Systems 64


Virtualization
• A technology that allows us to abstract the hardware
of a single computer into several different execution
environments

• Creating the illusion that each separate environment is


running on its own private computer

• These environments can be viewed as different


individual operating systems that may be running at
the same time and may interact with each other

1/16/2023 Operating Systems 65


Virtualization
• A user of a virtual machine can switch among the
various operating systems in the same way a user can
switch among the various processes running
concurrently in a single operating system

• Virtualization allows operating systems to run as


applications within other operating systems

1/16/2023 Operating Systems 66


Distributed Systems
• A distributed system is a collection of physically
separate, possibly heterogeneous computer systems
that are networked to provide users with access to the
various resources that the system maintains

• Access to a shared resource increases computation


speed, functionality, data availability, and reliability

1/16/2023 Operating Systems 67


Distributed Systems
• A network is a communication path between two or
more systems
• Distributed systems depend on networking for their
functionality
• Networks vary by the protocols used, the distances
between nodes, and the transport media
• TCP/IP is the most common network protocol, and it
provides the fundamental architecture of the Internet
• Most operating systems support TCP/IP, including all
general-purpose ones

1/16/2023 Operating Systems 68


Distributed Systems
• Networks are characterized based on the distances
between their nodes

• A local-area network (LAN) connects computers


within a room, a building, or a campus

• A metropolitan-area network (MAN) could link


buildings within a city

1/16/2023 Operating Systems 69


Distributed Systems
• A wide-area network (WAN) usually links buildings,
cities, or countries

• BlueTooth and 802.11 devices use wireless technology


to communicate over a distance of several feet

• They help to create a personal-area network (PAN)


between a phone and a headset or a smartphone and
a desktop computer

1/16/2023 Operating Systems 70


Distributed Systems
• A network operating system is an operating system
that provides features such as file sharing across the
network, along with a communication scheme that
allows different processes on different computers to
exchange messages

1/16/2023 Operating Systems 71


Computing Environments
• It is important to discuss how operating systems are
used in a variety of computing environments

1. Traditional Computing
• A possess of using physical data centers for storing
digital assets and running complete networking
system for daily operations
• In this, access to data, or software, or storage by users
is limited to device or official network they are
connected with

1/16/2023 Operating Systems 72


Computing Environments
2. Mobile Computing
• Refers to computing on handheld smartphones and
tablet computers
• These devices share the distinguishing physical
features of being portable and lightweight
• Today, mobile systems are used not only for e-mail and
web browsing but also for playing music and video,
reading digital books, taking photos, and recording and
editing high-definition video

1/16/2023 Operating Systems 73


Computing Environments
2. Mobile Computing
• Two operating systems currently dominate mobile
computing: Apple iOS and Google Android
• iOS was designed to run on Apple iPhone and iPad
mobile devices
• Android powers smartphones and tablet computers
available from many manufacturers

1/16/2023 Operating Systems 74


Computing Environments
3. Client-Server Computing
• Contemporary network architecture features
arrangements in which server systems satisfy requests
generated by client systems
• This form of specialized distributed system, called a
client–server system
• Server systems can be broadly categorized as compute
servers and file servers

1/16/2023 Operating Systems 75


Computing Environments
3. Client-Server Computing
Compute Servers
• Provides an interface to which a client can send a
request to perform an action (for example, read data)
• In response, the server executes the action and sends
the results to the client
File Servers
• Provides a file-system interface where clients can
create, update, read, and delete files (a web server
that delivers files to clients running web browsers)

1/16/2023 Operating Systems 76


Computing Environments
3. Client-Server Computing

Figure: General Structure of Client-Server System

1/16/2023 Operating Systems 77


Computing Environments
4. Peer-to Peer Computing
• Another structure for a distributed system
• In this model, clients and servers are not distinguished
from one another
• All nodes within the system are considered peers, and
each may act as either a client or a server, depending
on whether it is requesting or providing a service
• Peer-to-peer systems offer an advantage over
traditional client–server systems

1/16/2023 Operating Systems 78


Computing Environments
4. Peer-to Peer Computing
• In a client–server system, the server is a bottleneck;
but in a peer-to-peer system, services can be provided
by several nodes distributed throughout the network
• Skype is another example of peer-to-peer computing
• It allows clients to make voice calls and video calls and
to send text messages over the Internet using a
technology known as voice over IP (VoIP)
• It uses a hybrid peer-to-peer approach

1/16/2023 Operating Systems 79


Computing Environments
4. Peer-to Peer Computing

Figure: General Structure of Peer-to-Peer Computing System

1/16/2023 Operating Systems 80


Computing Environments
5. Cloud Computing
• A type of computing that delivers computing, storage,
and even applications as a service across a network
• It’s a logical extension of virtualization, because it uses
virtualization as a base for its functionality
• There are many types of cloud computing

1/16/2023 Operating Systems 81


Computing Environments
5. Cloud Computing
• Public cloud—a cloud available via the Internet to
anyone willing to pay for the services
• Private cloud—a cloud run by a company for that
company’s own use
• Hybrid cloud—a cloud that includes both public and
private cloud components
• Software as a service (SaaS)—one or more
applications (such as word processors or spreadsheets)
available via the Internet

1/16/2023 Operating Systems 82


Computing Environments
5. Cloud Computing
• Platform as a service (PaaS)—a software stack ready
for application use via the Internet (for example, a
database server)
• Infrastructure as a service (IaaS)—servers or storage
available over the Internet (for example, storage
available for making backup copies of production data)

1/16/2023 Operating Systems 83


Computing Environments

Figure: Cloud Computing

1/16/2023 Operating Systems 84


Computing Environments
6. Real-Time Embedded Systems
• Embedded computers are the most prevalent form of
computers in existence
• These devices are found everywhere, from car engines
and manufacturing robots to optical drives and
microwave ovens
• They tend to have very specific tasks
• The systems they run on are usually primitive, and so
the operating systems provide limited features

1/16/2023 Operating Systems 85


Computing Environments
6. Real-Time Embedded Systems
• Usually, they have little or no user interface, preferring
to spend their time monitoring and managing
hardware devices, such as automobile engines and
robotic arms

1/16/2023 Operating Systems 86


Free and Open-Source Operating Systems
❑ Assignment 1

Explore free and open-source operating systems and


submit a report

1/16/2023 Operating Systems 87


Homework
• Complete the tutorial 1

1/16/2023 Operating Systems 88


1/16/2023 Operating Systems 89

You might also like