0% found this document useful (0 votes)
44 views63 pages

BCS303

Uploaded by

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

BCS303

Uploaded by

arjun20041111
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 63

BCS303

OPERATING SYSYTEMS

Prepared By:
Saritha N
Assistant Professor
Department of CS&E
AIT Chikkamagaluru
Module 1
Chapter 1

Introduction to operating systems,

System structures
Introduction

What is Operating System?


• An is a program that manages the computer hardware.
• It also provides a basis for application programs.
• OS acts as an intermediary between the computer user and the
computer hardware.
How OS Varies??

• Mainframe operating systems are designed primarily to optimize


utilization of hardware.
• Personal computer (PC) operating systems support complex games,
business applications, and everything in between.
• Operating systems for handheld computers are designed to provide
an environment in which a user can easily interface with the
computer to execute programs.
What OS do?
A computer system can be divided roughly into four components:
• The hardware- the CPU, the Memory and the I/O devices-provides
the basic computing resources for the system
• The Application Program-Such as word processors/ spreadsheets
/compilers, and Web browsers-define the ways in which these
resources are used to solve users' computing problems.
• The operating system controls the hardware and coordinates its use
among the various application programs for the various users.
Operating systems from two viewpoints

1. User view:
Case-1
• Most computer users sit in front of a PC, consisting of a
monitor/keyboard/ mouse, and system unit.
• Such a system is designed for one user to monopolize its
resources. The goal is to maximize the work (or play) that the
user is performing.
• In this case OS is designed for ease of use,no attention paid to
resource utilization
Case-2
• a user sits at a terminal connected to a mainframe or a mini
computer. Other users are accessing the same computer through
other terminals.
• These users share resources and may exchange information.
• The operating system in such cases is designed to maximize resource
utilization.
• To assure that all available CPU time, memory, and I/0 are used
efficiently and that no individual user takes more than her fair share.
Case 3
• In still other cases, users sit at connected to networks of other
workstations and These users have dedicated resources at their
disposal, but they also share resources such as networking and
servers-file, compute, and print servers.
• Therefore, their operating system is designed to compromise between
individual usability and resource utilization.
Systems View

