Download Monday, 26 November, 2007.

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

Library (computing) wikipedia , lookup

Plan 9 from Bell Labs wikipedia , lookup

DNIX wikipedia , lookup

RSTS/E wikipedia , lookup

Burroughs MCP wikipedia , lookup

Spring (operating system) wikipedia , lookup

Mobile operating system wikipedia , lookup

Unix security wikipedia , lookup

Copland (operating system) wikipedia , lookup

Security-focused operating system wikipedia , lookup

Process management (computing) wikipedia , lookup

CP/M wikipedia , lookup

Paging wikipedia , lookup

Distributed operating system wikipedia , lookup

VS/9 wikipedia , lookup

Transcript
Operating Systems in a Nutshell
26-30 November 2007
WWW: http://www.ru.is/luca/osintro/
Operating System Concepts with Java – 7th Edition, Nov 15, 2006
Silberschatz, Galvin and Gagne ©2007
Operating Systems in a Nutshell


Aims/Learning Outcomes:
 Understand the basic concepts and algorithms
underlying the handling of processes in modern
operating systems and in parallel systems.
 To be able to make models of concurrent systems
using Uppaal and to use the tool to analyze their
behaviour.
At the end of the week, you will be expected to know
(and be able to think creatively about) the following key
topics: Processes, process scheduling, process
synchronization, and deadlocks.
Operating System Concepts with Java – 7th Edition, Nov 15, 2006
1.2
Silberschatz, Galvin and Gagne ©2007
Why Is This Important?




Operating systems are one of the key software systems.
The theory of OS design has been the source of many of
the abstractions that permeate parallel computing (e.g.
control systems).
 Motto: Abstraction is the key to computing!
Big Picture: OS design will reinforce your belief in the
worth of abstraction, good software engineering and
design principles, and in “thinking before coding” 
Connections with many topics in parallel programming,
formal methods (need for “Modelling and Verification”!),
security, distributed systems, etc.
Operating System Concepts with Java – 7th Edition, Nov 15, 2006
1.3
Silberschatz, Galvin and Gagne ©2007
The Boring Preliminaries



Language of instruction: (Italian/Icelandic) English 
Textbooks:
 Avi Silberschatz, Peter Baer Galvin and Greg Gagne. “Operating
System Concepts with Java” (7th ed.).
 The Little Book of Semaphores by Allen B. Downey. Freely
available here.
Lecturers:
 Ari K. Jónsson and Hannes H. Vilhjálmsson [on 26 November]
 Luca Aceto (Web: http://www.ru.is/faculty/luca/; Email:
[email protected], [email protected]; Skype: luca_aceto; Physical:
Kringlan 1) [on 29-30 November]
Operating System Concepts with Java – 7th Edition, Nov 15, 2006
1.4
Silberschatz, Galvin and Gagne ©2007
Methods of Instruction



Lectures
 Take active part! Socratic method (aka, let’s play
ping-pong ).
 Slides will be made available on line.
Exercise sessions
 What we learn, we learn by doing! Be active!
Independent work
 Read book material independently.
 Formulate questions and try to answer them. (What
if...)
 Peer instruction.
Operating System Concepts with Java – 7th Edition, Nov 15, 2006
1.5
Silberschatz, Galvin and Gagne ©2007
Evaluation




One group project accounting for 30% of the final mark
for the course.
Work in groups of 3-4 people.
Project report (at most 8 pages) due in the form of a PDF
file by Sunday, 2 December at 23:59 GMT.
Policy/Code of Conduct
 All work is due by the date and time specified in the
respective assignment; there are no extensions.
 Assignments should report on your own work.
Representing another's work as one's own is
plagiarism and a violation of the RU Academic Code
of Conduct.
Operating System Concepts with Java – 7th Edition, Nov 15, 2006
1.6
Silberschatz, Galvin and Gagne ©2007
Plan for the Mini-course




Today: An introduction to operating systems: What they
are and what they do.
Tuesday-Wednesday, 27-28 November 2007.
(Independent work sessions) The joys of concurrency
Thursday, 29 November 2007, from 8:15 till 12:00.
Process scheduling and synchronization. Afternoon
devoted to project work.
Friday, 30 November 2007, from 8:15 till 10:00.
Deadlock. Project work will follow. You are also
encouraged to attend Brian Nielsen’s tutorial on Modelbased Testing of Real-time Systems (13:00-16:00).
Operating System Concepts with Java – 7th Edition, Nov 15, 2006
1.7
Silberschatz, Galvin and Gagne ©2007
Let’s Get Down to Business







What Operating Systems Are/Do
Computer-System Organization
Computer-System Architecture
Operating-System Structure
Operating-System Operations
Process Management
Memory Management
Operating System Concepts with Java – 7th Edition, Nov 15, 2006
1.8
Silberschatz, Galvin and Gagne ©2007
Objectives of the Lecture


To provide a trailer for the course by giving a
grand tour of the major operating systems
components
To provide coverage of basic computer system
organization. (You have it already, don’t you?)
Operating System Concepts with Java – 7th Edition, Nov 15, 2006
1.9
Silberschatz, Galvin and Gagne ©2007
What is an Operating System?




A program that acts as an intermediary between a
user of a computer and the computer hardware.
 Can you name examples of operating systems?
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.
 What do you use the operating system for?
What do you mean with “computer system”?
Operating System Concepts with Java – 7th Edition, Nov 15, 2006
1.10
Silberschatz, Galvin and Gagne ©2007
Four Components of a Computer System
Operating System Concepts with Java – 7th Edition, Nov 15, 2006
1.11
Silberschatz, Galvin and Gagne ©2007
Operating System Definition



OS is a resource allocator
 Manages all resources
 Decides between conflicting requests for efficient
