Cs238 Introduction to Operating Systems

Download Report

Transcript Cs238 Introduction to Operating Systems

Cs238 Introduction to Operating
Systems
Dr. Alan R. Davis
Course Information
• Text: Applied Operating System Concepts.
1st Ed. Silbershatz, Galvin, and Gagne.
John Wiley & Sons, Inc. 2000
• Grading: 2 Tests (25% each), a Final Exam
(50%), and a Project (50%)
• Goals: be able to define and give examples
of OS terminology; be able to describe,
diagram, outline OS structures; be able to
describe, implement, design OS algorithms
Operating Systems
What is an operating system?
• An operating system is a program that makes
the computer perform tasks for the computer
user.
• An operating system controls and coordinates
the use of the hardware among the various
applications programs and users.
• An operating system is the one program always
running on the computer.
• An operating system provides the environment
within which programs are executed.
Operating Systems
An operating system is a resource allocator
And it is a control program
•
•
•
•
•
CPU time
Memory space
File storage space
I/O devices
The OS manages these resources, allocating
them to specific programs and users.
• It controls the execution of user programs.
• It controls the I/O devices
Examples of Operating Systems
What operating systems are you familiar with?
• Windows?
– Windows 98, Windows NT, Windows 2000
– Windows Me, Whistler
• Unix?
– Linux
• Older operating systems?
– Windows 3.1, Windows 95
– MS-DOS
– Multics
Examples of Operating Systems
cont’d
What new operating systems have you heard of?
•
•
•
•
•
•
•
•
Whistler
JavaOS
Microsoft Windows CE
PalmOS
AppForge
vxWorks
i-opener
BEOS
Examples of Operating Systems
cont’d
Learn from the past
• Atlas, 1958, virtual memory, Univ Manchester
• XDS-940, 1965, time-shared, UC Berkeley
• THE, 1968, layer structure, concurrent
processing
• RC4000, operating system kernel
• CTSS, compatible time-sharing system, MIT
• MULTICS, 1966, time-sharing, MIT
• OS/360, 1966
• Mach
Introduction and Overview cont’d
• Computer architecture and operating systems
influence each other. Change one, you need to
change the other.
• Operating systems and applications programs are
not always clearly separate.
• Efficient operating systems require efficient
algorithms.
• Operating system features are developed to solve
simple(?) problems. Complexity usually comes
from the details.
Simple Batch Systems
If computers are extremely expensive ... ?
• Hire a professional to run them, and keep
the users away.
• How do the users use the machine then?
• They give their programs to the professional
operator.
• How does he know what the program is
going to need to use?
• The programmer must supply the
information. Job Control Language, JCL
Simple Batch Systems cont’d
What information should be in the JCL?
•
•
•
•
Accounting info ... user name, dept, etc.
What language is to be used.
Where the program starts and stops.
Where the data starts and stops.
Simple Batch Systems cont’d
How do you reduce setup time?
• The operator must take the program from the
user, look at the instructions, load the required
compiler, compile the program, load the required
assembler, assemble the program, load the data,
run the program, check to see how the program
stops (normally or abnormally), output the
results, or output a dump of memory, etc.
• By placing all jobs requiring the same compiler
together, some of this setup time can be
eliminated. This is called batch processing.
Simple Batch Systems cont’d
• Programs used to be placed one instruction at a
time onto punched cards, using a card punch
machine.
• The cards were then placed into a card reader,
and the information was sent to the CPU of the
computer.
• Output would then go to a line printer.
• Card readers and line printers were very slow
compared to CPU speeds.
• The CPU would often have to wait for more
cards to be input, or for data to be printed.
Simple Batch Systems cont’d
How do you decrease I/O time?
• Read and write the data to a buffer.
• Keep reading data to the buffer while the CPU is
working on previous input.
• Keep printing data from the buffer while the
CPU is working on subsequent instructions.
• This process is called spooling, or simultaneous
peripheral operation on-line.
• A tape drive or disk drive could be used for
spooling. The drive hardware was usually faster
(and more expensive) than the card reader or
line printer.
Simple Batch Systems cont’d
What do you do with all those jobs on the disk?
• Spooling creates a set of jobs, called a job
pool, on the external memory device.
• A human operator is too slow to organize
them into proper batches.
• We need a program (operating system) on
the CPU to handle job scheduling.
• This operating system has to decide which
job to move from external memory to main
memory for processing.
Multiprogrammed Batch Systems
One user can’t keep the CPU busy enough ...
• So we can let multiple users place their jobs
into the job pool.
• If main memory is large enough (which by this
point it is) the operating system can move
several jobs from the job pool into main
memory (job scheduling).
• Now the operating system must also decide
which job to run next (only one job can run at a
time). This is called CPU scheduling.
Multiprogrammed Batch Systems
But the CPU is still waiting if Jobx is doing I/O ...
• We can let the operating system halt Jobx
briefly, and give the CPU resource to Jobz.
Multiprogrammed Batch Systems
Won’t everything get mixed up?
• We need to make sure that Jobx does not
interfere with or destroy Jobz or its data.
• Therefore we need the operating system to
manage memory (memory management)
and separate the multiple programs in
memory (protection).
Time-Sharing Systems
How do you reduce turn-around time?
• Multiprogrammed batched systems effectively
used the CPU and other resources, except for
the “programmer resource”.
• Users/programmers had no contact with their
work until it was over.
• Errors could take many runs to correct.
• Programs could not interact with the user.
• Give the user access to the machine while the
program is running.
Time-Sharing Systems cont’d
• Access requires hardware ... keyboards,
terminals, etc.
• Access requires software ... the operating
system must now control/allow the users to
communicate with their programs.
• We are still multiprogramming, but the
switches between programs occur much faster.
We call this multitasking.
• Control statements are not read from the cards
anymore, but from the user at the keyboard.
Time-Sharing Systems cont’d
How do we access the data and the code conveniently?
• We now need an on-line file system.
• We have source files, object files, data files
• Data files can be numeric, alphabetic,
alphanumeric
• Files can be free form or rigidly formatted
• The operating system implements the
abstract concept of a file
• Files can be organized into directories
• They can have access rights
Time-Sharing Systems cont’d
• Time-sharing systems were developed to
provide interactive use of a computer system at
a reasonable cost.
• A process is a program that is loaded into
memory and is executing.
• Time-sharing systems didn’t become popular
until the early 1970s.
• Earlier batch systems were modified ... IBM’s
OS/360 gained the Time-Sharing Option (TSO)
Personal Computers
• Advances in hardware in the 1970s allowed the
invention of personal computers
• Operating systems were key to the success of
these machines, since they were designed to be
easy to use.
• Many concepts of previous mainframe operating
systems were adapted to personal computers.
• Some mainframe concepts were not adapted in
the early PCs because the hardware support did
not yet exist.
Personal Computers cont’d
• PCs have arguably been the driving force of
change in both hardware and software in the
last few decades.
• Apple’s operating system and Microsoft
Windows have radically changed the way
that users interact with computer systems.
• Because of the huge numbers of users of
PCs operating system developments are
now front page news.
Parallel Systems
• Multiprocessor systems, currently usually
servers, have more than one CPU.
• Operating systems must be able to manage
this hardware.
• Since these system often share the bus, the
clock, and sometimes memory and
peripheral devices, they are called tightly
coupled systems.
Parallel Systems cont’d
• Parallel systems are designed to increase
throughput.
• However, n CPUs do not accomplish n
times the work because of the overhead of
cooperation.
• Parallel systems are also designed to
improve reliability.
• If one processor fails, then the system can
continue with the remaining ones.
Parallel Systems cont’d
• In a symmetric multiprocessing system each
processor runs an identical copy of the
operating system.
• In an asymmetric multiprocessing system one
processor (the master) controls the system, the
others either have predefined tasks or look to
the master processor for instructions.
• SunOS Version 4 provides asymmetric
multiprocessing.
• SunOS Version 5 (Solaris 2) is symmetric.
Distributed Systems
• Multiple processors need not be inside the
same system.
• A loosely coupled or distributed system is
one in which each processor has its own
memory and clock and communicates with
the others through various means such as
high-speed buses, telephone lines, network
cables.
• The processors may also vary in size, type,
and function.
Distributed Systems cont’d
• Distributed systems allow resource sharing,
computation speedup, reliability, and
communication.
Real-Time Systems
• Real-time systems are used when there are rigid
time requirements on the operation of a processor
or the flow of data.
• Often used in control devices hardware systems
such as automobile engines, weapons systems,
home appliances, or real-time stock quotes.
• Hard real-time systems guarantee that critical tasks
complete on time.
• Soft real-time systems give priority to critical realtime tasks.