• From the computer's point of view, the operating system is the program most
intimately involved with the hardware.
• In this context, we can view an operating system as a resource allocator.
• A computer system has many resources that may be required to solve a problem:
CPU time, memory space, file-storage space, I/0 devices, and so on.
• The operating system acts as the manager of these resources.
• Facing numerous and possibly conflicting requests for resources, the operating
system must decide how to allocate them to specific programs and users so that it
can operate the computer system efficiently and fairly.
• A bit is the basic unit of computer storage- it can contain 0 0r 1
• All other storage in a computer is based on collections of bits.
• numbers, letters, images, movies, sounds, documents, and programs,
• 1 byte-8bits
Computer System Organization
• Computer System Operation
• Storage Structure
• I/O structure
Computer System Operation
• A modern General Purpose computer system consists of one or more
CPUs and a number of device controllers connected through a
common bus that provides access to shared memory
• Each device controller is in charge of a specific type of device
• The CPU and the device controllers can execute concurrently,
competing for memory cycles
• To ensure orderly access to the shared memory, a memory controller
is provided whose function is to synchronize access to the shared
memory.
Some important Terms:
1. Bootstrap Program
• the initial program that runs when a computer is powered up or
rebooted
• It is stored in the ROM
• It must know how to load the OS and start executing that system.
• It must locate and load into memory the OS kernal
2. Interrupt
• The occurrence of an event is usually signalled by an interrupt from
hardware or software
• Hardware may Trigger an interrupt at any time by sending a signal to the
CPU, usually by the way of the system bus
3. System Call
• Software may trigger an interrupt by executing a special operating
system call
• When the CPU is interrupted, it stops what it is doing and immediately
transfers execution to a fixed location
• Fixed location: Usually contains the starting address where the service
routine of the interrupt is located.
• The interrupt Service Routine executes
• On completion, the CPU resumes the interrupted computation.
Storage Structure
I/O Stucture
Computer System Architecture
1. Single Processor Systems
2. Multi Processor system
3. Clustered Systems
1.Single Processor System
● One single CPU capable of executing a general purpose instruction
set including instructions from user processes
● Other Special purpose processors are also present which perform
device specific task ( for devices such as disk, keyboard, and graphics
controllers.)
● All special-purpose processors run limited instructions and do not
run user processes.
● These are managed by the operating system; the operating system
sends them information about their next task and monitors their
status.
● For example, a disk-controller processor, implements its own disk
queue and scheduling algorithm, thus reducing the task of main
CPU. Special processors in the keyboard, converts the keystrokes
into codes to be sent to the CPU.
● The use of special-purpose microprocessors is common and does
not turn a single- processor system into a multiprocessor.
● If there is only one general-purpose CPU, then the system is a single-
processor system.
Multi -Processor Systems
(parallel systems or tightly coupled systems)
● Systems that have two or more processors in close communication,
sharing the computer bus, the clock, memory, and peripheral
devices are the multiprocessor systems.
● Multiprocessor systems have three main advantages:
○ Increased throughput
○ Economy of scale
○ Increased reliability
1. Increased Throughput
• In multiprocessor system, as there are multiple processors execution of
different programs take place simultaneously.
• Even if the number of processors is increased the performance cannot be
simultaneously increased.
• This is due to the overhead incurred in keeping all the parts working
correctly and also due to the competition for the shared resources.
• The speed-up ratio with N processors is not N, rather, it is less than N.
Thus the speed of the system is not has expected.
2. Economy of scale
• Multiprocessor systems can cost less than equivalent number of
many single-processor systems.
• As the multiprocessor systems share peripherals, mass storage, and
power supplies, the cost of implementing this system is economical.
• If several processes are working on the same data, the data can also
be shared among them.
3. Increased reliability
• In multiprocessor systems functions are shared among several
processors.
• If one processor fails, the system is not halted, it only slows down.
The job of the failed processor is taken up, by other processors.
• Two techniques to maintain ‘Increased Reliability’:
1. Graceful degradation
As there are multiple processors when one processor fails other
processor will take up its work and the system go down slowly.
2. Fault tolerant
When one processor fails, its operations are stopped, the system
failure is then detected, diagnosed, and corrected.
Different types of multiprocessor systems:

1. Symmetric Multiprocessing System


2. Asymmetric multiprocessing
Clustered Systems
● Like Multi processor Systems,Clustered Systems gather together
multiple CPUs to accomplish computational work
● They are composed of two or more individual systems coupled
together.
● Provide high availability.
● Can be structured asymmetrically or Symmetrically.
● Asymmetric: one machine in standby mode and others run
applications
● Symmetrical: two or hosts run applications, monitors each other.
Operating System Structure
• Operating Systems vary greatly in their makeup internally
• Commonalities:
i. Multiprogramming Systems
ii. Timesharing (Multitasking)
Multiprogramming Systems

• A single user cannot , in general, keep either the CPU or the I/O
devices busy all the time
• Multiprogramming increases CPU utilization by organizing jobs (code
and data) so that the CPU always has one to execute.

job
job 11 2job 2

