Showing posts with label Operating System. Show all posts
Showing posts with label Operating System. Show all posts

Wednesday, February 18, 2015

 Advantages of Distributed System over Independent PCs--

1. Data Sharing: It is always possible to have people working independently on their
own PCs, for the same business. But we know that users may need to share data. For example,
airline reservation clerks need access to the master database of flights and existing
reservations. Giving each clerk his own private copy Of the entire database would not work,
since nobody would be able to know which seas the other clerks have all ready sold. Shared
data is absolutely essential to this of application and so, the machines must be.
interconnected
2.Device Sharing: Data are not the only things to be shared. Expensive . peripherals
such as color laser printers, photo-type setters and massive archival storage devices are also
among the few things that should be sharable.
3. Communication: Another reason to connect a group of isolated computers into a
distributed system is to achieve enhanced person-to-person communication. For many people,
electronic mail has numerous attractions over paper mail, telephone and FAX as it makes
various kinds of documents accessible by the people without changing their formats. this
requires a good communication setup.
4. Flexibility: Finally, a distributed System is potentially more flexible than giving each
user a isolated personal computer. If, we have a mixture of personal and shared computers, perhaps of different sizes, and jobs run on the most appropriate ones rather than always on
the owners machine. Then the workload can be spread Over the computers more effectively
and letting people run their jobs elsewhere may compensate for the loss of a few machines.
This way the system will be more flexible.

Tuesday, March 6, 2012

Functions of an Operating System Kernel

Functions of an Operating System Kernel-->
1.Process Management
•- Process creation and termination
• -Process scheduling and dispatching
•- Process switching
• -Process synchronization and support for interprocess communication
• -Management of process control blocks
2.Memory Management--
•- Allocation of address space to processes
• -Swapping
• -Page and segment management
3.I/O Management
•- Buffer management
•- Allocation of I/O channels and devices to processes
4.Support Functions--
• -Interrupt handling
-• Accounting
•- Monitoring

Process State

Process State:-For a program to be executed, a process, or task, is created for that program.As a process executes, it changes state. The state of a process is defined in part by the current activity of that process.dispatcher program that switches the processor from one process to another.

 Each process may be in one of the following states:-
*New: The process is being created.
*Running: Instructions are being executed.
*Waiting: The process is waiting for some event to occur (such as an I/O
completion or reception of a signal).
*Ready: The process is waiting to be assigned to a processor.
*Terminated: The process has finished execution.

MEMORY MANAGEMENT REQUIREMENTS

MEMORY MANAGEMENT REQUIREMENTS-->
                                    Relocation,Protection,Sharing,Logical organization,Physical organization.
1.Relocation--In a multiprogramming system, the available main memory is generally shared among a number of      processes.relocation is the process of swapping a process back in  memory .Once a program has been swapped out to disk,then we can put it into main memory at another area of memory.It is called relocation.so we need memory allocation for process to execute.and we need  MEMORY MANAGEMENT.
2.Protection--Each process should be protected against unwanted interference by other processes,
whether accidental or intentional. Thus, programs in other processes should not be able to reference memory locations in a process for reading or writing purposes without permission.
3.Sharing--Any protection mechanism must have the flexibility to allow several processes to
access the same portion of main memory.The memory management system must therefore allow controlled access to shared
areas of memory without compromising essential protection.
4.Logical Organization

Monday, December 19, 2011

Benefits of multithread


Benefits of multithread :-
The benefits of multithreaded programming is:
1. Responsiveness:- Multithreading an interactive application may allow a
program to continue running even if part of it is blocked or is performing
a lengthy operation, thereby increasing responsiveness to the user.
2.Resource sharing :-It allows an application to have several different threads of activity all within the same address space.
3.)Economy:-Due to cost of memory ,it is more economical to create and context switch threads.
4. Utilization of multiprocessor architectures: - A single-threaded
process can only run on one CPU,Multithreading on a multi-CPU machine increases concurrency.

   On single processor machine ,multithreading can help where:-i)some task tales much longer to execute than other .
ii)some task need a better deterministic outcome than other.
iii)some user interface activity is to be run concurrently with hardware communication.

Process State

Process State:-for a program to be executed, a process, or task, is created for that program.As a process executes, it changes state. The state of a process is defined in part by the current activity of that process.dispatcher program that switches the processor from one process to another.

 Each process may be in one of the following states:--
