What Is An Operating System?: CPU Data Bus Address Bus

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

What is an Operating System?

Computer system: hardware, operating


Silberschatz, Galvin, and Gagne system, application programs, users
Computer hardware: von Neumann
architecture: CPU, memory, input/output
Topics based on Chapters 1 & 3
Applications programs: compilers,
Operating System Structures assemblers, text editors, utilities, etc....
Operating system: interface between
hardware and applications programs
CS 431 -- Computer Operating Systems 1 2002 Timothy J. McGuire, Ph.D. CS 431 -- Computer Operating Systems 2 2002 Timothy J. McGuire, Ph.D.

Von Neumann Architecture

Data bus
CPU Address bus

Controller Controller
Main
Memory
User
I/O Subsystem
CS 431 -- Computer Operating Systems 3 2002 Timothy J. McGuire, Ph.D. CS 431 -- Computer Operating Systems 4 2002 Timothy J. McGuire, Ph.D.

Operating System Definitions Operating System


Resource allocator--manages and allocates OS balances conflicting needs of users and
resources programs. Coordinator. Permits multiple
activities to coexist in efficient and fair manner.
Control program--controls the execution of Implements policy based on assumptions
user programs and operation of I/O devices Is hardware cheap or expensive?
Kernel--the one program running at all Interactive response time vs. wall clock time
times (all else being application programs) Protect users or facilitate sharing?
How encompassing is OS? Kernel concept. Is
CLI in OS?
CS 431 -- Computer Operating Systems 5 2002 Timothy J. McGuire, Ph.D. CS 431 -- Computer Operating Systems 6 2002 Timothy J. McGuire, Ph.D.
Historical Overview 1940s: No operating system
Early assumption Programmer writes in machine language,
Hardware (very!) expensive and rare when enters program directly (e.g., switches),
compared to people time operates computer
Goal: make more efficient use of hardware Dedicated computer and peripherals;
even at expense of personal productivity programmer=operator
Modern assumption Different environments for different tasks.
Hardware cheap. People are expensive.
Manual scheduling. Organizational factors
Perhaps have common subroutine library
CS 431 -- Computer Operating Systems 7 2002 Timothy J. McGuire, Ph.D. CS 431 -- Computer Operating Systems 8 2002 Timothy J. McGuire, Ph.D.

JCL (Job Control Language)


