Nội dung text Operating Systems By Blackhortechonologydocx.pdf
Operating System BY:- RB Sharma Page 1 of 85 11:23:45 PM Friday, July 7, 2023 Unit-1 Introduction What is an operating system? An operating system is a software program that controls the system’s hardware and that interacts with the user and application software. It is the master control program that performs basic tasks, such as recognizing input from the keyboard, sending output to the display screen, keeping track of files and directories on the disk, and controlling peripheral devices such as printer and disk drives. Application programs usually require an operating system to function. The placement of the operating system is shown in figure below: Most commonly used operating systems include Microsoft Windows, DOS, UNIX, Linux, Mac OS, OS/2, MVS etc. Operating systems perform two basically unrelated functions: Extending the machine and Managing resources. The OS as an Extended Machine/Virtual Machine (Top-down view):- The architecture (instruction set, memory organization, I/O and bus structure) of most computers at the machine language level is primitive and awkward to program. For example, the most basic commands are read and write data in a floppy disk, each of which requires 13 parameters packed into 9 bytes. These parameters specify such items as the address of the disk block to be read, the number of sectors per track, the recording mode used on the physical medium etc. The OS shields the programmer from the disk hardware and presents a simple file-oriented interface. It also conceals a lot of unpleasant business concerning interrupts, timers, memory management, and other low-level features. In this view, the function of the OS 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 OS as a Resource Manager (Bottom-up view):- Modern computers consist of processors, memories, timers, disks, mice, network interfaces, printers and a wide variety of other devices. The job of the OS is to provide for an orderly and controlled allocation of the processors, memories and I/O devices among the various programs competing for them. It also keeps track of who is using which resources. It is like a traffic policeman. It makes sure that different programs and users running at the same time do not interfere with each other. Resource management includes multiplexing (sharing) resources in two ways: in time and in space. When a resource is time multiplexed, different programs (or users) take turns using it. For example, CPU. In space multiplexing, each one gets part of the resource instead of taking turns. For example, memory.
Operating System BY:- RB Sharma Page 2 of 85 11:23:45 PM Friday, July 7, 2023 History of operating systems: Historically operating systems have been tightly related to the computer architecture. So, it is good idea to study the history of operating system from the successive generations of computers. The first generation of computer (1945-1955): These machines were made up of vacuum tubes, very huge in size filling entire rooms. They produced a lot of heat and consumed more power. They were very slow. All the programming was done in absolute machine language by wiring up plug boards (rows of mechanical switches). Programming languages were unknown (not even assembly languages). Operating systems were unheard of. All the problems were straightforward numerical calculations. The second generation (1955-1965): These machines were made up of transistors. Compared to first generation, they were smaller in size, faster in speed and consumed less power and heat. These were batch processing systems in which jobs were gathered in groups or batches. Once a job was running, it had total control of the machine. As each job terminated, control was returned to the operating system (that cleaned up after the job and read in and initiated the next job). The operating systems were designed to smooth the transaction between jobs. A job is a set of programs written in FORTRAN or assembly language. Mostly used for scientific and engineering calculations. Typical OSs were FMS (the Fortran Monitor System), and IBSYS (IBM’s OS for the 7094). The third generation (1965-1980): These machines were made up of ICs. They provided a major price/performance advantage over the second generation machines. The OS designers developed the concept of multiprogramming in which several jobs are in main memory at once. A processor is switched from job to job as needed to keep several jobs advancing. Another major feature in third-generation OS was the technique called SPOOL (Simultaneous Peripheral Operations on Line). In Spooling, a high-speed device is interposed between a running program and a low-speed I/O device. For example, instead of writing directly to a printer, outputs are written to the disk. Programs can run to completion faster and other programs can be initiated sooner. Another feature present in this generation was time-sharing technique. It is a variant of multiprogramming technique, which was developed to multi-program large number of simultaneous interactive users. Fourth generation (1980-Present): With the development of LSI circuits, OS entered in the personal computer and workstation age. Computers became small enough and inexpensive.
Operating System BY:- RB Sharma Page 3 of 85 11:23:45 PM Friday, July 7, 2023 Two operating systems have dominated the personal computer scene: MS-DOS written by Microsoft, Inc. for IBM PC and UNIX. During mid-1980s, it began taking place the growth of networks of personal computers running network OS and distributed OS. Networked systems consist of multiple computers that are networked together. The users are aware of the existence of multiple computers. A distributed OS is one that appears to its users as a traditional uniprocessor system, even though it is actually composed of multiple processors. The users should not be aware of where their programs are being run or where their files are stored, that all should be handled by the OS automatically and efficiently. Types of Operating System: Batch System: A batch system is one that processes routine jobs without any interactive user present. Jobs are set up so they can be run to completion without manual intervention. A program takes a set of data files as input, processes the data and produces a set of output data files. This operating environment is termed as ‘batch processing’. Real-time Operating Systems: Real-time OSs are systems that respond to input immediately. These systems are characterized by having time as a key parameter. Often there are hard deadlines that must be met. For example, if a welding robot welds too early or too late, the car will be ruined. If the action must occur absolutely at a certain moment, we have a hard real-time system. In a soft real-time system, missing an occasional deadline is acceptable. Digital audio and multimedia systems fall in this category. VxWorks and QNX are well-known real-time OSs. Time Sharing Systems: Time sharing is the sharing of computing resources among many users. It is a variant of multiprogramming, in which each user has an online terminal. For example, if 20 users are logged in and 17 of them are thinking or drinking coffee, the CPU can be allocated in turn to the 3 jobs that want service. Multiprocessing System: Multiprocessing is the use of two or more central processing units (CPUs) within a single computer system. It refers to the ability of a system to support more than one processor or the ability to allocate tasks between them. A multiprocessor is a computer system having two or more processing units (multiple processors) each sharing main memory and peripherals, in order to simultaneously process programs. At the operating system level, multiprocessing is sometimes used to refer to the execution of multiple concurrent processes in a system, with each process running on a separate CPU or core, as opposed to a single process at any one instant. Multiprocessing is sometimes contrasted with multitasking, which may use just a single processor but switch it in time slices between tasks (i.e. a time-sharing system). Multiprocessing however means true parallel execution of multiple processes using more than one processor. Interactive System: An interactive operating system is one that allows the user to directly interact with the operating system while one or more programs are running. There will be a user interface in place to allow this to happen. It could be a command line style of interface or it could be a graphical interface. These systems allow users to enter data or commands and receive the results of processing immediately. The user is in direct two way communication with the computer. Most of the operating systems such as Windows and Mac OS are of this type. OS Components
Operating System BY:- RB Sharma Page 4 of 85 11:23:45 PM Friday, July 7, 2023 Process management I/O management Main Memory management File & Storage Management Protection Networking Command Interpreter Process Management: Tasks of Process Management of an OS include: Create, load, execute, suspend, resume, and terminate processes Switch system among multiple processes in main memory (process scheduling) Provides communication mechanisms so that processes can send (or receive) data to (or from) each other (process communication). Control concurrent access to shared data to keep shared data consistent (process synchronization). Allocate/de-allocate resources properly to prevent or avoid deadlock situation I/O Management: It ensures the proper use of devices, to prevent errors, and to provide users with convenient and efficient programming environment. Tasks of I/O Management of OS include: Hide the details of H/W devices Manage main memory for the devices using cache, buffer, and spooling Maintain and provide device driver interfaces Main Memory management: Processes must be loaded into main memory to be executed. It maximizes memory utilization Tasks of Main Memory Management of OS include: Keep track of which memory area is used by whom. Allocate/de-allocated memory as need File & Storage Management: Almost everything is stored in the secondary storage. Therefore, storage accesses must be efficient and convenient. Tasks of File and Storage Management include: Create, manipulate, delete files and directories Allocate, de-allocate, and defrag blocks Bad block marking Scheduling for multiple I/O request to optimize the performance Networking: It allows communications between computers Protection: Protect hardware resources, Kernel code, processes, files, and data from erroneous programs and malicious programs. Command Interpreter: Command Interpreter is one of the most important system programs. Its tasks include: Allow human users to interact with OS Provide convenient programming environment to users Execute a user command by calling one or more number of underlying system programs or system calls. OS Structure: Monolithic Systems: This is the most common organization. The structure is that there is no structure. The OS is written as a collection of procedures. Each procedure has a well-defined interface and each one is free to call any other one. Every procedure is visible to every other procedure, i.e., no information hiding. MS-DOS and the original UNIX system are the example of such a system.