*New: The process is being created.
*Running: Instructions are being executed.
*Waiting: The process is waiting for some event to occur (such as an I/O completion or reception of a signal).
*Ready: The process is waiting to be assigned to a processor.
*Terminated: The process has finished execution.
Process state Diagram


Process Creation

Process Creation--When a new process is to be added to those currently being managed, the OS builds the data structures that are used to manage the process and allocates address space in main memory to the process.
                 A process may create several new processes, via a create-process system call, during the course of execution. The creating process is called a parent process, and the new processes are called the children of that process. Each of these new processes may in turn create other processes, forming a tree of processes.
*Reasons for Process Creation->
1.New batch job -The OS is provided with a batch job control stream, usually on tape or
disk.When the OS is prepared to take on new work, it will read the
next sequence of job control commands.
2.Interactive login-> A user at a terminal logs on to the system.
3.Created by OS to provide a service-> The OS can create a process to perform a function on behalf of a user program, without the user having to wait (e.g., a process to control
printing).
4.Spawned by existing process->For purposes of modularity or to exploit parallelism, a user program
can dictate the creation of a number of processes.

                                                                     When the OS creates a process at the explicit request of another
process, the action is referred to as process spawning.

Proccess

Proccesses :-
A batch system executes jobs, whereas a time-shared system has user programs, or tasks. Process is a program in execution. A program is only one part of process ,the process also contains the execution state of program.
It also includes the current activity, as represented by the value of the program counter and the contents of the processor ‘s registers. a process generally includes the process stack, which contains temporary data (such as method parameters, return addresses, and local variables), and a data section, which contains global
variables.
 So process,including--
  a.)A program in execution
  b.)An instance of a program running on a computer
  c.)The entity that can be assigned to and executed on a processor
  d.)A unit of activity characterized by the execution of a sequence of instructions, a current state, and an associated set of system resources

Each process provides the resources needed to execute a program.A single process might contains multiple threads. A process has a virtual address space, executable code, open handles to system objects, a security context, a unique process identifier.A process is always stored in the main memory also termed as the primary memory or random access memory.On a multiprocessor system, multiple processes can be executed in parallel.
        At any given point in time, while the program is executing, this process can be uniquely characterized by a number of elements, including the following:--
• Identifier:- A unique identifier associated with this process, to distinguish it
from all other processes.
• State- If the process is currently executing, it is in the running state.
• Priority:- Priority level relative to other processes.
• Program counter: -The address of the next instruction in the program to be
executed.
• Memory pointers: -Includes pointers to the program code and data associated
with this process, plus any memory blocks shared with other processes.
• Context data: -These are data that are present in registers in the processor
while the process is executing.
• I/O status information: -Includes outstanding I/O requests, I/O devices (e.g., tape
drives) assigned to this process, a list of files in use by the process, and so on.
• Accounting information: -May include the amount of processor time and clock
time used, time limits, account numbers, and so on.

Os as Resource Manager

Os as Resource Manager--
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 resources like mouse ,printer ,memory ,etc.OS provides instructions for the processor.it is a program or suite of programs executed by the processor.    
                      The OS frequently relinquishes control and must depend on the processor to allow it to regain control.The OS directs the processor in the use of the other system resources and in the timing of its execution of other programs.
 Fig shows the main resources that are managed by the OS.A portion of the OS is in main memory.This includes the kernel, or nucleus, which contains the most frequently used functions in the OS and, at a given time, other portions of the OS currently in use.The allocation of this resource (main memory) is controlled by the OS and memory management hardware in the processor.The processor itself is a resource, and the OS determines how much processor time is to be devoted to the execution of a particular user program..


Sunday, December 18, 2011

Batch Processing

Batch Processing-It uses use multiprogramming.
Advantages of Batch Processing-
*Batch processing is particularly useful for operations that require the computer or a
peripheral device for an extended period of time and very little user interaction
  Disadvantages of Batch Processing-
*No interaction is possible with the user while the program is being executed
Job setup time was real problem li took a lot of time for mounting of tapes or cards
• .CPU sat idle during the transition from one job to another.

Advantages of Distributed System over Independent PCs

 Advantages of Distributed System over Independent PCs--

