Operating System Objectives and Functions
Operating System Objectives and Functions
efficient manner.
3) Ability to evolve: An OS should be constructed in such a way as to permit
7) Accounting
The Operating System as Resource Manager
1. A computer is a set of resources for the movement, storage, and processing
of data and for the control of these functions. The OS is responsible for
managing these resources
2. Following figure suggests the main resources that are managed by the OS.
3. Key points(the OS provides instructions for the processor, loading, scheduling
etc.)
a) With the earliest computers, from the late 1940s to the mid-1950s,
the programmer interacted directly with the computer hardware;
there was no OS.
b) These computers were run from a console consisting of display
lights, toggle switches, some form of input device, and a printer.
c) These early systems presented two main problems
I.
Scheduling(No scheduler manually had to reserve
computer)
II.
Setup time(takes lot of time like loading, linking , setting for
exe)
d) Users have to access computer in series so the name.
2. Simple Batch Systems
1. Early computers were very expensive, and therefore it was
important to maximize processor utilization. The wasted time due to
scheduling and setup time was unacceptable.
2. To improve utilization, the concept of a batch operating system was
developed.
3. It appears that the first batch operating system (and the first OS of
any kind) was developed in the mid-1950s by General Motors for
use on an IBM 701.
4. The central idea behind the simple batch-processing scheme is the
use of a piece of software known as the monitor
5. With this type of OS, the user no longer has direct access to the
processor. Instead, the user submits the job on cards or tape to a
computer operator, who batches the jobs together sequentially and
places the entire batch on an input device, for use by the monitor.
6. Each program is constructed to branch back to the monitor when it
completes processing, at which point the monitor automatically
begins loading the next program.
7. Monitor pint of view (Figure below
a. The monitor controls the sequence of events)
b. For this to be so, much of the monitor must always be in
main memory and available for execution that portion is
referred to as the resident monitor.
c. The rest of the monitor consists of utilities and common
functions that are loaded as subroutines to the user program
at the beginning of any job that requires them
8. Processor point of view
At a certain point, the processor is executing instructions from the
portion of main memory containing the monitor. These instructions
cause the next job to be read into another portion of main memory.
1.
2.
3.
4.
Major Achievements
1.
Operating systems are among the most complex pieces of software ever
developed.
2. This reflects the challenge of trying to meet the difficult and in some cases
competing objectives of convenience, efficiency, and ability to evolve.
3. There are five major theoretical advances in the development of operating
systems.
a. Processes
A program in execution
An instance of a program running on a computer
Main causes of error in process synchronization
1. Improper synchronization(One routine hangs for I/O
and other is waiting for this response)
2. Failed mutual exclusion(Accessing same resource by
more processes)
b. Memory Management
The needs of users can be met best by a computing environment that
supports modular programming and the flexible use of data. System
managers need efficient and orderly control of storage allocation. The
OS, to satisfy these requirements, has five
principal storage management responsibilities:
1. Process isolation(prevent interfering)
2. Automatic allocation and management(dynamic
allocation)
e. System structure
We can view the system as a series of levels
Each level performs a related subset of the functions
required of the OS. It relies on the next lower level to
perform more primitive functions and to conceal the details
of those functions It provides services to the next higher
layer.
Ideally, the levels should be defined so that changes in one
level do not
require changes in other levels.
Following table shows different layer.(Explain in detail)
The rate of change in the demands on operating systems requires not just
modifications and enhancements to existing architectures but new ways of
organizing the OS. A wide range of different approaches and design elements has
been tried in both experimental and commercial operating systems, but much of the
work fits into the following categories:
Microkernel architecture: (earlier there was monolithic kernel everything in
single proceses)
The microkernel approach simplifies implementation, provides
flexibility, and is well suited to a distributed environment.
This approach decouples kernel and server development. Servers may
be customized to specific application or environment requirements.
A microkernel architecture assigns only a few essential functions to
the kernel, including address spaces, interprocess communication
(IPC), and basic scheduling. Other OS services are provided by
processes, sometimes called servers, that run in user mode and are
treated like any other application by the microkernel
Multithreading: Explain on own words about thread and process
Symmetric multiprocessing:
As demands for performance increase and as the cost of
microprocessors continues to drop, vendors have introduced
computers with multiple microprocessors. To achieve greater efficiency
and reliability, one technique is to employ symmetric
multiprocessing (SMP).
A symmetric multiprocessor can be defined as a standalone computer
system with the following characteristics
i. There are multiple processors.
ii. These processors share the same main memory and I/O
facilities, interconnected by a communications bus or other
internal connection scheme.
iii. All processors can perform the same functions (hence the term
symmetric).
SMP has a number of potential advantages over uniprocessor
architecture, including the following: i) Performance ii) Availability
iii) Incremental growth iv) Scaling
Explain the following diagram
Window OS Organization
o
o
o
o
The Windows operating system services, the protected subsystems, and the
applications are structured using the client/server computing model.
Advantages of a client/server architecture include the following
o It simplifies the Executive.
o It improves reliability.
o Easy communication using RPC
o Provides suitable for Distributed computing
o Encapsulation
o Object class and instance
o Inheritance
o Polymorphism
There are two categories of objects used by Windows for synchronizing
the use of the processor i) Dispatcher Objects and ii) Control
Objects
Linux
Linux started out as a UNIX variant for the IBM PC (Intel 80386)
architecture
What is Process
A program in execution
An instance of a program running on a computer
The entity that can be assigned to and executed on a processor
A unit of activity characterized by the execution of a sequence of
instructions, current state, and an associated set of system resources
process can be uniquely characterized by a number of elements,
including the following
o Identifier
o State
o Priority
o Program Counter
o Memory Pointers
o Context Data
o I/O Status Information
o Accounting Information
o All the above information stored in data structure called PCB as
given below.
Process State
1. Figure 3.2 shows a memory layout of three processes
Figure 3.6 indicates the types of events that lead to each state transition for a
process; the possible transitions are as follows
o
o
o
o
o
o
o
o
o
Null->New
New->Ready
Ready->Running
Running->Exit
Running->Ready
Running->Blocked
Blocked->Ready
Ready->Exit
Bocked->Exit
Security Issues
UNIX SVR4 Process management
Process Description:
A process in UNIX is a rather complex set of data structures that provide the
OS
with all of the information necessary to manage and dispatch processes. Table
3.10
summarizes the elements of the process image, which are organized into
three parts:
user-level context, register context, and system-level context.
Module 2
Process and Threads
Thread is light weight process
Two characteristics of process i) Resource ownership ii)
Scheduling/Execution
Thread Functionality
Like processes, threads have execution states and may synchronize with one
another.
We look at these two aspects of thread functionality in turn.
Thread States:
As with processes, the key states for a thread are Running, Ready, and
Blocked
There are four basic thread operations associated with a change in thread
state
o Spawn (If Process spawns thread also spawns)
o Block (waiting for an event)
o Unblock (Event occurs)
o Finish (complete execution)
If one thread blocks, it doesnt block entire process explain same following
RPC example.
Thread Synchronization:
Example - Adobe Pagemaker: An example of the use of threads is the Adobe
PageMaker application running under a shared system
SMP and clusters are two most popular approaches to providing parallelism
by replicating processors.
These approaches are used to improve performance and, in some cases, to
improve reliability
SMP Architecture
Flynn proposed the following categories of computer systems.
Single instruction single data (SISD) stream: A single processor
executes a
single instruction stream to operate on data stored in a single memory.
Single instruction multiple data (SIMD) stream: A single machine
instruction
SMP Organization
Figure 4.9 illustrates the general organization of an SMP.There are multiple
processors, each of which contains its own control unit, arithmetic-logic unit, and
registers. Each processor has access to a shared main memory and the I/O devices
through some form of interconnection mechanism; a shared bus is a common
facility.
Microkernels
Microkernel Architecture
Uniform interfaces
Extensibility
Flexibility
Portability
Reliability
Distributed system support
Support for object-oriented operating systems (OOOSS)
Process Structure
Linux Threads
Optimal: The optimal policy selects for replacement that page for which the
time to the next reference is the longest.
Least recently used (LRU): The least recently used (LRU) policy
replaces the page in memory that has not been referenced for the longest
time
First-in-first-out (FIFO): The first-in-first-out (FIFO) policy treats the page
frames allocated to a
process as a circular buffer, and pages are removed in round-robin style
Clock:
Load Control:
Load control is concerned with determining the number of processes that will
be
resident in main memory, which has been referred to as the
multiprogramming
level.The load control policy is critical in effective memory management. If
too few
processes are resident at any one time, then there will be many occasions
when all
processes are blocked, and much time will be spent in swapping. On the
other hand,
if too many processes are resident, then, on average, the size of the resident
set of
each process will be inadequate and frequent faulting will occur. The result is
thrashing.
Multiprogramming Level
Process Suspension
The Windows virtual memory manager controls how memory is allocated and
how paging is performed.
Figure shows Windows default 32 address space. It consists of four regions:
Windows Paging: When a process is created, it can in principle make use of
the entire user space of almost 2G Bytes. This space is divided into fixed-size
pages, any of which can be brought into main memory, but the operating
system manages them in contiguous regions allocated on 64-Kbyte
boundaries. A region can be in one of three states i) Available ii) Reserved
and Committed