• Have any questions?
  • info.zbook.org@gmail.com

Operating System - LPU Distance Education (LPUDE)

6m ago
67 Views
11 Downloads
4.40 MB
326 Pages
Last View : 1d ago
Last Download : 3d ago
Upload by : Camryn Boren
Share:
Transcription

Operating SystemDCAP403EditorDr. Pooja Guptanil Sharma

www.lpude.inDIRECTORATE OF DISTANCE EDUCATIONOPERATING SYSTEMEdited ByDr. Pooja Gupta

ISBN: 978-93-87034-83-9Printed byEXCEL BOOKS PRIVATE LIMITEDRegd. Office: E-77, South Ext. Part-I, Delhi-110049Corporate Office: 1E/14, Jhandewalan Extension, New Delhi-110055 91-8800697053, celbooks.comforLovely Professional UniversityPhagwara

CONTENTSUnit 1:Introduction to Operating SystemSarabjit Kumar, Lovely Professional University1Unit 2:Operation and Function of Operating SystemPooja Gupta, Lovely Professional University14Unit 3:Operating System StructureDeepak Mehta, Lovely Professional University29Unit 4:Process ManagementMithilesh Kumar Dubey, Lovely Professional University48Unit 5:SchedulingSahil Rampal, Lovely Professional University70Unit 6:Process SynchronizationPooja Gupta, Lovely Professional University96Unit 7:Memory ManagementPawan Kumar, Lovely Professional University119Unit 8:File ManagementMithilesh Kumar Dubey, Lovely Professional University139Unit 9:I/O & Secondary Storage StructureRamandeep Kaur, Lovely Professional University159Unit 10:System ProtectionSarabjit Kumar, Lovely Professional University182Unit 11:System SecurityMandeep Kaur, Lovely Professional University200Unit 12:Security SolutionRamandeep Kaur, Lovely Professional University225Unit 13:Case Study: LinuxYadwinder Singh, Lovely Professional University241Unit 14:Windows 2000Pooja Gupta, Lovely Professional University300

SYLLABUSOperating SystemObjectives: In order to meet the ever increasing need of computers, study of operating system is compulsory. This is coretechnology subject and the knowledge of which is absolutely essential for Computer Engineers. It familiarizes the students withthe concepts and functions of operating system. This subject provides knowledge to develop systems using advanced operatingsystem concepts.To learn the evolution of Operating systems.To study the operations performed by Operating System as a resource manager.To study computer security issues and Operating System tools.1.Introduction: Operating system Meaning, Supervisor & User mode, operating system operations & Functions, Types ofOS: Single-processor system, multiprogramming, Multiprocessing, Multitasking, Parallel, Distributed, RTOS etc.2.Operating System Structure: OS Services, System Calls, System Programs, OS Structures, layered structure Virtualmachines,3.Processes: Process Concept, PCB, Operation on Processes, Cooperating Processes, Inter process Communication,Process Communication in Client Server Environment.Threads: Concept of Thread, Kernel level & User level threads, Multithreading, Thread Libraries, Threading Issues4.Scheduling: scheduling criteria, scheduling algorithms, Type of Scheduling: Long term, Short term & Medium termscheduling, multi-processor scheduling algorithm, thread scheduling,5.Process Synchronization: Critical Section problem, semaphores, monitors, Deadlock characterization, Handling ofdeadlocks - deadlock prevention, avoidance, detection, recovery from deadlock.6.Memory Management: Logical & Physical Address space, Swapping, Contiguous memory allocation, paging,segmentation, Virtual memory, demand paging, Page replacement & Page Allocation algorithms, thrashing,Performance issues7.File Management: File concepts, access methods, directory structure, file system mounting, file sharing, protection,Allocation methods, Free space Mgt., Directory Implementation.8.I/O & Secondary Storage Structure: I/O H/W, Application I/O Interface, Kernel I/O subsystem, Disk Scheduling, diskmanagement, swap-space management, RAID structure.9.System Protection: Goals of protection, Access matrix and its implementation, Access control and revocation of accessrights, capability-based systems10.System Security: Security problem, program threats, system and network threats, cryptography as a security tools, userauthentication, implementing security defenses, firewalling to protect systems and networks.Case studies Windows OS, Linux or any other OS

