0% found this document useful (0 votes)
85 views46 pages

CH 3 Operating Systems

Operating system course

Uploaded by

chargegeee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views46 pages

CH 3 Operating Systems

Operating system course

Uploaded by

chargegeee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd

计算机基础

Computer basics

Fall 2024

1
Chapter 3:
Operating Systems
操作系统
1
-
3

Chapter Contents

• 3.1 The History of Operating Systems


• 3.2 Operating System Architecture
• 3.3 Coordinating the Machine’s Activities
• 3.4 Handling Competition Among Processes
• 3.5 Security
1
-
4

What is an operating system

• An operating system is the software that controls the overall op


eration of a computer.
• It provides the means by which a user can store and retrieve fil
es, provides the interface by which a user can request the execu
tion of programs, and provides the environment necessary to e
xecute the programs requested.
• Examples:
• Windows: Microsoft
• Unix
• Mac OS: Apple
What is an Operating System?

• A program that acts as an intermediary between a user of


a computer and the computer hardware
• 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
1
-
6

The History of Operating Systems

• The computers of the 1940s and 1950s were not very flexible or effic
ient.
• Machines occupied entire rooms.
• Program execution required significant preparation of equipment in
terms of mounting magnetic tapes, placing punched cards in card re
aders, setting switches, and so on.
• The execution of each program, called a job, was handled as an isola
ted activity
• the machine was prepared for executing the program, the program
was executed, and then all the tapes, punched cards, etc. had to be r
etrieved before the next program preparation could begin.
1
-
7

The History of Operating Systems

• In batch processing systems ( 批处理系统 ), the jobs residing in mass storage wa


it for execution in a job queue.
• A queue is a storage organization in which objects (in this case, jobs) are or
dered in first-in, first-out (abbreviated FIFO and pronounced “FI-foe”) fashi
on.
• In reality, most job queues do not rigorously follow FIFO structure, since mo
st operating systems provide for consideration of job priorities. As a result,
a job waiting in the job queue can be bumped by a higher-priority job.

Batch processing
1
-
8

The History of Operating Systems

• Job control language (JCL) 作业控制语言 : a set of instructions explaining


the steps required to prepare the machine for that particular job.
• When the job was selected for execution, the operating system print
ed these instructions at a printer where they could be read and follo
wed by the computer operator.
• Major drawback to using a computer operator as an intermediary be
tween a computer and its users is that the users have no interaction
with their jobs once they are submitted to the operator.
• it is not acceptable when the user must interact with a program duri
ng its execution. For Example:
word processing systems
computer games
1
-
9

The History of Operating Systems

• To solve this problem, new operating systems were developed that a


llowed a program being executed to carry on a dialogue with the use
r through remote terminals—a feature known as interactive processi
ng.
• interactive processing: is a terminal consisted of little more than an
electronic typewriter by which the user could type input and read th
e computer’s response that was printed on paper.

Interactive processing
1
-
1
0
The History of Operating Systems

• Real-time processing: is to force the computer to execute tasks unde


r a deadline, so we can say that a task is performed in real time.
• Previous interactive systems had been required to serve only one us
er at a time, real-time processing.
• Time-sharing: is to provided service to multiple users at the same ti
me.
• Multiprogramming: the time is divided into intervals and then the e
xecution of each job is restricted to only one interval at a time. At th
e end of each interval, the current job is temporarily set aside and a
nother is allowed to execute during the next interval.
• Today, multiprogramming techniques are used in single-user as well
as multiuser systems, although in the former the result is usually call
ed multitasking.
The History of Operating Systems

Batch Operating System


• The users of this type of operating system does not interact wit
h the computer directly.
• Each user prepares his job on an off-line device like punch card
s and submits it to the computer operator
• There is an operator which takes similar jobs having the same r
equirement and group them into batches.
The History of Operating Systems

Batch Operating System cont..

Advantages of Batch Operating System:


 Processors of the batch systems know how long the job would be when it is in queue
 Multiple users can share the batch systems
 The idle time for the batch system is very less
 It is easy to manage large work repeatedly in batch systems