job 4
job 3
• Multi programming systems provide an environment in which the
various system resources (eg: CPU, memory, peripheral devices etc.)
are utilized effectively, but they do not provide for user interaction
with the computer system.
Multi Tasking (Time Shraing)
• CPU executes multiple jobs by switching among them
• Switches occur so frequently that the users can interact with each
program while it is running
• Time Sharing requires a interactive (or hand on) computer system,
which provides direct communication between the user and the
system
• A time shared operating system allows many users to share the
computer simultaneously
• Uses CPU scheduling and multiprogramming to provide each user
with a small portion of a time shared computer.
• Each user has at least one separate program in memory
• Program
Operating-System Operations
• Modern operating systems are interrupt driven.
• If there are no processes to execute, no I/O devices to service, and
no users to whom to respond, an operating system will sit quietly,
waiting for something to happen.
• Events are signaled by the occurrence of an interrupt or a trap. A
trap (or an exception) is a software-generated interrupt.
• For each type of interrupt, separate segments of code in the
operating system determine what action should be taken.
• An interrupt service routine is provided that is responsible for
dealing with the interrupt.
Dual-Mode Operation
• Since the operating system and the user programs share the hardware
and software resources of the computer system, it has to be made sure
that an error in a user program cannot cause problems to other
programs and the Operating System running in the system.
• The approach taken is to use a hardware support that allows us to
differentiate among various modes of execution.
• The system can be assumed to work in two separate modes of
operation:
1. User mode
2. Kernel mode (supervisor mode, system mode, or privileged mode).
• A hardware bit of the computer, called the mode bit, is used to
indicate the current mode:
1. Kernel (0)
2. User (1)
• With the mode bit, we are able to distinguish between a task
that is
executed by the operating system and one that is executed by
the user.
• When the computer system is executing a user application, the
system is in user mode. When a user application requests a
service from the operating system (via a system call), the
transition from user to kernel mode takes place.
• At system boot time, the hardware starts in kernel mode.
• The operating system is then loaded and starts user
applications in user mode.
• Whenever a trap or interrupt occurs, the hardware switches
from user mode to kernel mode (that is, changes the mode
bit from 1 to 0).
• Thus, whenever the operating system gains control of the
computer, it is in kernel mode.
• The dual mode of operation provides us with the means for
protecting the operating system from errant users—and
errant users from one another.
• The hardware allows privileged instructions to be executed only in
kernel mode.
• If an attempt is made to execute a privileged instruction in user
mode, the hardware does not execute the instruction but rather
treats it as illegal and traps it to the operating system.
• The instruction to switch to user mode is an example of a privileged
instruction.
• Initial control is within the operating system, where instructions are
executed in kernel mode.
• When control is given to a user application, the mode is set to user
mode.
• Eventually, control is switched back to the operating system via an
interrupt, a trap, or a system call.
Process Management
● A program under execution is a process.
● A process needs resources like CPU time, memory, files and I/O devices for its
execution.
● These resources are given to the process when it is created or at run time.
● When the process terminates, the operating system reclaims the resources.
● The program stored on a disk is a passive entity and the program under
execution is an active entity.
● A single-threaded process has one program counter specifying the next
instruction to execute.
● The CPU executes one instruction of the process after another, until the process
completes.
● A multithreaded process has multiple program counters, each pointing to the
next instruction to execute for a given thread.
● The operating system is responsible for the following activities in connection
with process management:

1. Scheduling process and threads on the CPU


2. Creating and deleting both user and system processes
3. Suspending and resuming processes
4. Providing mechanisms for process synchronization
5. Providing mechanisms for process communication
Memory Management
• Main memory is a large array of words or bytes.
• Each word or byte has its own address.
• Main memory is the storage device which can be easily and directly
accessed by the CPU.
• As the program executes, the central processor reads instructions
and also reads and writes data from main memory.
• To improve both the utilization of the CPU and the speed of the
computer's response to its users, general-purpose computers must
keep several programs in memory, creating a need for memory
management.
The operating system is responsible for the following activities in connection with
memory management:

1. Keeping track of which parts of memory are currently being used by user.
2. Deciding which processes and data to move into and out of memory.
3. Allocating and deallocating memory space as needed.
Storage Management

There are three types of storage management