Sarabjit Kumar, Lovely Professional UniversityUnit 1: Introduction to Operating SystemUnit 1: Introduction to Operating ing System: Meaning1.2History of Computer Operating Systems1.3Supervisor and User Mode1.4Goals of an Operating System1.5Generations of Operating Systems1.5.10th Generation1.5.2First Generation (1951-1956)1.5.3Second Generation (1956-1964)1.5.4Third Generation (1964-1979)1.5.5Fourth Generation (1979 – Present)1.6Summary1.7Keywords1.8Self Assessment1.9Review Questions1.10 Further ReadingsObjectivesAfter studying this unit, you will be able to:Define operating systemKnow supervisor and user modeExplain various goals of an operating systemDescribe generation of operating systemsIntroductionAn Operating System (OS) is a collection of programs that acts as an interface between a userof a computer and the computer hardware. The purpose of an operating system is to providean environment in which a user may execute the programs. Operating Systems are viewed asresource managers. The main resource is the computer hardware in the form of processors,storage, input/output devices, communication devices, and data. Some of the operating systemfunctions are: implementing the user interface, sharing hardware among users, allowing usersto share data among themselves, preventing users from interfering with one another, schedulingresources among users, facilitating input/output, recovering from errors, accounting for resourceusage, facilitating parallel operations, organising data for secure and rapid access, and handlingnetwork communications.LOVELY PROFESSIONAL UNIVERSITY1

Operating SystemNotes1.1 Operating System: MeaningAn operating system (sometimes abbreviated as “OS”) is the program that, after being initiallyloaded into the computer by a boot program, manages all the other programs in a computer.The other programs are called applications or application programs. The application programsmake use of the operating system by making requests for services through a defined ApplicationProgram Interface (API). In addition, users can interact directly with the operating systemthrough a user interface such as a command language or a Graphical User Interface (GUI).Figure 1.1: Operating System InterfaceHard DriveMouseComputerOperating SystemVideo CardMonitorSound CardKeyboardSpeakersIn a computer system, you find four main components: the hardware, the operating system,the application software and the users. In a computer system, the hardware provides the basiccomputing resources. The applications programs define the way in which these resources areused to solve the computing problems of the users. The operating system controls and coordinatesthe use of the hardware among the various systems programs and application programs for thevarious users.You can view an operating system as a resource allocator. A computer system has many resources(hardware and software) that may be required to solve a problem: CPU time, memory space,files storage space, input/output devices etc. The operating system acts as the manager of theseresources and allocates them to specific programs and users as necessary for their tasks. Sincethere may be many, possibly conflicting, requests for resources, the operating system must decidewhich requests are allocated resources to operate the computer system fairly and efficiently.An operating system is a control program. This program controls the execution of user programsto prevent errors and improper use of the computer. Operating systems exist because: they area reasonable way to solve the problem of creating a usable computing system. The fundamentalgoal of a computer system is to execute user programs and solve user problems.While there is no universally agreed upon definition of the concept of an operating system, thefollowing is a reasonable starting point:A computer’s operating system is a group of programs designed to serve two basic purposes:21.To control the allocation and use of the computing system’s resources among the varioususers and tasks, and2.To provide an interface between the computer hardware and the programmer that simplifiesand makes feasible the creation, coding, debugging, and maintenance of applicationprograms.LOVELY PROFESSIONAL UNIVERSITY

