notes on operating system2013 formatted

Upload: laxmipant

Post on 02-Jun-2018

232 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/10/2019 Notes on Operating System2013 Formatted

    1/212

    INTRODUCTION TO MODERN OPERATING SYSTEM- CHAPTER 1

    WHAT IS AN OPERATING SYSTEM?

    AN OPERATING SYSTEM ACTS AS AN INTERFACE BETWEEN THE USER AND THE COMPUTER SYSTEM.

    The 1960s definition of an operating system is the software that controls the hardware. However, today, due to microcode we need a better definition. We see an operating system asthe programs that make the hardware useable. In brief, an operating system is the set ofprograms that controls a computer. Some examples of operating systems are UNIX, Mach, MS-DOS, MS-Windows, Windows/NT, Chicago, OS/2, MacOS, VMS, MVS, and VM.

    Controlling the computer involves software at several levels. We will differentiate kernelservices, library services, and application-level services, all of which are part of the operatingsystem. Processes run Applications, which are linked together with libraries that performstandard services. The kernel supports the processes by providing a path to the peripheraldevices. The kernel responds to service calls from the processes and interrupts from thedevices. The core of the operating system is the kernel, a control program that functions inprivileged state (an execution context that allows all hardware instructions to be executed),reacting to interrupts from external devices and to service requests and traps from processes.Generally, the kernel is a permanent resident of the computer. It creates and terminatesprocesses and responds to their request for service.

    Operating Systems are resource managers. The main resource is computer hardware in theform of processors, storage, input/output devices, communication devices, and data. Some ofthe operating system functions are: implementing the user interface, sharing hardware among

    users, allowing users to share data among themselves, preventing users from interfering withone another, scheduling resources among users, facilitating input/output, recovering fromerrors, accounting for resource usage, facilitating parallel operations, organizing data for secureand rapid access, and handling network communications.

    The operating system (OS) is the first thing loaded onto the computer -- without theoperating system, a computer is useless.

    Operating systems can now be found on many of the devices we use every day, fromcell phones to wireless access points.

    The purpose of an operating system is to organize and control hardware and softwareso that the device it lives in behaves in a flexible but predictable way.

    Not all computers have operating systems. The computer that controls the microwaveoven in your kitchen, for example, doesn't need an operating system. It has one set oftasks to perform, very straightforward input to expect (a numbered keypad and a fewpre-set buttons) and simple, never-changing hardware to control.

    For a computer like this, an operating system would be unnecessary baggage, driving upthe development and manufacturing costs significantly and adding complexity where

    http://electronics.howstuffworks.com/cell-phone.htmhttp://home.howstuffworks.com/microwave.htmhttp://home.howstuffworks.com/microwave.htmhttp://home.howstuffworks.com/microwave.htmhttp://home.howstuffworks.com/microwave.htmhttp://electronics.howstuffworks.com/cell-phone.htm
  • 8/10/2019 Notes on Operating System2013 Formatted

    2/212

    none is required. Instead, the computer in a microwave oven simply runs a single hard-wired program all the time (EMBEDDED SYSTEMS).

    All desktop computers have operating systems. The most common are the Windowsfamily of operating systems developed by Microsoft, the Macintosh operating systemsdeveloped by Apple and the UNIX family of operating systems (which have beendeveloped by a whole history of individuals, corporations and collaborators). There arehundreds of other operating systems available for special-purpose applications,including specializations for mainframes, robotics, manufacturing, real-time controlsystems and so on.

    Operating system are made of portable code instead of permanent physical circuits sothat changes can be made regularly as an when required without scrapping the wholedevice

    For a desktop computer user, this means you can add a new security update, systempatch, new application or even an entirely new operating system rather than junk yourcomputer and start again with a new one when you need to make a change.

    OBJECTIVES OF OPERATING SYSTEMS

    Modern Operating systems generally have following three major goals. Operating systemsgenerally accomplish these goals by running processes in low privilege and providing servicecalls that invoke the operating system kernel in high-privilege state.

    TO HIDE DETAILS OF HARDWARE BY CREATING ABSTRACTION:-

    An abstraction is software that hides lower level details and provides a set ofhigher-level functions. An operating system transforms the physical world of devices,instructions, memory, and time into virtual world that is the result of abstractions builtby the operating system. There are several reasons for abstraction.First , the code needed to control peripheral devices is not standardized. Operatingsystems provide subroutines called device drivers that perform operations on behalf ofprograms for example, input/output operations.

    Second , the operating system introduces new functions as it abstracts thehardware. For instance, operating system introduces the file abstraction so thatprograms do not have to deal with disks.

    Third , the operating system transforms the computer hardware into multiplevirtual computers, each belonging to a different program. Each program that is runningis called a process. Each process views the hardware through the lens of abstraction.Fourth , the operating system can enforce security through abstraction.

    http://computer.howstuffworks.com/microsoft.htmhttp://computer.howstuffworks.com/microsoft.htm
  • 8/10/2019 Notes on Operating System2013 Formatted

    3/212

    TO ALLOCATE RESOURCES TO PROCESSES (MANAGE RESOURCES):-An operating system controls how processes (the active agents) may access resources(passive entities).

    PROVIDE A PLEASANT AND EFFECTIVE USER INTERFACE :-

    The user interacts with the operating systems through the user interface and usuallyinterested in the look and feel of the operating system. The most importantcomponents of the user interface are the command interpreter, the file system, on-linehelp, and application integration. The recent trend has been toward increasinglyintegrated graphical user interfaces that encompass the activities of multiple processeson networks of computers.

    One can view Operating Systems from two points of views: Resource manager andExtended machines . Form Resource manager point of view Operating Systems manage thedifferent parts of the system efficiently and from extended machines point of view OperatingSystems provide a virtual machine to users that is more convenient to use. The structurallyOperating Systems can be design as a monolithic system, a hierarchy of layers, a virtualmachine system, an exokernel, or using the client-server model.

    Operating System Also Known as the Resource Manager Means Operating System will

    Manages all the Resources those are Attached to the System means all the Resource like

    Memory and Processor and all the Input output Devices those are Attached to the System are

    Known as the Resources of the Computer System and the Operating system will Manage all the

    Resources of the System. The Operating System will identify at which Time the CPU will perform

    which Operation and in which Time the Memory is used by which Programs. And which Input

    Device will respond to which Request of the user means When the Input and Output Devices

    are used by the which Programs. So this will manage all the Resources those are attached to the

    Computer System.

    The basic concepts of Operating Systems are processes, memory management, I/Omanagement, the file systems, and security.

    http://ecomputernotes.com/fundamental/introduction-to-computer/what-is-cpuhttp://ecomputernotes.com/fundamental/introduction-to-computer/what-is-computerhttp://ecomputernotes.com/fundamental/introduction-to-computer/what-is-cpuhttp://ecomputernotes.com/fundamental/input-output-and-memory/list-various-input-and-output-deviceshttp://ecomputernotes.com/fundamental/input-output-and-memory/list-various-input-and-output-deviceshttp://ecomputernotes.com/fundamental/input-output-and-memory/list-various-input-and-output-deviceshttp://ecomputernotes.com/fundamental/input-output-and-memory/list-various-input-and-output-deviceshttp://ecomputernotes.com/fundamental/introduction-to-computer/what-is-cpuhttp://ecomputernotes.com/fundamental/introduction-to-computer/what-is-computerhttp://ecomputernotes.com/fundamental/introduction-to-computer/what-is-cpu
  • 8/10/2019 Notes on Operating System2013 Formatted

    4/212

    OPERATING SYSTEM FUNCTIONS

    PROCESS MANAGEMENT

    A process is a program in execution: (A program is passive, a process active.)

    A process has resources (CPU time, files) and attributes that must be managed.

    One (or more) threads are the schedulable entities within a process.

    Management of processes includes:

    Thread Scheduling (priority, time management, . . . )

    Creation/termination

    Block/Unblock (suspension/resumption )

    Synchronization

    Communication

    Deadlock handling

    Debugging

    The Operating System also Treats the Process Management means all the Processesthose are given by the user or the Process those are System s own Process are

    Handled by the Operating System . The Operating System will Create the Priorities foe

    the user and also Start or Stops the Execution of the Process and Also Makes the Child

    Process after dividing the Large Processes into the Small Processes.

  • 8/10/2019 Notes on Operating System2013 Formatted

    5/212

    MAIN MEMORY MANAGEMENT

    Operating System also Manages the Memory of the Computer System means Providethe Memory to the Process and Also Deallocate the Memory from the Process. And also

    defines that if a Process gets completed then this will deallocate the Memory from theProcesses.

    Allocation/de-allocation for processes, files, I/O.

    Maintenance of several processes at a time

    Keep track of who's using what memory

    Movement of process memory to/from secondary storage.

    FILE MANAGEMENT

    A file is a collection of related information defined by its creator. Commonly, files representprograms (both source and object forms) and data.

    The operating system is responsible for the following activities in connections with filemanagement:

    File creation and deletion. Directory creation and deletion.

    Support of primitives for manipulating files and directories.

    Mapping files onto secondary storage.

    File backup on stable (nonvolatile) storage media.

  • 8/10/2019 Notes on Operating System2013 Formatted

    6/212

    I/O MANAGEMENT

    Buffer caching system

    Generic device driver code

    Drivers for each device - translate read/write requests into disk positioncommands.

    SECONDARY STORAGE MANAGEMENT

    Operating System also Controls the all the Storage Operations means how the

    data or files will be Stored into the computers and how the Files will be

    Accessed by the users etc. All the Operations those are Responsible for Storing

    and Accessing the Files is determined by the Operating System Operating System

    also Allows us Creation of Files, Creation of Directories and Reading and Writing

    the data of Files and Directories and also Copy the contents of the Files and the

    Directories from One Place to Another Place.

    Disks, tapes, optical, ...

    Free space management ( paging/swapping )

    Storage allocation ( what data goes where on disk )

    Disk scheduling

    NETWORKING

    Communication system between distributed processors.

    Getting information about files/processes/etc. on a remote machine.

    Can use either a message passing or a shared memory model.

    PROTECTION

    Of files, memory, CPU, etc.

    Means controlling of access

    Depends on the attributes of the file and user

  • 8/10/2019 Notes on Operating System2013 Formatted

    7/212

    SYSTEM PROGRAMS(User Interface)

    Command Interpreters -- Program that accepts control statements (shell, GUIinterface, etc.)

    Compilers/linkers

    Communications (ftp, telnet, etc.)

    Extended Machine : Operating System also behaves like an Extended Machine meansOperating system also Provides us Sharing of Files between Multiple Users, also

    Provides Some Graphical Environments and also Provides Various Languages for

    Communications and also Provides Many Complex Operations like using Many

    Hardwares and Softwares.

    Mastermind: Operating System also performs Many Functions and for those Reasonswe can say that Operating System is a Mastermind. It provides Booting without an

    Operating System and Provides Facility to increase the Logical Memory of the Computer

    System by using the Physical Memory of the Computer System and also provides various

    Types of Formats Like NTFS and FAT File Systems.

    Operating System also controls the Errors those have been Occurred into the Programand Also Provides Recovery of the System when the System gets Damaged Means When

    due to Some Hardware Failure , if System Doesnt Works properly then this Recover the

    System and also Correct the System and also Provides us the Backup Facility. And

    Operating System also breaks the large program into the Smaller Programs those arealso called as the threads. And execute those threads one by one

    TYPES OF OPERATING SYSTEM

    BASED ON ENVIRONMENT

    CUI

    GUI

    BASED ON FUNCTIONS

    REAL-TIME OPERATING SYSTEM

    SINGLE-USER, SINGLE TASK

    SINGLE-USER, MULTI-TASKING

  • 8/10/2019 Notes on Operating System2013 Formatted

    8/212

    MULTI-USER , MULTI-TASKING

    MULTIPROCESSING O/S

    MULTITHREADING O/S

    NETWORKING O/S

    BATCH PROCESSING O/S

    DISTRIBUTED O/S

    Command user Interface :-This operating system is totally command dependent. Onecan work on this environment only if they are familiar with the respective O/S commandEg. MS-DOS

    GUI: - Short for Graphical User Interface , a GUI Operating System contains graphics andicons and is commonly navigated by using a computer mouse. See the GUI definition fora complete definition. Below are some examples of GUI Operating Systems.

    System 7.xWindows 98Windows CE

    A real-time operating system (RTOS):- is an operating system (OS) intended to servereal-time application requests. It must be able to process data as it comes in, typically

    without buffering delays. Processing time requirements (including any OS delay) aremeasured in tenths of seconds or shorter. RTOS is specially designed for embeddedenvironments such as consumer devices, automobiles and robotics

    RTOS) - Real-time operating systems are used to control machinery, scientificinstruments and industrial systems.

    An RTOS typically has very little user-interface capability, and no end-user utilities, sincethe system will be a "sealed box" when delivered for use.

    A very important part of an RTOS is managing the resources of the computer so that aparticular operation executes in precisely the same amount of time, every time itoccurs.

    A common example of an RTOS is an HDTV receiver and display. It needs to read adigital signal, decode it and display it as the data comes in. Any delay would benoticeable as jerky or pixelated video and/or garbled audio.

    http://www.computerhope.com/jargon/g/gui.htmhttp://www.computerhope.com/macos.htmhttp://www.computerhope.com/win98.htmhttp://www.computerhope.com/wince.htmhttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Real-time_computinghttp://en.wikipedia.org/wiki/HDTVhttp://en.wikipedia.org/wiki/HDTVhttp://en.wikipedia.org/wiki/Real-time_computinghttp://en.wikipedia.org/wiki/Operating_systemhttp://www.computerhope.com/wince.htmhttp://www.computerhope.com/win98.htmhttp://www.computerhope.com/macos.htmhttp://www.computerhope.com/jargon/g/gui.htm
  • 8/10/2019 Notes on Operating System2013 Formatted

    9/212

    Some of the best known, most widely deployed, real-time operating systems

    LynxOS

    OSE

    QNX

    RTLinux

    VxWorks

    Windows CE

    Single user single tasking : -As the name implies, this operating system is designed tomanage the computer so that one user can effectively do one thing at a time. The Palm

    OS for Palm handheld computers is a good example of a modern single-user, single-taskoperating system. E.g. MS-DOS

    An example of a this kind of O/S would be the O/S of a basic mobile phone or an mp3player.

    There can only be one user using the device and that person is only using one of itsapplications at a time

    An MP3 player contains a computer to handle all of its functions. It has a small amountof memory and a number of specialist silicon chips . The operating system is installed inmemory and runs as soon as you switch on the device.

    Single user Multi-Tasking :-This is the type of operating system most people use ontheir desktop and laptop computers today. Microsoft's Windows and Apple's MacOSplatforms are both examples of operating systems that will let a single user have severalprograms in operation at the same time. For example, it's entirely possible for aWindows user to be writing a note in a word processor while downloading a file fromthe Internet while printing the text of an e-mail message.

    Another word for multi-tasking is multiprogramming E.g. Windows 95.

    Multi-user Multi-tasking :- A multi-user operating system allows many different users totake advantage of the computer's resources simultaneously. The operating system mustmake sure that the requirements of the various users are balanced, and that each of theprograms they are using has sufficient and separate resources so that a problem with

    http://en.wikipedia.org/wiki/LynxOShttp://en.wikipedia.org/wiki/Operating_System_Embeddedhttp://en.wikipedia.org/wiki/QNXhttp://en.wikipedia.org/wiki/RTLinuxhttp://en.wikipedia.org/wiki/VxWorkshttp://en.wikipedia.org/wiki/Windows_CEhttp://en.wikipedia.org/wiki/Windows_CEhttp://en.wikipedia.org/wiki/VxWorkshttp://en.wikipedia.org/wiki/RTLinuxhttp://en.wikipedia.org/wiki/QNXhttp://en.wikipedia.org/wiki/Operating_System_Embeddedhttp://en.wikipedia.org/wiki/LynxOS
  • 8/10/2019 Notes on Operating System2013 Formatted

    10/212

    one user doesn't affect the entire community of users. Unix, VMS and mainframeoperating systems, such as MVS, are examples of multi-user operating systems.

    Examples of this kind of O/S include various versions of UNIX, LINUX, IBMs z/OS, OS390,MVS and VM

    Network Operating System:- Operating system that supports networking

    examples of a network O/S include Windows Vista, Windows 8 and Mac O/S X , Unix,Linux and all other mainframes O/S

    A network O/S system should have the following features :-

    Deal with users logging on

    Maintain the network connection to the server

    Expand the file system to view folders on other computers

    Provide security to separate user accounts from each other

    Batch Operating System :-

  • 8/10/2019 Notes on Operating System2013 Formatted

    11/212

    Batch processing is a technique in which Operating System collects one programs and datatogether in a batch before processing starts. Operating system does the following activitiesrelated to batch processing.

    OS defines a job which has predefined sequence of commands, programs and data as a

    single unit.

    OS keeps a number a jobs in memory and executes them without any manualinformation.

    Jobs are processed in the order of submission i.e first come first served fashion.

    When job completes its execution, its memory is released and the output for the jobgets copied into an output spool for later printing or processing.

    Advantages

    Batch processing takes much of the work of the operator to the computer.

    Increased performance as a new job gets started as soon as the previous job finishedwithout any manual intervention.

    Disadvantages

    Difficult to debug program.

    A job could enter an infinite loop.

    Due to lack of protection scheme, one batch job can affect pending jobs.

  • 8/10/2019 Notes on Operating System2013 Formatted

    12/212

    Distributed operating system:-

    This is one of the modern operating system

    It is a O/S that supports distributed computing

    Distributed systems allow users to share resources on geographically dispersed hostsconnected via a computer network. Services could be provided either through a Client-Server Model or a Peer-to-Peer model

    A distributed system is a collection of loosely coupled processors interconnected by acommunication network.

    The processors in a distributed system may vary in size and function. They may includemicroprocessors, workstations, minicomputers and large general purpose computersystems

    They are referred as sites, nodes, computers, machines and hosts

    There are two types distributed System

    o Parallel Computingo Distributed Computing

    In the most simple form Parallel Computing is a method where several individual(autonomous) systems (CPU's) work in tandem to resolve a common computing

    workload.Distributed Computing is where several dis-associated systems are working separatelyto resolve a multi-faceted computing workload.

    An example of parallel computing would be two servers that share the workload ofrouting mail, managing connections to an accounting system or database, solving amathematical problem, etc....

    Distributed Computing would be more like the SETI (Search for extra-terresterialintelligence). Program, where each client works a separate "chunk" of information, and

    returns the completed package to a centralized resource that's responsible formanaging the overall workload.

    If you think of ten men pulling on a rope to lift a load, that is parallel computing. If tenmen have ten ropes and are lifting ten different loads from one place to consolidate atanother place, that would be distributed computing.

  • 8/10/2019 Notes on Operating System2013 Formatted

    13/212

    In Parallel Computing all processors have access to a shared memory. In distributedcomputing, each processor has its own private memory

    Distributed Operating System is a model where distributed applications are running onmultiple computers linked by communications. A distributed operating system is an

    extension of the network operating system that supports higher levels of

    communication and integration of the machines on the network.

    This system looks to its users like an ordinary centralized operating system but runs onmultiple, independent central processing units (CPUs).

    These systems are referred as loosely coupled systems where each processor has its own

    local memory and processors communicate with one another through various

    communication lines, such as high speed buses or telephone lines. By loosely coupled

    systems, we mean that such computers possess no hardware connections at the CPU -

    memory bus level, but are connected by external interfaces that run under the control

    of software. The Distributed Os involves a collection of autonomous computer systems, capable of

    communicating and cooperating with each other through a LAN / WAN. A Distributed Os

    provides a virtual machine abstraction to its users and wide sharing of resources like as

    computational capacity, I/O and files etc.

    http://ecomputernotes.com/fundamental/disk-operating-system/what-is-operating-systemhttp://ecomputernotes.com/fundamental/disk-operating-system/what-is-operating-systemhttp://ecomputernotes.com/fundamental/disk-operating-system/what-is-operating-systemhttp://ecomputernotes.com/fundamental/introduction-to-computer/what-is-cpuhttp://ecomputernotes.com/fundamental/input-output-and-memory/what-are-the-different-types-of-ram-explain-in-detailhttp://ecomputernotes.com/fundamental/introduction-to-computer/what-is-cpuhttp://ecomputernotes.com/fundamental/introduction-to-computer/what-is-computerhttp://ecomputernotes.com/images/ATypical-View-of-Distributed-System.jpghttp://ecomputernotes.com/fundamental/introduction-to-computer/what-is-computerhttp://ecomputernotes.com/fundamental/introduction-to-computer/what-is-cpuhttp://ecomputernotes.com/fundamental/input-output-and-memory/what-are-the-different-types-of-ram-explain-in-detailhttp://ecomputernotes.com/fundamental/introduction-to-computer/what-is-cpuhttp://ecomputernotes.com/fundamental/disk-operating-system/what-is-operating-systemhttp://ecomputernotes.com/fundamental/disk-operating-system/what-is-operating-system
  • 8/10/2019 Notes on Operating System2013 Formatted

    14/212

    The structure shown in fig contains a set of individual computer systems andworkstations connected via communication systems, but by this structure we can not

    say it is a distributed system because it is the software, not the hardware, that

    determines whether a system is distributed or not.

    The users of a true distributed system should not know, on which machine theirprograms are running and where their files are stored. LOCUS and MICROS are the best

    examples of distributed operating systems.

    Using LOCUS operating system it was possible to access local and distant files in uniformmanner. This feature enabled a user to log on any node of the network and to utilize the

    resources in a network without the reference of his/her location. MICROS provided

    sharing of resources in an automatic manner. The jobs were assigned to different nodes

    of the whole system to balance the load on different nodes.

    Below given are some of the examples of distributed operating systems:

    l. IRIX operating system; is the implementation of UNIX System V, Release 3 for Silicon

    Graphics multiprocessor workstations.

    2. DYNIX operating system running on Sequent Symmetry multiprocessor computers. 3. AIX operating system for IBM RS/6000 computers.

    4. Solaris operating system for SUN multiprocessor workstations.

    5. Mach/OS is a multithreading and multitasking UNIX compatible operating system;

    6. OSF/1 operating system developed by Open Foundation Software: UNIX compatible. Distributed systems provide the following advantages: 1 Sharing of resources.

    2 Reliability. 3 Communication.

    4 Computation speedup.

    Distributed systems are potentially more reliable than a central system because if asystem has only one instance of some critical component, such as a CPU, disk, or

    network interface, and that component fails, the system will go down. When there are

    multiple instances, the system may be able to continue in spite of occasional failures. In

    addition to hardware failures, one can also consider software failures. Distributed

    systems allow both hardware and software errors to be dealt with.

  • 8/10/2019 Notes on Operating System2013 Formatted

    15/212

    A distributed system is a set of computers that communicate and collaborate each otherusing software and hardware interconnecting components. Multiprocessors (MIMD

    computers using shared memory architecture), multicomputers connected through

    static or dynamic interconnection networks (MIMD computers using message passing

    architecture) and workstations connected through local area network are examples ofsuch distributed systems.

    A distributed system is managed by a distributed operating system. A distributedoperating system manages the system shared resources used by multiple processes, the

    process scheduling activity (how processes are allocating on available processors), the

    communication and synchronization between running processes and so on. The

    software for parallel computers could be also tightly coupled or loosely coupled. The

    loosely coupled software allows computers and users of a distributed system to be

    independent each other but having a limited possibility to cooperate. An example of

    such a system is a group of computers connected through a local network. Every

    computer has its own memory, hard disk. There are some shared resources such files

    and printers. If the interconnection network broke down, individual computers could be

    used but without some features like printing to a non-local printer.

    ADVANTAGES OF DISTRIBUTED SYSTEM

    Resource Sharing

    Computation Speedup Reliability

    Communication

    Resource Sharing :- If number of different sites are connected to one another, then auser at one site may be able to use the resources available at another. For. E.g. a user atsite A may be using a laser printer located at site B

    Computation Sped : - If a particular computation can be partitioned into

    subcomputations that can run concurrently then a distributed system allows us todistribute the subcomputations among various sites.

    There also exist automated load sharing in which the distributed operating systemautomatically moves jobs among several sites that are lightly loaded.

    http://ecomputernotes.com/fundamental/input-output-and-memory/what-is-a-printer-and-what-are-the-different-types-of-printershttp://ecomputernotes.com/fundamental/input-output-and-memory/what-is-a-printer-and-what-are-the-different-types-of-printers
  • 8/10/2019 Notes on Operating System2013 Formatted

    16/212

    Reliability :- If one site fails in a distributed system the remaining sites can continueoperating giving the system better reliability.

    Data is replicated among several sites in a distributed system so that even if one sitefails data still can be access from other sites.

    Communication : -When several sites are connected to one another by a communicationnetwork, the users at different sites have the opportunity to exchange information likepass message among themselves, collaborate on project by transferring the files of theproject, logging in to each others remote systems to run programs and exchanging mailto coordinate the work.

    DISTRIBUTED OPERATING SYSTEM

    With the advent of computer networks, in which many computers are linked together

    and are able to communicate with one another, distributed computing became feasible.A distributed computation is one that is carried out on more than one machine in acooperative manner. A group of linked computers working cooperatively on tasks,referred to as a distributed system, often requires a distributed operating system tomanage the distributed resources

    The operating systems commonly used for distributed computing systems can bebroadly classified into two types

    Network operating systems

    -Distributed operating systems.

    The three most important features commonly used to differentiate between these twotypes of operating systems are

    o System image,

    o Autonomy, and

    o Fault tolerance capability.

    o System image : Under network OS, the user views the distributed system as a collectionof machines connected by a communication subsystem. i.e the user is aware of the factthat multiple computers are used. A distributed OS hides the existence of multiplecomputers and provides a single system image to the users.

    http://www.britannica.com/EBchecked/topic/1494997/distributed-computinghttp://www.britannica.com/EBchecked/topic/1494997/distributed-computing
  • 8/10/2019 Notes on Operating System2013 Formatted

    17/212

    o Autonomy: A network OS is built on a set of existing centralized OSs and handles theinterfacing and coordination of remote operations and communications between theseOSs. So, in this case, each machine has its own OS. With a distributed OS, there is asingle system-wide OS and each computer runs part of this global OS.

    o Fault Tolerance capability: -Fault tolerance capability: A network operating systemprovides little or no fault tolerance capability in the sense that if 10% of the machines ofthe entire distributed computing system are down at any moment, at least 10% of theusers are unable to continue with their work. On the other hand, with a distributedoperating system, most of the users are normally unaffected by the failed machines andcan continue to perform their work normally, with only a 10% loss in performance of theentire distributed computing system.

    o Therefore, the fault tolerance capability of a distributed operating system is usually very

    high as compared to that of a network operating system

    Multimedia System :- Supports multiple kinds of applications

    Multimedia applications : Streaming audio, video games, etc.

    Traditional applications : Editors, compilers, web servers, etc.

    Different applications have different requirements For e.g. interactiveapplications like Editors, compilers require low or average response time

    While soft real time applications like streaming media , virtual games requireshigh response time

    Multimedia O/S divides resources according to application requirements. E.g. 30% of CPU to streaming and 20% to http server, etc.

    Multimedia data consist of audio and video files as well as conventional files.

    These data differ from conventional data in that multimedia data such as frame of videomust be delivered according to certain time restrictions (for e.g., 30 frames per second)

    Multimedia applications may also include live webcasts(broadcast over the world wideweb) of speeches or sporting events and even live webcams that allow a viewer nManhattan to observe customers at a caf in Paris.

    Multimedia applications also run on smaller devices. Eg. Stock trader may have stockquotes delivered wirelessly and in real time to his PDA.

  • 8/10/2019 Notes on Operating System2013 Formatted

    18/212

    A mobile operating system:- , also referred to as mobile OS , is the operating system thatoperates a smartphone, tablet, PDA, or other digital mobile devices. Modern mobileoperating systems combine the features of a personal computer operating system witha touchscreen, cellular, Bluetooth, WiFi, GPS mobile navigation, camera, video camera,

    speech recognition, voice recorder, music player, Near field communication, InfraredBlaster, and other features.

    E.g. Android from googleinc., Blackberry10 from Blackberry, iOS from Apple Inc. NokiaAsha Platform from Nokia, Symbian OS from Nokia etc.

    Clustered Systems : Cluster computing is a type of distributed computing. Distributedcomputing just means coordinating a number of computers to accomplish a single task.Cluster computing means the computers are specifically organized just to work togetherto accomplish a single task.

    For example, massively parallel "grid computing" projects like seti@home andfolding@home are examples of distributed computing but they are not clustercomputing. Here, the computers all work together to accomplish a task, so this isdistributed computing. But they are not specifically arranged for this purpose (thearrangement is haphazard and uncoordinated with computers all over the place beingrandomly added and removed from the set working on the problem), so they are not acluster and this is not cluster computing.

    What is SETI@home? SETI@home is a scientific experiment that uses Internet-connected computers in theSearch for Extraterrestrial Intelligence (SETI). You can participate by running a freeprogram that downloads and analyzes radio telescope data.E.g. http://setiathome.berkeley.edu/sah_about.php

    Folding@home (FAH or F@h) is a distributed computing project for disease researchthat simulates protein folding, computational drug design, and other types of moleculardynamics. The project uses the idle processing resources of thousands of personalcomputers owned by volunteers who have installed the software on their systems. Itsprimary purpose is to determine the mechanisms of protein folding, which is the

    process by which proteins reach their final three-dimensional structure, and to examinethe causes of protein misfolding.

    http://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Smartphonehttp://en.wikipedia.org/wiki/Tablet_computerhttp://en.wikipedia.org/wiki/PDAhttp://en.wikipedia.org/wiki/Mobile_deviceshttp://en.wikipedia.org/wiki/Personal_computerhttp://en.wikipedia.org/wiki/Touchscreenhttp://en.wikipedia.org/wiki/Cellular_networkhttp://en.wikipedia.org/wiki/Bluetoothhttp://en.wikipedia.org/wiki/Wi-Fihttp://en.wikipedia.org/wiki/Global_Positioning_Systemhttp://en.wikipedia.org/wiki/Digital_camerahttp://en.wikipedia.org/wiki/Video_camerahttp://en.wikipedia.org/wiki/Speech_recognitionhttp://en.wikipedia.org/wiki/Sound_recording_and_reproductionhttp://en.wikipedia.org/wiki/Portable_media_playershttp://en.wikipedia.org/wiki/Near_field_communicationhttp://en.wikipedia.org/wiki/Infraredhttp://setiathome.berkeley.edu/sah_about.phphttp://en.wikipedia.org/wiki/Distributed_computinghttp://en.wikipedia.org/wiki/Protein_foldinghttp://en.wikipedia.org/wiki/Drug_designhttp://en.wikipedia.org/wiki/Molecular_dynamicshttp://en.wikipedia.org/wiki/Molecular_dynamicshttp://en.wikipedia.org/wiki/Idle_(CPU)http://en.wikipedia.org/wiki/Personal_computershttp://en.wikipedia.org/wiki/Personal_computershttp://en.wikipedia.org/wiki/Proteinhttp://en.wikipedia.org/wiki/Protein_tertiary_structurehttp://en.wikipedia.org/wiki/Protein_misfoldinghttp://en.wikipedia.org/wiki/Protein_misfoldinghttp://en.wikipedia.org/wiki/Protein_misfoldinghttp://en.wikipedia.org/wiki/Protein_tertiary_structurehttp://en.wikipedia.org/wiki/Proteinhttp://en.wikipedia.org/wiki/Personal_computershttp://en.wikipedia.org/wiki/Personal_computershttp://en.wikipedia.org/wiki/Idle_(CPU)http://en.wikipedia.org/wiki/Molecular_dynamicshttp://en.wikipedia.org/wiki/Molecular_dynamicshttp://en.wikipedia.org/wiki/Drug_designhttp://en.wikipedia.org/wiki/Protein_foldinghttp://en.wikipedia.org/wiki/Distributed_computinghttp://setiathome.berkeley.edu/sah_about.phphttp://setiathome.berkeley.edu/sah_about.phphttp://en.wikipedia.org/wiki/Infraredhttp://en.wikipedia.org/wiki/Near_field_communicationhttp://en.wikipedia.org/wiki/Portable_media_playershttp://en.wikipedia.org/wiki/Sound_recording_and_reproductionhttp://en.wikipedia.org/wiki/Speech_recognitionhttp://en.wikipedia.org/wiki/Video_camerahttp://en.wikipedia.org/wiki/Digital_camerahttp://en.wikipedia.org/wiki/Global_Positioning_Systemhttp://en.wikipedia.org/wiki/Wi-Fihttp://en.wikipedia.org/wiki/Bluetoothhttp://en.wikipedia.org/wiki/Cellular_networkhttp://en.wikipedia.org/wiki/Touchscreenhttp://en.wikipedia.org/wiki/Personal_computerhttp://en.wikipedia.org/wiki/Mobile_deviceshttp://en.wikipedia.org/wiki/PDAhttp://en.wikipedia.org/wiki/Tablet_computerhttp://en.wikipedia.org/wiki/Smartphonehttp://en.wikipedia.org/wiki/Operating_system
  • 8/10/2019 Notes on Operating System2013 Formatted

    19/212

    Web Based Computing

    That answer is just as easy - because they are cheaper. Computers cost less if you don'thave to have to include a hard drive. They also cost less if you don't have to buy andinstall software on them, and that is the real driving force behind the switch. Less

    obvious is that users can use more than one of them rather seamlessly. Consider thenew Surface Tablet from Microsoft. It runs a web-computer based version of Windowsthat looks virtually identical to Windows 8 which runs on real computers. This meansusers don't have to learn two systems. But it means more than that, it means that userscan use web, or cloud based apps instead of those they install locally, e.g. Google Docs,Facebook, Flickr, etc. to create, manipulate and store their work, which they can thenaccess using their phone, Chromebook, or any other web based device. computers withweaker processors and no hard drives that run applications off the "cloud instead oflocally and generally have touch screens to make using them easier. They're also

    generally lighter and smaller than so-called "real" computers.

    Effect of web based computing :All of this is evident as reports of a slowdown in sales ofreal computers contrasts with those noting bigger numbers for iOS, Android and nowWindows 8/RT based machines, which are essentially all the same breed: computersthat do little except allow users to browse the web, access social media and play musicor video files.

    It's the newest trend in personal computing, and it's been going on for long enough now,that most have heard the rumblings

    Cloud Computing : In science, cloud computing is a synonym for distributed computingover a network and means the ability to run a program on many connected computersat the same time.

    Cloud computing is a type of computing that relies on sharing computing resources rather than having local servers or personal devices to handle applications.

    It is called cloud computing because the data and applications exist on a cloud of WEBservers.

    http://www.zdnet.com/news/moving-apps-to-the-cloud-why-when-and-how/6344653http://voices.yahoo.com/topic/1269/google.htmlhttp://www.nytimes.com/2012/09/08/technology/intel-downgrades-sales-expectations.html?_r=0http://www.ip-192.com/2012/11/05/tablet-samsung-apple/http://voices.yahoo.com/topic/67863/social_media.htmlhttps://en.wikipedia.org/wiki/Distributed_computinghttp://www.webopedia.com/TERM/D/device.htmlhttp://www.webopedia.com/TERM/A/application.htmlhttp://www.webopedia.com/TERM/A/application.htmlhttp://www.webopedia.com/TERM/D/device.htmlhttps://en.wikipedia.org/wiki/Distributed_computinghttp://voices.yahoo.com/topic/67863/social_media.htmlhttp://www.ip-192.com/2012/11/05/tablet-samsung-apple/http://www.nytimes.com/2012/09/08/technology/intel-downgrades-sales-expectations.html?_r=0http://voices.yahoo.com/topic/1269/google.htmlhttp://www.zdnet.com/news/moving-apps-to-the-cloud-why-when-and-how/6344653
  • 8/10/2019 Notes on Operating System2013 Formatted

    20/212

    TRANSLATION PROGRAMS

    o ASSEMBLERS

    o COMPILERS

    o INTERPRETERS

    o LINKERS

    Assembler :- A program that translates programs from assembly language to machinelanguage.

    An assembler is a program that takes basic computer instructions and converts theminto a pattern of bits that the computer's processor can use to perform its basicoperations. Some people call these instructions assembler language and others use the

    term assembly language .

    Compilers ad Interpreters : -Historically, most programs have been written in "higher-level" languages such as COBOL, FORTRAN, PL/I, and C. These languages are easier tolearn and faster to write programs with than assembler language. The program thatprocesses the source code written in these languages is called a compiler.

    A compiler is a program that translates a source program written in some high-levelprogramming language (such as Java) into machine code for some computerarchitecture (such as the Intel Pentium architecture). The generated machine code canbe later executed many times against different data each time.

    Linker :- Also called link editor and binder, a linker is a program that combines objectmodules to form an executable program. Many programming languages allow you towrite different pieces of code, called modules , separately. This simplifies theprogramming task because you can break a large program into small, more manageablepieces. Eventually, though, you need to put all the modules together. This is the job ofthe linker.

    In addition to combining modules, a linker also replaces symbolic addresses with realaddresses. Therefore, you may need to link a program even if it contains only onemodule.

    http://www.webopedia.com/TERM/P/program.htmlhttp://www.webopedia.com/TERM/A/assembly_language.htmlhttp://www.webopedia.com/TERM/M/machine_language.htmlhttp://www.webopedia.com/TERM/M/machine_language.htmlhttp://searchsoftwarequality.techtarget.com/definition/programhttp://searchcio-midmarket.techtarget.com/definition/instructionhttp://searchcio-midmarket.techtarget.com/definition/bithttp://searchcio-midmarket.techtarget.com/definition/processorhttp://whatis.techtarget.com/definition/compilerhttp://www.webopedia.com/TERM/P/program.htmlhttp://www.webopedia.com/TERM/M/module.htmlhttp://www.webopedia.com/TERM/P/programming_language.htmlhttp://www.webopedia.com/TERM/C/code.htmlhttp://www.webopedia.com/TERM/M/module.htmlhttp://www.webopedia.com/TERM/M/module.htmlhttp://www.webopedia.com/TERM/A/address.htmlhttp://www.webopedia.com/TERM/L/link.htmlhttp://www.webopedia.com/TERM/L/link.htmlhttp://www.webopedia.com/TERM/A/address.htmlhttp://www.webopedia.com/TERM/M/module.htmlhttp://www.webopedia.com/TERM/C/code.htmlhttp://www.webopedia.com/TERM/P/programming_language.htmlhttp://www.webopedia.com/TERM/M/module.htmlhttp://www.webopedia.com/TERM/P/program.htmlhttp://whatis.techtarget.com/definition/compilerhttp://searchcio-midmarket.techtarget.com/definition/processorhttp://searchcio-midmarket.techtarget.com/definition/bithttp://searchcio-midmarket.techtarget.com/definition/instructionhttp://searchsoftwarequality.techtarget.com/definition/programhttp://www.webopedia.com/TERM/M/machine_language.htmlhttp://www.webopedia.com/TERM/M/machine_language.htmlhttp://www.webopedia.com/TERM/A/assembly_language.htmlhttp://www.webopedia.com/TERM/P/program.html
  • 8/10/2019 Notes on Operating System2013 Formatted

    21/212

    COMPONENT OF COMPUTER SYSTEM

    o Hardwareo Provides basic computing resources (CPU, memory, I/O devices).o Operating Systemo Controls and coordinates the use of hardware among application programs.o Application Programso Solve computing problems of users (compilers, database systems, video games,

    business programs such as banking software).o Userso People, machines, other computers

    OPERATING SYSTEM VIEW

    o Resource allocatoro to allocate resources (software and hardware) of the computer system and manage

    them efficiently.o Control programo Controls execution of user programs and operation of I/O devices.o Kernelo The program that executes forever (everything else is an application with respect to the

    kernel).o Monitors and Small Kernelso special purpose and embedded systems, real-time systemso Batch and multiprogramming

    o Timesharing

  • 8/10/2019 Notes on Operating System2013 Formatted

    22/212

    o workstations, servers, minicomputers, timeframeso Transaction systems

    o Personal Computing Systems

    o Mobile Platforms, devices (of all sizes)

    COMPONENT OF O/S

  • 8/10/2019 Notes on Operating System2013 Formatted

    23/212

    DEVICE DRIVERS

    USER INTERFACE

    SYSTEM UTILITIES :

  • 8/10/2019 Notes on Operating System2013 Formatted

    24/212

    OPERATING SYSTEM STRUCTURES-CHAPTER 2

    SYSTEM COMPONENTS

    Even though, not all systems have the same structure many modern operating systems share

    the same goal of supporting the following types of system components.

    PROCESS MANAGEMENT

    The operating system manages many kinds of activities ranging from user programs to systemprograms like printer spooler, name servers, file server etc. Each of these activities isencapsulated in a process. A process includes the complete execution context (code, data, PC,registers, OS resources in use etc.).

    It is important to note that a process is not a program. A process is only ONE instant of aprogram in execution. There are many processes can be running the same program. The fivemajor activities of an operating system in regard to process management are

    Creation and deletion of user and system processes. Suspension and resumption of processes. A mechanism for process synchronization. A mechanism for process communication. A mechanism for deadlock handling. Process - fundamental concept in OS Process is a program in execution. Process needs resources - CPU time, memory, files/data and I/O devices.

    OS is responsible for the following process management activities. Process creation and deletion Process suspension and resumption Process synchronization and interprocess communication Process interactions - deadlock detection, avoidance and correction

    MAIN-MEMORY MANAGEMENT

    Primary-Memory or Main-Memory is a large array of words or bytes. Each word or byte has itsown address. Main-memory provides storage that can be access directly by the CPU. That is tosay for a program to be executed, it must in the main memory.

    The major activities of an operating in regard to memory-management are:

    Keep track of which part of memory are currently being used and by whom. Decide which process are loaded into memory when memory space becomes available. Allocate and deallocate memory space as needed. Main Memory is an array of addressable words or bytes that is quickly accessible.

  • 8/10/2019 Notes on Operating System2013 Formatted

    25/212

    Main Memory is volatile. OS is responsible for: Allocate and deallocate memory to processes. Managing multiple processes within memory - keep track of which parts of memory are

    used by which processes. Manage the sharing of memory between processes.

    Determining which processes to load when memory becomes OS Task: Secondary Storage and I/O Management Since primary storage is expensive and volatile, secondary storage is required for

    backup. Disk is the primary form of secondary storage. OS performs storage allocation, free-space management and disk scheduling. I/O system in the OS consists of Buffer caching and management Device driver interface that abstracts device details Drivers for specific hardware devices

    FILE MANAGEMENT

    A file is a collected of related information defined by its creator. Computer can store files on thedisk (secondary storage), which provide long term storage. Some examples of storage mediaare magnetic tape, magnetic disk and optical disk. Each of these media has its own propertieslike speed, capacity, data transfer rate and access methods.

    A file systems normally organized into directories to ease their use. These directories maycontain files and other directions.

    The five main major activities of an operating system in regard to file management are:

    1. The creation and deletion of files.2. The creation and deletion of directions.3. The support of primitives for manipulating files and directions.4. The mapping of files onto secondary storage.5. The back up of files on stable storage media.6. File is a collection of related information defined by creator - represents programs and

    7. File creation and deletion8. Directory creation and deletion9. Supporting primitives for file/directory manipulation.10. Mapping files to disks (secondary storage).11. Backup files on archival media (tapes).

  • 8/10/2019 Notes on Operating System2013 Formatted

    26/212

    I/O SYSTEM MANAGEMENT

    I/O subsystem hides the peculiarities of specific hardware devices from the user. Only thedevice driver knows the peculiarities of the specific device to whom it is assigned.

    SECONDARY-STORAGE MANAGEMENT

    Generally speaking, systems have several levels of storage, including primary storage,secondary storage and cache storage. Instructions and data must be placed in primary storageor cache to be referenced by a running program. Because main memory is too small toaccommodate all data and programs, and its data are lost when power is lost, the computersystem must provide secondary storage to back up main memory. Secondary storage consistsof tapes, disks, and other media designed to hold information that will eventually be accessedin primary storage (primary, secondary, cache) is ordinarily divided into bytes or wordsconsisting of a fixed number of bytes. Each location in storage has an address; the set of alladdresses available to a program is called an address space.

    The three major activities of an operating system in regard to secondary storage managementare:

    1. Managing the free space available on the secondary-storage device.2. Allocation of storage space when new files have to be written.3. Scheduling the requests for memory access.

    NETWORKING

    A distributed system is a collection of processors that do not share memory, peripheral devices,or a clock. The processors communicate with one another through communication lines callednetwork. The communication-network design must consider routing and connection strategies,and the problems of contention and security.

    Connecting processors in a distributed system

    Distributed System is a collection of processors that do not share memory or a clock.

    Processors are connected via a communication network.

    Advantages:Allows users and system to exchange information

    provide computational speedup

    increased reliability and availability of information

  • 8/10/2019 Notes on Operating System2013 Formatted

    27/212

    PROTECTION SYSTEM

    If a computer systems has multiple users and allows the concurrent execution of multipleprocesses, then the various processes must be protected from one another's activities.Protection refers to mechanism for controlling the access of programs, processes, or users to

    the resources defined by a computer systems.

    Protection mechanisms control access of programs and processes to user and systemresources.Protect user from himself, user from other users, system from users.Protection mechanisms must:Distinguish between authorized and unauthorized use.

    Specify access controls to be imposed on use.

    Provide mechanisms for enforcement of access control.

    Security mechanisms provide trust in system and privacy

    authentication, certification, encryption etc.

    COMMAND INTERPRETER SYSTEM

    A command interpreter is an interface of the operating system with the user. The user givescommands with are executed by operating system (usually by turning them into system calls).The main function of a command interpreter is to get and execute the next user specifiedcommand. Command-Interpreter is usually not part of the kernel, since multiple command

    interpreters (shell, in UNIX terminology) may be support by an operating system, and they donot really need to run in kernel mode. There are two main advantages to separating thecommand interpreter from the kernel.

    1. If we want to change the way the command interpreter looks, i.e., I want to change theinterface of command interpreter, I am able to do that if the command interpreter isseparate from the kernel. I cannot change the code of the kernel so I cannot modify theinterface.

    2. If the command interpreter is a part of the kernel it is possible for a malicious process togain access to certain part of the kernel that it showed not have to avoid this uglyscenario it is advantageous to have the command interpreter separate from kernel.

  • 8/10/2019 Notes on Operating System2013 Formatted

    28/212

    An O/S provides an environment within which programs are executed

    O/S vary greatly in their makeup since they are organized along many different lines

    The design of a O/S is a major task

    It is important that goals of the system be well defined before the design begins

    Operating system can be viewed from various vantage points

    Services

    Interface to users and programmers

    Components

    OPERATING SYSTEM SERVICES

    Following are the five services provided by operating systems to the convenience of the users.

    Program Execution

    The purpose of a computer systems is to allow the user to execute programs. So the operatingsystems provides an environment where the user can conveniently run programs. The userdoes not have to worry about the memory allocation or multitasking or anything. These things

    are taken care of by the operating systems.

    Running a program involves the allocating and deallocating memory, CPU scheduling in case ofmultiprocess. These functions cannot be given to the user-level programs. So user-levelprograms cannot help the user to run programs independently without the help from operatingsystems.

    I/O Operations

    Each program requires an input and produces output. This involves the use of I/O. Theoperating systems hides the user the details of underlying hardware for the I/O. All the user

    sees is that the I/O has been performed without any details. So the operating systems byproviding I/O makes it convenient for the users to run programs.

    For efficiently and protection users cannot control I/O so this service cannot be provided byuser-level programs.

  • 8/10/2019 Notes on Operating System2013 Formatted

    29/212

    File System Manipulation

    The output of a program may need to be written into new files or input taken from some files.

    The operating systems provides this service. The user does not have to worry about secondarystorage management. User gives a command for reading or writing to a file and sees his hertask accomplished. Thus operating systems makes it easier for user programs to accomplishedtheir task.

    This service involves secondary storage management. The speed of I/O that depends onsecondary storage management is critical to the speed of many programs and hence I think it isbest relegated to the operating systems to manage it than giving individual users the control ofit. It is not difficult for the user-level programs to provide these services but for abovementioned reasons it is best if this service s left with operating system.

    Communications

    There are instances where processes need to communicate with each other to exchangeinformation. It may be between processes running on the same computer or running on thedifferent computers. By providing this service the operating system relieves the user of theworry of passing messages between processes. In case where the messages need to be passedto processes on the other computers through a network it can be done by the user programs.The user program may be customized to the specifics of the hardware through which themessage transits and provides the service interface to the operating system.

    Error Detection

    An error is one part of the system may cause malfunctioning of the complete system. To avoidsuch a situation the operating system constantly monitors the system for detecting the errors.This relieves the user of the worry of errors propagating to various part of the system andcausing malfunctioning.

    This service cannot allowed to be handled by user programs because it involves monitoring andin cases altering area of memory or deallocation of memory for a faulty process. Or may berelinquishing the CPU of a process that goes into an infinite loop. These tasks are too critical tobe handed over to the user programs. A user program if given these privileges can interferewith the correct (normal) operation of the operating systems.

    Services for ensuring the efficient operation of the system itself

    Resource Allocation (With Multiple Users)

    Accounting

  • 8/10/2019 Notes on Operating System2013 Formatted

    30/212

    Protection and Security (user area and o/s area)

    OPERATING SYSTEM INTERFACES

    Command interpreter

    Graphical User Interface

    System Calls

    A System Call is the main way a user program interacts with the OperatingSystem.System calls provide an interface to the services made available by an O/S.Thesecalls are generally available as routines written in C and C++ System calls provide aninterface between the process an the operating system. System calls allow user-level

    processes to request some services from the operating system which process itself is notallowed to do. In handling the trap, the operating system will enter in the kernel mode,where it has access to privileged instructions, and can perform the desired service on thebehalf of user-level process. It is because of the critical nature of operations that theoperating system itself does them every time they are needed. For example, for I/O aprocess involves a system call telling the operating system to read or write particular areaand this request is satisfied by the operating system.

    System programs provide basic functioning to users so that they do not need to write their own

    environment for program development (editors, compilers) and program execution (shells). Insome sense, they are bundles of useful system calls.

    TYPES OF SYSTEM CALLS

    Process Control

    File Management

    Device Management

    Information maintenance Communication

    PROCESS CONTROL SYSTEM CALL

    End, abort

    Load, execute

  • 8/10/2019 Notes on Operating System2013 Formatted

    31/212

    Create process, terminate process

    Get process attribute, set process attributes

    Wait

    Allocate and free memory

    FILE MANAGEMENT CALLS

    Create file

    Delete file

    Read, write operation

    Get file attributes, set file attributes

    DEVICE MANAGEMENT CALLS

    Request device, release device

    Read, write

    Get device attributes and set devices attributes

    Logically attach or detach devices

    INFORMATION MAINTAINENCE CALLS

    Get time or date, set time or date

    Get system data, set system data

    Get process

    Set process

    COMMUNICATION CALLS

    Create, delete communication connection

    Send, receive messages

    Transfer of status information

    Attach or detach remote devices

  • 8/10/2019 Notes on Operating System2013 Formatted

    32/212

    HOW A SYSTEM CALL WORKS

    Obtain access to system space

    Do parameter validation

    System resource collection ( locks on structures )

    Ask device/system for requested item

    Suspend waiting for device

    Interrupt makes thread ready to run

    Wrap-up

    Return to user

    TYPES OF OPERATING SYSTEM STRUCTURE

    An operating system is usually large and complex. Therefore, it should be engineeredcarefully. Possible ways to structure an operating system:

    o Simple, single-user, MS-DOS,MacOS, Windows (Only one or two levels of code)o Monolithic, multi-user, UNIX,Multics, OS/360o Layered,T.H.E. operating system (Lower levels independent of upper levels)o Client/Server (microkernel), Chorus/MiX(OS built from many user-level

    processes)o Modules (Solaris)(Core Kernel with dynamically loadable modules)

  • 8/10/2019 Notes on Operating System2013 Formatted

    33/212

  • 8/10/2019 Notes on Operating System2013 Formatted

    34/212

  • 8/10/2019 Notes on Operating System2013 Formatted

    35/212

    Simple structure :

    Simple structure has interfaces and functionality not separated For eg. Application program hasthe liberty of accessing basic I/O routines to write data directly or to display data to disk leavingit vulnerable for the O/S to get corrupted and crash through some malicious program.

    MS-DoS is an example here it does not provide any hardware protection and MS-DOS,applications may bypass the operating system.

    Operating systems such as MS-DOS and the original UNIX did not have well-definedstructures.

    There is no CPU Execution Mode (user and kernel), and so errors in applications cancause the whole system to crash.

    http://www.sal.ksu.edu/faculty/tim/ossg/Introduction/OSworking.html#modehttp://www.sal.ksu.edu/faculty/tim/ossg/Introduction/OSworking.html#modehttp://www.sal.ksu.edu/faculty/tim/ossg/Introduction/OSworking.html#modehttp://www.sal.ksu.edu/faculty/tim/ossg/Introduction/OSworking.html#mode
  • 8/10/2019 Notes on Operating System2013 Formatted

    36/212

    Monolithic structure :-

    Functionality of the OS is invoked with simple function calls within the kernel, which isone large program.

    Device drivers are loaded into the running kernel and become part of the kernel.

    Layered Approach:-

    This approach breaks up the operating system into different layers.

    This allows implementers to change the inner workings, and increases modularity. As long as the external interface of the routines dont change, developers have more

    freedom to change the inner workings of the routines. With the layered approach, the bottom layer is the hardware, while the highest layer is

    the user interface.o The main advantage is simplicity of construction and debugging.o The main difficulty is defining the various layers.o The main disadvantage is that the OS tends to be less efficient than other

    implementations.

  • 8/10/2019 Notes on Operating System2013 Formatted

    37/212

  • 8/10/2019 Notes on Operating System2013 Formatted

    38/212

    In layered system program of O/S is defined as hierarchy of layers

    Layer function

    5 The operator/user

    4 user program

    3 process manage

    2 memory

    1 device

    0 Hardware

    The major difficulty with layered approach is to appropriately define the layers. Becausea layer can use the services only of the lower level layers.

    A final problem with layered implementation is that it tends to be less efficient than theother types

  • 8/10/2019 Notes on Operating System2013 Formatted

    39/212

    Microkernel Structure:-

    This structures the operating system by removing all nonessential portions of the kernel and

    implementing them as system and user level programs.

    Generally they provide minimal process and memory management, and acommunications facility.

    Communication between components of the OS is provided by message passing.

    The benefits of the microkernel are as follows:

    Extending the operating system becomes much easier. Any changes to the kernel tend to be fewer, since the kernel is smaller.

    The microkernel also provides more security and reliability.

    Main disadvantage is poor performance due to increased system overhead from messagepassing.

  • 8/10/2019 Notes on Operating System2013 Formatted

    40/212

    The organizing structure currently in vogue is the

    microkernel OS.

    Goal is minimize what goes in the kernel, and implement much of the OS as user-levelprocesses. This results in:

    better reliability

    ease of extension and customization

    mediocre performance (unfortunately)

    First microkernel system was Hydra (CMU, 1970)

    Examples of microkernel systems are the CMU Mach system, Chorus (French Unix-likesystem), and in some ways Microsoft NT/Windows.

    Move as much functionality as possible from the kernel into user space.

    Only a few essential functions in the kernel:

    primitive memory management (address space)

    I/O and interrupt management

    Inter-Process Communication (IPC)

    basic scheduling

    Other OS services are provided by processes running in user mode (vertical servers):

  • 8/10/2019 Notes on Operating System2013 Formatted

    41/212

    device drivers, file system, virtual me mory

    Benefits of Microkernel

    Extensibility/Reliability

    o easier to extend a microkernelo easier to port the operating system to new architectureso more reliable (less code is running in kernel mode)o more secureo small microkernel can be rigorously tested.

    Portability

    o changes needed to port the system to a new processor is done in themicrokernel, not in the other services.

    Modular Struture:-

    Most modern operating systems implement kernel modules:

    Uses object-oriented approach. Each core component is separate.

    Each talks to the others over known interfaces.

    Each is loadable as needed within the kernel.

    Overall, similar to layers but with more flexibility.

  • 8/10/2019 Notes on Operating System2013 Formatted

    42/212

    VIRTUAL MACHINE:-

    A Virtual Machine (VM) takes the layered and microkernel approach to its logicalconclusion.

    It treats hardware and the operating system kernel as though they were all hardware.

    A virtual machine provides an interfaceidentical to the underlying bare hardware.

    The operating system host creates the illusion that a process has its own processor and(virtual memory).

    Each guest provided with a (virtual) copy of underlying computer.

    The resources of the physical computer are shared to create the virtual machines:

    CPU scheduling can create the appearance that users have their own processor.

    Spooling and a file system can provide virtual card readers and virtual lineprinters.

    A normal user time- sharing terminal serves as the virtual machine operatorsconsole.

  • 8/10/2019 Notes on Operating System2013 Formatted

    43/212

    Advantages/Disadvantages

    The VM concept provides complete protection of system resources since each virtualmachine is isolated from all other virtual machines. This isolation permits no directsharing of resources.

  • 8/10/2019 Notes on Operating System2013 Formatted

    44/212

    A VM system is a perfect vehicle for OS researchand development. System development is done on the virtual machine, instead of on aphysical machine and so does not disrupt normal system operation.

    The VM concept is difficult to implement due to the effort required to provide an exactduplicate to the underlying machine.

    A virtual machine takes the layered approach to its logical conclusion. It treatshardware and the operating system kernel as though they were all hardware. Avirtual machine provides an interface identical to theunderlying bare hardware. Theoperating system creates the illusion

    of multiple processes, each executing on its own processor with its own (virtual)memory.

    The resources of the physical computer are shared to create the virtual machines.

    1. CPU scheduling can create the appearance that users have their own processor. 2. Spooling and a file system can provide virtual card readers and virtual lineprinters.

    3. A normal user time-sharing terminal serves as the virtual machine operatorsconsole.

    System Models

    Non-virtual Machine Virtual Machine Advantages/Disadvantages of Virtual Machines

    The virtual-machine concept provides complete protection of system resources sinceeach virtual machine is isolated from all other virtual machines. This isolation,however, permits no direct sharing of resources. A virtual-machine system is a

  • 8/10/2019 Notes on Operating System2013 Formatted

    45/212

    perfect vehicle for operating-systems research and development. Systemdevelopment is done on the virtual machine, instead of on a physical machine and sodoes not disrupt normal system operation. The virtual machine concept is difficult toimplement due to the effort required to provide an exact duplicate to theunderlyingmachine.

    Java Virtual Machine Compiled Java programs are platform-neutral byte codes executed by a Java Virtual

    Machine (JVM). JVM consists of 1. class loader 2. class verifier 3. runtime interpreter Just-In-Time (JIT) compilers increase performance

    Java Virtual Machine

    Virtual Machines The concept of virtual machines is closely related to layering.In a typical multi-user system, users are expected to know that the machine is shared by otherusers, and that resources such as devices are shared between all the users.In virtual machine operating systems an addition layer of abstraction is placed between the

    users and the system so that it appears to the user that they are using a machine dedicated tothem.Usually it is the case that a more powerful machine is used to host several virtual machines. Forexample, the 80386 and later Intel CPUssupported virtual 8086 machines. Thus, an operatingsystem designed for the 80386 could actually run several copies of MS-DOS and appear to theuser to be several different PCs at the same time.Another example of a virtual machine system is the IBM 370 running the VM operating system.

  • 8/10/2019 Notes on Operating System2013 Formatted

    46/212

    This allowed users to work as if they had a dedicated (but smaller, less powerful) 370completely at their disposal.

    A virtual machine provides an interface identical to the underlying bare hardware.

    The operating system creates the illusion of multiple processes, each executing on itsown processor with its own (virtual) memory.

    A Virtual Machine is a software that creates a virtualized environment between thecomputer platform and the end user in which the end user can operate software.

    A virtual machine provides an interface identical to the underlying bare hardware.

    The operating system creates the illusion of multiple processes, each executing on itsown processor with its own (virtual) memory.

    Virtualization is an abstraction layer that decouples the physical hardware from theoperating system to deliver greater IT resource utilization and flexibility.

    It allows multiple virtual machines, with heterogeneous operating systems to run inisolation, side-by-side on the same physical machine.

    The host software that provides virtualization is often referred to as a virtual machinemonitor (VMM) or hypervisor.

    The VMM gives each virtual machine an illusion of a complete computer to itself.

  • 8/10/2019 Notes on Operating System2013 Formatted

    47/212

  • 8/10/2019 Notes on Operating System2013 Formatted

    48/212

  • 8/10/2019 Notes on Operating System2013 Formatted

    49/212

    Common Virtualisation used today

    Run legacy software on non-legacy hardware

    Run multiple operating systems on the same hardware

    Create a manageable upgrade path

    Manage outages (expected and unexpected) dynamically

  • 8/10/2019 Notes on Operating System2013 Formatted

    50/212

    Chapter 3- Process Management

    DEFINITION

    The term "process" was first used by the designers of the MULTICS in 1960's. Since then, theterm process, used somewhat interchangeably with 'task' or 'job'. The process has been givenmany definitions for instance

    A program in Execution.

    An asynchronous activity. The 'animated sprit' of a procedure in execution. The entity to which processors are assigned. The 'dispatchable' unit.

    and many more definitions have given. As we can see from above that there is no universallyagreed upon definition, but the definition " Program in Execution " seem to be most frequentlyused. And this is a concept are will use in the present study of operating systems.

    Now that we agreed upon the definition of process, the question is what the relation betweenprocess and program is. It is same but with different name or when this beast is sleeping (not

    executing) it is called program and when it is executing becomes process. Well, to be veryprecise. Process is not the same as program. In the following discussion we point out some ofthe difference between process and program. As we have mentioned earlier.

    Process is not the same as program. A process is more than a program code. A process is an'active' entity as oppose to program which consider to be a 'passive' entity. As we all know that

  • 8/10/2019 Notes on Operating System2013 Formatted

    51/212

    a program is an algorithm expressed in some suitable notation, (e.g., programming language).Being a passive, a program is only a part of process. Process, on the other hand, includes:

    Current value of Program Counter (PC) Contents of the processors registers

    Value of the variables The process stack (SP) which typically contains temporary data such as subroutine

    parameter, return address, and temporary variables. A data section that contains global variables.

    A process is the unit of work in a system.

    In Process model, all software on the computer is organized into a number of sequentialprocesses. A process includes PC, registers, and variables. Conceptually, each process has itsown virtual CPU. In reality, the CPU switches back and forth among processes. (The rapidswitching back and forth is called multiprogramming).

    The process state consist of everything necessary to resume the process execution if it issomehow put aside temporarily. The process state consists of at least following:

    Code for the program. Program's static data. Program's dynamic data. Program's procedure call stack.

    Contents of general purpose registers. Contents of program counter (PC) Contents of program status word (PSW). Operating Systems resource in use.

    PROCESS OPERATIONS

    PROCESS CREATION

    In general-purpose systems, some way is needed to create processes as needed duringoperation. There are four principal events led to processes creation.

    System initialization. Execution of a process Creation System calls by a running process. A user request to create a new process.

  • 8/10/2019 Notes on Operating System2013 Formatted

    52/212

    Initialization of a batch job.

    Foreground processes interact with users. Background processes that stay inbackground sleeping but suddenly springing to life to handle activity such as

    email, webpage, printing, and so on. Background processes are called daemons.This call creates an exact clone of the calling process.

    A process may create a new process by some create process such as'fork'. It choose to does so, creating process is called parent process and thecreated one is called the child processes. Only one parent is needed to create achild process. This creation of process (processes) yields a hierarchical structureof processes like one in the figure. Notice that each child has only one parent buteach parent may have many children. After the fork, the two processes, theparent and the child, have the same memory image, the same environmentstrings and the same open files. After a process is created, both the parent andchild have their own distinct address space. If either process changes a word inits address space, the change is not visible to the other process.

  • 8/10/2019 Notes on Operating System2013 Formatted

    53/212

    PROCESS STATES

    A process goes through a series of discrete process states.

    New State The process being created. Terminated State The process has finished execution. Blocked (waiting) State When a process blocks, it does so because logically it cannot

    continue, typically because it is waiting for input that is not yet available. Formally, aprocess is said to be blocked if it is waiting for some event to happen (such as an I/Ocompletion) before it can proceed. In this state a process is unable to run until someexternal event happens.

    Running State A process is said t be running if it currently has the CPU, that is, actuallyusing the CPU at that particular instant.

    Ready State A process is said to be ready if it use a CPU if one were available. It isrunable but temporarily stopped to let another process run.

    Logically, the 'Running' and 'Ready' states are similar. In both cases the process is willing to run,only in the case of 'Ready' state, there is temporarily no CPU available for it. The 'Blocked' stateis different from the 'Running' and 'Ready' states in that the process cannot run, even if the CPUis available.

    PROCESS STATE TRANSITIONS

    Following are six(6) possible transitions among above mentioned five (5) states

    Transition 1 occurs when process discovers that it cannot continue. If running process initiates an I/Ooperation before its allotted time expires, the running process voluntarily relinquishes the CPU.

    This state transition is:

    Block (process- name): Running Block.

    Transition 2 occurs when the scheduler decides that the running process has run long

    enough and it is time to let another process have CPU time.

    This state transition is:

    Time-Run-Out (process- name): Running Ready.

    Transition 3 occurs when all other processes have had their share and it is time for thefirst process to run again

  • 8/10/2019 Notes on Operating System2013 Formatted

    54/212

    This state transition is:

    Dispatch (process- name): Ready Running.

    Transition 4 occurs when the external event for which a process was waiting (such asarrival of input) happens.

    This state transition is:

    Wakeup (process- name): Blocked Ready.

    Transition 5 occurs when the process is created.

    This state transition is:

    Admitted (process- name): New Ready.

    Transition 6 occurs when the process has finished execution.

    This state transition is:

    Exit (process- name): Running Terminated.

    PROCESS CONTROL BLOCK

    A process in an operating system is represented by a data structure known as a process controlblock (PCB) or process descriptor. The PCB contains important information about the specificprocess including

    The current state of the process i.e., whether it is ready, running, waiting, or whatever. Unique identification of the process in order to track "which is which" information. A pointer to parent process. Similarly, a pointer to child process (if it exists). The priority of process (a part of CPU scheduling information). Pointers to locate memory of processes.

    A register save area. The processor it is running on.

    The PCB is a certain store that allows the operating systems to locate key information about aprocess. Thus, the PCB is the data structure that defines a process to the operating systems.

  • 8/10/2019 Notes on Operating System2013 Formatted

    55/212

    Process Control block is used for storing the collection of information about the Processes and

    this is also called as the Data Structure which Stores the information about the process. The

    information of the Process is used by the CPU at the Run time. The various information which is

    Stored into the PCB as followings:

    1) Name of the Process.

    2) State of the Process. Means Ready, Active, Wait.

    3) Resources allocated to the Process

    4) Memory which is provided to the Process.

    5) Scheduling information.

    6) Input and Output Devices used by the Process.

    7) Process ID or a Identification Number which is given by the CPU when a Process Request

    for a Service.

    http://ecomputernotes.com/fundamental/introduction-to-computer/what-is-cpuhttp://ecomputernotes.com/fundamental/introduction-to-computer/what-is-cpu
  • 8/10/2019 Notes on Operating System2013 Formatted

    56/212

    THREADS

    Despite of the fact that a thread must execute in process, the process and its associated

    threads are different concept. Processes are used to group resources together and threads arethe entities scheduled for execution on the CPU.

    A thread is a single sequence stream within in a process . Because threads have some of theproperties of processes, they are sometimes called lightweight processes . In a process, threadsallow multiple executions of streams. In many respect, threads are popular way to improveapplication through parallelism. The CPU switches rapidly back and forth among the threadsgiving illusion that the threads are running in parallel. Like a traditional process i.e., processwith one thread, a thread can be in any of several states (Running, Blocked, Ready orTerminated). Each thread has its own stack. Since thread will generally call different proceduresand thus a different execution history. This is why thread needs its own stack. An operatingsystem that has thread facility, the basic unit of CPU utilization is a thread. A thread has orconsists of a program counter (PC), a register set, and a stack space. Threads are notindependent of one other like processes as a result threads shares with other threads theircode section, data section, OS resources also known as task, such as open files and signals.

    PROCESSES VS THREADS

    As we mentioned earlier that in many respect threads operate in the same way as that ofprocesses. Some of the similarities and differences are:

    Similarities

    Like processes threads share CPU and only one thread active (running) at a time. Like processes, threads within processes, threads within a processes execute

    sequentially. Like processes, thread can create children. And like process, if one thread is blocked, another thread can run.

    Differences

    Unlike processes, threads are not independent of one another. Unlike processes, all threads can access every address in the task . Unlike processes, thread are design to assist one other. Note that processes might or

    might not assist one another because processes may originate from different users.

    WHY THREADS?

  • 8/10/2019 Notes on Operating System2013 Formatted

    57/212

    Following are some reasons why we use threads in designing operating systems.

    1. A process with multiple threads make a great server for example printer server.2. Because threads can share common data, they do not need to use interprocess

    communication.

    3. Because of the very nature, threads can take advantage of multiprocessors.

    Threads are cheap in the sense that

    1. They only need a stack and storage for registers therefore, threads are cheap to create.2. Threads use very little resources of an operating system in which they are working. That

    is, threads do not need new address space, global data, program code or operatingsystem resources.

    3. Context switching are fast when working with threads. The reason is that we only haveto save and/or restore PC, SP and registers.

    But this cheapness does not come free - the biggest drawback is that there is no protectionbetween threads.

    USER-LEVEL THREADS

    User-level threads implement in user-level libraries, rather than via systems calls, so threadswitching does not need to call operating system and to cause interrupt to the kernel. In fact,the kernel knows nothing about user-level threads and manages them as if they were single-

    threaded processes.

    ADVANTAGES:

    The most obvious advantage of this technique is that a user-level threads package can beimplemented on an Operating System that does not support threads. Some other advantagesare

    User-level threads does not require modification to operating systems. Simple Representation:

    Each thread is represented simply by a PC, registers, stack and a small control block,all stored in the user process address space.

    Simple Management:This simply means that creating a thread, switching between threads and

    synchronization between threads can all be done without intervention of the kernel.Fast and Efficient:

    Thread switching is not much more expensive than a procedure call.

  • 8/10/2019 Notes on Operating System2013 Formatted

    58/212

    DISADVANTAGES:

    There is a lack of coordination between threads and operating system kernel. Therefore,process as whole gets one time slice irrespect of whether process has one thread or1000 threads within. It is up to each thread to relinquish control to other threads.

    User-level threads requires non-blocking systems call i.e., a multithreaded kernel.Otherwise, entire process will blocked in the kernel, even if there are runable threadsleft in the processes. For example, if one thread causes a page fault, the process blocks.

    KERNEL-LEVEL THREADS

    In this method, the kernel knows about and manages the threads. No runtime system is neededin this case. Instead of thread table in each process, the kernel has a thread table that keepstrack of all threads i