1. File system management
2. Mass-storage management
3. Cache management.
4. I/O systems
1. File-System Management
● File management is one of the most visible components of an operating
system.
● Computers can store information on several different types of physical media.
● Magnetic disk, optical disk, and magnetic tape are the most common.
● Each of these media has its own characteristics and physical organization.
● Each medium is controlled by a device, such as a disk drive or tape drive, that
also has its own unique characteristics.
● A file is a collection of related information defined by its creator.
● Commonly, files represent programs and data.
● Data files may be numeric, alphabetic, alphanumeric, or binary.
● Files may be free-form (for example, text files), or they may be formatted
rigidly (for example, fixed fields).
• The operating system implements the abstract concept of a file by managing
mass storage media.
• Files are normally organized into directories to make them easier to u When
multiple users have access to files.
• It may be desirable to control by whom and in what ways (read, write,
execute) files may be accessed.

● The operating system is responsible for the following activities in connection


with file management:
1. Creating and deleting files
2. Creating and deleting directories to organize files
3. Supporting primitives for manipulating files and directories
4. Mapping files onto secondary storage
Mass-Storage Management
● As the main memory is too small to accommodate all data and programs, and as the data that
it holds are erased when power is lost, the computer system must provide secondary storage
to back up main memory.
● Most modern computer systems use disks as the storage medium for both programs and
data.
● Most programs—including compilers, assemblers, word processors, editors, and formatters—
are stored on a disk until loaded into memory and then use the disk as both the source and
destination of their processing.
● Hence, the proper management of disk storage is of central importance to a computer system.
● The operating system is responsible for the following activities in connection with disk
management:
1. Free-space management
2. Storage allocation
3. Disk scheduling
● As the secondary storage is used frequently, it must be used efficiently.
● The entire speed of operation of a computer may depend on the speed of the
disk.
● Magnetic tape drives and their tapes, CD, DVD drives and platters are tertiary
storage devices.
● The functions that operating systems provides include mounting and
unmounting media in devices, allocating and freeing the devices for exclusive
use by processes, and migrating data from secondary to tertiary storage.
Caching
•Caching is an important principle of computer systems.
•Information is normally kept in some storage system (such as main
memory).
• As it is used, it is copied into a faster storage system— the cache—as
temporary data.
•When a particular piece of information is required, first we check
whether it is in the cache. If it is, we use the information directly from
the cache;
• if it is not in cache, we use the information from the source, putting a
copy in the cache under the assumption that we will need it again soon.
• Because caches have limited size, cache management is an
important design problem.
• Careful selection of the cache size and page replacement policy can
result in greatly increased performance.
• The movement of information between levels of a storage hierarchy
may be either explicit or implicit, depending on the hardware design
and the controlling operating-system software.
• For instance, data transfer from cache to CPU and registers is
usually a hardware function, with no operating-system intervention.
• In contrast, transfer of data from disk to memory is usually
controlled by the operating system.
• In a hierarchical storage structure, the same data may appear in
different levels of the storage system.
• For example, suppose to retrieve an integer A from magnetic disk to
the processing program.
• The operation proceeds by first issuing an I/O operation to copy the
disk block on which A resides to main memory.
• This operation is followed by copying A to the cache and to an
internal register.
• Thus, the copy of A appears in several places: on the magnetic disk,
in main memory, in the cache, and in an internal register.
• In a multiprocessor environment, in addition to maintaining internal
registers, each of the CPUs also contains a local cache.
• In such an environment, a copy of A may exist simultaneously in
several caches.
• Since the various CPUs can all execute concurrently, any update
done to the value of A in one cache is immediately reflected in all
other caches where A resides.
• This situation is called cache coherency, and it is usually a hardware
problem (handled below the operating-system level).
I/O Management

• One of the purposes of an operating system is to hide the peculiarities


of specific hardware devices from the user.
• The I/O subsystem consists of several components:
A memory-management component that includes buffering,
caching, and spooling
A general device-driver interface
Drivers for specific hardware devices
• Only the device driver knows the peculiarities of the specific device to
which it is assigned.
Protection and Security

