You are on page 1of 14
> Operating System An operating system (OS) is a collection of software that manages computer hardware resources and provides ‘common services for computer programs. The operating system is a vital component of the system software in a ‘computer system. Definition-An operating system is system software that acts as an interface between the user and the computer hardware and controls the execution of all kinds of programs. A computer system has many resources (hardware and software), which may be require to complete a task. The commonly required resources are input/output devices, memory, file storage space, CPU etc, The operating system acts as a manager of the above resources and allocates them to specific programs and users, whenever necessary to perform a patticular task. Therefore operating system is the resource manager ie. it can manage the resource of a computer system internally. The resources are processor, memory, files, and I/O devices. In simple terms, an operating system is the interface between the user and the machine. Some popular Operating Systems include Linux Operating System, Windows Operating System, MS, 08/400, AIX, z/OS, ete. Four Com J nai aeaermer ai Deyn system ana Appeston Progam (OPERATING SYSTEM ‘coMPUTER HARDWARE > Views of Operating System 1. 1's View 2. System View 1. Operating System: User View ‘The user view of the computer refers to the interface being used. Such systems are designed for one user to ‘monopolize its resources, to maximize the work that the user is performing, In these cases, the operating system. is designed mostly for ease of use, with some attention paid to performance, and none paid to resource utilization, 2. Operating System: System View Operating system can be viewed as a resource allocator also. A computer system consists of many resources like - hardware and software - that must be managed efficiently. The operating system acts as the manager of the resources, decides between conflicting requests, controls execution of programs etc. > Functions of Operating System System Processor Management _ —eEe EE baal ™ 1. Processor management which involves putting the tasks into order and pairing them into manageable size before they go to the CPU. In multiprogramming environment, the OS decides which process gets the processor when and for how much time, This function is called process scheduling. An Operating System does the following activities for processor management ~ ‘+ Keeps tracks of processor and status of process. The program responsible for this task is known as traffic controller. ‘+ Allocates the processor (CPU) to a process. + De-allocates processor when a process is no longer required. 2, Memory management which coordinates data to and from RAM (random-access memory) and determines the necessity for virtual memory. 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 accessed directly by the CPU. For a program to be executed, it must in the main memory. An Operating System does the following activities for memory management ~ ‘+ Keeps tracks of primary memory, i.., what part of it are in use by whom, what part are not in use ‘+ In multiprogramming, the OS decides which process will get memory when and how much. + Allocates the memory when a process requests it to do so. ‘+ De-allocates the memory when a process no longer needs it or has been terminated. 3, Device management which provides interface between connected devices. An Operating System manages device communication via their respective drivers. It does the following activities for device management ~ ‘+ Keeps tracks of all devices. Program responsible for this task is known as the /O controller. ‘+ Decides which process gets the device when and for how much time. + Allocates the device in the efficient way. © Deallocates devices 4, File management which directs permanent data storage. It provides file management which refers to the way that the operating system manipulates, stores, retrieves and saves data. A file system is normally organized into directories for easy navigation and usage. These directories may contain files and other directions. An Operating System does the following activities for file management — ‘Keeps track of information, location, uses, status ete, The collective facilities are often known as file system, ‘Decides who gets the resources. ‘#*Allocates the resources. ‘*De-allocates the resources. 5. Application which allows standard communication between software and your computer. 6. User interface which allows you to communicate with your computer. It provides a user interface, e.g, ‘command line, graphical user interface (GUI) 7. Security ~ By means of password and similar other techniques, it prevents unauthorized access to programs and data. 8. Control over system performance — Recording delays between request for a service and response from the system. 9, Job accounting ~ Keeping track of time and resources used by various jobs and users. 10, Error detecting aids ~ Error Handling is done by the operating system. It takes preventive measures whenever required to avoid errors. Production of dumps, traces, error messages, and other debugging and error detecting aids. 11. Coordination between other software's and users— Coordination and assignment of compilers, interpreters, assemblers and other software to the various users of the computer systems. > Concepts 1, Multi programming In a modern computing system, there are usually several concurrent application processes which want to execute. Now it is the responsibility of the Operating System to manage all the processes effectively and efficiently, One of the most important aspects of an Operating System is to multi program Ina computer system, there are multiple processes waiting to be executed, i.e. they are waiting when the CPU will be allocated to them and they begin their execution. These processes are also known as jobs. Now the main memory is too small to accommodate all of these processes or jobs into it. Thus, these processes are initially kept in an area called job pool. This job pool consists of all those processes awaiting allocation of ‘main memory and CPU. CPU selects one job out of all these waiting jobs, brings it from the job pool to main memory and starts, executing it. The processor executes one job until it is interrupted by some external factor or it goes for an VO task, Non-multi programmed system’s working - + Inanon multi programmed system, As soon as one job leaves the CPU and goes for some other task (say VO), the CPU becomes idle. The CPU keeps waiting and waiting until this job (wich was executing earlier) comes back and resumes its execution with the CPU. So CPU remains free for allthis while. + Now it has a drawback that the CPU remains idle for a very long period of time. Also, other jobs which are waiting to be executed might not get a chance to execute because the CPU is still allocated to the carlier job. + This poses a very serious problem that even though other jobs are ready to execute, CPU is not allocated to them as the CPU is allocated to a job which is not even utitizing it (as itis busy in VO tasks). + It cannot happen that one job is using the CPU for say 1 hour while the others have been waiting in the queue for 5 hours. To avoid situations like this and come up with efficient utilization of CPU, the concept of multi programming came up. The main idea of multi programming is to maximize the CPU time. Multi programmed system’s working — + Ina multi-programmed system, as soon as one job goes for an W/O task, the Operating System interrupts that job, chooses another job from the job pool (waiting queue), gives CPU to this new job and starts its execution. The previous job keeps doing its /O operation while this new job does CPU bound tasks. Now say the second job also goes for an I/O task, the CPU chooses a third job and starts executing it. As soon asa job completes its 1/0 operation and comes back for CPU tasks, the CPU is allocated to it + In this way, no CPU time is wasted by the system waiting for the /O task to be completed. Therefore, the ultimate goal of multi programming is to keep the CPU busy as long as there are processes ready to execute. This way, multiple programs can be executed on a single processor by executing a part of a program at one time, a part of another program after this, then a part of another program and so on, hence executing multiple programs. Hence, the CPU never remains idle. In the image below, program A runs for some time and then goes to waiting state. In the mean time program B begins its execution. So the CPU does not waste its resources and gives program B an opportunity to run, Program B = = Combined Wait Wait 2. Multiprocessing In a umi-processor system, only one -—pprocess executes. «at = a_—itime, Multiprocessing is the use of two ot more CPUs (processors) within a single Computer system, The term also ref to the ability of a system to support more than one processor within a single computer system, Now since there are multiple processors available, multiple proce processors share the computer bus, sometimes the clock, memory and peripheral devices also. be executed at a time. These multi Multi processing system’s working — + With the help of multiprocessing, many processes can be executed simultaneously. Say processes Pl, P2, 3 and P4 are waiting for execution, Now in a single processor system, firstly one process will execute, then the other, then the other and so on, + But with multiprocessing, each process can be assigned to a different processor for its execution. If it’s a dual-core processor (2 processors), two processes can be executed simultaneously and thus will be two times faster, similarly a quad core processor will be four times as fast as a single processor Why use multi processing — + The main advantage of multiprocessor system is to get more work done in a shorter period of time. These types of systems are used when very high speed is required to process a large volume of data, Multi processing systems can save money in comparison to single processor systems because the processors can share peripherals and power supplies + It also provides increased reliability in the sense that if one processor fails, the work does not halt, it only slows down. e.g. if we have 10 processors and 1 fails, then the work does not halt, rather the remaining 9 processors can share the work of the 10th processor. Thus the whole system runs only 10 percent slower, rather than failing altogether. cPur cPua). MEMORY Multiprocessing refers to the hardware (ie., the CPU units) rather than the software (i.e., running processes). If the underlying hardware provides more than one processor then that is multiprocessing. It is the ability of the system to leverage multiple processors’ computing power. Difference between Multi programming and Multi processing - + A System can be both multi programmed by having multiple programs running at the same time and multiprocessing by having more than one physical processor. The difference between multiprocessing, and multi programming is that Multiprocessing is basically executing multiple processes at the same time on multiple processors, whereas multi programming is keeping several programs in main memory and executing them concurrently using a single CPU only. + Multiprocessing occurs by means of parallel processing whereas Multi programming occurs by switching from one process to other (phenomenon called as context switching). 3. Multitasking As the name itself suggests, multi tasking refers to execution of multiple tasks (say processes, programs, threads etc.) at a time, In the modern operating systems, we are able to play MP3 music, edit documents in Microsoft Word, surf the Google Chrome all simultaneously, this is accomplished by means of multitasking. Multitasking is a logical extension of multi programming. The major way in which multitasking differs, from multi programming is that multi programming works solely on the concept of context switching whereas multitasking is based on time sharing alongside the concept of context switching, Multi tasking system’s working — + Ina time sharing system, each process is assigned some specific quantum of time for which a process is, meant to execute, Say there are 4 processes P1, P2, P3, PA ready to execute. So each of them are assigned some time quantum for which they will execute e.g time quantum of 5 nanoseconds (5 ns). As one process begins execution (say P2), it executes for that quantum of time (5 ns). After 5 ns the CPU starts, the execution of the other process (say P3) for the specified quantum of time. + Thus the CPU makes the processes to share time slices between them and execute accordingly. As soon as time quantum of one process expires, another process begins its execution, + Here also basically a context switch is occurring but it is occurring so fast that the user is able to interact, with each program separately while it is running, This way, the user is given the illusion that multiple processes/ tasks are executing simultaneously. But actually only one process! task is executing at a particular instant of time. In multitasking, time sharing is best manifested because each running process takes only a fair quantum of the CPU time. Ina more general sense, multitasking refers to having multiple programs, processes, tasks, threads running at the same time, This term is used in modern operating systems when multiple tasks shar processing resource (¢.g., CPU and Memory). + As depicted in the above image, at any time the CPU is executing only one task while other tasks are waiting for their turn, The illusion of parallelism is achieved when the CPU is reassigned to another task. i.e all the three tasks A, B and C are appearing to occur simultaneously because of time sharing, + So for multitasking to take place, firstly there should be multiprogramming ic. presence of multiple programs ready for execution, And secondly the concept of time sharing 4, Multi threading A thread is a basic unit of CPU utilization, Multi threading is an execution model that allows a single process to have multiple code segments (j.c., threads) running concurrently within the “context” of that process e.g. VLC media player, where one thread is used for opening the VLC media player, one thread for playing a particular song and another thread for adding new songs to the playlist. Multi threading is the ability of a process to manage its use by more than one user at a time and to manage multiple requests by the same user without having to have multiple copies of the program. Multi threading system’s working — Example 1 — + Say there is a web server which processes client requests. Now if it executes as a single threaded process, then it will not be able to process multiple requests at a time. Firstly one client will make its request and finish its execution and only then, the server will be able to process another client request. This is really costly, time consuming and tiring task. To avoid this, multi threading can be used + Now, whenever a new client request comes in, the web server simply creates a new thread for processing this request and resumes its execution to hear more client requests. So the web server has the task of listening to new client requests and creating threads for each individual request. E: ich newly created thread processes one client request, thus reducing the burden on web server. Example 2 - + We can think of threads as child processes that share the parent process resources but execute independently. Now take the case of a GUI. Say we are performing a calculation on the GUI (which is taking very long time to finish). Now we cannot interact with the rest of the GUI until this command finishes its execution, To be able to interact with the rest of the GUL, this command of calculation should be assigned to a separate thread. So at this point of time, 2 threads will be executing i.e. one for calculation, and one for the rest of the GUI Hence here in a single process, we used multiple threads for multiple functionality. The image below completely describes the VLC player example: VLC Media Player ww CPU Advantages of Multi threading — + Benefits of Multi threading include increased responsiveness. Since there are multiple threads in a program, so if one thread is taking too long to execute or if it gets blocked, the rest of the threads keep executing without any problem, Thus the whole program remains responsive to the user by means of remaining threads. + Another advantage of multi threading is that itis less costly, Creating brand new processes and allocating resources is a time consuming task, but since threads share resources of the parent process, creating threads and switching between them is comparatively easy. Hence multi threading is the need of modern Operating Systems. > Operating System - Services An Operating System provides services to both the users and to the programs ‘+ Itprovides programs an environment to execute. + Itprovides users the services to execute the programs in a convenient manner. Following are a few common services provided by an operating system— + Program execution ‘+ 1/0 operations .F yystem manipulation = Communication © Error Di + Resource Allocation + Protection 1, 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 ~ + Loads a program into memory. Executes the program, + Handles program's execution. + Provides a mechanism for process synchronization, + Provides a mechanism for process communication. + Provides a mechanism for deadlock handling, 2, 1/0 Operation ‘An /O subsystem comprises of 1/0 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. ‘+ 1/0 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, 3. File system manipula n A file represents a collection of related information. Computers can store files on the disk (secondary storage), for long-term storage purpose. Examples of storage media include magnetic tape, magnetic disk and optical disk drives like CD, DVD. Each of these media has its own properties like speed, capacity, data transfer rate and data access methods. A file system is normally organized into directories for easy navigation and usage. These directories may contain files and other directions. Following are the major activities of an operating system with respect to file management — + Program needs to read a file or write a file, + The operating system gi 's the permission to the program for operation on file. + Permission varies from read-only, read-write, denied and so on. + Operating System provides an interface to the user to create/delete files. + Operating System provides an interface to the user to ereate/delete directories. + Operating System provides an interface to create the backup of file system. 4, 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 securit Following are the major activities of an operating system with respect to communication — + Two processes often require data to be transferred between them + Both the processes can be on one computer or on different computers, but are connected through a computer network. + Communication may be implemented by two methods, either by Shared Memory or by Message Passing. 5. Error handling Errors can occur anytime and anywhere. An etror 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 ~ ‘© The OS constantly checks for possible errors, The OS takes an appropriate action to ensure correct and consistent computing. 6, 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 — + The OS manages all kinds of resources using schedulers, + CPU scheduling algorithms are used for better utilization of CPU. 7. 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 = + The OS ensures that all access to system resources is controlled. + The OS ensures that extemal 1/O devices are protected from invalid access attempts. + The OS provides authentication features for each user by means of passwords. > Types of Operating System ‘Operating systems are there from the very first computer generation and they keep evolving with time. Some of the important types of operating systems are as follows’ 1. Simple Batch Systems Fach user prepares his job on an off-line device like punch cards and submits it to the computer operator. To speed up processing, jobs with similar needs are batched together and run as a group. The programmers leave their programs with the operator and the operator then sorts the programs with similar requirements into batches. In this type of system, there is no direct interaction between user and the computer. Disadvantages of Simple Batch Systems 1. No interaction between user and computer. 2. No mechanism to prioritize the processes. 3. Lack of interaction between the user and the job. 4, CPU is often idle, because the speed of the mechanical I/O devices is slower than the CPU, 2. Time-sharing operating systems ‘Time-sharing is a technique which enables many people, located at various terminals, to use @ particular ‘computer system at the same time. Time-sharing or multitasking is a logical extension of multiprogramming. Processor's time which is shared among multiple users simultaneously is termed as time-sharing. The main difference between Multi-programmed Systems and Time-Sharing Systems is that in case of Multi- programmed batch systems, the objective is to maximize processor use, whereas in Time-Sharing Systems, the objective is to minimize response time. Multiple jobs are executed by the CPU by switching between them, but the switches occur so frequently. ‘Thus, the user can receive an immediate response. For example, in a transaction processing, the processor executes, each user program in a short burst or quantum of computation. That is, if m users are present, then each user ‘can get a time quantum, When the user submits the command, the response time is in few seconds at most. ‘The operating system uses CPU scheduling and multiprogramming to provide each user with a small portion of a time, Computer systems that were designed primarily as batch systems have been modified to time-sharing systems. Advantages of Timesharing operating systems ‘+ Provides the advantage of quick response. ‘+ Each task gets an equal opportunity. + Avoids duplication of software. © Reduces CPU idle time. Disadvantages of Time-sharing operating systems + Problem of reliability. ‘* Question of security and integrity of user programs and data, + Problem of data communication 3. Distributed operating System Distributed systems use multiple central processors to serve multiple real-time applications and multiple users. Data processing jobs are distributed among the processors accordingly. The processors communicate with one another through various communication lines (such as high-speed buses, of telephone lines). These are referred as loosely coupled systems or distributed systems. Processors in a distributed system may vary in size and function. These processors are referred as sites, nodes, computers, and soon. ‘These system’s processors differ in size and function. The major benefit of working with these types of the ‘operating system is that it is always possible that one user can access the files or software which are not actually present on his system but some other system connected within this network i.e., remote access is enabled within the devices connected in that network. Advantages of distributed systems ‘+ With resource sharing facility, a user at one site may be able to use the resources available at another. ‘+ Speedup the exchange of data with one another via electronic mail, ‘+ [fone site fails in a distributed system, the remaining sites can potentially continue operating, ‘+ Better service to the customers. ‘+ Reduction of the load on the host computer. + Reduction of delays in data processing, Disadvantages of Distributed Operating System: + Failure of the main network will stop the entire communication + Toestablish distributed systems the language which are used are not well defined yet. + ‘These types of systems are not readily available as they are very expensive, Not only thatthe underlying software is highly complex and not understood well yet Examples of Distributed Operating System are- LOCUS ete. 4. Network operating System A Network Operating System runs on a server and provides the server the capability to manage data, users, groups, security, applications, and other networking functions. The primary purpose of the network operating, system is to allow shared file and printer access among multiple computers in a network, typically a local area mnetwork (LAN), and a private network ot to other networks. Examples of network operating systems include Microsoft Windows Server 2003, Microsoft Windows Server 2008, UNIX, Linux, Mae OS X, Novell NetWare, and BSD. Advantages of network operating systems + Centralized servers are highly stable. + Security is server managed. ‘+ Upgrades to new technologi and hardware can be easily integrated into the system. + Remote access to servers is possible from different locations and types of systems. Disadvantages of network operating systems ‘+ High cost of buying and running a server. ‘+ Dependency on a central location for most operations. ‘+ Regular maintenance and updates are required, 5. Real Time operating System A real-time system is defined as a data processing system in which the time interval required to process and respond to inputs is so small that it controls the environment. The time taken by the system to respond to an input and display of required updated information is termed as the response time. So, in this method, the response time is very less as compared to online processing, Real-time systems are used when there are rigid time requirements on the operation of a processor, or the flow of data and real-time systems can be used as a control device in a dedicated application A real-time operating system must have well-defined, fixed time constraints, otherwise the system will fail For example, scientific experiments, medical image systems, industrial control systems, weapon systems, robots, air traffic control systems, ete «Hard real-time systems Hard real-time systems guarantee that critical tasks complete on time. In hard real-time systems, secondary storage is limited or missing and the data is stored in ROM. In these systems, virtual memory is almost never found, * Soft real-time systems Soft real-time systems are less restrictive. A critical real-time task gets priority over other tasks and retains the priority until it completes. Soft real-time systems have limited utility than hard real-time systems. For example, multimedia, virtual reality, Advanced Scientific Projects likes undersea exploration and planetary rovers, etc. Advantages of RTOS + Maximum Utilizatio resources + Task Shifting: Time assigned for shifting tasks in these systems are very less. For example in older systems it takes about 10 micro seconds in shifting one task to another and in latest systems it takes 3 micro seconds. + Focus on Application: Focus on running applications and less importance to applications which are in queue. + Real time operating system in embedded system: Since size of programs is small, RTOS used in embedded systems like in transport and others. + Error Free: These types of systems are error free. + Memory Allocation: Memory allocation is best managed in these types of systems, Maximum utilization of devices and system, thus more output from all the san also be Disadvantages of RTOS jmited Tasks: Very few tasks run at the same time and their concentration is very less on few applications to avoid errors. + Use heavy system resources: Sometimes the system resources are not so good and they are expensive as well. + Complex Algorithms: The algorithms are very complex and difficult for the designer to writeon. + Device driver and interrupt signals: It needs specific device drivers and interrupts signals to response earliest to interrupts + Thread Priority: It is not good to set thread priority as these systems are very less prone to switching tasks. Examples of Real-Time Operating Systems are: Scientific experiments, medical imaging systems, industrial control systems, weapon systems, robots, air traffic control systems, ete.

You might also like