Unit 1: Introduction to Operating SystemAn effective operating system should accomplish the following functions:1.Should act as a command interpreter by providing a user friendly environment.2.Should facilitate communication with other users.3.Facilitate the directory/file creation along with the security option.4.Provide routines that handle the intricate details of I/O programming.5.Provide access to compilers to translate programs from high-level languages to machinelanguage.6.Provide a loader program to move the compiled program code to the computer’s memoryfor execution.7.Assure that when there are several active processes in the computer, each will get fair andnon-interfering access to the central processing unit for execution.8.Take care of storage and device allocation.9.Provide for long term storage of user information in the form of files.10.Permit system resources to be shared among users when appropriate, and be protectedfrom unauthorised or mischievous intervention as necessary.NotesFigure 1.2: Abstract View of the Components of a Computer SystemUser 1User 2User 3User nCompilerAssemblerText editorDatabasesystemApplication programsOperating SystemComputer hardwareThough systems programs such as editors and translators and the various utility programs (suchas sort and file transfer program) are not usually considered part of the operating system, theoperating system is responsible for providing access to these system resources.The abstract view of the components of a computer system and the positioning of OS is shownin the Figure 1.2.Task“Operating system is a hardware or software”. Discuss.1.2 History of Computer Operating SystemsEarly computers lacked any form of operating system. The user had sole use of the machine andwould arrive armed with program and data, often on punched paper and tape. The programwould be loaded into the machine, and the machine would be set to work until the programcompleted or crashed. Programs could generally be debugged via a front panel using switchesand lights. It is said that Alan Turing was a master of this on the early Manchester Mark I machine,LOVELY PROFESSIONAL UNIVERSITY3

Operating SystemNotesand he was already deriving the primitive conception of an operating system from the principlesof the Universal Turing machine.Later machines came with libraries of support code, which would be linked to the user’s programto assist in operations such as input and output. This was the genesis of the modern-day operatingsystem. However, machines still ran a single job at a time; at Cambridge University in Englandthe job queue was at one time a washing line from which tapes were hung with different coloredclothes-pegs to indicate job-priority.As machines became more powerful, the time needed for a run of a program diminished andthe time to hand off the equipment became very large by comparison. Accounting for andpaying for machine usage moved on from checking the wall clock to automatic logging by thecomputer. Run queues evolved from a literal queue of people at the door, to a heap of media on ajobs-waiting table, or batches of punch-cards stacked one on top of the other in the reader, untilthe machine itself was able to select and sequence which magnetic tape drives were online. Whereprogram developers had originally had access to run their own jobs on the machine, they weresupplanted by dedicated machine operators who looked after the well-being and maintenanceof the machine and were less and less concerned with implementing tasks manually. Whencommercially available computer centers were faced with the implications of data lost throughtampering or operational errors, equipment vendors were put under pressure to enhance theruntime libraries to prevent misuse of system resources. Automated monitoring was needed notjust for CPU usage but for counting pages printed, cards punched, cards read, disk storage usedand for signaling when operator intervention was required by jobs such as changing magnetictapes.All these features were building up towards the repertoire of a fully capable operating system.Eventually the runtime libraries became an amalgamated program that was started before thefirst customer job and could read in the customer job, control its execution, clean up after it,record its usage, and immediately go on to process the next job. Significantly, it became possiblefor programmers to use symbolic program-code instead of having to hand-encode binaryimages, once task-switching allowed a computer to perform translation of a program into binaryform before running it. These resident background programs, capable of managing multistepprocesses, were often called monitors or monitor-programs before the term operating systemestablished itself.An underlying program offering basic hardware-management, software-scheduling andresource-monitoring may seem a remote ancestor to the user-oriented operating systems ofthe personal computing era. But there has been a shift in meaning. With the era of commercialcomputing, more and more “secondary” software was bundled in the operating system package,leading eventually to the perception of an operating system as a complete user-system withutilities, applications (such as text editors and file managers) and configuration tools, and havingan integrated graphical user interface. The true descendant of the early operating systems iswhat we now call the “kernel”. In technical and development circles the old restricted sense of anoperating system persists because of the continued active development of embedded operatingsystems for all kinds of devices with a data-processing component, from hand-held gadgets upto industrial robots and real-time control-systems, which do not run user-applications at thefront-end. An embedded operating system in a device today is not so far removed as one mightthink from its ancestor of the 1950s.1.3 Supervisor and User ModeSingle user mode is a mode in which a multiuser computer operating system boots into a singlesuperuser. It is mainly used for maintenance of multi-user environments such as networkservers. Some tasks may require exclusive access to shared resources, for example running fsckon a network share. This mode may also be used for security purposes – network services are4LOVELY PROFESSIONAL UNIVERSITY