and fair resource use
OS is a control program (yes!)
 Controls execution of programs to prevent errors
and improper use of the computer
Why is this necessary/desirable?
Operating System Concepts with Java – 7th Edition, Nov 15, 2006
1.12
Silberschatz, Galvin and Gagne ©2007
Operating System Definition (Cont.)





No universally accepted definition
“Everything a vendor ships when you order an
operating system” is good approximation
“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 systems differ a lot in how much they
offer in the kernel and in their structure.
An operating system is what it does!
Operating System Concepts with Java – 7th Edition, Nov 15, 2006
1.13
Silberschatz, Galvin and Gagne ©2007
In the Beginning: Computer Startup


bootstrap program is loaded at power-up or
reboot
 Typically stored in ROM or EPROM, generally
known as firmware
 Initializates all aspects of system
 Loads operating system kernel and starts
execution
What happens next?
Operating System Concepts with Java – 7th Edition, Nov 15, 2006
1.14
Silberschatz, Galvin and Gagne ©2007
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
Operating System Concepts with Java – 7th Edition, Nov 15, 2006
1.15
Silberschatz, Galvin and Gagne ©2007
Computer-System Operation






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 for I/O data
and registers (content determines type of operation).
CPU moves data from/to main memory to/from local
buffers
I/O is from the device to local buffer of controller.
Device controller informs CPU that it has finished its
operation by causing an interrupt.
 What happens upon occurrence of an interrupt?
Operating System Concepts with Java – 7th Edition, Nov 15, 2006
1.16
Silberschatz, Galvin and Gagne ©2007
Common Functions of Interrupts





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. How could this happen?
A trap is a software-generated interrupt caused
either by an error or a user request.
An operating system is interrupt driven.
Operating System Concepts with Java – 7th Edition, Nov 15, 2006
1.17
Silberschatz, Galvin and Gagne ©2007
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
Operating System Concepts with Java – 7th Edition, Nov 15, 2006
1.18
Silberschatz, Galvin and Gagne ©2007
I/O Structure


Synchronous I/O: After I/O starts, control returns to user
program only upon I/O completion.
 Wait instruction idles the CPU until the next interrupt
 Wait loop (contention for memory access).
 At most one I/O request is outstanding at a time, no
simultaneous I/O processing.
Asynchronous I/O: After I/O starts, control returns to user
program without waiting for I/O completion.
 System call – request to the operating system to allow user
to wait for I/O completion.
 Device-status table contains entry for each I/O device
indicating its type, address, and state.
 Operating system indexes into I/O device table to determine
device status and to modify table entry to include interrupt.
Operating System Concepts with Java – 7th Edition, Nov 15, 2006
1.19
Silberschatz, Galvin and Gagne ©2007
Two I/O Methods
Synchronous
Operating System Concepts with Java – 7th Edition, Nov 15, 2006
Asynchronous
1.20
Silberschatz, Galvin and Gagne ©2007
Operating System Structure


Multiprogramming needed for efficiency
 Single user cannot keep CPU and I/O devices busy at
all times
 Multiprogramming organizes jobs (code and data) so
CPU always has one to execute
 A subset of total jobs in system is kept in memory
 One job selected and run via job scheduling (aka
long-term scheduling)
 When it has to wait (for I/O for example), OS switches
to another job
What are the main differences with the “single-user”
setting? Benefits vs. problems?
Operating System Concepts with Java – 7th Edition, Nov 15, 2006
1.21
Silberschatz, Galvin and Gagne ©2007
Operating System Structure (Cont.)

Timesharing (multitasking): CPU switches jobs so
frequently that users can interact with each job while it
is running, creating interactive computing
 Response time should be < 1 second
 Each user has at least one program executing in
memory process (a key abstraction!)
 If several jobs ready to run at the same time 
CPU scheduling
 If processes don’t fit in memory, swapping moves
them in and out to run
 Virtual memory allows execution of processes not
completely in memory
Operating System Concepts with Java – 7th Edition, Nov 15, 2006
1.22
Silberschatz, Galvin and Gagne ©2007
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
Single-threaded process has one program counter specifying
location of next instruction to execute
 Process executes instructions sequentially, one at a time, until
completion
Multi-threaded process has one program counter per thread
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
Operating System Concepts with Java – 7th Edition, Nov 15, 2006
1.23
Silberschatz, Galvin and Gagne ©2007
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
 What is the difference?
 Providing mechanisms for deadlock handling
 Why? Examples?
Operating System Concepts with Java – 7th Edition, Nov 15, 2006
1.24
Silberschatz, Galvin and Gagne ©2007
Memory Management (not covered in the course)





All data in main memory before and after processing
All instructions in main 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
Needs sophisticated algorithms with proper hardware
support!
Operating System Concepts with Java – 7th Edition, Nov 15, 2006
1.25
Silberschatz, Galvin and Gagne ©2007
Storage Management (not covered)


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, datatransfer 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. (Example: Unix “rwx” access rights for “ugo”.)
 OS activities include
 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
Operating System Concepts with Java – 7th Edition, Nov 15, 2006
1.26
Silberschatz, Galvin and Gagne ©2007
Plan for the Rest of the Week



No lectures on Tuesday and Wednesday.
 “Good, I can be idle and party!”
 No way!
 Do independent reading as suggested on the course
web page.
 Install Uppaal, play with it, and work out suggested
exercises.
 Discuss the course material amongst yourselves.
Lectures and project work on Thursday and Friday.
Operating System Concepts with Java – 7th Edition, Nov 15, 2006
1.27
Silberschatz, Galvin and Gagne ©2007
End of Session 1
Operating System Concepts with Java – 7th Edition, Nov 15, 2006
Silberschatz, Galvin and Gagne ©2007