1. Data Sharing: It is always possible to have people working independently on their
own PCs, for the same business. But we know that users may need to share data. For example,
airline reservation clerks need access to the master database of flights and existing
reservations. Giving each clerk his own private copy Of the entire database would not work,
since nobody would be able to know which seas the other clerks have all ready sold. Shared
data is absolutely essential to this of application and so, the machines must be.
interconnected
2.Device Sharing: Data are not the only things to be shared. Expensive . peripherals
such as color laser printers, photo-type setters and massive archival storage devices are also
among the few things that should be sharable.
3. Communication: Another reason to connect a group of isolated computers into a
distributed system is to achieve enhanced person-to-person communication. For many people,
electronic mail has numerous attractions over paper mail, telephone and FAX as it makes
various kinds of documents accessible by the people without changing their formats. this
requires a good communication setup.
4. Flexibility: Finally, a distributed System is potentially more flexible than giving each
user a isolated personal computer. If, we have a mixture of personal and shared computers, perhaps of different sizes, and jobs run on the most appropriate ones rather than always on
the owners machine. Then the workload can be spread Over the computers more effectively
and letting people run their jobs elsewhere may compensate for the loss of a few machines.
This way the system will be more flexible.

Advantage of Distributed Systems over Centralized Ones

Advantage of Distributed Systems over Centralized Ones-->
1. Speed. When used to implement parallel processing where only goal is to achieve
maximum speed on a single problem, distributed systems can achieve very high specd as
compared to the centralized ones.
2. Inherent Distribution- Another reason for building a distributed system is that some
applications are inherently distributed. Banking, Airline reservation etc. are examples of the
 applications that are inherently distribute . When all the branches of a bank are connected,
  we have a commercial distributed system.
3. Reliability- Another potential advantage of a distributed system over a centralized
 one is higher reliability. By distributing the workload over many machines, a single chip
failure will bring down at most one machine, leaving the rest intact. Ideally, if 5 percent of
the machines are down at any moment, the system should be able to continue to work with
a 5 percent loss in performance. For critical applications, such as control of nuclear reactors
or aircraft, using a distributed system to achieve high reliability may be a dominant consideration
4. Incremental Growth. Finally, incremental growth is also potentially a big plus. Often
a company will buy a mainframe with the intention of doing all its work on it. If the company
prospers and the workload grows, at a certain point the mainframe will no longer be adequate.
The only solutions are to either replace the mainframe with a larger one (if it exists), or add
a second mainframe. Both of these can cause management difficulties with the company's
operations. In contrast, with a distributed system, it may be possible to simply add more
processors to the system, thus allowing it to expand gradually as the need arises.

Client Server

Client Server Support--server process waits for a request from a
client for one of its services.A client, which can be an application program or another server
program, requests a service by sending a message.The message is routed through the Executive to the appropriate server.The server performs the requested operation and
returns the results or status information by means of another message,which is routed
through the Executive back to the client.
*Advantages of a client/server architecture include the following:-
• It simplifies the Executive. It is possible to construct a variety of APIs implemented
in user-mode servers without any conflicts or duplications in the Executive.
New APIs can be added easily.
• It improves reliability. Each new server runs outside of the kernel, with its own partition of memory, protected from other servers. A single server can fail without crashing or corrupting the rest of the OS.
-It provides a uniform means for applications to communicate with services via
RPCs without restricting flexibility.
-It provides a suitable base for distributed computing.

Saturday, December 17, 2011

Thereds and it's Use

Thereds:-A thread is a single sequential flow of control within a program . or A sequence of a program which runs a certain function within a program.
                          A thread, sometimes called a lightweight process (LWP), is a basic unit of CPU  utilization.
If the process has multiple threads of control, it can do more than  one task at a time.
  ex.-A web browser might have one thread display images or text   while another thread retrieves data from the network.For example, a web server accepts client requests for web pages, images, sound, and so forth. A busy web server may have several (perhaps hundreds) of clients concurrently accessing it. If the web server ran as a traditional single-threaded process, it would be able to service only one client at a time.
    Uses of threads in a single-user multiprocessing system:-