Disadvantages of Batch Operating System:
 The computer operators should be well known with batch systems
 Batch systems are hard to debug
 It is sometimes costly
 The other jobs will have to wait for an unknown time if any job fails
Examples of Batch based Operating System:
IBM's MVS
The History of Operating Systems

Real-Time Operating System


• These types of OSs serve real-time systems.
• The time interval required to process and respond to inputs is very small
.
• This time interval is called response time.
• Real-time systems are used when there are time requirements that are
very strict like
 missile systems,
 air traffic control systems,
 robots.
 word processing systems
 computer games, etc;
The History of Operating Systems

Time-Sharing Operating Systems


• Each task is given some time to execute so that all the tasks
work smoothly.
• These systems are also known as Multi-tasking Systems.
• The task can be from a single user or different users also.
• The time that each task gets to execute is called quantum.
• After this time interval is over OS switches over to the next
task.
The History of Operating Systems

Time-Sharing Operating Systems cont..


• Advantages of Time-Sharing OS:
 Each task gets an equal opportunity
 Fewer chances of duplication of software
 CPU idle time can be reduced
• Disadvantages of Time-Sharing OS:
 Reliability problem
 One must have to take care of the security and integrity of user programs and data
 Data communication problem
• Examples of Time-Sharing Oss
Multics, Unix, etc.
The History of Operating Systems

Embedded Operating System


• An embedded operating system is one that is built into the circuitry of an electronic
device.
• Embedded operating systems are now found in automobiles, bar-code scanners, cell
phones, medical equipment, and personal digital assistants (PDAs).
• The most popular embedded operating systems for consumer products, such as PDAs
, include the following:
 Windows XP Embedded
 Windows CE .NET:- it supports wireless communications, multimedia and Web
browsing. It also allows for the use of smaller versions of Microsoft Word, Excel,
and Outlook.
 Palm OS:- It is the standard operating system for Palm-brand PDAs as well as ot
her proprietary handheld devices.
 Symbian:- OS found in “ smart” cell phones from Nokia and Sony Ericsson
1
-
1
7
Chapter Contents

• 3.1 The History of Operating Systems


• 3.2 Operating System Architecture
• 3.3 Coordinating the Machine’s Activities
• 3.4 Handling Competition Among Processes
• 3.5 Security
Computer System Structure

• Computer system can be divided into four components:


• Hardware – provides basic computing resources
• CPU, memory, I/O devices
• Operating system
• Controls and coordinates use of hardware among various
applications and users
• Application programs – define the ways in which the system re
sources are used to solve the computing problems of the user
s
• Word processors, compilers, web browsers, database syste
ms, video games
• Users
• People, machines, other computers
Four Components of a Computer Syste
m
Four Components of a Computer Syste
m
Four Components of a Computer Syste
m
Soft ware Classification

• Machine’s software can be divided into two broad categories:


application software and system software
• Application software consists of the programs for performing t
asks particular to the machine’s utilization.
• System software provides the infrastructure that the applicatio
n software requires, in much the same manner as a nation’s inf
rastructure (government, roads, utilities, financial institutions,
etc.)
Soft ware Classification

• System software has two categories:


1. Operating system itself
[Link] software: consists of programs for performing activities t
hat are fundamental to computer installations but not included
in the operating system. Simply, software units that extend (or
perhaps customize) the capabilities of the operating system.
What Operating Systems Do

• Depends on the point of view


• Users want convenience, ease of use and good performance
• Don’t care about resource utilization
• But shared computer such as mainframe or minicomputer mus
t keep all users happy
• Users of dedicate systems such as workstations have dedicated
resources but frequently use shared resources from servers
• Handheld computers are resource poor, optimized for usability
and battery life
• Some computers have little or no user interface, such as embed
ded computers in devices and automobiles
Operating System Definition

• OS is a resource allocator 资源分配器


