0% found this document useful (0 votes)
26 views48 pages

Lec1 Intro

The document provides an overview of an operating systems course. It discusses the course information including prerequisites and office hours. It defines what an operating system is and its goals of managing resources and providing services. It briefly covers the history of operating systems from the first to fourth generations. It also discusses the hardware components of a typical computer system and the memory hierarchy. Finally, it gives a peek into the structure of Unix operating systems.

Uploaded by

hellsing89
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views48 pages

Lec1 Intro

The document provides an overview of an operating systems course. It discusses the course information including prerequisites and office hours. It defines what an operating system is and its goals of managing resources and providing services. It briefly covers the history of operating systems from the first to fourth generations. It also discusses the hardware components of a typical computer system and the memory hierarchy. Finally, it gives a peek into the structure of Unix operating systems.

Uploaded by

hellsing89
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 48

Operating Systems

Operating Systems

Lecture 1
Today’s Agenda
 Basic Course information.
 What is an OS? What does it do?
 A Brief History of OS’s.
 Hardware overview
 A peek at Unix
 System Calls
 Overview of OS components
 User space versus Kernel space

Operating Systems 2
Overview
 Teaching Assistants:
 Required Textbook:
Modern Operating Systems, 3rd
Ed.,Tanenbaum, Pearson Edu., 2009
 Class Website
http://www.fatih.edu.tr/~hakkoymaz

Operating Systems 3
Course Information
 Prerequisites
 CENG/BİLM 201 or equivalent
 CENG/BİLM 252 or equivalent
 C programming (Basic level)

 Office hours: Thursdays 11-1


 Office: EA-306

Operating Systems 4
Why are you here?
 To fulfill a requirement
 To better understand other subjects
 Networking
 Distributedsystems
 Real-time systems
 Multimedia systems

Operating Systems 5
About this course…
Principles Goals

 System concepts  Understand OS


design decisions
 OS design
 Basis for future
 Some theory learning
 Rationale  Get hands dirty
 Practice

Operating Systems 6
Pain=Reward
Fast pace
Hard material

~programming
~homeworks AND quizzes

Operating Systems 7
Name some OS’s
 Linux  PalmOS
 Unix  TinyOS
 Windows  WinCE
 Multics  Spring
 BSDUnix  2K
 Mac/Tiger  ….
 Vista

Operating Systems 8
What Is an OS?
“Code” that:
 Sits between programs & hardware
 Sits between different programs
 Sits betweens different users
What happens if two applications simultaneously use
But what does it do? the printer?
Provides an orderly and controlled allocation of the processors,
memories and I/O devices among the various programs competing
for them

Loose analogy:
 Government: creates and enforces laws that govern
resources (money, land, houses, vehicles, oil, etc.) but
allows citizens to have freedom with using the resources
(as long as the citizen obeys laws)

Operating Systems 9
What Is an OS?

Resources Services
 Allocation  Abstraction
 Protection  Simplification
 Reclamation  Convenience
 Virtualization  Standardization

Makes computers simpler (to manage, use,


and understand)
Operating Systems 10
What Is an OS?
Government

Finite resources Limited budget,


Resources Competing demands Land,
Oil,
 Allocation Examples: Gas,

 Protection  CPU
 Memory
 Reclamation
 Disk
 Virtualization
 Network

Printer problem: buffer! (Time Multiplexing)


Space Multiplexing: give CPU to one application, disk to another application

Operating Systems 11
What Is an OS?
Government

Law and order


Resources You can’t hurt me
 Allocation I can’t hurt you
 Protection
Implies some degree of
 Reclamation
safety & security
 Virtualization

Operating Systems 12
What Is an OS?
Government

Income Tax
Resources The OS gives
 Allocation The OS takes away
 Protection
Voluntary at run time
 Reclamation
Implied at termination
 Virtualization
Involuntary
Cooperative

Operating Systems 13
What Is an OS?
Government
illusion of infinite, private Social security
Resources resources
 Allocation
 Protection Memory versus disk
