ppt - Duke Computer Science

Download Report

Transcript ppt - Duke Computer Science

Operating Systems
Operating systems






Most important program that runs on a computer
Every general-purpose (such as desktop) computer must
have OS to run other programs
Manages the hardware and software resources of the
system
Provides stable and consistent way for applications to
deal with the hardware without having to know all the
details
Most common
 Windows, UNIX, Macintosh
Many other OS designed for special-purpose applications
 mainframes, robotics, manufacturing, real-time control
systems
Starting the computer




BIOS loads the bootstrap loader (or bootstrap program)
from a known location on disk and starts it
Bootstrap loader looks for the OS kernel and loads it into
memory
The kernel initializes the hardware present in the system
and loads required drivers
OS begins loading services and application programs and
shows the user interface
Managing hardware and software


Various programs and input methods compete for the
attention of the central processing unit (CPU)
 programs and methods demand memory, storage and
input/output (I/O) bandwidth for their own purposes
OS makes sure each application gets the necessary
resources while cooperating with the other applications
 economizes capacity of the system to greatest benefit
of users and applications.
Software  OS  Hardware
Providing consistent application interface



Important if more than one type of computer is using OS
or if computer hardware is open to change
A consistent application program interface (API) allows
software developer to write an application on one
computer and have a high level of confidence that it will
run on another computer of the same type
 even if the amount of memory or the quantity of
storage is different on the two machines
OS can ensure that applications continue to run when
hardware upgrades and updates occur
 OS and not the application is charged with managing
the hardware and the distribution of its resources
Tasks of the OS


A task refers to the combination of a program being
executed and bookkeeping information used by the
operating system
Tasks of the OS:
 Processor management
 Memory management
 Device management
 Storage management
 Application interface
 User interface
Processor management



Ensuring that each process and application receives
enough of the processor's time to function properly
Using as many processor cycles for real work as is
possible
Processes (thread)
 schedule work done by processor
 CPU can only do one thing at a time
 OS has to switch between different processes
thousands of times a second
 OS sets a certain number of CPU execution cycles to
one program, after those cycles switches to another
program, etc.
Memory and storage management



Each process must have enough memory in which to
execute, and it can neither run into the memory space of
another process nor be run into by another process
The different types of memory in the system must be used
properly so that each process can run most effectively
Memory types
 High-speed cache - fast, small amounts of memory
available to the CPU, where cache controllers predict
which data CPU will need next and pull it from main
memory
 Main memory - RAM
 Secondary memory - disk
Virtual memory



The memory installed in a computer is called physical
memory
 limited in size and shared by all processes
Virtual memory assigns a different address space to every
process
 address 5 for process 1 describes a different location
in physical memory than address 5 for process 2
 prevents processes from accessing each others
memory (memory protection)
OS can allocate more space in virtual memory than is
present in physical memory by using paging
Paging






OS must balance the needs of the various processes with
the availability of the different types of memory
Not enough memory to run all processes simultaneously
Processes not running take up space in memory
Paging: allocating physical memory to processes in fixedsize blocks called pages
Separate programs into pages and keep only a few pages
of each running program in memory at one time
 active pages kept in memory
 inactive pages kept on disk, brought in as needed
Moving pages in and out of memory is called swapping
Thrashing


If user runs too many processes at the same time, OS will
use majority of its available CPU cycles to swap between
processes rather than run processes
Paging or swapping systems that are overloaded waste
most of their time moving data rather than performing
useful computation
Thrashing


CPU utilization, system throughput and system response
time decrease resulting poor performance of a system
Risk of thrashing increases with degree of multiprogramming
Device management



Device driver
 path between the operating system and (most)
hardware not on computer's motherboard
 translator between signals of the hardware subsystems
and high-level programming languages of the OS and
application programs
 takes file data from OS and translates into bit streams
put in specific locations on storage devices
Drivers are run when device is required, function basically
like any other process
OS assigns high-priority blocks to drivers so hardware
resources can be released and readied for further use as
quickly as possible
Application and user interfaces


Application Program Interfaces (APIs)
 allow application programmers to use functions of
computer and OS without worrying about details of
CPU operation
 provides a consistent way for applications to use the
resources of the computer system
User Interface (UI)
 brings structure to the interaction between a user and
the computer
 program or set of programs that sits as a layer above
the OS
 usually a graphical user interface (GUI)
Classification
Multi-user
 allows many different users to take advantage of the
computer's resources simultaneously
 Single-user, multi-tasking
 single user operates many programs at same time
 most desktop and laptop computers today
 Single-user, single task
 one user can do one thing at a time (e.g. Palm OS)
 Real time (RTOS)
 particular operation executes in precisely the same
amount of time every time it occurs
 machinery, scientific instruments and industrial
systems

Types of operating systems
Open Source


Description of software distributed as source code under
licenses that guarantee everyone the right to freely use,
change, or redistribute the source code
Initiated by Bruce Perens
 primary author of The Open Source Definition, the
formative document of Open Source movement
The basic idea behind open source is very simple: When
programmers can read, redistribute, and modify the source
code for a piece of software, the software evolves. People
improve it, people adapt it, people fix bugs. And this can
happen at a speed that, if one is used to the slow pace of
conventional software development, seems astonishing.
www.opensource.org
Open Source definition

Distribution terms of open-source software must comply
with the following criteria:
1. free redistribution
2. source code
3. derived works
4. integrity of the author's source code
5. no discrimination against persons or groups
6. no discrimination against fields of endeavor
7. distribution of license
8. license must not be specific to a product
9. the license must not restrict other software
10. the license must be technology-neutral
www.opensource.org
The GNU Project




Founded by Richard Stallman
Launched in 1984 to develop a complete free Unix- like
operating system: GNU
GNU Manifesto
 written by Stallman at start of GNU Project to ask for
participation and support
GNU is free software
 everyone is free to copy
and redistribute it as well
as make changes either
large or small
 www.gnu.org
Linux




Linux is a Unix-like kernel, created by Linus Torvalds
in 1991
Linux together with the GNU operating system made
a complete free system: a Linux-based version of the
GNU system
 GNU/Linux system
GNU/Linux systems
are in widespread use
 estimated 20 million users
Complete, free OS
References
www.webopedia.com
 www.howstuffworks.com
 www.linux.org
 www.microsoft.com
 www.apple.com
 www.opensource.org
 www.stallman.org
 www.gnu.org
 www.perens.com
 FOLDOC