1950s: Simple batch processing
OS/360
Programmer <> Operator //QUESTNAR JOB (204121),MARCO.POLO,MSGLEVEL=1
// EXEC ASMFCG
Resident monitor (computer program): load and //ASM.SYSIN DD *
Program to be assembled
run, dump if exception /*
//GO.OBJECT DD DSNAME=USERLIB,DISP=OLD
Batching jobs (automatic job sequencing) // DD *
JCL (Job Control Language) Object deck of subroutine
/*
One job at a time but maximize hardware use: off- //GO.SYSPRINT DD SYSOUT=A,DCB=(BLKSIZE=133)
//GO.INDATA DD DISP=OLD,UNIT=TAPE9,
line operation, buffering, interrupt handling, // DSNAME=QUEST214,VOLUME=SER=102139
spooling, job scheduling (e.g., by time, subsystem, //GO.SYSIN DD *
etc..) Data cards, perhaps control cards for the program
/*
CS 431 -- Computer Operating Systems 9 2002 Timothy J. McGuire, Ph.D. CS 431 -- Computer Operating Systems 10 2002 Timothy J. McGuire, Ph.D.

Off-line operation Off-line operation

Load jobs into memory from tapes, not


directly from cards
Tape units are faster than card readers
Application programs act as before
Possible to use multiple reader-to-tape and
tape-to-printer systems for one CPU

CS 431 -- Computer Operating Systems 11 2002 Timothy J. McGuire, Ph.D. CS 431 -- Computer Operating Systems 12 2002 Timothy J. McGuire, Ph.D.
Early 1960s: Multiprogramming
Spooling
and multiprocessing
Multiprogramming: several users share system at Overlaps I/O of one job with computation
same time of another job.
batched: keep CPU busy by switching in other While executing a job, the OS
work when idle (e.g., waiting for I/O)
Reads next job from card reader into storage
Multitasking (timesharing): frequent switches to
area on disk (job queue)
permit interactive use (extension of
multiprogramming) Outputs printout of previous job from disk to
printer
Multiprocessing: several processors are used on a
single system Issue: what job to select to run next?
CS 431 -- Computer Operating Systems 13 2002 Timothy J. McGuire, Ph.D. CS 431 -- Computer Operating Systems 14 2002 Timothy J. McGuire, Ph.D.

Mid-1960s to mid-1970s:
Spooling
General purpose systems
Large and expensive (e.g., OS/360)
100ks of lines of code
hundreds to thousands of development man-
years
complex, asynchronous, ideosyncratic to
specific hardware
never completely debugged (1000s of release
bugs)
hard to predict behavior, requires guesswork
CS 431 -- Computer Operating Systems 15 2002 Timothy J. McGuire, Ph.D. CS 431 -- Computer Operating Systems 16 2002 Timothy J. McGuire, Ph.D.

Mid-1960s to mid-1970s Mid 1970s to present


OS begins to be treated as subject area Cheap hardware, very expensive people
formerly collection of individual problems OS in support of single user or small group of
basic concepts becoming standardized; cooperating users
theoretical underpinnings developed Single process support evolves to multiple process
research: concurrency, protection, scheduling support
(e.g., avoid thrashing), portability, Device independent standards; commercial,
maintainability (e.g., kernels) defacto, and formal (MS-DOS, Unix, POSIX, etc.)
research systems (e.g., Project MAC, THE) Support for window packages, etc.

CS 431 -- Computer Operating Systems 17 2002 Timothy J. McGuire, Ph.D. CS 431 -- Computer Operating Systems 18 2002 Timothy J. McGuire, Ph.D.
Different actors view OS
Two interesting special cases
differently
Distributed systems Operating system designers--systems
tightly coupled (shared memory and clock) vs. components and their interconnections
loosely coupled (distributed) Users--services provided by the operating
issues of resource sharing, load sharing, system
reliability, communication
Programmers--interface provided (i.e.,
Real-time systems
system calls), their organization, and other
obligation to complete processing to meet
defined constraints. Often conflicts with
abstractions
timesharing
CS 431 -- Computer Operating Systems 19 2002 Timothy J. McGuire, Ph.D. CS 431 -- Computer Operating Systems 20 2002 Timothy J. McGuire, Ph.D.

Common system components Process management


Process Management The process is the unit of work in a system.
Main-Memory Management A process is a program in execution. A
Secondary-Storage Management process needs certain resources, including
File Management CPU time, memory, files, and I/O devices,
I/O System Management to accomplish its task.
Protection System A program is passive; a process is dynamic
Networking
Command-Interpreter System

CS 431 -- Computer Operating Systems 21 2002 Timothy J. McGuire, Ph.D. CS 431 -- Computer Operating Systems 22 2002 Timothy J. McGuire, Ph.D.

Process management Main memory management


The operating system is responsible for the Main memory is
following process management activities large array of words or bytes, each with its own
process creation and deletion. address
process suspension and resumption. repository of quickly accessible data shared by
provision of mechanisms for: CPU and I/O devices
process synchronization volatile
process communication
deadlock handling

CS 431 -- Computer Operating Systems 23 2002 Timothy J. McGuire, Ph.D. CS 431 -- Computer Operating Systems 24 2002 Timothy J. McGuire, Ph.D.
Main memory management Secondary storage management
The operating system must Persistent storage; larger capacity than
Keep track of which parts of memory are primary storage
currently being used and by whom. Generally disks in modern systems
Decide which processes to load when memory
Operating system responsibilities:
space becomes available.
Free-space management
Allocate and deallocate memory space as
needed. Storage allocation
Disk scheduling

CS 431 -- Computer Operating Systems 25 2002 Timothy J. McGuire, Ph.D. CS 431 -- Computer Operating Systems 26 2002 Timothy J. McGuire, Ph.D.

File management I/O System management


Logical storage unit: file (an abstract Hides details of hardware devices from user
concept that is mapped onto a physical I/O subsystem consists of
implementation) memory management component: buffering,
Operating system responsibilities: caching, and spooling
creation and deletion of files and directories general device-driver interface
primitives for manipulating files and directories drivers for specific hardware devices
mapping files onto secondary storage
backup of files on stable storage media
CS 431 -- Computer Operating Systems 27 2002 Timothy J. McGuire, Ph.D. CS 431 -- Computer Operating Systems 28 2002 Timothy J. McGuire, Ph.D.

Protection system Networking


Protection refers to a mechanism for Distributed system: collection of processors that
controlling access by programs, processes, do not share memory, peripheral devices, or a
or users to both system and user resources. clock (they have local memory and clock)
Communicate through a communications network
The protection mechanism must: (many different routing and connection strategies)
distinguish between authorized and Provides user access to (heterogeneous) system
unauthorized usage. resources
specify the controls to be imposed. Allows computation speedup, increased data
provide a means of enforcement. availability, and enhanced reliability
CS 431 -- Computer Operating Systems 29 2002 Timothy J. McGuire, Ph.D. CS 431 -- Computer Operating Systems 30 2002 Timothy J. McGuire, Ph.D.
Command-interpreter system Command-interpreter system
Interface between user and operating system Control statements may deal with:
Some systems put into kernel; others treat as a process creation and management
program (e.g., Unix and MS-DOS) I/O handling
Control-statement-driven systems also called secondary-storage management
control-card interpreter
main-memory management
command-line interpreter
shell
file-system access
Function: Get next command and execute it protection
networking
CS 431 -- Computer Operating Systems 31 2002 Timothy J. McGuire, Ph.D. CS 431 -- Computer Operating Systems 32 2002 Timothy J. McGuire, Ph.D.

Users view Users view


Operating system services Operating system services
Program execution system capability to load a Communications exchange of information
program into memory and to run it. between processes executing either on the same
I/O operations since user programs cannot computer or on different systems tied together by
execute I/O operations directly, the operating a network. Implemented via shared memory or
system must provide some means to perform I/O. message passing.
File-system manipulation program capability to Error detection ensure correct computing by
read, write, create, and delete files. detecting errors in the CPU and memory
hardware, in I/O devices, or in user programs.

CS 431 -- Computer Operating Systems 33 2002 Timothy J. McGuire, Ph.D. CS 431 -- Computer Operating Systems 34 2002 Timothy J. McGuire, Ph.D.

Users view Programmers view


Operating system services System calls
Services that ensure the efficient operation of the Interface between process and operating
system system
Resource allocation: allocating resources to multiple
users or multiple jobs running at the same time. Often called by assembly-language
Accounting: keep track of and record which users use programs but may be available to higher-
how much and what kinds of computer resources for level language programmers in some
account billing or for accumulating usage statistics.
systems (e.g., C, Bliss, BCPL, etc.)
Protection: ensuring that all access to system resources
is controlled. Java does not allow system calls to be made
directly because it is platform independent
CS 431 -- Computer Operating Systems 35 2002 Timothy J. McGuire, Ph.D. CS 431 -- Computer Operating Systems 36 2002 Timothy J. McGuire, Ph.D.
System calls System calls
Three general methods are used to pass parameters Major categories of system calls:
between a running program and the operating Process control
system:
File manipulation
Pass parameters in registers.
Store the parameters in a table in memory, and the table Device manipulation
address is passed as a parameter in a register. Information maintenance
Push (store) the parameters onto the stack by the Communications
program, and pop off the stack by the operating system.

CS 431 -- Computer Operating Systems 37 2002 Timothy J. McGuire, Ph.D. CS 431 -- Computer Operating Systems 38 2002 Timothy J. McGuire, Ph.D.

System calls System calls


Process control File manipulation
end, abort create file, delete file
load, execute open, close
create process, terminate process read, write, reposition
get process attributes, set process attributes get file attributes, set file attributes
wait for time
wait event, signal event
allocate and free memory
CS 431 -- Computer Operating Systems 39 2002 Timothy J. McGuire, Ph.D. CS 431 -- Computer Operating Systems 40 2002 Timothy J. McGuire, Ph.D.

System calls System calls


Device manipulation Information maintenance
request device, release device get time or date, set time or date
read, write, reposition get system data, set system data
get device attributes, set device attributes get process, file, or device attributes
logically attach or detach devices set process, file, or device attributes

CS 431 -- Computer Operating Systems 41 2002 Timothy J. McGuire, Ph.D. CS 431 -- Computer Operating Systems 42 2002 Timothy J. McGuire, Ph.D.
System calls System structure
Communications Simple approach
create, delete communication connection MS-DOS written to provide the most
send, receive messages functionality in the least space
transfer status information not divided into modules
Although MS-DOS has some structure, its
attach or detach remote devices interfaces and levels of functionality are not
well separated

CS 431 -- Computer Operating Systems 43 2002 Timothy J. McGuire, Ph.D. CS 431 -- Computer Operating Systems 44 2002 Timothy J. McGuire, Ph.D.

System structure System structure


Simple approach Layered approach
Unix limited by hardware functionality, the The operating system is divided into a
original Unix operating system had limited number of layers (levels), each built on top
structuring. The Unix OS consists of two of lower layers. The bottom layer (layer 0)
separable parts:
is the hardware; the highest (layer N) is the
Systems programs
The kernel
user interface.
Consists of everything below the system-call interface and With modularity, layers are selected such
above the physical hardware
Provides the file system, CPU scheduling, memory
that each uses functions (operations) and
management, and other operating-system functions; a large services of only lower-level layers.
number of functions for one level.

CS 431 -- Computer Operating Systems 45 2002 Timothy J. McGuire, Ph.D. CS 431 -- Computer Operating Systems 46 2002 Timothy J. McGuire, Ph.D.

System structure System structure


Layered approach Virtual machines
A layered design was first used in the THE A virtual machine takes the layered
operating system (Dijkstra, 1968). Its six layers approach to its logical conclusion. It treats
are as follows: hardware and the operating system kernel as
layer 5: user programs
though they were all hardware.
layer 4: buffering for input and output devices
layer 3: operator-console device driver A virtual machine provides an interface
layer 2: memory management
identical to the underlying bare hardware.
layer 1: CPU scheduling The operating system creates the illusion of
layer 0: hardware multiple processes, each executing on its own
processor with its own (virtual) memory.
CS 431 -- Computer Operating Systems 47 2002 Timothy J. McGuire, Ph.D. CS 431 -- Computer Operating Systems 48 2002 Timothy J. McGuire, Ph.D.
System structure Virtual machines advantages and
Virtual machines disadvantages
The resources of the physical computer are The virtual-machine concept provides complete protection
shared to create the virtual machines. of system resources since each virtual machine is isolated
from all other virtual machines. This isolation, however,
CPU scheduling can create the appearance that permits no direct sharing of resources.
users have their own processor. A virtual-machine system is a perfect vehicle for
Spooling and a file system can provide virtual operating-systems research and development. System
card readers and virtual line printers. development is done on the virtual machine, instead of on
a physical machine and so does not disrupt normal system
A normal user time-sharing terminal serves as operation.
the virtual machine operators console. The virtual machine concept is difficult to implement due
(Example, IBM VM) to the effort required to provide an exact duplicate of the
underlying machine.
CS 431 -- Computer Operating Systems 49 2002 Timothy J. McGuire, Ph.D. CS 431 -- Computer Operating Systems 50 2002 Timothy J. McGuire, Ph.D.

System design goals Mechanism and policy


User goals operating system should be Mechanisms determine how to do
convenient to use, easy to learn, reliable, something; policies decide what will be
safe, and fast. done.
System goals operating system should be The separation of policy from mechanism
easy to design, implement, and maintain, as is a very important principle; it allows
well as flexible, reliable, error-free, and maximum flexibility if policy decisions are
efficient. to be changed later.

CS 431 -- Computer Operating Systems 51 2002 Timothy J. McGuire, Ph.D. CS 431 -- Computer Operating Systems 52 2002 Timothy J. McGuire, Ph.D.

System implementation System Generation (SYSGEN)


OS used to be written exclusively in assembly language Configure for a particular machine in a class and/or for
Now some are written in higher-level languages (e.g., C); peripheral configurations
assembly-language routines (e.g., for identified CPU to be used
bottlenecks) provide speed for key functions Amount of memory available
Available devices
Advantage: faster development, easier to understand and
Operating system options desired, e.g., what job mix is expected,
debug, easier to port
etc.
Disadvantage: reduced speed and increased storage
Bootstrap program (bootstrap loader): stored in ROM;
requirements
locates kernel, loads it into main memory; starts execution
Alternately fetches more complex boot program and
transfers control to it (two step process)

CS 431 -- Computer Operating Systems 53 2002 Timothy J. McGuire, Ph.D. CS 431 -- Computer Operating Systems 54 2002 Timothy J. McGuire, Ph.D.

You might also like