Timeshared CPU
 Reclamation
 Virtualization
More extreme cases
possible

Operating Systems 14
History of Operating Systems
 First generation 1945 – 1955 (Anarchy)
 vacuum tubes, plug boards (no OS, signup sheets or
punch cards)
 Second generation 1955 – 1965 (Monarchy)
 transistors, batch systems
 Third generation 1965 – 1980 (Feudalism)
 ICs and multiprogramming
 Fourth generation 1980 – present (free market)
– personal computers

Operating Systems 15
History of Operating Systems
(Monarchy)

Early batch system


 bring cards (multiple jobs) to 1401
 read cards to tape
 put tape on 7094 which does computing
 put tape on 1401 which prints output

Operating Systems 16
History of Operating Systems
(Monarchy)

 Structure of a typical JCL job – 2nd generation


 Single “user”
 Programmer/User as the operator
 Secure, but inefficient, use of expensive resources
 Low CPU utilization-slow mechanical I/O devices

Operating Systems 17
History of Operating Systems
(Feudalism) 1401 7094 50’s

IBM 360 60’s

 Multiprogramming system
– Multiple jobs in memory – 3 rd generation
– SPOOLing - use disk as large buffer for input/output devices
– SPOOL=Simultaneous Peripheral Operation On-Line
– Timesharing=multiple users logged on, e.g., CTSS, MULTICS

Operating Systems 18
The Operating System Zoo
 Mainframe operating systems
 Server operating systems
 Multiprocessor operating systems
 Personal computer operating systems
 Real-time operating systems
 Embedded operating systems
 Smart card operating systems

Operating Systems 19
Historical Comparison
Mainframe Mini Micro
System $/ 10:1 – 10:1 – 1:10-1:100
Worker 100:1 1:1
Salary
Goal System Overall Productivity
utilization cost
Target Capacity Features Ease of
Use

Operating Systems 20
Pentium System

Structure of a large Pentium system


Operating Systems 21
A Typical Computer
from a Hardware Point of View
CPU ... CPU

Memory Chipset
I/O bus

Network

Operating Systems 22
A Typical Computer System (black
box)
CPU Memory

.. Programs and data


. Operating System Software
CPU

OS
Network
Apps
Data
Operating Systems 23
Memory-Storage Hierarchy

Real life analogy?


• Registers : Cache : Main Memory as
Your school bag : Your house : Your parents’ house

Operating Systems 24
A peek into Unix

Application

Libraries User space/level

Kernel space/level
Portable OS Layer •User/kernel modes are
supported by hardware
Machine-dependent layer
•Some systems do not have
clear user-kernel boundary

Operating Systems 25
Unix: Application

Application Written by programmer


(E.g., emacs) Compiled by programmer
Uses function calls
Libraries

Portable OS Layer

Machine-dependent layer

Operating Systems 26
Unix: Libraries

Application Provided pre-compiled


Defined in headers
Input to linker (compiler)
Libraries (e.g., stdio.h) Invoked like functions
May be “resolved” when
program is loaded
Portable OS Layer

Machine-dependent layer

Operating Systems 27
Typical Unix OS Structure

Application

Libraries

Portable OS Layer
system calls (read, open..)
All “high-level” code
Machine-dependent layer

Operating Systems 28
Typical Unix OS Structure

Application

Libraries Bootstrap
System initialization
Interrupt and exception
I/O device driver
Portable OS Layer Memory management
Kernel/user mode
Machine-dependent layer switching
Processor management

Operating Systems 29
Typical Unix OS Structure

Application

Libraries User space/level


System
Calls
Kernel space/level
Portable OS Layer

Machine-dependent layer

Operating Systems 30
Another Look: Unix “Onion”
Applications User and Kernel
boundary
OS Service
Device

Hardware

Driver

Operating Systems 31
A small fraction of System Calls in Unix

Operating Systems 32
read (fd,buffer,nbytes)
How an Interrupt Works