Unit 1: Introduction to Operating Systemnot run, eliminating the possibility of outside interference. On some systems a lost superuserpassword can be changed by switching to single user mode, but not asking for the password insuch circumstances is viewed as a security vulnerability.NotesYou are all familiar with the concept of sitting down at a computer system and writing documentsor performing some task such as writing a letter. In this instance, there is one keyboard and onemonitor that you interact with.Operating systems such as Windows 95, Windows NT Workstation and Windows 2000professional are essentially single user operating systems. They provide you the capability toperform tasks on the computer system such as writing programs and documents, printing andaccessing files.Consider a typical home computer. There is a single keyboard and mouse that accept inputcommands, and a single monitor to display information output. There may also be a printer forthe printing of documents and images.In essence, a single-user operating system provides access to the computer system by a singleuser at a time. If another user needs access to the computer system, they must wait till the currentuser finishes what they are doing and leaves.Students in computer labs at colleges or University often experience this. You might also haveexperienced this at home, where you want to use the computer but someone else is currentlyusing it. You have to wait for them to finish before you can use the computer system.1.4 Goals of an Operating SystemThe primary objective of a computer is to execute an instruction in an efficient manner and toincrease the productivity of processing resources attached with the computer system such ashardware resources, software resources and the users. In other words, you can say that maximumCPU utilisation is the main objective, because it is the main device which is to be used for theexecution of the programs or instructions. Brief the goals as:1.The primary goal of an operating system is to make the computer convenient to use.2.The secondary goal is to use the hardware in an efficient manner.1.5 Generations of Operating SystemsOperating systems have been evolving over the years. you will briefly look at this developmentof the operating systems with respect to the evolution of the hardware/architecture of thecomputer systems in this section. Since operating systems have historically been closely tied withthe architecture of the computers on which they run, you will look at successive generations ofcomputers to see what their operating systems were like. You may not exactly map the operatingsystems generations to the generations of the computer, but roughly it provides the idea behindthem.You can roughly divide them into five distinct generations that are characterized by hardwarecomponent technology, software development, and mode of delivery of computer services.1.5.1 0th GenerationThe term 0th generation is used to refer to the period of development of computing, which predatedthe commercial production and sale of computer equipment. You consider that the period mightbe way back when Charles Babbage invented the Analytical Engine. Afterwards the computersby John Atanasoff in 1940; the Mark I, built by Howard Aiken and a group of IBM engineersat Harvard in 1944; the ENIAC, designed and constructed at the University of Pencylvania byLOVELY PROFESSIONAL UNIVERSITY5

Operating SystemNotesWallace Eckert and John Mauchly and the EDVAC, developed in 1944-46 by John Von Neumann,Arthur Burks, and Herman Goldstine (which was the first to fully implement the idea of thestored program and serial execution of instructions) were designed. The development of EDVACset the stage for the evolution of commercial computing and operating system software. Thehardware component technology of this period was electronic vacuum tubes.The actual operation of these early computers took place without the benefit of an operatingsystem. Early programs were written in machine language and each contained code for initiatingoperation of the computer itself.The mode of operation was called “open-shop” and this meant that users signed up for computertime and when a user’s time arrived, the entire (in those days quite large) computer system wasturned over to the user. The individual user (programmer) was responsible for all machine setup and operation, and subsequent clean-up and preparation for the next user. This system wasclearly inefficient and dependent on the varying competencies of the individual programmer asoperators.1.5.2 First Generation (1951-1956)The first generation marked the beginning of commercial computing, including the introductionof Eckert and Mauchly’s UNIVAC I in early 1951, and a bit later, the IBM 701 which was alsoknown as the Defence Calculator. The first generation was characterised again by the vacuumtube as the active component technology.Operation continued without the benefit of an operating system for a time. The mode was called“closed shop” and was characterised by the appearance of hired operators who would select thejob to be run, initial program load the system, run the user’s

operating system is responsible for providing access to these system resources. The abstract view of the components of a computer system and the positioning of OS is shown in the Figure 1.2. Task “Operating system is a hardware or software”. Discuss. 1.2 History of Computer Operating Systems Early computers lacked any form of operating system.