What is an Operating System?
Operating System
An Operating System is a program that acts as an intermediary between the user of a computer and computer hardware. The purpose of an operating system is to provide an environment in which user can execute programs in a convenient and efficient manner. It is the first program loaded into the computer's memory after the computer is switched on. Popular operating systems include MS-DOS, OS/2, Windows and UNIX. The operating system is an important component of the computer system, because it sets the standards for the application programs that run on it. All programs must be written to talk to the operating system.
Various functions of Operating System:
- Memory Management
- Processor Management
- Device Management
- File Management
i) Memory Management Functions:
Operating System manages the primary memory of the system. It allocates the memory, on the request of a process, which is being run at that time. It also keeps a check that at a particular time, how many bytes of memory are in use and which process is using it. It also keeps track of what part of it is free. In case of a multi-user system, it decides on priority basis, which user will have access to memory and when. How much of it is used depends on the requirements.
ii) Processor Management Functions:
Operating System also takes care of the processor. It allocates the processor to the user. In case of multi-user system, it allocates the processor time to different users as and when needed and in such a way that every user has a minimum waiting time.
iii) Device Management Functions:
It keeps track of all the devices i.e. peripherals attached to the computer such as I/O devices etc. When needed, it allocates the devices in such a way that each can be efficiently used. It initiates the I/O operations and allocates them along with other devices to the user.
iv) File Management Functions:
Writing and retrieving the information on/from the secondary storage device is the function of an Operating System. It follows a complete methodology for maintaining the files, so that different sets of information do not get mixed up and exactly the same set of information is supplied, which is required by the user.
An operating system is a program that manages the computer hardware.
An operating system may be viewed as an organized collection of software extension of hardware, consisting of control routines for operating a computer and for providing an environment for execution of program.
An operating system is an important part of almost every computer system.
A computer system can be divided roughly into four components:
The hardware,
The operating system,
The application programs, and
The users
Abstract View of Computer System
Operating system performs basically two unrelated functions:
Extending the machine and
Managing resources
Operating system as an extended Machine
The function of the operating system is to present the user with the equivalent of an extended machine or virtual machine that is easier to program than the underlying hardware.
The Operating System as a Resource Manager
Internally an Operating System acts as a manager of resources of the computer system such as processor, memory, files, and I/O device.
In this role, the operating system keeps track of the status of each resource, and decides who gets a resource, for how long and when.
In system that supports concurrent execution of program, the operating system resolves conflicting requests for resources in manner that preserves system integrity, and in doing so attempts to optimize the resulting performance.
Operating System Services arrow_upward
An operating system provides an environment for the execution of programs. It provides certain services to programs and to the users of those programs.
These operating-system services are provided for the convenience of the programmer, to make programming task easier.
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, either normally or abnormally (indicating error).
I/O operations
A running program may require I/O. This I/O may involve a file or an I/O device. For specific devices, special functions may be desired.
For efficiency and protection, users usually cannot control I/O devices directly. Therefore, the operating system must provide a means to do I/O.
File-system manipulation
Programs need to read and write files. Programs also need to create and delete files by name.
Communications
In many circumstances, one process needs to exchange information with another process.
Communications may be implemented via shared memory, or by the technique of message passing, in which packets of information are moved between processes by the operating system.
Error detection
The operating system constantly needs to be aware of possible errors.
Errors may occur in the CPU and memory hardware, in I/O devices, and in the user program. For each type of error, the operating system should take the appropriate action to ensure correct and consistent computing.
Resource allocation
When multiple users are logged on the system or multiple jobs are running at the same time, resources must be allocated to each of them.
Many different types of resources are managed by the operating system. Some may have special allocation code, whereas others (such as I/O devices) may have much more general request and release code.
Protection
Protection involves ensuring that access to system resources is controlled. Security of the system from outsiders is also important. Such security starts with each user having to authenticate himself to the system, usually by means of a password, to be allowed access to the resources.
Evolution of Operating System arrow_upward
Operating Systems have been evolving through the years. In the following discussion, we will briefly look at this development.
Mainframe System
Mainframe computer systems were the first computers used to tackle many commercial and scientific applications. Now we trace the growth of mainframe systems from simple batch systems to time-shared system.
Batch System
The operating system in these early computers was fairly simple. Its major task was to transfer control automatically from one job to the next. The operating system was always resident in memory.
To speed up processing, operators batched together jobs with similar needs and ran them through the computer as a group. Thus, the programmers would leave their programs with the operator.
The operator would sort programs into batches with similar requirements and, as the computer became available, would run each batch. The output from each job would be sent back to the appropriate programmer.
Memory Layout for a Simple Batch System
Multi-programmed Systems
The most important aspect of job scheduling is the ability to multi-program. In general, a single user cannot keep either the CPU or the I/O devices busy at all times. Multiprogramming increases CPU utilization by organizing jobs so that the CPU always has one to execute.
The operating system keeps several jobs in memory simultaneously. The operating system picks and begins to execute one of the jobs in the memory.
Eventually, the job may have to wait for some task, such as an I/O operation, to complete. In a non-multi-programmed system, the CPU would sit idle. In a multiprogramming system, the operating system simply switches to, and executes, another job.
Time-Sharing Systems
Time sharing (or multitasking) is a logical extension of multiprogramming. The CPU executes multiple jobs by switching among them, but the switches occur so frequently that the users can interact with each program while it is running.
A time-shared operating system allows many users to share the computer simultaneously. Since each action or command in a time-shared system tends to be short, only a little CPU time is needed for each user.
As the system switches rapidly from one user to the next, each user is given the impression that the entire computer system is dedicated to his/her use, even though it is being shared among many users.
Desktop System
Personal computers PCs appeared in the 1970s. During their first decade, the CPUs in PCs lacked the features needed to protect an operating system from user programs. PC operating systems therefore were neither multiuser nor multitasking.
However, the goals of these operating systems have changed with time; instead of maximizing CPU and peripheral utilization, the systems opt for maximizing user convenience and responsiveness.
Multiprocessor Systems
Multiprocessor systems (also known as parallel systems or tightly coupled systems) are growing in importance. Such systems have more than one processor in close communication, sharing the computer bus, the clock, and sometimes memory and peripheral devices.
Multiprocessor systems have three main advantages:
Increased throughput
By increasing the number of processors, we hope to get more work done in less time. The speed-up ratio with N processors is not N; rather, it is less than N When multiple processors cooperate on a task, a certain amount of overhead is incurred in keeping all the parts working correctly.
Economy of scale
Multiprocessor systems can save more money than multiple single-processor systems, because they can share peripherals, mass storage, and power supplies.
If several programs operate on the same set of data, it is cheaper to store those data on one disk and to have all the processors share them, than to have many computers with local disks and many copies of the data.
Increased reliability
If functions can be distributed properly among several processors, then the failure of one processor will not halt the system, only slow it down. If we have ten processors and one fails, then each of the remaining nine processors must pick up a share of the work of the failed processor.
This ability to continue providing service proportional to the level of surviving hardware is called fault tolerant.
Symmetric multiprocessing architecture
Distributed Systems
A network is a communication path between two or more systems. Distributed systems depend on networking for their functionality. By communicating, distributed systems are able to share computational tasks, and provide a rich set of features to users.
Most operating systems support TCP/IP, including the Windows and UNIX operating systems. Some systems support proprietary protocols to suit their needs. To an operating system, a network protocol simply needs an interface device-a network adapter and software to package data in the communications protocol to send it and to unpack it to receive it.
Clustered Systems
Clustered systems gather together multiple CPUs to accomplish computational work. Clustered systems differ from parallel systems, however, in that they are composed of two or more individual systems coupled together.
The generally accepted definition is that clustered computers share storage and are closely linked via LAN networking. Clustering is usually performed to provide high availability. A layer of cluster software runs on the cluster nodes.
Real-Time Systems
Another form of a special-purpose operating system is the real-time system. A real-time system is used when rigid time requirements have been placed on the operation of a processor or the flow of data; thus, it is often used as a control device in a dedicated application. Sensors bring data to the computer.
A real-time system has well-defined, fixed time constraints. Processing must be done within the defined constraints, or the system will fail.
Real-time systems come in two flavors:
Hard: A hard real-time system guarantees that critical tasks be completed on time.
Soft: A less restrictive type of real-time system is a soft real-time system, where a critical real-time task gets priority over other tasks, and retains that priority until it completes.
An operating system executes a variety of programs:
Note
Sometimes we use the terms job and process almost interchangeably.
- Program counter
- Stack
- Data section
- 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
Each process is represented in the operating system by a process control block (PCB)—also called a task control block.
PCB includes :
- They include accumulators, index registers, stack pointers, and general-purpose registers, plus any condition-code information.
- Along with the program counter, this state information must be saved when an interrupt occurs, to allow the process to be continued correctly afterward.
In brief, the PCB simply serves as the repository for any information that may vary from process to process.
Diagram of Process Control Block
Context Switch Illustrated
The systems must provide a mechanism for process creation and termination.
Process Creation
- Parent and children share all resources,
- Children share subset of parent’s resources,
- Parent and child share no resources.
- Parent and children execute concurrently
- Parent waits until children terminates.
- Child is duplicate of parent
- Child has a program loaded into it.
- All resources shared (i.e. child is a clone).
- execve() system call used to replace process’ memory with a new program.
Process Termination
- Output data from child to parent (wait)
- Process’ resources are de-allocated by the OS.
- Makes an attempt to access memory to which it is not authorized,
- Attempts to execute a privileged instruction
- Child has exceeded allocated resources
- Task assigned to child is no longer required
- Parent is exiting (“cascading termination”)
- Many operating systems do not allow a child to continue if its parent terminates
Process Blocking
- An I/O device completes an operation,
- Another process sends a message
1 2 3 4 5 6 7 8 9 | if (no key being pressed) { await(keypress); print( "Key has been pressed!\n" ); } // handle keyboard input |
1 comment:
very nice
Post a Comment