pptx - Shafikchaudhry.net

foamyflumpMobile - Wireless

Nov 21, 2013 (3 years and 8 months ago)

76 views

CS325
:
Operating Systems

Lecture 1:

Introduction



Dr. Shafique Ahmad Chaudhry

Department of Computer Science

E
-
mail:
hazrat.shafique@gmail.com

Office #
FR
-
128

Tel #
2586728

Note
:

Some

slides

and/or

pictures

in

the

followings

are

adapted

from

slides

©
2005

Silberschatz
,

Galvin,

and

Gagne
.

Courtsey

Kubiatowicz
,

Ion

Stoica,and

David

Wagner
.

About the Teacher


Shafique Ahmad Chaudhry


Postdoc

-

National University of Ireland


PhD from Korea


Masters and Undergrads from Pakistan


Research Interests


Wireless Sensor Networks, Ubiquitous Computing,
Computer Networks, Operating Systems and many more


Contact:


Email:
hazrat.shafique@gmail.com


Phone: 2586728 Office: FR
-
128

Shafique Ahmad Chaudhry, PhD

2

Textbook

Operating Systems Concepts,

8
th

Edition
Silbershatz
, Galvin, Gagne



However, I shall also provide links to
other reading resources


Topic Coverage



Textbook:
Silberschatz
, Galvin, and Gagne,

Operating Systems Concepts
, 8
th

Ed., 2008



1 week:

Fundamentals (Operating Systems Structures)


2 weeks:

Process Control and Threads


2 weeks:

Synchronization and scheduling


2 week:

Protection, Address translation, Caching


1 week:

Demand Paging


2 weeks:

File Systems and disk management


1 week:

Intro to Networking and Distributed Systems


1 week:

Protection and Security


Important


Announcements shall be made in class and
through
google

group
imamu
-
cs325
-
s2011



Please get registered with mailing list

imamu
-
cs325
-
s2011@googlegroups.com


Projects shall be done in groups


Please form groups of size 3
-
4 within 2 weeks


Course slides shall also be available at

\
\
10.10.70.70
\
college share folders
\
shafique

shaudhry

and
course website
http://www.shafikchaudhry.net/cs325





Shafique Ahmad Chaudhry, PhD

5

Moodle


It is essential for all students to register at
moodle

for Assignments and Projects
submission. There shall be no submissions
through email. The address for
moodle

is

http://www.shafikchaudhry.net/moodle


The instructions to register are available in
collegesharefolder

and at the course website
http://shafikchaudhry.net/cs325


Shafique Ahmad Chaudhry, PhD

6

Grading


Grading


ONE Mid Term 20% FINAL EXAM 40%


Quizzes


15%


Case Study 10%


Projects and Assignments 15%


Assignment submission


All submissions through
moodle


No provision for late submission


No makeup for ‘SURPRISE QUIZZES’ so attendance is
IMPORTANT


Any plagiarism shall result into SEVERE punishment


Shafique Ahmad Chaudhry, PhD

7

Academic Dishonesty Policy


Copying all or part of another person's work, or using
reference material not specifically allowed,
are forms of
cheating and will not be tolerated. A student involved in
an incident of cheating will be notified by the instructor
and the following policy will apply:


The instructor may take actions such as:


require repetition of the subject work,


assign an F grade or a 'zero' grade to the subject work,


for serious offenses, assign an F grade for the course.




The instructor must inform the student and the
Department Chair in writing of the incident, the action
taken, if any, and its student's right to appeal.




Let us Start

Shafique Ahmad Chaudhry, PhD

9

Goals for Today


What is an Operating System?


And


what is it not?


Examples of Operating Systems design


Why study Operating Systems?




What is Operating System???

Shafique Ahmad Chaudhry, PhD

11

What is an Operating System?


A program that acts as an intermediary
between a user of a computer and the
computer hardware


Operating system goals:


Execute user programs and make solving user
problems easier


Make the computer system convenient to use


Use the computer hardware in an efficient
manner

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


Brief Review??


Modern Computer System Working


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


Shafique Ahmad Chaudhry, PhD

14

Interrupts


Device controller informs CPU that it has finished
its operation by causing an
interrupt


Interrupt transfers control to the interrupt service
routine generally, through the
interrupt

vector
, which
contains the addresses of all the service routines


Interrupt architecture must save the address of the
interrupted instruction


Incoming interrupts are
disabled

while another
interrupt is being processed to prevent a
lost interrupt


A
trap

is a software
-
generated interrupt caused either
by an error or a user request


An operating system is
interrupt driven


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 Timeline

Four Components of a Computer System

User View
vs

System View??

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

What does an Operating System
do?


Most Likely:


Memory Management


I/O Management


CPU Scheduling


Communications? (Does Email belong in OS?)


Multitasking/multiprogramming?


What about?


File System?


Multimedia Support?


User Interface?


Internet Browser?



Whats

your interest in OS??

Operating System Definition


No universally accepted definition


“Everything a vendor ships when you order
an operating system” is good
approximation


But varies wildly


“The one program running at all times on
the computer” is the
kernel
.


Everything else is either a system program
(ships with the operating system) or an
application program

Operating System Definition


Silerschatz

and Gavin:


“An OS is Similar to a government”


Coordinator and Traffic Cop:


Manages all resources


Settles conflicting requests for resources


Prevent errors and improper use of the computer


Facilitator:


Provides facilities that everyone needs


Standard Libraries, Windowing systems


Make application programming easier, faster, less error
-
prone


Some features reflect both tasks:


E.g. File system is needed by everyone (Facilitator)


But File system must be Protected (Traffic Cop)

