Unit-I Operating System Concepts 1. What do you mean by OS (Operating System)? Or What is OS? Definition: OS is a program/software that • • Manage the computer hardware. Provides simple interface to the hardware for user programs. Goal: • Convenience for users. • Efficient operation of the computer system. 2. Explain in detail component of OS. • Hardware: The hardware comes at the lowest Level. It contains various kinds of physical devices like processor, memory, keyboard, mouse, monitor etc. • Operating System: The next level is for the OS. So, provides simple interface between application programs and hardware. It manages all the connected hardware. It hides complex details of hardware from the users. • Application Programs: Application programs perform particular tasks. They use different kinds of functionalities provided by OS. Ex. railway reservation system, banking system, web-browser. • User: The users comes at the top level. Users interact with the system by using application programs to perform particular tasks. 3. Explain OS from user and system point of view. • • • • • • OS: From User View This is a top-down view. From user point of view, OS can be considered as an Extended Machine. OS represents the computer system as a machine which is easier to program rather than connected hardware. OS hides all the details of the hardware. It acts as a layer between user and hardware, and provides simple interface between them. User doesn’t need to concern about the complexities of the hardware. • • Users have to just use the functionalities provided by the OS such as system calls, to make his work done. The primary goal of OS is the Convenience of User. OS: From System View • • • 1. This is a bottom-up view. OS can be considered as Resource Manager. OS manages all the resources such as CPU, memory, I/O devices. By multiplexing them in TIME: a Here, each user takes turn to use the resource. Ex. CPU 2. By multiplexing them in SPACE: a Here, each user gets parts of the resource. Ex. Memory • The primary goal of OS is the Efficiency of OS 4. Explain in detail generation of OS. The First Generation (1945-1955) • Hardware: Vacuum tubes and plug boards. • Neumann and others succeeded in building calculating engine. • No OS, No Programming languages. • Punch cards made it possible to write and read programs instead of using plug boards. The Second Generation (1955-1965) • Hardware: Transistors. • Clear separation between designers, builders, operators, programmers and maintenance personnel • Machines were called Mainframes • Batch Operating System took birth. The Third Generation (1965-1980) • Hardware: Integrated Circuits(ICs) • Multiprogramming OS and variations of it such as Time sharing, Interactive Multitasking OS came in picture. • SPOOLing (Simultaneous Peripheral Operating On Line) began during this time duration. • UNIX became popular as an OS. The Forth Generation (1980) • Hardware: Large Scale Integration (LSI) circuits — Chips has thousands of transistors on a square centimeter of silicon. • Personal computers evolved. • The first OS is DOS, and then revised DOS is known as MS-DOS. • Later on, Apple came provide user friendly GUI. • Microsoft, UNIX and Linux also provide same. The Fifth Generation (1980-till date) • The VLSI technology became ULSI (Ultra Large Scale Integration) technology, resulting in the production of microprocessor chips having ten million electronic components. Below are the features of fifth generation. a Artificial Intelligence o Parallel Processing o Nanotechnology o Natural language • 5. List out types of OS. Various important OS are listed below: 1. 3. 5. 7. 9. Batch OS Time Sharing OS Multi-User OS Network OS Multithreading OS 2. 4. 6. 8. Multiprogramming OS Real Time OS Multiprocessing OS Distributed OS 6. Explain in detail Batch Operating System. • • • • • • • • • In past, computer were large machines. o Input devices: Card readers, Tap drives o Output devices: Line printers, Punch cards and Tap drives The OS was very simple and always reside in main memory. Programmers would prepare a job and submit it to the operator. Job was consisted program, data and some control information. Operator would sort them in batches with similar requirements, and as computer available, run them batch wise. At some later time (Hours/Days), output appeared. The output consisted of the result of the program and error information. Memory is divided in two parts OS & JOB as seen in above fig. At a time, one job is selected out of the batch of jobs, and is loaded into memory for execution. Once its execution completes, another job will be selected and loaded into memory for execution This procedure will continue until all the jobs in a batch get executed. Disadvantages: • Low throughput — CPU remains idle when I/O is going on. • Programmers do not have direct interaction with job. • Debugging is possible only offline, after output appears • Operations were too much time consuming 7. Explain in detail Multiprogramming Operating System • • • • A multiprogramming OS provides the ability to run more than one program concurrently. Contrast to batch OS; here more than one program (or Job) can be loaded in main memory simultaneously. These programs can be executed concurrently. Memory is shared between OS and such kind of programs as such in fig. Job 3 Job 2 Job 1 Operating System Working: • A simple multiprogramming OS works in a non-preemptive manner • A program is allowed to execute until it voluntarily gives up the CPU. • A program voluntarily gives up the CPU in following two conditions 1. It waits for some events like I/O operation, memory read/write, file read/write etc. 2. It terminates(After successfully completion of execution) • Once a CPU becomes free, it can be allocated to some other program as see in figure kuo Rua kua it’u’it Time ‹ r› 4lultipr‹ ratmni rig u ith three ›rogr›unx Objective: • The Primary objective of Multiprogramming OS is to maximize CPU usage. Advantages: • • Multiprogramming significantly improves system throughput and resource utilization. Various resources such as CPU, can be utilized as much as possible among various simultaneously executing programs. 8. Explain Time Sharing Operating System • Time Sharing OS is a logical extension of the Multiprogramming OS. • CPU is multiplexed by time among several programs(or jobs) that are kept in main memory and on disk Working: • It works in preemptive manner. • A program is allowed to execute only for some maximum time duration. • After this time duration, a CPU is forcibly taken away from that program and allocated to another Program. • Smaller programs need not to wait for other large program to finish its execution. • So it minimizes the response time for user. • They are suitable for interactive programs in which user can directly interact with the program • Such type of system is also referred as multitasking system. • User can perform more than one task simultaneously. • For ex. User can execute program like MS-Word to prepare a document, as well as can run some other program like Windows Media Player to play songs. Both of these task can be performed simultaneously Objective: • The primary objective of Time Sharing OS is to provide better response time to users. Advantages • Improvement in system throughput and resource utilization • Response time is low. • It also allows sharing of computer among multiple users simultaneously. • It gives an illusion/impression to each user as if the entire computer resources are available to him only. Required Features: • Memory management & protection • Swapping and virtual memory • CPU scheduling • Disk management • Synchronization & Communication 9. Describe types of Real Time Operating System with example • • • • • • Real Time OS strictly require to process input data in a pre-specified time duration. In such type of OS, Time is key parameter Here input immediately affects (gives) the output. Time is very critical Systems having such type of characteristics are systems to control nuclear power plants, oil refining, air traffic control system, air defense systems, etc. In such system, input coming from some sensors should be processed immediately. Results of such processing affect the output, which generally controls some device. All these operations must occur within some time limits. Types: • Hard Real Time System: all critical tasks must get completed strictly within the specified time limits. In other words, tasks are guaranteed to occur in time. o Ex. Oil refinery, Nuclear Power Plant Controller and Flight Control System • Soft Real Time System: less strict. Missing an occasional dead line is an acceptable. o Ex. Digital audio/multimedia system, web sites/services and Satellite-based applications Required Features: • • • • 10. As primary objective is to provide quick response to the external events, scheduling should be priority based preemptive. Most of the processes are memory resident for quick access. So, memory management is simpler. I/O event management should be time critical. Like processes, databases and files are also memory resident for quick access. So, file management is also simpler. Explain in detail Services of Operating System. OS services can be described from two different points of view. User Point of View: • • • • • Program Execution: The OS provides an efficient and convenient environment for the execution of programs. So, an OS must provide functions for loading a program into main memory, execute it, and after execution, terminate it. I/O Operations: A running program needs I/O operations for reading input data, and for outputting the results. This I/O may be with a file or with device. File System Manipulation: OS provides file system manipulation functionalities like create, read, write and delete a file Communications: In multitasking OS more than one processes are running simultaneously. Sometime there is a need to exchanging information among processes. The OS provide communications for such inter processes. Error Detection: Errors may be in user programs. CPU and memory hardware, or in I/O devices. OS detects such errors and makes user aware from them. System Point of View: • • • Resource Allocation: When multiple user are sharing the same machine, or when multiple jobs are running simultaneously, there is a need of fair allocation of resources among them. Accounting: The OS keeps information about the users uses which resources, and for what duration of time. Such information can be used to bill the users in multi-user environment, or to get information of future usage of resources. Protection: OS ensures that all access to system resources is controlled. Also security from outsiders is important.