Professional Documents
Culture Documents
OS U-1
OS U-1
We need a system which can act as an intermediary and manage all the
processes and resources present in the system.
A more common definition is that the operating system is the one program
running at all times on the computer (usually called the kernel), with all else
being application programs.
An operating system is concerned with the allocation of resources and services,
such as memory, processors, devices, and information. The operating system
correspondingly includes programs to manage these resources, such as a
traffic controller, a scheduler, memory management module, I/O programs, and
a file system.
Functions of Operating system – Operating system performs three functions:
1. Convenience: An OS makes a computer more convenient to use.
2. Efficiency: An OS allows the computer system resources to be used in an
efficient manner.
3. Ability to Evolve: An OS should be constructed in such a way as to permit the
effective development, testing and introduction of new system functions at the
same time without interfering with service.
Memory Management
Processor Management
Device Management
File Management
Security
Control over system performance
Job accounting
Error detecting aids
Coordination between other software and users
Q3. What are the Characteristics of Operating System?
1. Operating System is a Collection of Programs those are Responsible for
the Execution of other Programs.
2. Operating System is that which Responsible is for Controlling all the
Input and Output Devices those are connected to the System.
3. Operating System is that which Responsible is for Running all the
Application Software’s.
4. Operating System is that which Provides Scheduling to the Various
Processes Means Allocates the Memory to various Process those Wants
to Execute.
5. Operating System is that which provides the Communication between
the user and the System.
6. Operating System is Stored into the BIOS Means in the Basic Input and
Output System means when a user Starts his System then this will Read
all the instructions those are Necessary for Executing the System Means
for Running the Operating System, Operating System Must be Loaded
into the Computer For this, this will use the Floppy or Hard Disks Which
Stores the Operating System.
Q4. What does a modern operating system do?
Provides Abstractions Hardware has low-level physical resources with
complicated, idiosyncratic interfaces. OS provides abstractions that
present clean interfaces. Goal: make computer easier to use.
o Examples: Processes, Unbounded Memory, Files, Synchronization
and Communication Mechanisms.
Provides Standard Interface Goal: portability. Unix runs on many very
different computer systems. To a first approximation can port programs
across systems with little effort.
Mediates Resource Usage Goal: allow multiple users to share resources
fairly, efficiently, safely and securely. Examples:
o Multiple processes share one processor. (preemptable resource)
o Multiple programs share one physical memory (preemptable
resource).
o Multiple users and files share one disk. (non-preemptable
resource)
o Multiple programs share a given amount of disk and network
bandwidth (preemptable resource).
Q1. What is meant by Real Time Operating System?
A real-time operating system (RTOS) is an operating system (OS)
intended to serve real-time application process data as it comes in,
typically without buffering delays. Processing time requirements
(including any OS delay) are measured in tenths of seconds or shorter.
Q2. What is meant by Multi Programming?
Multiprogramming is a rudimentary form of parallel processing in
which several programs are run at the same time on a uniprocessor.
Multiprocessor Systems
Most computer systems are single processor systems i.e they only have one
processor. However, multiprocessor or parallel systems are increasing in importance
nowadays. These systems have multiple processors working in parallel that share
the computer clock, memory, bus, peripheral devices etc. An image demonstrating
the multiprocessor architecture is:
Types of Multiprocessors
There are mainly two types of multiprocessors i.e. symmetric and asymmetric
multiprocessors. Details about them are as follows:
Symmetric Multiprocessors
In these types of systems, each processor contains a similar copy of the operating
system and they all communicate with each other. All the processors are in a peer to
peer relationship i.e. no master - slave relationship exists between them.
An example of the symmetric multiprocessing system is the Encore version of Unix
for the Multimax Computer.
Asymmetric Multiprocessors
In asymmetric systems, each processor is given a predefined task. There is a master
processor that gives instruction to all the other processors. Asymmetric
multiprocessor system contains a master slave relationship.
Asymmetric multiprocessor was the only type of multiprocessor available before
symmetric multiprocessors were created. Now also, this is the cheaper option.
Advantages of Multiprocessor Systems
There are multiple advantages to multiprocessor systems. Some of these are:
More reliable Systems
In a multiprocessor system, even if one processor fails, the system will not halt. This
ability to continue working despite hardware failure is known as graceful degradation.
For example: If there are 5 processors in a multiprocessor system and one of them
fails, then also 4 processors are still working. So the system only becomes slower
and does not ground to a halt.
Enhanced Throughput
If multiple processors are working in tandem, then the throughput of the system
increases i.e. number of processes getting executed per unit of time increase. If
there are N processors then the throughput increases by an amount just under N.
More Economic Systems
Multiprocessor systems are cheaper than single processor systems in the long run
because they share the data storage, peripheral devices, power supplies etc. If there
are multiple processes that share data, it is better to schedule them on
multiprocessor systems with shared data than have different computer systems with
multiple copies of the data.
Disadvantages of Multiprocessor Systems
There are some disadvantages as well to multiprocessor systems. Some of these
are:
Increased Expense
Even though multiprocessor systems are cheaper in the long run than using multiple
computer systems, still they are quite expensive. It is much cheaper to buy a simple
single processor system than a multiprocessor system.
Complicated Operating System Required
All the processors in the multiprocessor system share the memory. So a much larger
pool of memory is required as compared to single processor systems.
Concepts/components of os:
Memory Management
Processor Management
Device Management
File Management
Security
Control over system performance
Job accounting
Error detecting aids
Coordination between other software and users
Memory Management
Memory management refers to management of Primary Memory or Main
Memory. Main memory is a large array of words or bytes where each word or
byte has its own address.
Main memory provides a fast storage that can be access directly by the CPU.
So for a program to be executed, it must in the main memory. Operating
System does the following activities for memory management.
Keeps tracks of primary memory i.e. what part of it are in use by whom,
what part are not in use.
In multiprogramming, OS decides which process will get memory when
and how much.
Allocates the memory when the process requests it to do so.
De-allocates the memory when the process no longer needs it or has
been terminated.
Processor Management
In multiprogramming environment, OS decides which process gets the
processor when and how much time. This function is called process scheduling.
Operating System does the following activities for processor management.
Keeps tracks of processor and status of process. Program responsible for
this task is known as traffic controller.
Allocates the processor(CPU) to a process.
De-allocates processor when processor is no longer required.
Device Management
OS manages device communication via their respective drivers. Operating
System does the following activities for device management.
Keeps tracks of all devices. Program responsible for this task is known as
the I/O controller.
Decides which process gets the device when and for how much time.
Allocates the device in the efficient way.
De-allocates devices.
File Management
A file system is normally organized into directories for easy navigation and
usage. These directories may contain files and other directions. Operating
System does the following activities for file management.
Keeps track of information, location, uses, status etc. The collective
facilities are often known as file system.
Decides who gets the resources.
Allocates the resources.
De-allocates the resources.
Other Important Activities
Following are some of the important activities that Operating System does.
Security -- By means of password and similar other techniques,
preventing unauthorized access to programs and data.
Control over system performance -- Recording delays between request
for a service and response from the system.
Job accounting -- Keeping track of time and resources used by various
jobs and users.
Error detecting aids -- Production of dumps, traces, error messages and
other debugging and error detecting aids.
Coordination between other softwares and users -- Coordination and
assignment of compilers, interpreters, assemblers and other software to
the various users of the computer systems.
Program execution
I/O operations
File System manipulation
Communication
Error Detection
Resource Allocation
Protection
Program execution
Operating systems handle many kinds of activities from user programs to system
programs like printer spooler, name servers, file server, etc. Each of these activities
is encapsulated as a process.
A process includes the complete execution context (code to execute, data to
manipulate, registers, OS resources in use). Following are the major activities of an
operating system with respect to program management −
I/O Operation
An I/O subsystem comprises of I/O devices and their corresponding driver software.
Drivers hide the peculiarities of specific hardware devices from the users.
An Operating System manages the communication between user and device
drivers.
I/O operation means read or write operation with any file or any specific I/O device.
Operating system provides the access to the required I/O device when required.
Communication
In case of distributed systems which are a collection of processors that do not share
memory, peripheral devices, or a clock, the operating system manages
communications between all the processes. Multiple processes communicate with
one another through communication lines in the network.
The OS handles routing and connection strategies, and the problems of contention
and security. Following are the major activities of an operating system with respect
to communication −
Error handling
Errors can occur anytime and anywhere. An error may occur in CPU, in I/O devices
or in the memory hardware. Following are the major activities of an operating
system with respect to error handling −
Resource Management
In case of multi-user or multi-tasking environment, resources such as main memory,
CPU cycles and files storage are to be allocated to each user or job. Following are
the major activities of an operating system with respect to resource management −
Protection
Considering a computer system having multiple users and concurrent execution of
multiple processes, the various processes must be protected from each other's
activities.
Protection refers to a mechanism or a way to control the access of programs,
processes, or users to the resources defined by a computer system. Following are
the major activities of an operating system with respect to protection −
These devices are found everywhere, from car engines and manufacturing
robots to VCRs and microwave ovens.
They tend to have very specific tasks. The systems they run on are usually
primitive, and so the operating systems provide limited features.
Usually, they have little or no user interface, preferring to spend their time
monitoring and managing hardware devices, such as automobile engines
and robotic arms. These embedded systems vary considerably.
Sensors bring data to the computer. The computer must analyze the data
and possibly adjust controls to modify
the sensor inputs. Systems that control scientific experiments, medical
imaging systems, industrial control systems, and certain display systems are
real-time systems.
2 Multimedia Systems
Most operating systems are designed to handle conventional data such as text files,
programs, word-processing documents, and spreadsheets. However, a recent trend
in technology is the incorporation of multimedia data into computer 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
that are in popular use today. These include audio files such as MP3 DVD movies,
video conferencing, and short video clips of movie previews or news stories
downloaded over the Internet. Multimedia applications may also include live
webcasts (broadcasting over the World Wide Web) of speeches or sporting events
and even live webcams that allow a viewer in Manhattan to observe customers at a
cafe in Paris. Multimedia applications need not be either audio or video; rather, a
multimedia application often includes a combination of both. For example, a movie
may consist of separate audio and video tracks. Nor must multimedia applications
be delivered only to desktop personal computers. Increasingly, they are being
directed toward smaller devices, including PDAs and cellular telephones. For
example, a stock trader may have stock quotes delivered wirelessly and in real time
to his PDA.
3 Handheld Systems
Handheld systems include personal digital assistants (PDAs), such as Palm and
Pocket-PCs, and cellular telephones, many of which use special-purpose embedded
operating systems. Developers of handheld systems and applications face many
challenges, most of which are due to the limited size of such devices. For example,
a PDA is typically about 5 inches in height and 3 inches in width, and it weighs less
than one-half pound. Because of their size, most handheld devices have a small
amount of memory, slow processors, and small display screens. We will take a look
now at each of these limitations. The amount of physical memory in a handheld
depends upon the device, but typically is is somewhere between 512 KB and 128
MB. (Contrast this with a typical PC or workstation, which may have several
gigabytes of memory!) As a result, 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. virtual memory allows
developers to write programs that behave as if the system has more memory than is
physically available. Currently, not many handheld devices use virtual memory
techniques, so program developers must work within the confines of limited physical
memory. 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 a
fraction of the speed of a processor in a PC. Faster processors require more power.
To include a faster processor in a handheld device would require a larger battery,
which would take up more space and would have to be replaced (or recharged)
more frequently. Most handheld devices use smaller, slower processors that
consume less power. Therefore, the operating system and applications must be
designed not to tax the processor.The last issue confronting program designers for
handheld devices is I/O. A lack of physical space limits input methods to small
keyboards, handwriting recognition, or small screen-based keyboards. The small
display screens limit output options. Whereas a monitor for a home computer may
measure up to 30 inches, the display for a handheld device is often no more than 3
inches square. Familiar tasks, such as reading e-mail and browsing web pages,
must be condensed into smaller displays. One approach for displaying the content in
web pages is web clipping, where only a small subset of a web page is delivered
and displayed on the handheld device. Some handheld devices use wireless
technology, such as BlueTooth or 802.11, allowing remote access to e-mail and web
browsing. Cellular telephones with connectivity to the Internet fall into this category.
However, for PDAs that do not provide wireless access, downloading data typically
requires the user to first download the data to a PC or workstation and then
download the data to the PDA. Some PDAs allow data to be directly copied from
one device to another using an infrared link. 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.
Here you will learn about the structure of operating systems. In other word, you will
see what operating systems looks like from the outside or the programmer's
interface.
1. Monolithic Systems
2. Layered Systems
3. Virtual Machines
4. Exokernels
5. Client-Server Systems
Now let's describe briefly about all the above different-different structures of
operating systems.
Monolithic Systems
When this technique is used, then each procedure in the system has a well-defined
interface in terms of parameter, and results, and each one is free to call any of the
other ones, if the latter provides some useful computation that the former needs.
In Monolithic system model, there is one service procedure for each system call, that
takes care of it. The utility procedures do jobs that are needed by several service
procedures, such as fetching the data from the user programs.
1. Main Procedure
2. Service Procedures
3. Utility Procedures
The figure given below shows all the layered provided above in monolithic system
model of operating system.
Layered Systems
Layer Function
5 The operator
4 User programs
3 I/O management
2 Operator-process communication
Layer 0 - This layer dealt with allocation of the processor, switching between
processes when interrupts occurred or timers expired
Layer 1 - This layer did the memory management
Layer 2 - This layer handled the communication between each process and the
operator console
Layer 3 - This layer took care of managing the Input/Output devices and buffering
the information streams to and from them
Layer 4 - On this layer, user programs were found
Layer 5 - On this layer, the system operator process was located
Virtual Machines
The system originally called CP/CMS, later renamed VM/370, was based on an
astute observation. That was a time sharing system, provides multiprogramming and
an extended machine with a more convenient interface than the bare hardware.
The heart of the system known as virtual machine monitor that runs on the bare
hardware and does the multiprogramming, providing several virtual machines to next
layer up as shown in the given figure.
These virtual machines aren't extended machines, with files and other nice features.
They are the exact copies of the bare hardware, including the kernel/user mode,
Input/Output, interrupts, and everything else the real machine has.
Exokernels
Exokernels is a program present at the bottom layer, running in the kernel mode.
The work of exokernel is just to allocate the resources to the virtual machines and
check attempts to use them to make sure no machine is trying to use some other's
resources.
Client-Server Model
In the client-server model, as shown in the figure given below, all the kernel does is
handle the communication between the clients and the servers.
By splitting the operating system (OS) up into parts, each of which only handles one
fact of the system, such as file service, terminal service, process service, or memory
service, each part becomes small and manageable.
System Call
When a program in user mode requires access to RAM or a hardware resource, it
must ask the kernel to provide access to that resource. This is done via something
called a system call.
When a program makes a system call, the mode is switched from user mode to
kernel mode. This is called a context switch.
Then the kernel provides the resource which the program requested. After that,
another context switch happens which results in change of mode from kernel mode
back to user mode.
A figure representing the execution of the system call is given as follows:
As can be seen from this diagram, the processes execute normally in the user mode
until a system call interrupts this. Then the system call is executed on a priority basis
in the kernel mode. After the execution of the system call, the control returns to the
user mode and execution of user processes can be resumed.
Generally, system calls are made by the user level programs in the following
situations:
CreateProcess() fork()
Process Control ExitProcess() exit()
WaitForSingleObject() wait()
CreateFile() open()
ReadFile() read()
File Management
WriteFile() write()
CloseHandle() close()
SetConsoleMode() ioctl()
Device Management ReadConsole() read()
WriteConsole() write()
GetCurrentProcessID() getpid()
Information Maintenance SetTimer() alarm()
Sleep() sleep()
CreatePipe() pipe()
Communication CreateFileMapping() shmget()
MapViewOfFile() mmap()
There are many different system calls as shown above. Details of some of those
system calls are as follows:
wait()
In some systems, a process may wait for another process to complete its execution.
This happens when a parent process creates a child process and the execution of
the parent process is suspended until the child process executes. The suspending of
the parent process occurs with a wait() system call. When the child process
completes execution, the control is returned back to the parent process.
exec()
This system call runs an executable file in the context of an already running process.
It replaces the previous executable file. This is known as an overlay. The original
process identifier remains since a new process is not created but data, heap, stack
etc. of the process are replaced by the new process.
fork()
Processes use the fork() system call to create processes that are a copy of
themselves. This is one of the major methods of process creation in operating
systems. When a parent process creates a child process and the execution of the
parent process is suspended until the child process executes. When the child
process completes execution, the control is returned back to the parent process.
exit()
The exit() system call is used by a program to terminate its execution. In a
multithreaded environment, this means that the thread execution is complete. The
operating system reclaims resources that were used by the process after the exit()
system call.
kill()
The kill() system call is used by the operating system to send a termination signal to
a process that urges the process to exit.However, kill system call does not necessary
mean killing the process and can have various meanings.