(a)
Steps 3 and 4
(a) Steps in starting an I/O in (a)
device and getting interrupt (b)
(b) How the CPU is interrupted
“Interrupt handler” is a part of the
Code for the device driver

Operating Systems 33
How a System Call Works
read (fd,buffer,nbytes)

(system call stub)

Where might an interrupt be used?


•Trap=Interrupt
•If steps 7 and 8 take long,
an interrupt is used later to
signal to the CPU when job is done

Operating Systems 34
All OS’s offer their own Syscalls

Some Win32 API calls


Operating Systems 35
OS - Major Components
 Process and thread management
 Resource management
 CPU Management
 Memory Management
 I/O Device Management
 File system
 Bootstrapping

Operating Systems 36
Introducing…the “Process”
 Program=code
 Process=running program. Includes:
 Code, data, stack, program counter, register values,
anything that describes current “state” of process
 A process tree
A created two child processes, B and C
 B created three child processes, D, E, and F
 An OS has to manage/juggle multiple processes
at the same time!

Operating Systems 37
An example process: A Command
Shell!
 A stripped down shell:
while (TRUE) { /* repeat forever */
type_prompt( ); /* display prompt */
read_command (command, parameters) /* input from terminal */

if (fork() != 0) { /* fork off child process */


/* Parent code */
waitpid( -1, &status, 0); /* wait for child to exit */
} else {
/* Child code */
execve (command, parameters, 0); /* execute command */
}
}

“fork()”? Wait for next week!

Operating Systems 38
Deadlock

(a) A potential deadlock. (b) an actual deadlock.


An OS has to deal with deadlock detection, avoidance, and prevention.

Operating Systems 39
Process communication

Two processes connected by a pipe

Operating Systems 40
Is this done in user-level or kernel-level?

Processor (CPU) Management


 Goals
 Timesharing
 Multiple CPU allocations
 Issues
 Do not waste CPU resources
Analogy: Single Video Game
 Synchronization and mutual in a house with multiple
exclusion kids
 Fairness
What happens if a process executes
 Deadlock freedom
while ( 1 ) ; ?

Operating Systems 41
Is this done in user-level or kernel-level?

Memory Management

 Goals
Register
 Support programs to run
 Allocation and management
L2 10x
 Transfers from and to
secondary storage
Memory 200x
 Issues
 Efficiency & convenience Disk 10Mx
 Fairness
 Protection Tape 100Mx

Operating Systems 42
Is this done in user-level or kernel-level?

I/O Device Management


 Goals User 1 ... User n
 Interactions between
devices and applications
 Ability to plug and play new Library support
devices
 Issues Driver Driver
 Efficiency
I/O I/O
 Fairness device ... device
 Protection and sharing

Operating Systems 43
File System Example

File system for a university department


Operating Systems 44
Is this done in user-level or kernel-level?

File System
 A typical file system User 1 ... User n
 Open a file with
authentication
 Read/write data in files
File system services
 Close a file

 Can some of these


services be moved to File File
...
user level?

Operating Systems 45
Is this done in user-level or kernel-level?

Bootstrapping
 Power up a computer Boot Boot
 Processor reset loader loader
 Set to known state OS
 Jump to ROM code sector 1
1. Load in the boot loader from OS
stable storage sector 2
2. Jump to the boot loader .
.
3. Load the rest of the .
operating system
4. Initialize and run
OS
sector n

Operating Systems 46
Design Tradeoffs
 All in the kernel (Windows)
 Pros:efficient?
 Cons: difficult to develop new services
 Almost all at user level (Exokernel)
 Pros:easy to develop new apps
 Cons: protection
 Split between user and kernel (Unix)
 Kernel:display driver and mouse driver
 User: many other services, incl. novel file systems!

Operating Systems 47
You Live in Interesting Times…

 Processors double in 18 months


 Disks double every 12 months
 Global bandwidth doubles every 6-9 months

 The future of OS’s is also interesting


If population doubles every year, or people can move twice
faster every year, what would the government do/would
it need to change?

Operating Systems 48

You might also like