You are on page 1of 56

Operating Systems

Lecture #01

Introduction to
Operating System (OS)

1 Dr. Bushra Naz


bushra.naz@faculty.muet.edu.pk
:BOOKS RECOMMENDED
A. Silberschatz, P. B. Galvin, and G. Gagne, “Operating Systems
Concepts (Essentials)”,
9th Edition, John Wiley & Sons, 2012.
http://codex.cs.yale.edu/avi/os-book/

2 Dr. Bushra Naz


:BOOKS RECOMMENDED
W. Stallings, “Operating Systems:
Internals and Design
Principles”, 8th ed, Pearson,
2015.
http://williamstallings.com/
OperatingSystems/

3 Dr. Bushra Naz


:BOOKS RECOMMENDED
A. S. Tanenbaum, “Modern
Operating Systems”, 4th ed,
Pearson, 2015.
http://www.pearsonhighered
.com/educator/academic/pro
duct/0,,0136006639,00%2b
en-USS_01DBC.html

4 Dr. Bushra Naz


:BOOKS RECOMMENDED
T. W. Doeppner, Operating
Systems in Depth, John Wiley
& Sons, 2011,
http://eu.wiley.com/WileyCD
A/WileyTitle/productCd-EHE
P001803.html

5 Dr. Bushra Naz


Learning Objectives
Taxonomy
CLOs Domain PLO
level
Gain knowledge about terminologies,
CLO:1 classification and key terms related to operating Cognitive C1 1
.systems

 To describe the basic organization of computer systems.

 To provide a grand tour of the major components of operating systems.

6 Dr. Bushra Naz


Computer

7 Dr. Bushra Naz


Computer

mainboard

8 Dr. Bushra Naz


What is an Operating System?
• A modern computer consists of:
 One or more processors
 Main memory
 Disks
 Printers
 Various input/output devices.
• Managing all these varied components requires a
layer of software – the
Operating System (OS).

9 Dr. Bushra Naz


General Definition

• An OS is a program which acts as an interface 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.

10 Dr. Bushra Naz


General Definition
 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

11 Dr. Bushra Naz


General Definition

• Another aspect for the usage of


OS is that; it is used as a Application Programs
predefined library for hardware-
software interaction. System Programs

Operating System
• This is why, system programs
apply to the installed OS since
Machine Language
they cannot reach hardware
directly.
HARDWARE

12 Dr. Bushra Naz


General Definition
 In a system where there is no OS installed, we should
consider some hardware work as:

(Assuming an MC 6800 computer hardware)

LDAA $80  Loading the number at memory location 80


LDAB $81  Loading the number at memory location 81
ADDB  Adding these two numbers
STAA $55  Storing the sum to memory location 55

 As seen, we considered memory locations and used our


hardware knowledge of the system.

13 Dr. Bushra Naz


General Definition
• With the advantage of easier programming provided by the
OS, the hardware, its machine language and the OS
constitutes a new combination called as a virtual (extended)
machine.

Operating
Machine System
Virtual
Language Machine (Extended)
Machine Language
Hardware Machine
Hardware

14 Dr. Bushra Naz


The Three Elements of an OS

1) User Interface – The part of the OS that you interface with.

2) Kernel – The core of the OS. Interacts with the BIOS (at one
end), and the UI (at the other end).

3) File Management System – Organizes and manages files.

15 Dr. Bushra Naz


?Where does the OS fit in

16 Dr. Bushra Naz


OPERATING SYSTEM
• In a more simplistic approach, in fact, OS itself is a program.

• But it has a priority which application programs don’t have.

• OS uses the kernel mode of the microprocessor, whereas


other programs use the user mode.

• The difference between two is that; all hardware instructions


are valid in kernel mode, where some of them cannot be used
in the user mode.

17 Dr. Bushra Naz


:OS goals 14-12-2022
 Control/execute user/application programs.

 Make the computer system convenient to use.

 Ease the solving of user problems.

 Use the computer hardware in an efficient manner.

OS Functions
 File Management

 Application Management

 Built-in Utility Programs

 Control of Computer Hardware


18 Dr. Bushra Naz
?Why are Operating Systems Important
• Important to understand and know how to correctly use when
writing user applications.

• Large and complex systems that have a high economic impact


and result in interesting problems of management.

• Few actually involved in OS design and implementation but


nevertheless many general techniques to be learned and applied.

• Combines concepts from many other areas of Computer


