Professional Documents
Culture Documents
Operating Systems
Module 1
Introduction, Overview and History
2008 Stanley A. Wileman, Jr.
Operating Systems
Slide 1
Welcome!
Welcome to Operating Systems. This course is designed to
introduce you to the fundamentals of operating systems. The
course uses specific features of real operating systems to
illustrate and reinforce the fundamental concepts.
Prerequisites include a good knowledge of data structures and
computer organization. You should also have had reasonable
experience with assembler language programming for some
contemporary processor (e.g. IBM S/390 or Intel X86,) and
strong skills in the C or C++ programming language. C is the
programming language of choice, and it is used in all code
illustrations. While not required, a course in digital design will
prove helpful.
2008 Stanley A. Wileman, Jr.
Operating Systems
Slide 2
In This Module
Basic material about the course
The study of operating systems
The OS API and the user interface
Processor modes
Computer system and OS history
Operating Systems
Slide 3
Programming Assignments
Programming assignments are used to reinforce the
concepts you learn in this course. There are three basic
types of assignments possible:
illustration of various system calls for one or more real
operating systems,
implementation of OS algorithms and simulation of
their effect, and
implementation of OS algorithms in the context of a
toy operating system, or a real system with readily
available source code (e.g. Linux, FreeBSD).
Your instructor will provide complete details on each of the
programming assignments you are to complete for the
course.
2008 Stanley A. Wileman, Jr.
Operating Systems
Slide 4
Operating Systems
Slide 5
Reference Textbooks
There are many good operating system textbooks available
and your instructor may expect you to use one with these
modules. Some of these texts are
Operating Systems Design and Implementation (third
edition), by Tanenbaum and Woodhull (Prentice Hall,
2006).
Operating Systems (third edition), by Deitel, Deitel, and
Choffnes (Addison-Wesley, 2003).
Operating Systems: Internals and Design Principles,
(sixth edition) by Stallings (Prentice Hall, 2008).
Operating System Concepts (eighth edition), by
Silberschatz, Galvin, and Gagne (Wiley, 2008).
2008 Stanley A. Wileman, Jr.
Operating Systems
Slide 6
Operating Systems
Slide 7
Operating Systems
Slide 8
Operating Systems
Slide 9
Operating Systems
Slide 10
10
Presentation
Software
Spreadsheet
Compilers
Command Line
Interpreters
Editors
Operating System
Machine Language
Microprogram
Bare hardware
2008 Stanley A. Wileman, Jr.
Operating Systems
Slide 11
11
Operating Systems
Slide 12
12
Operating Systems
Slide 13
13
Operating Systems
Slide 14
14
Input/Output Interfaces
Operating Systems
Slide 15
15
Operating Systems
Slide 16
16
Operating Systems
Slide 17
17
Operating Systems
Slide 17.1
18
Operating Systems
Slide 17.2
19
Operating Systems
Slide 17.3
20
Half of Babbages
Brain and a Notebook
(in the Science
Museum, London)
Operating Systems
Slide 17.4
21
Generation 1: 1945-1955
The equipment in the first generation of practical
computing hardware consisted of hard-wired
plugboards, enormously heavy mechanical devices, and
vacuum-tube implementation of logical circuits.
There were no operating systems, programming
languages or networks in this generation.
Punched cards were introduced in the early 1950s.
Each card, the same size as a U. S. dollar bill, contained
80 bytes of data. Many devices existed to process data
in this format, including keypunches (to enter data onto
the cards), card sorters, and listing devices.
2008 Stanley A. Wileman, Jr.
Operating Systems
Slide 18
22
Operating Systems
Slide 18.1
23
Generation 2: 1955-1965
Perhaps the most important technological advance in this
generation was the invention of the transistor. Vacuum tubes,
previously used in computing devices, generate enormous
amounts of heat and consume lots of energy. In contrast,
transistors generate little heat and consume little energy. Since
transistors dont operate by burning themselves up (like light
bulbs), the reliability of systems was also greatly improved.
Previously a computer system was completely dedicated to one
user at a time, requiring lots of time to set up a computation,
debug and run it, and then clean up the system afterwards. In
this generation, the concept of a job, a deck of cards containing
commands and data, reduced this overhead time significantly.
2008 Stanley A. Wileman, Jr.
Operating Systems
Slide 19
24
Operating Systems
Slide 20
25
Operating Systems
Slide 20.1
26
Operating Systems
Slide 20.2
27
Operating Systems
Slide 21
28
Operating Systems
Slide 22
29
Generation 3: 1965-1980
The major hardware development that introduced the third
generation was the integrated circuit. Instead of using discrete
components (transistors, resistors, etc.) to build a system, welldefined logical circuits were constructed as a single component.
This resulted in smaller and more power-efficient systems.
Another major architectural change united the features of
scientific and business computer systems. Instead of two
different machines (i.e. scientific and business), a single system
providing features of both types of machines was introduced.
The most popular of these was the IBM 360. Multiple models
this system was produced, varying in speed and features. Many
other manufacturers also produced similar systems.
2008 Stanley A. Wileman, Jr.
Operating Systems
Slide 23
30
Operating Systems
Slide 23.1
31
Generation 3: OS/360
Perhaps the most important operating system prevalent in the
third generation was IBMs OS/360. It was designed to
successfully accommodate the needs of all users on every
model of the S/360 computer system. This goal was never
completely achieved.
The OS/360 operating system included millions of lines of
assembler code written by thousands of programmers. It isnt
surprising, then, that the numbers of bugs in the system
remained essentially constant, even over many releases.
Even so, OS/360 satisfied the needs of almost all customers.
2008 Stanley A. Wileman, Jr.
Operating Systems
Slide 24
32
Operating Systems
Slide 25
33
Operating Systems
Slide 26
34
Operating Systems
Slide 27
35
Generation 4: 1980...
The development of large scale integrated circuits (LSI)
containing thousands of transistors and other components
enabled the development of complete processors in a
single circuit package. These microprocessor devices have
revolutionized computing, especially as additional
development led to very large scale integrated circuits
(VLSI) using complementary metal oxide semiconductor
(CMOS) technology containing hundreds of thousands,
even millions, of transistors.
Families of processors have been produced, starting with
small 4-bit systems. Today 64-bit microprocessor systems
are commonplace.
2008 Stanley A. Wileman, Jr.
Operating Systems
Slide 28
36
Operating Systems
Slide 29
37
Operating Systems
Slide 30
38
Next
In the next module well look at two
major operating system concepts:
processes and files.
Various system calls for managing
processes will be examined, and actual
programs using these system calls will
be developed.
2008 Stanley A. Wileman, Jr.
Operating Systems
Slide 31
39
CSCI 4500
Operating Systems
Module 2
OS Concepts: Processes and File Systems
Updated: July 30, 2014
2008 Stanley A. Wileman, Jr.
Operating Systems
Slide 1
In This Module
Operating System Concepts
Introduction to Processes
Files and Data Sets
Name Binding, Catalogs and Directories
System Calls for Processes and Tasks
Sample Programs Using Processes
2008 Stanley A. Wileman, Jr.
Operating Systems
Slide 2
Operating Systems
Slide 3
Operating Systems
Slide 4
Processes
In a multiprogramming system, multiple
processes (at least one per user) are being
virtually executed. But its obvious only one
process can be actually executed at a time on a
single processor.
Thus, the process currently being executed is
occasionally freeze dried and another process
is executed for a while. This is called a context
switch, since the processors context changes.
When a process is not being executed, salient
details (e.g. CPU register contents and file
pointers) are stored away in a process table.
2008 Stanley A. Wileman, Jr.
Operating Systems
Slide 5
Process A
LOAD K
DIV E
MPY T
STORE N
CMP L
JNE LOOP
Operating Systems
Process B
Slide 6
Process A
LOAD K
. DIV E
. MPY T
. STORE N
CMP L
JNE LOOP
Operating Systems
Process B
Slide 7
Process A
LOAD K
DIV E
MPY T
STORE N
CMP L
JNE LOOP
.
.
.
Operating Systems
Process B
Slide 8
Operating Systems
Slide 9
Process Tables
A process table has one entry for every
process in the system.
Each process table entry contains
information about process ownership,
relation to other processes, process state,
and statistical information.
Process tables are frequently organized
as static arrays.
2008 Stanley A. Wileman, Jr.
Operating Systems
Slide 10
10
Operating Systems
Slide 11
11
Operating Systems
Slide 12
12
File Systems
A file system is a storage structure (like a
data structure, but normally tailored for a
secondary storage device like a disk).
There are many different types of file
systems, even for the same operating
system. Speed, reliability, media type, and
other factors influence the design of a file
system. For example, CD Rom file systems
differ considerably from those for hard drives.
2008 Stanley A. Wileman, Jr.
Operating Systems
Slide 13
13
Operating Systems
Slide 14
14
Organizing Files
Even systems designed for use by a single
user may have thousands of files. How are
these files organized?
Most systems use a hierarchical naming
scheme for files. A particular file is accessed
by giving first the name at the top level of the
hierarchy, then the second level name, and
so forth, finishing with the name of the
desired file.
2008 Stanley A. Wileman, Jr.
Operating Systems
Slide 15
15
Operating Systems
Slide 16
16
Binding
The term binding is used to indicate the
mechanism by which a name is associated
with an object.
For file systems, binding refers to the
mechanism used to associate a name with a
file.
There are many different binding techniques
used in different file systems.
2008 Stanley A. Wileman, Jr.
Operating Systems
Slide 17
17
Binding Examples
The IBM MVS system uses catalogs, each of
which stores pairs of the form (name, location),
where name might be STANW.SAMPLE.JOBS and
location would identify the physical location of the
file.
UNIX systems use multiple directories are used to
store this information, each directory similar to an
interior node of a tree. Thus each directory entry
(called a link) contains one component of a
hierarchical name and a reference to the named
object, which could be another directory or a
regular file.
2008 Stanley A. Wileman, Jr.
Operating Systems
Slide 18
18
Catalogs
STANW.SAMPLE.JOBS
STANW.SAMPLE.CLIST
.
.
.
2008 Stanley A. Wileman, Jr.
Operating Systems
Slide 19
19
Directories
u
stanw
stanw
sample
sample
jobs
clist
Operating Systems
Slide 20
20
Operating Systems
Slide 21
21
Common Filesystems
Some common file systems include:
FAT (used with MS-DOS)
NTFS (used with Windows NT)
CDFS (used on CD-ROMs)
UFS (used with UNIX systems)
HFS (used with OS/390 UNIX)
MVS (used with mainframe systems)
Operating Systems
Slide 22
22
Operating Systems
Slide 23
23
Operating Systems
Slide 24
24
Example Paths
Absolute or complete paths
/u/stanw/samples/jobs
/usr/man/man2/fork.2
Equivalent relative paths (where cwd means
current working directory)
jobs (with cwd of /u/stanw/samples)
man2/fork.2 (with cwd of /usr/man)
Operating Systems
Slide 25
25
CreateDirectory, RemoveDirectory
GetCurrentDirectory, SetCurrentDirectory
UNIX:
mkdir, rmdir
link, unlink, mount, unmount
chdir, chroot
Operating Systems
Slide 26
26
Operating Systems
Slide 27
27
File Permissions
Most systems provide some protection for files
to restrict who can read, write, create, or
delete particular files.
UNIX systems use a 9-bit code containing
three groups (for the user/owner, the users
group, and all others) of 3 bits each.
Each group of bits is interpreted as r w x. If r
is set, then reading is allowed; w = write; x =
execute.
2008 Stanley A. Wileman, Jr.
Operating Systems
Slide 28
28
Operating Systems
Slide 29
29
Operating Systems
Slide 30
30
Special Files
UNIX allows access to physical devices (for
suitably privileged processes) using the same
I/O system calls used for regular files.
Character special files are used to model
devices that do transfer one character at a
time. Examples include serial ports, mice,
keyboards, printers, etc.
Block special files model devices that transfer
a block of data at a time (disks and tapes).
2008 Stanley A. Wileman, Jr.
Operating Systems
Slide 31
31
Operating Systems
Slide 32
32
Operating Systems
Slide 33
33
Operating Systems
Slide 34
34
Pipes
A pipe is essentially queue of bytes treated as an
I/O device.
When a pipe is created, the user is usually given
two handles (or file descriptors).
The first handle is used for reading, and the
second handle is used for writing.
Data written into the pipe is conceptually written
at the tail of the queue; reading from the pipe
removes data from the head of the queue.
Pipes are frequently used for communication
between processes.
2008 Stanley A. Wileman, Jr.
Operating Systems
Slide 35
35
Operating Systems
Slide 36
36
Operating Systems
Slide 37
37
Operating Systems
Slide 38
38
Operating Systems
Slide 39
39
Operating Systems
Slide 40
40
Operating Systems
Slide 41
41
Other Approaches
Note that the mechanism by which an
executable program is submitted for execution,
and how external objects (e.g. files and
terminals) are associated with the process, is
usually independent of the system calls made by
the process.
For example, in MVS, program execution is
requested by statements in a data set (file)
containing JCL (job command language). The
program itself, while unchanged, could have its
execution requested by a command line in UNIX.
2008 Stanley A. Wileman, Jr.
Operating Systems
Slide 42
42
Operating Systems
Slide 43
43
JOB
EXEC
12345678,USERNAME
COB2UCLG
//COB2.SYSIN DD *
The COBOL program goes here
/*
//GO.OUT DD SYSOUT=*
//GO.IN DD DSN=MY.INPUT.DATA,DISP=SHR
Operating Systems
Slide 44
44
Operating Systems
Slide 45
45
Operating Systems
Slide 46
46
Operating Systems
Slide 47
47
Operating Systems
Slide 48
48
Operating Systems
Slide 49
49
Operating Systems
Slide 50
50
Operating Systems
Slide 51
51
Operating Systems
Slide 52
52
Operating Systems
Slide 53
53
Operating Systems
Slide 54
54
Next
In the next module well examine the process
model in more detail.
We will examine the states in which
processes may exist, and the causes for
transitions between these states.
Threads will be considered as alternatives to
processes.
And interprocess communication (IPC) will be
introduced.
2008 Stanley A. Wileman, Jr.
Operating Systems
Slide 55
55