• Manages all resources
• Decides between conflicting requests for effici
ent and fair resource use
• OS is a control program
• Controls execution of programs to prevent err
ors and improper use of the computer
1
-
2
5
Components of an operating system

• (1) User Interface: the portion of an operating system that handles p


erform the actions requested by the computer’s users.
Shells: old user interfaces communicated with users through textual
messages using a keyboard and monitor screen.
Graphical user interface (GUI): new user interfaces in which objects
to be manipulated, such as files and programs, are represented picto
rially on the display as icons. ( an example: windows manager)

The user interface acts as an intermediary


between users and the operating system’s
kernel
1
-
2
6
Components of an operating system

• (2) kernel : the internal part of an operating system.


kernel contains those software components that perform the very b
asic functions required by the computer installation.
File manager: whose job is to coordinate the use of the machine’s m
ass storage facilities.
the file manager maintains records of all the files stored in mass stor
age, such as:
• where each file is located
• which users are allowed to access the various files
• which portions of mass storage are available for new files or extensio
ns to existing files.
1
-
2
7
Components of an operating system

File manager:
• most file managers allow files to be grouped into a bundle called a di
rectory or folder.
• This approach allows a user to organize his or her files according to t
heir purposes by placing related files in the same directory.
• Directory path: a chain of directories within directories;
Device Driver: the software units that communicate with the control
lers (or at times, directly with peripheral devices) to carry out operat
ions on the peripheral devices attached to the machine;
• Each device driver is uniquely designed for its particular type of devi
ce (such as a printer, disk drive, or monitor) and translates generic re
quests into the more technical steps required by the device assigned
to that driver.
1
-
2
8
Components of an operating system

Memory manager: is charged with the task of coordinating the mac


hine’s use of main memory.
• Such duties are minimal in an environment in which a computer is as
ked to perform only one task at a time;
• in multiuser or multitasking environments in which the computer is
asked to address many needs at the same time, the duties of the me
mory manager are extensive.
• Paging is a function of memory management where a computer will
store and retrieve data from a device’s secondary storage to the pri
mary storage.
For example: a main memory of 8GB is required but the computer o
nly has 4GB. To create the illusion of the larger memory space, the m
emory manager reserves 4GB of storage space on a magnetic disk.
1
-
2
9
Components of an operating system

scheduler: Coordinates the processes in the system.


Dispatcher: Controls the assignment of processes to CPU time.
1
-
3
0
Chapter Contents

• 3.1 The History of Operating Systems


• 3.2 Operating System Architecture
• 3.3 Coordinating the Machine’s Activities
• 3.4 Handling Competition Among Processes
• 3.5 Security
1
-
3
1
The Concept of a Process

• A Process: is an activity of executing a program under the c


ontrol of the operating system.
• Process State: Current status of the activity
o Program counter: the current position in the program being exec
uted
o General purpose registers
o Related portion of main memory
1
-
3
2
The difference between a program and a process

• A Program is an executable file which contains a certain se


t of instructions written to complete the specific job or ope
ration on your computer.
• A Process is an execution of a specific program.
3
-
3
3
Process Administration

• Scheduler: Adds new processes to the process table and removes co


mpleted processes from the process table.
• To keep track of all the processes, the scheduler maintains a block of
information in main memory called the process table.
• Each time the execution of a program is requested, the scheduler cre
ates a new entry for that process in the process table.
• A process is ready if it is in a state in which its progress can continue;
it is waiting if its progress is currently delayed until some external ev
ent occurs, such as the completion of a mass storage operation, the
pressing of a key at the keyboard, or the arrival of a message from an
other process
3
-
3
4
Process Administration

• Dispatcher: is the component of the kernel that oversees the exe


cution of the scheduled processes.
• In a time-sharing/multitasking system, this task is accomplished b
y multiprogramming;
• Multiprogramming: dividing time into short segments, each calle
d a time slice (typically measured in milliseconds or microseconds
), and then switching the CPU’s attention among the processes as
each is allowed to execute for one time slice.
• The procedure of changing from one process to another is called
a process switch (or a context switch).
• Each time the dispatcher awards a time slice to a process, it initia
tes a timer circuit that will indicate the end of the slice by generat
ing a signal called an interrupt.
3
-
3
5
Process Administration