OS Systems Principles


OS as illusionist:


Make hardware limitations go away


Provide illusion of dedicated machine with infinite memory
and infinite processors


OS as government:


Protect users from each other


Allocate resources efficiently and fairly


OS as complex system:


Constant tension between simplicity and functionality or
performance


OS as history teacher


Learn from past


Adapt as hardware tradeoffs change

What does an Operating System
do?


Most Likely:


Memory Management


I/O Management


CPU Scheduling


Communications? (Does Email belong in OS?)


Multitasking/multiprogramming?


What about?


File System?


Multimedia Support?


User Interface?


Internet Browser?



Whats

your interest in OS??

Process Management



A process is a program in execution. It is a unit of work within
the system. Program is a
passive entity
, process is
an
active
entity
.


Process needs resources to accomplish its task


CPU, memory, I/O, files


Initialization data


Process termination requires reclaim of any reusable resources


Process executes instructions sequentially, one at a time,
until completion


Typically system has many processes, some user, some
operating system running concurrently on one or more CPUs


Concurrency by multiplexing the CPUs among the
processes / threads


Process Management Activities

The operating system is responsible for the
following activities in connection with process
management:



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

Example: Protecting Processes
from Each Other


Problem: Run multiple applications in such a way
that they are protected from one another


Goal:


Keep User Programs from Crashing OS


Keep User Programs from Crashing each other


[Keep Parts of OS from crashing other parts?]


(Some of the required) Mechanisms:


Address Translation


Dual Mode Operation


Simple Policy:


Programs are not allowed to read/write memory of other
Programs or of Operating System


Memory Management


All data in memory before and after processing


All instructions in memory in order to execute


Memory management determines what is in memory
when


Optimizing CPU utilization and computer response to users


Memory management activities


Keeping track of which parts of memory are currently
being used and by whom


Deciding which processes (or parts thereof) and data to
move into and out of memory


Allocating and
deallocating

memory space as needed


CPU

MMU

Virtual

Addresses

Physical

Addresses

Address Translation


Address Space


A group of memory addresses usable by something


Each program (process) and kernel has potentially different address spaces.


Address Translation:


Translate from Virtual Addresses (emitted by CPU) into Physical Addresses
(of memory)


Mapping
often
performed in Hardware by Memory Management Unit
(MMU
)

Prog 1

Virtual

Address

Space 1

Prog 2

Virtual

Address

Space 2

Code

Data

Heap

Stack

Code

Data

Heap

Stack

Data 2

Stack 1

Heap 1

OS heap &

Stacks

Code 1

Stack 2

Data 1

Heap 2

Code 2

OS code

OS data

Translation Map 1

Translation Map 2

Physical Address Space

Storage Management


OS provides uniform, logical view of information
storage


Abstracts physical properties to logical storage unit
-

file


Each medium is controlled by device (i.e., disk drive, tape
drive)


Varying properties include access speed, capacity, data
-
transfer
rate, access method (sequential or random)


File
-
System management


Files usually organized into directories


Access control on most systems to determine who can
access what


OS activities include


Creating and deleting files and directories


Primitives to manipulate files and
dirs


Mapping files onto secondary storage


Backup files onto stable (non
-
volatile) storage media

Mass
-
Storage Management


Disks store data that must be kept for a “long” period
of time


Entire speed of computer operation hinges on disk
subsystem and its algorithms


OS activities


Free
-
space management


Storage allocation


Disk scheduling


Some storage need not be fast like Tertiary storage
includes optical storage, magnetic tape but Still must
be managed

Performance of Various Levels of Storage


Movement between levels of storage
hierarchy can be explicit or implicit

Migration of Integer A from Disk to Register


Multitasking environments must be careful to use most
recent value, no matter where it is stored in the storage
hierarchy





Multiprocessor environment must provide cache coherency
in hardware such that all CPUs have the most recent value
in their cache


Distributed environment situation even more complex


Several copies of a datum can exist


Various solutions covered in Chapter 17

I/O Subsystem


One purpose of OS is to hide peculiarities of
hardware devices from the user


I/O subsystem responsible for


Memory management of I/O including buffering
(storing data temporarily while it is being transferred),
caching (storing parts of data in faster storage for
performance), spooling (the overlapping of output of
one job with input of other jobs)


General device
-
driver interface


Drivers for specific hardware devices

Protection and Security


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


Protection and Security


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

Shafique Ahmad Chaudhry, PhD

37

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


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


Shafique Ahmad Chaudhry, PhD

39

Transition from User to Kernel
Mode


Timer to prevent infinite loop / process hogging resources


Set interrupt after specific period


Operating system decrements counter


When counter zero generate an interrupt


Set up before scheduling process to regain control or terminate
program that exceeds allotted time

Why Study Operating Systems?


Learn how to build complex systems:


How can you manage complexity for future projects?


Engineering issues:


Why is the web so slow sometimes? Can you fix it?


What features should be in the next mars Rover?


How do large distributed systems work? (
Kazaa
, etc)


Buying and using a personal computer:


Why different PCs with same CPU behave differently


How to choose a processor (
Opteron
, Itanium, Celeron, Pentium)


Should you get Windows XP, 2000, Linux, Mac OS …?


Why does Microsoft have such a bad name?


Business issues:


Should your division buy thin
-
clients
vs

PC?


Security, viruses, and worms


What exposure do you have to worry about?

“In conclusion…”


Operating systems provide a virtual machine
abstraction to handle diverse hardware


Operating systems coordinate resources and
protect users from each other


Operating systems simplify application
development by providing standard services


Operating systems can provide an array of
fault containment, fault tolerance, and fault
recovery