Transcript chapter 4

6
OPEARTING
SYSTEMS
1
The Evolution of Operating Systems :
 The single processing machines of 1940’s and 1950’s were
not very flexible or efficient.
 The processing is divided into 3 parts:
Batch Processing:The execution of jobs by collecting them
in a batch
- The jobs resides in mass storage waited for execution in a
job queue
- The job queue is referred to term First-In-First-Out (FIFO)
-In early batch processing systems, each job was
accompanied by a set of instruction explaining the steps
require preparing the machine for that particular job.These
instructions are called the Job Control Language(JCL)
2
The Evolution of Operating Systems :
Batch Processing:
Jobs,Program, Data, and Directions
Results
User Domain
FIFO
Job Queue
Job Execution
Machine
Domain
3
The Evolution of Operating Systems :
Interactive Processing:These systems allow the execution
of programs that carried on a dialogue with the user
through remote terminals or workstations
- These interactive systems gave birth of the concept
known as real-time processing , which refers to the
requirement that the activities taking place in a machine
must be coordinated with the activities in the machine’s
environment
Program, Data, Directions, and Results
User Domain
Machine
Domain
Program
Execution
4
The Evolution of Operating Systems :
Time-Sharing : technique of dividing time into
intervals , or time slices, and then restricting the
execution of a job(process) to only one time slice .
- At the end of each time slice, the current job is set
aside and another is allowed to execute during the
next time slice
- By rapidly shuffling of the jobs in this manner, the
illusion of several jobs executing simultaneously is
created
-Today, time-sharing is used
in single-user systems as well as
multi user systems, the former
is called multitasking
Time Slice
P1
P2
P3
P1
5
Multiprocessor Systems :
 The word multiprocessor refers to just one
computer contains several processors
 Coupled computer systems is called a
network
 The concept of network refers to many
small computers connected via network in
which users share resources(such as printing
capabilities, software packages, data storage
facilities, and information) scattered
throughout the system
 The Internet is an example of a network
6
Operating System Architecture :
 To understand the architecture of a typical operating
system(O S), it is helpful to grasp the complete spectrum of
software found within a typical computer system
 We group pieces of software according to the following
classification scheme:
Software
Application
System
Utility
Operating System
Shell
Kernel
7
O.S Architecture :
 Application Software (AS): Consists of the programs for performing
tasks particular to the machine’s utilization
- Examples of application software include spreadsheets, database
systems, publishing systems, program development software , and
games
 System Software : performs those tasks that are common to computer
systems in general.
- Provides the environment in which the A.S resides.
- Within the class of system software there two categories:
 Operating System (OS)
 Utility Software (US):
- Consists of Software units that extend the capabilities of OS
- The distinction between AS and US and between US and OS is
8
often vague
O.S Architecture :
 Consists of two parts:
 The Shell
 The Kernel
The Shell :
- The part of the OS that defines the interface between the operating
system and its users
- The job of the shell is to communicate with the user, or users , of the
machine. Modern shells perform this task by means of Graphical
User Interface (GUI)
User
O.S
User
User
9
The Kernel :
 The internal part of OS, contains those software
components that perform the very basic functions
required by the computer installation
 The kernel consists of the following components:
 File Manager
 Device Drivers
 Memory Manager
 Scheduler
 Dispatcher
10
Boot strapping (Booting) :
 The procedure performed by the machine each time it turned on
 The booting in special-purpose machines performed through the ROM
which contains the main part of OS
 In general-purpose machines, the ROM contains a short program
called the bootstrap , this program executed automatically when
the machine is turned on which directs the CPU through the
process of transferring material from a predetermined location in
mass storage into the volatile area of main memory
Main Memory
ROM
Volatile
Memory
Disk Storage
Bootstrap
Program
Bootstrap
Program
Operating
System
Operating
System
Operating
System
11
Coordinating the Machine’s Activities :
The Concept of a Process :
 The program is merely a static set of directions, while the process is
a dynamic activity whose properties change as time progresses
 A process encompasses the current status of the activity called the
process state, this state includes:

The current position in the program being executed(the value of the
program counter)