Multiprogramming between process A and process B


1
-
3
6
Chapter Contents

• 3.1 The History of Operating Systems


• 3.2 Operating System Architecture
• 3.3 Coordinating the Machine’s Activities
• 3.4 Handling Competition Among Processes
• 3.5 Security
3
-
3
7
Handling Competition Among Processes

• An important task of an operating system is the allocation of the


machine’s resources to the processes in the system.
• The file manager allocates access to files and allocates mass stora
ge space for the construction of new files;
• the memory manager allocates memory space;
• the scheduler allocates space in the process table;
• dispatcher allocates time slices;
• a machine does not think for itself; it merely follows directions.
• Thus, to construct reliable operating systems, we must develop al
gorithms that cover every possible contingency,
Semaphores

Semaphores are system-implemented data structures that are sh


ared between processes.
Features of Semaphores
• Semaphores are used to synchronize operations when processe
s access a common, limited, and possibly non-shareable resourc
e.
• Each time a process wants to obtain the resource, the associate
d semaphore is tested. A positive, non-zero semaphore value in
dicates the resource is available.
• Semaphore system calls will, by default, cause the invoking proc
ess to block if the semaphore value indicates the resource is not
available.
Deadlock

• Deadlock – two or more processes are waiting indefinitely for an ev


ent that can be caused by only one of the waiting processes
• Let S and Q be two semaphores initialized to 1
P0 P1
wait(S); wait(Q);
wait(Q); wait(S);
... ...
signal(S); signal(Q);
signal(Q); signal(S);

• Deadlock
• the condition in which two or more processes are blocked from
progressing because each is waiting for a resource that is allocat
ed to another.
Deadlock

 Analysis of deadlock has revealed that it cannot occur unless all three of the
following conditions are satisfied:
 1- There is competition for nonshareable resources.
 2. The resources are requested on a partial basis; that is, having received so
me resources, a process will return later to request more.
 3. Once a resource has been allocated, it cannot be forcibly retrieved

A deadlock resulting from competition for nonshareable railroad


intersections
1
-
4
1
Chapter Contents

• 3.1 The History of Operating Systems


• 3.2 Operating System Architecture
• 3.3 Coordinating the Machine’s Activities
• 3.4 Handling Competition Among Processes
• 3.5 Security
Security Techniques

Authentication – identifying users and programs


Authorization – determining what access users and pro
grams have to things
• Complete mediation: check every access to every protected
object
Auditing – record what users and programs are doing f
or later analysis
3
-
4
3
Security

• important task performed by operating systems is to protect the c


omputer’s resources from access by unauthorized personnel.
• login procedure: a sequence of transactions in which the user est
ablishes initial contact with a computer’s operating system;
• Accounts are established by a person known as the super user or
the administrator.
• auditing software, have been developed that record and then an
alyze the activities taking place within the computer system.
Authorization

• How does the system know what I’m allowed to do?


• Authorization matrix:
• Objects = things that can be accessed
• Subjects = things that can do the accessing (users or programs)
• What are the limits?
• Time of day
• Ranges of values

Alice Bob Carl


/etc Read Read Read
Write
/homes Read Read Read
Write Write Write
/usr None None Read
3
-
4
5
Homework

1. Which of the following activities require real-time processing?


a. Printing mailing labels
b. Playing a computer game
c. Displaying numbers on a smartphone screen as they are dialed
d. Executing a program that predicts the state of next year’s econo
my
e. Playing an MP3 recording
2. What is the difference between embedded systems and PCs?
3. What is the difference between time-sharing and multitasking?
3
-
4
6
Homework

4. List the components of a typical operating system and summarize the role o
f each in a single phrase.
5. What is the difference between application software and utility software?
6. Summarize the difference between a program and a process.

Assignment:
Write a report about the operating systems developments, including the ope
rating systems of current smartphone devices.

You might also like