Science: Architecture, Languages,
Data Structures, Algorithms, etc.

19 Dr. Bushra Naz


Operating System Types

 Multiuser – Two or more users work with the computer at the


same time
 Multitasking – Two or more processes running at the same
time.
 Multithreading – Two or more parts of the same process
running at the same time.

20 Dr. Bushra Naz


What Operating Systems Do
• Depends on the point of view.
• Users want convenience, ease of use and good performance
– Don’t care about resource utilization.
• But a shared computer such as mainframe or minicomputer
must keep all users happy.
• Users of dedicate systems such as workstations have dedicated
resources but frequently use shared resources from servers.
• Handheld computers are resource poor, optimized for usability
and battery life.
• Some computers have little or no user interface, such as
embedded computers in devices and automobiles.

21 Dr. Bushra Naz


Views of an Operating System
• There are three classical views (in literature):
1. Resource Manager – manages and allocates resources.
2. Control program – controls the execution of user
programs and operations of I/O devices.
3. Command Executer – Provides an environment for
running user commands.
• But one more modern view: the Operating System as a
Virtual Machine.

22 Dr. Bushra Naz


Resource Manager .1
• Resource Manager:
– Manages and protects multiple computer resources: CPU,
Processes, Internal/External memory, Tasks, Applications,
Users, Communication channels, etc…
– Handles and allocates resources to multiple users or
multiple programs running at the same time and space
(e.g., processor time, memory, I/O devices).
– Decides between conflicting requests for efficient and fair
resource use (e.g., maximize throughput, minimize
response time).
• Sort of a bottom-up view.

23 Dr. Bushra Naz


OS as a Resource Manager

24 Dr. Bushra Naz


Resource Manager oriented OS names
• DEC RSX – Resource Sharing eXecutive
• MIT Multics – MULTiplexed Information and
Computing Services
• IBM MFT/MVT – Multiple Fixed/Variable Tasks
• IBM MVS – Multiple Virtual Storage
• DEC VMS – Virtual Memory System
• MVS TSO – Time Sharing Option
• CTSS – Compatible Time Sharing System
• IBM VM – Virtual machine

25 Dr. Bushra Naz


Control Program .2
• Control Program:
– Manages all the components of a complex
computer system in an integrated manner.
– Controls the execution of user programs and
I/O devices to prevent errors and improper
use of computer resources.
– Looks over and protects the computer:
Monitor, Supervisor, Executive, Controller,
Master, Coordinator ….
• Sort of a black box view.
26 Dr. Bushra Naz
Command Executer .3
• Command Executer:
– Interfaces between the users and machine.
– Supplies services/utilities to users.
– Provides the users with a convenient CLI
(Command Language Interface), also called
a Shell (in UNIX), for entering the user
commands.
• Sort of a top-down view.

27 Dr. Bushra Naz


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
specie task.
2. Symmetric Multiprocessing – each processor performs all
tasks
28
Symmetric Multiprocessing Architecture

29
Dual-Core Design

• Multi-chip and multicore


• Systems containing all chips
– Chassis containing multiple separate systems

30
Non-Uniform Memory Access System

31
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

32
Clustered Systems

33
Protection and Security 1.6

• Protection – any mechanism for controlling access of processes or users to


resources defined by the OS
• Security – defense of the system against internal and external attacks
– Huge range, including denial-of-service, worms, viruses, identity theft, theft
of service
• Systems generally first distinguish among users, to determine who can do what
– User identities (user IDs, security IDs) include name and associated
number, one per user
– User ID then associated with all files, processes of that user to determine
access control
– Group identifier (group ID) allows set of users to be defined and controls
managed, then also associated with each process, file
– Privilege escalation allows user to change to effective ID with more rights

34
Virtualization 1.7

• 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

35
Virtualization (cont.)

• 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
– Quality assurance 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)

36
Computing Environments - Virtualization

37
Modern view: Virtual Machine (1)
• Operating System as a Virtual Machine:
– An interface between the user and hardware that
hides the details of the hardware (e.g., I/O).
– Constructs higher-level (virtual) resources out of
lower-level (physical) resources (e.g., files).
– Definition: OS is a collection of software
enhancements, executed on the bare hardware,
culminating in a high-level virtual machine that
serves as an advanced programming environment.
• virtual machine = software enhancement = extended
machine = abstract machine = layer = level = ring.
38 Dr. Bushra Naz
Modern view: Virtual Machine (2)