The value of other CPU registers

The associated memory cells
 At different times during the execution of a program( at different
times in a process) different snapshots(different process states) will be
observed
12
Process Administration :
 The tasks associated with process coordination are handled by the
scheduler and dispatcher within the operating system’s kernel
The Scheduler :
 To keep track of all the processes, the scheduler maintains a block of
information in main memory called the process table
 Each time a new task is assigned to the machine, the scheduler creates
a process for that task by placing a new entry in the process table
 The entry contains such information as
- The memory area assigned to the process(obtained from the
memory manager) , the priority of the process, and whether the
process is ready or waiting
 The Scheduler maintains this information as the process progresses.
The process will shift back and forth between ready and waiting
 The priority of the process changes as time passes
 The scheduler must remove the process from the process table when
13
the process is completed
The Dispatcher :
 Ensures that the scheduled processes are actually executed
 In time-sharing system this task is accomplished by dividing time into
short segments, each called a time slice or quantum(typically about
50 ms)
 Switching the CPU’s attention among the processes as each allowed to
execute for no longer than one time slice process switch
 Dispatcher initiates a timer circuit that will measure the next quantum
 At the end of the quantum the timer circuit generates a signal called an
interrupt
Interrupt
Interrupt
Interrupt
Process B
Process
Switch
Process A
Advancing Time
Interrupt
Process B
Process
Switch
Process
Switch
Process A
14
The Client/Server Model :
 The various units within an operating system normally
execute as individual processes
 To coordinate their activities, these processes must
communicate with one another
 To simplify this interprocess communication, the
components of OS are often designed to conform to the
Requests
client/server model Client
Server
Service
S
C
C
S
C
C
C
S
15
C
S
Handling Competition Among Processes :
 A universal task among the components of OS’s kernel is
the allocation of the machine’s resources to the processes in
the system.
 This allocation task may has several problems that can lead
to system malfunctions unless they accounted for.
 Semaphores
 Deadlock
16
Semaphores :
 Consider the printer example where two users send a
file to the printer
 Access allocation requires that the OS keeps track
whether the printer has been allocated. One
approach is to use flag(Set + Clear)
 Clear: means the printer is available
 Set: means that the printer is busy
 The OS clears the flag to begin, then it checks the
flag each time a request for printer access is made. If
the flag is set the OS makes the request wait.
Two solutions Test-and-Set and Interrupt Enable
and Disable
17
Deadlock :
 Two processes are blocked from processing because
each is waiting for access to resources allocated to
another. Like a printer waiting for tape drive while
the tape drive is waiting for the printer
 Analysis of deadlock has revealed that it cannot
occur unless all three of the following conditions are
satisfied:
 There is a competition for non-sharable resources
 The resources are requested on a partial basis; that
is, having received some resources, a process will
return later to request more
 Once a resource has been allocated, it can not be
18
forcibly retrieved
Networks :
 Networks are classified as :
 Local Area Networks(LANs) and Wide Area Networks
(WANs) :
LAN: Normally consists of collection of computers in a
single building or building complex
WAN: Links machines that may be on opposite sides of a city
or the world, like satellite link
 Closed Networks and Open Networks:
Closed Network:Network comprised of HW and SW from a
single vendor
Open Network: Implemented as a conglomerate of products
from different manufactures (e.g. Internet)
19
 Topology of the network
Networks
Topology of the network: the pattern in which the machines
are connected:
- Ring topology
- Bus topology
- Star topology
- Irregular topology
 Internet
 Internet addressing
 WWW

20
Network Protocols :
 Controlling Transmission Privileges :
Computer
Computer
Messages move in only
one direction
Computer
Computer
Computer
“Communication over ring topology”
21
The Layered Approach to Network Software :
Message’s Origin
Application Layer
Message’s Destination
Application Layer
Transport Layer
Transport Layer
Network Layer
Network Layer
Link Layer
Internet Software
Layers
Link Layer
22
The layered Approach to Network Software :
Application
Transport
Application
Network
Link
Network
Network
Link
Link
Transport
Network
Link
A Path of a data unit through the Internet involving two
intermediate machines
23