Download What is an Operating System?

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Mobile operating system wikipedia , lookup

Burroughs MCP wikipedia , lookup

RSTS/E wikipedia , lookup

Process management (computing) wikipedia , lookup

Copland (operating system) wikipedia , lookup

Spring (operating system) wikipedia , lookup

VS/9 wikipedia , lookup

Unix security wikipedia , lookup

Security-focused operating system wikipedia , lookup

Paging wikipedia , lookup

Distributed operating system wikipedia , lookup

CP/M wikipedia , lookup

Transcript
Operating Systems
Lecture 1: Introduction
Review of System Architecture and Concurrent Programming
Maxim Shevertalov
Jay Kothari
William M. Mongan
Lec 1
Operating Systems
1
Introduction
• What is an Operating System?
• How are they designed?
• Why study them?
Lec 1
Operating Systems
2
What is an Operating System?
• Facilitation + Performance
• Think of Air Traffic Control: they are in charge of lots of airplanes,
and sometimes they tell airplanes to wait their turn.
• Despite what we may sometimes think, their intent is not to prevent
us from doing what we want by imposing complicated rules.
• Rather, they are there to facilitate aircraft in flight.
• On its own, the air traffic controller does not accomplish much; but,
together with the aircraft he supports, he aims to maximize
performance for all the participating airplanes (not any one!), while
protecting them from one another.
• It’s all about coordination.
Lec 1
Operating Systems
3
What is an Operating System?
• Can we use a computer system without an operating system?
Lec 1
Operating Systems
4
What is an Operating System?
• Can we use a computer system without an operating system?
– We would have to directly interface with the computer hardware.
– Pros: speed?, control?
– Cons: What if we need to run on a different machine? Or change the network
card? Install a new OS? What if new features like multiprocessors or a cluster
is introduced to the program?
• The operating system mediates between application (the airplanes)
and the shared resources (the runways and airspace) in a way that
provides abstraction and generality for the applications.
Lec 1
Operating Systems
5
What is an Operating System?
• Trusted software interposed between the hardware and
application/utilities to improve efficiency and usability
• Most computing systems have some form of operating systems
• Hard to use computer systems without OS
Applications and Utilities
Operating System
Computer Hardware
Lec 1
Operating Systems
6
Why Study Them?
• Take a deeper at system architecture
• Modular, layered software design
• All of our software runs on top of it! It is the common
denominator of everything we write.
• How often do you make a syscall? Or invoke some system
library?
• Learn to build complex systems
• Engineering Issues
• Business Issues (OS as a government)
• Security (viruses, worms, etc.)
Lec 1
Operating Systems
7
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
CPU
CPU
CPU
Disk Controller
USB Controller
GPU
Memory
Lec 1
Operating Systems
8
Operating System Design: Modularity
•
•
•
•
•
•
•
Process Control: Threads
Synchronization and Scheduling
Protection, Memory Management, Caching
Demand Paging
File Systems
Networking and Distributed Systems
Protection and Security
Lec 1
Operating Systems
9
One Size Fits All? Requirements
Dictate Design
Lec 1
Operating Systems
10
Evolution of the OS
• In the beginning... Computers
• Cost millions of $$$
• Were hard to operate (performed using console switches)
• Were hard to program (in particular I/O devices)
Lec 1
Operating Systems
11
Utilizing Expensive Hardware
• Expensive computers could not idle; utilization should be very
high
• Batch processing was devised
• Programming done offline and subroutine were created for common tasks
• I/O and processing overlap obtained via buffering and interrupts
Lec 1
Operating Systems
12
Factors in OS Evolution
computer utilization
• Cost of computers (i.e., computer time)
• Cost of people (i.e., user time)
early batch
systems
time sharing
systems
personal
systems
user wait time
Lec 1
Operating Systems
13
Major OS Functions
Lec 1
Operating Systems
14
Major OS Functions
• Control access and provide interfaces
• To the OS and devices attached to the system
• Provide interfaces for human-machine and machine-machine transactions
• Manage resources
• Mediate resource usage among different tasks
• Implement policies
Lec 1
Operating Systems
15
Major OS Functions
• Control access and provide interfaces
• To the OS and devices attached to the system
• Provide interfaces for human-machine and machine-machine transactions
• Manage resources
• Mediate resource usage among different tasks
• Implement policies
• Provide abstractions
• Hide the peculiarities of the hardware.
• Example: device independent I/O
• Consume resources
• OS runs on the system that is being managed… so it is going to consume
resources!
Lec 1
Operating Systems
16
What is the Access Problem?
• User wants to access OS, why?
• User wants to access devices connected to the system
• It all starts with recognizing the user’s intent to access!
Lec 1
Operating Systems
17
Access Problem: Handling I/O
• Programmed I/O
• The CPU transfers the data from (or to) the device buffers.
• After issuing an I/O operation the CPU continuously checks (polls) for its
completion
Lec 1
Operating Systems
18
Access Problem: Handling I/O
• Interrupt-driven I/O (slow speed, character device)
• The CPU issues an I/O operation and goes on; Device notifies (interrupts) the
CPU as data arrives; CPU processes the data
Lec 1
Operating Systems
19
How Does the OS Service Interrupts?
Lec 1
Operating Systems
20
Access Problem: Data Processing
• Once data is captured from device (e.g., keyboard) what is
next?
• Imagine you want to write a word processor
• Capture some keystrokes – for arrow and other control keys
• Capture words (cooked or raw form?)
Lec 1
Operating Systems
21
Accessing Devices vs. OS Services
• OS interposes itself between the hardware and
applications/utilities/users
User
OS
Device
• Controlling access to OS ---> Controls device access
Lec 1
Operating Systems
22
How Do You Control Access to the
OS?
• Provides a two level architecture:
• Trusted mode
• Untrusted mode
• The OS (at least the core part – called Kernel) runs in the
trusted mode
• User applications/utilities run in the untrusted mode
Lec 1
Operating Systems
23
System Call via Trap
• OS provides system calls for accessing OS services from
applications
• System calls are special procedure calls
• Control transfer
• Switch protection domain
• System calls also:
• Validate the call
• Allow authorized actions to take place
Lec 1
Operating Systems
24
How are Syscalls Processed?
Lec 1
Operating Systems
25
UNIX Syscall Examples
• Process control
• fork(), exec(), wait(), abort()
• File manipulation
• chmod(), link(), stat(), creat()
• Device manipulation
• open(), close(), ioctl(), select()
• Information maintenance
•
time(), acct(), gettimeofday()
• Communications
• socket(), accept(), send(), recv()
Lec 1
Operating Systems
26
How Does an OS Manage Resources?
Lec 1
Operating Systems
27
Process: Avatar of the Application
• A process represented process table entry
Lec 1
Operating Systems
28
Simple Process Model
• Below is a two-state process model
• Running (on the CPU)
• Not running (waiting to get the CPU or at I/O)
Lec 1
Operating Systems
29
Resource Management: Processor
Time
• Processor time is the primary resource managed by the OS
• How it is managed depends on the type of OS:
• Batch vs Time-sharing
• Uniprogramming vs Multiprogramming
Lec 1
Operating Systems
30
Example: Uniprogramming
(only one program running on the system)
What is the CPU Utilization?
Lec 1
Operating Systems
31
Example: Multiprogramming
(multiple programs simultaneously running)
Lec 1
Operating Systems
32
Comparing System Utilization
Lec 1
Operating Systems
33
Process Scheduling
Lec 1
Operating Systems
34
Process Scheduling: Concerns
Lec 1
Operating Systems
35
Process Scheduling Concerns
• Fairness
• Give equal and fair access to resources
• Differential responsiveness
• Discriminate among different classes of jobs
• Efficiency
• Maximize throughput, minimize response time, and accommodate as many
users as possible
Lec 1
Operating Systems
36
Memory Management
• Memory management is key to multiprogramming
• Memory is a space sharing resource
• Memory management is necessary to protect co-residing programs from each
other
• Depending on the occupancy pattern, a program would not know the location
until load time
• Memory management should provide:
• Protection
• Relocation
Lec 1
Operating Systems
37
How Does an OS Manage Memory?
• Idea:
• Divide the memory into partitions and allocate them to different processes
• Partitions can be fixed size or variable size
• A process
• Cannot access memory not allocated to it
• Can request more memory from OS
• Can release already held memory to OS
• May only use a small portion of the allocated memory
Lec 1
Operating Systems
38
How Does an OS Manage Memory?
• We can load more processes than that fitting the memory
• Where do the rest go?
Answer: Virtual Memory
Lec 1
Operating Systems
39
Virtual Memory in Action
• Some memory chunks
(pages) are in memory
• Rest in disk
• OS is responsible for
retrieving the pages
from and flushing the
pages to disk
Lec 1
Operating Systems
40
To Use Storage, We Need a Filesystem
Lec 1
Operating Systems
41
Storage Management: Component
View
Lec 1
Operating Systems
42
Topics Covered
• Fundamentals (Operating Systems Structures)
• Process Control and Threads
• Synchronization and scheduling
• Protection, Address translation, Caching
• Demand Paging
• File Systems
• Networking and Distributed Systems
• Protection and Security
Lec 1
Operating Systems
43