39 Dr. Bushra Naz


Computing Environments

• Traditional
• Mobile
• Client Server
• Peer-to-Peer
• Cloud computing
• Real-time Embedded

40
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

41
Mobile

• Handheld smartphones, tablets, etc.


• What is the functional difference between them and a “traditional”
laptop?
• Extra feature – more OS features (GPS, gyroscope)
• Allows new types of apps like augmented reality
• Use IEEE 802.11 wireless, or cellular data networks for connectivity
• Leaders are Apple iOS and Google Android

42
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

43
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

44
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
45
Cloud Computing (Cont.)

• 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)

46
Cloud Computing (cont.)

• 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

47
Real-Time Embedded Systems

• Real-time embedded systems most prevalent form of computers


– Vary considerable, special purpose, limited purpose OS, real-
time OS
– Use expanding
• Many other special computing environments as well
– Some have OSes, some perform tasks without an OS
• Real-time OS has well-defined fixed time constraints
– Processing must be done within constraint
– Correct operation only if constraints met

48
Free and Open-Source Operating Systems

• Operating systems made available in source-code format rather than just


binary closed-source and proprietary
• Counter to the copy protection and Digital Rights Management (DRM)
movement
• Started by Free Software Foundation (FSF), which has “copyleft” GNU
Public License (GPL)
– Free software and open-source software are two different ideas
championed by different groups of people
• https://www.gnu.org/philosophy/open-source-misses-the-
point.en.html
• Examples include GNU/Linux and BSD UNIX (including core of Mac
OS X), and many more
• Can use VMM like VMware Player (Free on Windows), Virtualbox (open
source and free on many platforms - http://www.virtualbox.com)
– Use to run guest operating systems for exploration
49
The Study of Operating Systems
There has never been a more interesting time to study operating systems, and it has never been
easier. The open-source movement has overtaken operating systems, causing many of them to be
made available in both source and binary (executable) format. The list of operating
systems available in both formats includes Linux, BUSD UNIX, Solaris, and part of macOS.
The availability of source code allows us to study operating systems from the inside out.
Questions that we could once answer only by looking at documentation or the behavior of an
operating system we can now answer by examining the code itself.

Operating systems that are no longer commercially viable have been open-sourced as well, enabling
us to study how systems operated in a time of fewer CPU, memory, and storage resources.
An extensive but incomplete list of open-source operating-system projects is available
from https://curlie.org/Computers/Software/Operating_Systems/Open_Source/

In addition, the rise of virtualization as a mainstream (and frequently free) computer function
makes it possible to run many operating systems on top of one core system. For example, VMware
(http://www.vmware.com) provides a free “player” for Windows on which hundreds of free
“virtual appliances” can run. Virtualbox (http://www.virtualbox.com) provides a free, open-source
virtual machine manager on many operating systems. Using such tools, students can try out
hundreds of operating systems without dedicated hardware.

The advent of open-source operating systems has also made it easier to make the move from
student to operating-system developer. With some knowledge, some effort, and an Internet
connection, a student can even create a new operating-system distribution. Just a few years ago,
it was difficult or impossible to get access to source code. Now, such access is limited only by
how much interest, time, and disk space a student has.

50
?What is the OS/Kernel
• Is the Operating System just the Kernel (not the utilities and
application programs)?!
• The Command Line Interface (CLI) (or command
layer/interpreter or shell) allows direct command entry by the
user.
• The shell used to be in the kernel but now is a (first between
equals) utility outside of it:
– Easy to change/debug
– Many of them (sh, bsh, csh, ksh, tcsh, wsh, bash)
– Possible to switch between them (chsh)

51 Dr. Bushra Naz


UNIX Shell and Utilities

User

Utilities Shell

Kernel

Hardware
52 Dr. Bushra Naz
CLI is the User OS Interface
CLI allows direct command entry:
– Sometimes implemented in kernel, sometimes by
systems program.
– Sometimes multiple flavors implemented – shells.
– Primarily fetches a command from user and
executes it.
– Sometimes commands built-in, sometimes just
names of programs; if the latter, adding new
features doesn’t require shell modification.

53 Dr. Bushra Naz


Bourne Shell (bsh)

54 Dr. Bushra Naz


UNIX System Layout

55 Dr. Bushra Naz


General UNIX Architecture (1)

56 Dr. Bushra Naz

You might also like