• If a computer system has multiple users and allows the concurrent execution of
multiple processes, then access to data must be regulated.
• For that purpose, mechanisms ensure that files, memory segments, CPU, and
other resources can be operated on by only those processes that have gained
proper authorization from the operating system.
• For example, memory-addressing hardware ensures that a process can execute
only within its own address space.
• The timer ensures that no process can gain control of the CPU for a long time.
• Device-control registers are not accessible to users, so the integrity of the
various peripheral devices is protected.
• Protection is a mechanism for controlling the access of processes or users
to the resources defined by a computer system.
• This mechanism must provide means for specification of the controls to be
imposed and means for enforcement.
• Protection improves reliability.
• A protection-oriented system provides a means to distinguish between
authorized and unauthorized usage.
• A system can have adequate protection but still be prone to failure and
allow inappropriate access.
• Consider a user whose authentication information is stolen. Her data could be copied

or deleted, even though file and memory protection are working. It is the job of

security to defend a system from external and internal attacks. Such attacks spread

across a huge range and include viruses and worms, denial-of service attacks etc.

• Protection and security require the system to be able to distinguish among all its users.

Most operating systems maintain a list of user names and associated user identifiers

(user IDs). When a user logs in to the system, the authentication stage determines the

appropriate user ID for the user.


Distributed Systems
• A distributed system is a collection of systems that are networked to provide the users
with access to the various resources in the network.
• Access to a shared resource increases computation speed, functionality, data
availability, and reliability.
• A network is a communication path between two or more systems.
• Networks vary by:
• the protocols used(TCP/IP,UDP,FTP etc.),
• the distances between nodes, and
• the transport media(copper wires, fiber-optic,wireless).
• TCP/IP is the most common network protocol.
• The operating systems support of protocols also varies.
• Most operating systems support TCP/IP, including the Windows and UNIX operating
systems.
• Networks are characterized based on the distances between their nodes.
• A local-area network (LAN) connects computers within a room, a floor, or a building.
• A wide-area network (WAN) usually links buildings, cities, or countries.
• A global company may have a WAN to connect its offices worldwide. These networks may
run one protocol or several protocols.
• A metropolitan-area network (MAN) connects buildings within a city.
• BlueTooth and 802.11 devices use wireless technology to communicate over a distance of
several feet, in essence creating a small-area network such as might be found in a home.
• The transportation media to carry networks are also varied.
• They include copper wires, fiber strands, and wireless transmissions between satellites,
microwave dishes, and radios. When computing devices are connected to cellular
phones, they create a network.
Special Purpose Systems
Multimedia Systems
• Multimedia data consist of audio and video files as well as conventional files.
• These data differ from conventional data in that multimedia data—such as frames of video
—must be delivered (streamed) according to certain time restrictions (for example, 30
frames per second).
• Multimedia describes a wide range of applications like audio files - MP3, DVD movies, video
conferencing, and short video clips of movie previews or news.
• Multimedia applications may also include live webcasts of speeches or sporting events and
even live webcams.
• Multimedia applications can be either audio or video or combination of both. For example,
a movie may consist of separate audio and video tracks.
Handheld Systems

• Handheld systems include personal digital assistants (PDAs), such as


Palm and Pocket-PCs, and cellular telephones.
• Developers of these systems face many challenges, due to the
limited memory, slow processors and small screens in such devices.
• The amount of physical memory in a handheld depends upon the
device, the operating system and applications must manage
memory efficiently.
• This includes returning all allocated memory back to the memory
manager when the memory is not being used.
• A second issue of concern to developers of handheld devices is the
speed of the processor used in the devices.
• Processors for most handheld devices run at faster speed than the
processor in a PC.
• Faster processors require more power and so, a larger battery is
required.
• Another issue is the usage of I/O devices.
• Generally, the limitations in the functionality of PDAs are balanced by
their convenience and portability.
• Their use continues to expand as network connections become more
available and other options, such as digital cameras and MP3 players,
expand their utility.

You might also like