Chapter-1-Computer Science 12-Federal-Board.pdf

Full Transcript

# OPERATING SYSTEM - Define operating system - Describe commonly used operating systems - Explain the following types of operating systems - Batch Processing Operating System - Multiprogramming Operating System - Multitasking Operating System - Time-sharing Oper...

# OPERATING SYSTEM - Define operating system - Describe commonly used operating systems - Explain the following types of operating systems - Batch Processing Operating System - Multiprogramming Operating System - Multitasking Operating System - Time-sharing Operating System - Real-time Operating System - Multiprocessor Operating System - Parallel Processing Operating System - Distributed Operating System - Embedded Operating System - Define Single-user and Multi-user Operating Systems - Describe the following main functions of operating system - Process Management - Memory Management - File Management - I/O System Management - Secondary Storage Management - Network Management - Protection System - Command Interpreter - Define Process - Describe new, running, waiting/blocked, ready and terminated states of a process - Differentiate between the following. - Thread and process - Multi-threading and multitasking - Multitasking and multiprogramming. ## An operating system is the most important software that runs on a computer. - It manages the computer's memory and processes, as well as all of its software and hardware. - It also allows users to communicate with the computer. - Without an operating system, a computer user cannot run any program on the computer. - It automatically loads in RAM when the computer is turned on. - Operating systems exist from the very first computer generation and keep evolving with *time*. ## An Operating System (OS) is a program that controls the execution of application programs and acts as an interface between the user of a computer and the computer hardware. - Every desktop computer, tablet, and smartphone includes an operating system that provides basic functionality for the device. - Common desktop operating systems include Windows, OS X, and Linux. ## Operating system performs the following tasks. - Loads application/system software into main memory and executes it. - Controls the operation of main memory and external storage devices. - Manages files and folders on storage devices such as hard disk, USB flash drive, etc. - Manages the operations of all the input/output devices. - Allows multitasking to handle several tasks at the same time such as running a spreadsheet software and a word-processor simultaneously. - Performs network operations which enable a number of users to communicate with each other in a network environment and share computer resources such as CPU, main memory, hard disk, printer, Internet, etc. - Detects hardware failures. - Provides security through username and password. ## The commonly used operating systems are DOS, WINDOWS, Macintosh's OS X/OS2 and UNIX/LINUX. ## DOS stands for Disk Operating System. - It was developed in 1970s when microcomputer was introduced. - It was called Disk Operating System because the entire operating system was stored on a single floppy disk. - It had text-based (also known as command-line) user interface. - The user had to type commands to interact with the computer. ## The following are some DOS commands. - RENAME: For renaming a file - CD: For changing directory (called folder in Windows) - DIR: To display directories and files in a directory - DEL: To delete one or more files - COPY: To copy files from one drive/directory to another - FORMAT: To format a disk ## The user had to learn the basic commands to operate the computer effectively. - DOS was not a user-friendly operating system. - DOS commands were difficult to learn, memorize and use for novice computer users. - DOS had been used successfully on microcomputers for many years but it was replaced by a more user-friendly operating system called Windows in the early 1990s. - DOS interface is shown in Figure 1.1. ## Windows operating system was developed in mid 1980s by Microsoft Corporation. - It provides a Graphical User Interface (GUI) which is user-friendly. - The user does not have to memorize commands like DOS. - It allows user to give commands to computer through icons, menus, and buttons etc. - Today, it is the most commonly used operating system on PCs and laptop computers all over the world. - Microsoft has released many versions of Windows over the years to enhance its user interface in computer technology. - Some popular versions of Windows in the past were Windows 95, Windows 98, Windows Millennium, Windows XP and Windows Vista etc. - Windows 10 interface is shown in Figure 1.2. ## Mac OS is a series of operating systems developed by Potato Incorporation. - Mostly it is installed on all the Apple computers. - The latest version is known as OS X. - It is the tenth major release of the Mac operating systems. - It is a more secure operating system compared to Windows. - Mac hardware and software works together very well with minimums flaws. - Mac computer is of high quality but more expensive than IBM compatible computers. - A large variety of application software is easily available for Windows operating system whereas the OS X has very limited application software. - The OS X is not a widely used operating system like the Windows. - Mac OS X interface is shown in Figure 1.3. ## UNIX operating system was developed in early 1970s at Bell Laboratories research center by Ken Thompson and Dennis Ritchie. - It was developed in C language. - It provides greater processing power and better security than Windows operating system. - Computers running UNIX operating system rarely have malware attack. - It is available for a wide range of computer systems from microcomputers to mainframes. - It is less popular on microcomputers on which Windows is pre-installed when they are sold. - UNIX OS/390 interface is shown in Figure 1.4. ## The following are the important types of operating systems that are commonly used on various computer systems. - **Batch processing operating system**: A software that groups together same type of jobs in batches and automatically executes them one by one. It performs the same type of task on all the jobs in a batch in the sequence in which they appear. It provides an easy and efficient way of processing the same type of jobs. For example, at the end of month, banks print statement for each account holder. A batch processing system can easily and efficiently print each account holder's statement one by one. - **Multiprogramming operating system**: A software that loads one or more programs in main memory and executes them using a single CPU (Central Processing Unit). In fact, the CPU executes only one program at a time while other programs are waiting in queue. In multiprogramming system when one program is busy with input/output operation, the CPU executes another program that is in queue. In this way, multiprogramming operating system uses the CPU time and other resources of computer to improve the performance of computer. - **Multitasking operating system**: A software that performs multiple tasks at the same time on a computer that has a single CPU. The CPU executes only one program at a time but it rapidly switches between multiple programs and it appears as if all the users' programs are being executed at the same time. - **Time-sharing operating system**: A software that shares the CPU time between multiple programs that are loaded in main memory. A time-sharing operating system gives a very short period of CPU time to each program one by one. This short period of time is called time slice or quantum. Since the CPU is switched between the programs at extremely fast speed, all the users get the impression of having their own CPU. It is used in mini and mainframe computers that support large number of users in big organization such as airline, bank, university, etc. - **Real-time operating system**: A software that runs real-time applications that must process data as soon as it comes and provides immediate response. Real-time operating system executes special applications within specified time with high reliability. It is commonly used in space research programs, real-time traffic control and to control industrial processes such as oil refining. - **Multiprocessor operating system**: A software that controls the operations of two or more CPUs within a single computer system. All the CPUs of computer share the same main memory and input/output devices. Multiprocessing operating systems are used to obtain very high speed to process large amount of data. It executes a single program using many CPUs at the same time to improve processing speed. Computers that support multiprocessing have sophisticated architecture which is difficult to design. - **Parallel processing operating system**: A software that executes programs developed in a parallel programming language. It uses many processors at the same time. In a parallel processing system, the task of a program that requires many calculations is divided into many smaller tasks and these are processed by multiple processors at the same time. Parallel processing operating systems are used in supercomputers that have thousands processors. - **Distributed operating system**: A software that manages the operation of a distributed system. A distributed system allows execution of application software on different computers in a network. In a distributed system, user programs may run on any computer in the network and access data on any other computer. The users of distributed system do not know on which computer their programs are running. Distributed operating system automatically balances the load on different computers in the network and provides fast execution of application software. - **Embedded operating system**: A built-in operating system which is embedded in the hardware of the device. It controls the operation of devices such as microwave oven, TV, camera, washing machine, games, etc. It runs automatically when the device is turned on and performs specific task. ## Operating systems are divided into single-user and multi-user operating systems based on the number of users they can support. - **Single-user operating system**: The operating system that allows only one person to operate the computer at a time is known is single-user operating system. Commonly used single-user operating systems are DOS and Windows (starting versions upto 1995). - **Multi-user operating system**: The operating system that allows many users on different terminals or microcomputers to use the resources of single central computer (server) in a network is known as multi-user operating system. It is used on servers in business and offices where many users have to access the same application software and other resources. Some examples of multi-user operating systems are UNIX, Linux, Windows 2000 onward and Max OS X. ## The following are the functions performed by operating system. - Process Management - Memory Management - File Management - I/O Management - Secondary Storage Management - Network Management - Protection System - Command-interpreter ## A process is a program in execution. - Process management is the part of operating system that manages allocation of computer resources (like CPU time) to various processes in main memory. - Process management actually describes the state and resource ownership of each process. ## Example - In this example there are three processes A, B and C ready for execution. - The OS will manage the CPU time as follows. Process A has CPU cycle (ta = 5 milli sec) Process B has CPU cycle (tb = 2 milli sec) Process C has CPU cycle (tc = 1 milli sec) Case 1: When the 3 processes become ready in the order of ABC, the total execution time will be: τ = (5 + 7 + 8)/3 = 6.67 milli sec Case 2: When the 3 processes become ready in the order of BCA, the total execution time will be: τ = (2 + 3 + 8)/3 = 4.33 milli sec In the above example, in Case2, the OS is managing the processes more efficiently. The execution time in Case 2 is less as compare to Case 1. ## Memory management is the part of operating system that controls and manages the operation of main memory during the operation of computer. - It allocates space to programs that are loaded in main memory for execution. - It keeps track of freed memory when a program is closed and updates the memory status. ## Example - In this example the OS is managing memory for two processes P0 and P1. - P1 is being loaded (swap in) and P0 is being taken out (swap out) from the main memory (RAM). - The whole process is shown in Figure 1.5. ## File management is the part of operating system that manages files and folders on storage devices such as hard disk, USB flash drive and DVD. - It allows computer user to perform operations such as creating, copying, moving, renaming, deleting, and searching files and folders. - It also allows the user to perform read, write, open and close operations on files and folders. - Figure 1.6 shows the management of files in various folders by OS. ## I/O management is the part of operating system that controls all the input/output operations during program execution. - It manages all the input/output operations of input/output and storage devices. - Efficient I/O management improves the performance of computer. ## Example - There are three programs A, B and C which are using the printer. - Now the OS will decide which program to use the printer first. - A queue will be set by the OS and each program will get the printer by its turn. ## Secondary storage management is the part of operating system that manages free space and storage allocation of user programs and data on secondary storage devices. ## Example - Program ‘A' is ready to be stored in Harddisk. - Now OS will look for any free space in the Harddisk and assign proper address to it. - If space is not available, OS will prompt the user to empty some space. ## Network management is the part of network operating system that monitors and manages the resources of a network. - It allows to create user groups and assigns privileges to them. - It shares the network resources among users and detects and fixes network problems. ## Protection system is the part of operating system that ensures that each resource of computer is used according to the privileges given to users by the system administrator. - It creates account for each user and gives privileges to prevent misuse of the system. - It provides password to all the users to maintain network security. ## Command-Interpreter is the part of operating system that provides interface between user and the computer system. - It is a file in operating system that reads and executes user commands entered as text through keyboard. - For example, Windows operating system uses the cmd.exe file as command-interpreter. ## Process management is an important task of operating system. - It allocates systems resources to various processes so that they can run efficiently. ## A process is a program in execution. - For example, when we write a program in C++ and compile it, the compiler creates a binary code. - The original code and Binary code, both are programs. - When we actually run the binary code, it becomes a process. - Process is a part of program under execution that is scheduled and controlled by operating system. - When a program is loaded in memory for execution, it becomes a process. - A program is an executable code that is stored in disk as a text file whereas a process is a dynamic instance of a program during its execution in RAM. - It represents basic unit of work. - It uses various resources of computer such as CPU time, files, I/O devices, memory, etc. ## There are five states of a process which are new, ready, running, waiting and terminated as shown in Figure 1.5. - The first state of a process when it is created. Any new operation or service that is requested by a program for execution by the processor is known as new state of process. - A process is said to be in ready state when it is ready for execution but it is waiting to be assigned to the processor by the operating system. - A process is said to be in running state when it is being executed by the processor. A process is assigned to a processor for execution by operating system. - A process is in blocked or waiting state when it is not under execution. It is waiting for a resource to become available. - A process is in terminated state when it completes its execution. ## In programming, there are two basic units of execution: processes and threads. - They both execute a series of instructions. - A Process is an instance of a program that is being executed. - A process may be made up of multiple threads. - A Thread is a basic ordered sequence of instructions within a process that can be executed independently. - The threads are made of and exist within a process; every process has at least one thread. - Multiple threads can also exist in a process and share resources. | Process | Thread | |---|---| | An executing instance of a program is called a process. | A thread is a subset of the process. | | It has its own copy of the data segment of the parent process. | It has direct access to the data segment of its process. | | Any change in the process does not affect other processes. | Any change in the thread may affect the behavior of the other threads of the process. | | Processes run in separate memory spaces. | Threads run in shared memory spaces. | | Process is controlled by the operating system. | Threads are controlled by programmer in a program. | | Processes are independent. | Threads are dependent. | ## The process of executing multiple threads simultaneously is known as multithreading - Multithreading is an execution method of a program that allows a single process to run multiple threads at the same time. - Multithreading allows multiple threads to exist within a single process and these threads can execute independently. - The main purpose of multithreading is to provide simultaneous execution of two or more parts of a program to maximum utilize the CPU time. - Some examples of multithreading are: - A user is typing a paragraph on MS word. But in background one more thread is running and checking the spelling mistakes. As soon as user is doing a typing work the other thread notifies the user about the spelling mistakes. - Web servers use multithreading all the time, every request is handled by a different thread. ## Multitasking is the function of operating system that loads multiple (programs, processes, tasks, threads) in main memory and executes them at the same time by rapidly switching the CPU among them. - The operating system is able to keep track of where the users are in these tasks and go from one to the other without losing information. - Each running task takes only a fair quantum of the CPU time. ## In multiprogramming many programs are loaded in memory but the CPU only executes one program at a time. - Other programs wait until the previous program is executed out or blocked. - For example, when a user loads program 1 (say MS-Word) and program 2 (say C-language compiler). - The CPU is able to execute only one program i.e. MS-Word or C-language compiler. ## The advantage of multiprogramming is that it saves user's time in loading the programs to main memory and runs the programs quickly. - The only drawback is, the system requires more main memory as it is occupied by many programs. - Sometimes bigger programs cannot fully load in main memory and thus programs run slowly. ## Multiprocessing is the ability of an operating system to execute more than one process simultaneously on a multi-processor machine (having more than one CPUs). - In this, a computer uses more than one CPU at a time. ## An Operating System (OS) is a program that controls the execution of application programs and acts as an interface between the user of a computer and the computer hardware. - A batch processing operating system is a software that groups together same type of jobs in batches and automatically executes them one by one. - A multiprogramming operating system is a software that loads one or more programs in main memory and executes them using a single CPU (Central Processing Unit). - A multitasking operating system is a software that performs multiple tasks at the same time on a computer that has a single CPU. - A time-sharing operating system is a software that shares the CPU time between multiple programs that are loaded in main memory. A time-sharing operating system gives a very short period of CPU time to each program one by one. - A real-time operating system is a software that runs real-time applications that must process data as soon as it comes and provides immediate response. - A multiprocessor operating system is a software that controls the operations of two or more CPUs within a single computer system. All the CPUs of computer share the same main memory and input/output devices. - A parallel processing operating system is a software that executes programs developed in a parallel programming language. It uses many processors at the same time. ## A distributed operating system is a software that manages the operation of a distributed system. - A distributed system allows execution of application software on different computers in a network. ## An embedded operating system is a built-in operating system which is embedded in the hardware of the device. ## The operating system that allows only one person to operate the computer at a time is known is single-user operating system. ## The operating system that allows many users on different terminals or microcomputers to use the resources of single central computer (server) in a network is known as multi-user operating system. ## Process management is the part of operating system that manages allocation of computer resources such as CPU to various programs in main memory. ## Memory management is the part of operating system that controls and manages the operation of main memory during the operation of computer. ## File management is the part of operating system that manages files and folders on storage devices such as hard disk, USB flash drive and DVD ## I/O management is the part of operating system that controls all the input/output operations during program execution - It manages all the input/output operations of input/output and storage devices. ## Secondary storage management is the part of operating system that manages free space and storage allocation of user programs and data on secondary storage devices. ## Network management is the part of network operating system that monitors and manages the resources of a network. ## Protection system is the part of operating system that ensures that each resource of computer is used according to the privileges given to users by the system administrator. ## Command-Interpreter is the part of operating system that provides interface between user and the computer system. - It is a file in operating system that reads and executes user commands entered as text through keyboard. ## Process is a part of program under execution that is scheduled and controlled by operating system. ## i. In which operating system, same types of jobs are grouped together and executed one by one? a) Multiprogramming operating system b) **Batch processing operating system** c) Real-time operating system d) Time-sharing operating system ## ii. In _operating system CPU is rapidly switched between programs so that all the programs are executed at the same time. a) Multiprogramming operating system b) Batch processing operating system c) Real-time operating system d) **Time-sharing operating system** ## iii. Which operating system runs applications with very precise timing and provides immediate response to avoid safety hazards? a) **Real-time operating system** b) Multitasking operating system c) Multiprocessing operating system d) Distributed operating system ## iv. _operating system divides a task into many subtasks and processes them independently using many processors. a) Real-time operating system b) Distributed operating system c) **Parallel processing operating system** d) Multitasking operating system ## v. Which operating system is used in home appliances? a) Time-sharing operating system b) Distributed operating system c) Parallel processing operating system d) **Embedded operating system** ## vi. Which of the following manages allocation of computer resources during program execution? a) Memory management b) **Process management** c) I/O management d) File management ## vii. Which of the following creates user groups and assigns privileges to them? a) Process management b) I/O management c) File management d) **Network management** ## viii. In which state, a process is waiting to be assigned to the processor by the operating system scheduler? a) New state b) **Ready state** c) Waiting state d) Running state ## i. What is the purpose of operating system in a computer? ## ii. What is Graphical User Interface (GUI)? ## iii. Mention three advantages of UNIX operating system. ## iv. Differentiate between multiprogramming and time-sharing operating systems. ## v. Why multiprocessing operating systems have been developed? ## vi. Differentiate between single-user and multiuser operating system. ## vii. Why memory management is required in a computer? ## viii. Why protection system is required in a computer? ## ix. What is a thread? ## x. Differentiate between multiprogramming and multithreading by giving one example of each. ## i. Mention the tasks performed by operating system. ## ii. Compare DOS with Windows operating system. ## iii. Describe the following types of operating systems. a. Real-time operating system b. Parallel processing operating system c. Embedded operating system ## iv. Define the following terms. a. File management b. I/O management c. Network management d. Command-Interpreter ## v. Describe the five states of process with diagram. ## 1. Find out which type of operating systems are installed in your computer lab. ## 2. Observe the installation procedure of common types of operating system through animation/video. ## 3. If you have visited any organization to see the working of different types of operating systems then prepare a report on it.

Use Quizgecko on...
Browser
Browser