*Foreground and background work:- For example, in a spreadsheet program,
one thread could display menus and read user input, while another thread executes user commands and updates the spreadsheet.It increases speed of the application by allowing the program to prompt for the next command before the previous command is complete.
*Asynchronous processing: -asynchronous elements in the program can be implemented
as threads. For example, as a protection against power failure, one
can design a word processor to write its random access memory (RAM) buffer
to disk once every minute.
*Speed of execution: A multithreaded process can compute one batch of data
while reading the next batch from a device. On a multiprocessor system, multiple threads from the same process may be able to execute simultaneously.
*Modular program structure: -Programs that involve a variety of activities or a variety of sources and  estinations of input and output may be easier to design and implement using threads.
  

Processor point of view of OS

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. Once  a job has been read in, the processor will encounter a branch instruction in the  monitor that instructs the processor to continue execution at the start of the  user program.The processor will then execute the instructions in the user program  until it encounters an ending or error condition. Either event causes the processor to fetch its next instruction from the monitor program. Thus the  phrase “control is passed to a job” simply means that the processor is now  fetching and executing instructions in a user program, and “control is returned  to the monitor” means that the processor is now fetching and executing instructions  from the monitor program.

Network operating system

Network operating system--A network operating system is an operating system that provides features such as file sharing across the network and that includes a communication scheme that allows different processes on different computers to exchange messages. A computer running a network operating system acts autonomously from all other computers on the network, although it is aware of the network and is able to communicate with other networked computers.
     An operating system, which includes software to communicate with othe computers via a
network, is called -network operating system. This allows resources such as files, application
programs and printers to be shared between computers
Such operating systems are specialized to provide the networking services.
Network operating system examples are . -
                BSD (Berkeley System Distribution) Unix, Novell, Lantastic.

User and System View of OS

User View--For user The goal is to maximize the work (or play) that the user is performing. In this case, the operating system is designed mostly for ease of use, with some attention paid to performance and none paid to resource utilization—how various hardware and software resources are shared. Performance is, of course, important to the user; but rather than resource utilization, such systems are optimized for the single-user experience.
                A user sits at a terminal connected to a mainframe or  minicomputer. 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/O are used efficiently and   that no individual user takes more than her fair share.    In still other cases, users sit at workstations connected to networks of   other workstations and servers.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.
 

System View--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/O devices, and so on. The operating system acts as the manager of these resources.An operating system is a  control program. A control program manages the execution of user programs  to prevent errors and improper use of the computer. It is especially concerned  with the operation and control of I/O devices.

System Calls

System Calls-System calls provide an interface to the services made available by an operating
system or interface between a pEocess and the operating system.the purpose of a system call is to request the operating system to perform some activity. For ex writing a  simple program to read data from one file and copy them to another file. The first input that the program will need is the names of the two files: the input file and the output file.This requires many I/O system calls.Once the two file names are obtained, the program must open the input file and create the output file.Each of these operations requires another system call.
 
  There are different system calls for performing different kinds of tasks -
•File manipulation system calls for example, are open, close, read, write, lseek etc.
•There can be system calls for process control. These can be like abort, execute, create
    process, terminate a process, allocate and free ‘memory for a process etc.
•For device management, the system calls that can be there are — request device, release:
device, read, write, reposition, get and set device attributes etc
•For managing the information, the system calls that can be there are — get and set
time, get and set file or device attributes etc.. ‘‘

OPERATING SYSTEM SERVICES

OPERATING SYSTEM SERVICES-- It is Intermediary between user of a computer and computer h/w
An operating system provides an environment for the execution of programs in a convenient manner and manages the computer h/w.
*User interface.-
*Program execution. The system must be able to load a program into
memory and to run that program. The program must be able to end its
execution,.
*I/O operations.-A running program may require I/O, which may involve a
file or an I/O device.
*File-system manipulation.- The file system is of particular interest.programs need to read and write files and directories.
*Communications.-communication
may occur between processes that are executing on the same computer
or between processes that are executing on different computer systems tied together by a computer network.Communications may be implemented via shared memory or through message passing, in which packets of
information are moved between processes by the operating system.
*Error detection.- The operating system needs to be constantly aware of possible errors. Errors may occur in the CPU and memory hardware (such
as a memory error or a power failure), in I/O devices (such as a parity error on tape, a connection failure on a network,.
*Resource allocation. When there are multiple users or multiple jobs
running at the same time, resources must be allocated to each of them.This is done by os.
*Accounting:-A good OS will collect usage statistics for various resources and monitor performance parameters such as response time.
*Protection and security. The owners of information stored in a multiuser or
networked computer system may want to control use of that information.