operating system basic

Upload: rishabh-kushwaha

Post on 02-Apr-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/27/2019 Operating System Basic

    1/23

    1.0 INTRODUCTION TO OPERATINGSYSTEM

    An operating system (OS) is software, consisting of programs and data thatruns on computers and manages the computer hardware and provides

    common services for efficient execution of various application software.

    For large systems, the operating system has even greater responsibilities

    and powers. It makes sure those different programs and users running at

    the same time do not interfere with each other. The operating system is

    also responsible for security, ensuring that unauthorized users do not

    access the system. Operating systems provide a software platform on top

    of which other programs, called application programs, can run. The

    application programs must be written to run on top of a particular

    operating system. Handheld computer operating system is designed to

    provide an environment in which a user can easily interface with the

  • 7/27/2019 Operating System Basic

    2/23

    computer to execute programs. Thus, some operating systems are

    designed to be convenient, others to be efficient, and others combination

    of the two. Modern general-purpose computers, including personal

    computers and mainframes, have an operating system to run other

    programs, such as application software. Examples of operating systems for

    personal computers include Microsoft Windows, Mac OS, UNIX, and Linux.

    1.1 What is an Operating System?

    An operating system is an important part of almost every computer

    system. An Operating system mainly performs three functions

    Convenience: It makes computer more convenient to use Efficiency: It allows the computer system resources to be used in an

    efficient manner

    Ability to solve: It should be constructed in such a way as topermit the effective development, testing and introduction of

    new system functions at the same time interfacing with services.

    It also provides basics for application program and act as an intermediate

    between a user of a computer and the computer hardware. Without

    operating System, a computer is basically a useless lump of metal. A

    computer system can be divided roughly into four components: the

    hardware, the operating system, the application program, and the users.

  • 7/27/2019 Operating System Basic

    3/23

    The hardware, central processing unit (CPU), memory, and the

    input/output (I/O) devices provide the basic computing resources. The

    application program such as word processors, spreadsheets, compilers,

    and web browsers-defines the ways in which these resources are used to

    solve the computing problems of the user. The operating system controls

    and co-ordinates the use of the hardware among the various application

    programs for the various users.

    1.2 History of Operating Systems

    An operating system (OS) is a software program that manages the

    hardware and software resources of a computer. The OS performs basic

    tasks, such as controlling and allocating memory, prioritizing the

    processing of instructions, controlling input and output devices, facilitating

    networking, and managing files. First three digital computers were

    designed by English Mathematician Charles Babbage in 1792-1871. It was

    purely mechanical design.

  • 7/27/2019 Operating System Basic

    4/23

    1.2.1 First Generation (1945-1955):- In First Generation

    Computers with Vacuum tubes and plug boards were evolved. In these

    days a single group of people designed, built, programmed, operated

    and maintained each machine. Programming was done in MachineLanguage. The first computers did not have operating systems. In the early

    1950s, a computer could execute only one program at a time. Each user

    had sole use of the computer and would arrive at a scheduled time with

    program and data on punched paper cards and tape. The program would

    be loaded into the machine, and the machine would be set to work until

    the program completed or crashed.

    1.2.2 Second Generation (1955-65):- Transistors and batch

    System. Here for the first time between the programmers and

    maintenance persons, Transistors Were introduced. To run a job, a

    programmer would first write the program on paper, then punch it on

    cards, bring the card deck down to Input / Output room batch system

    was to collect a tray full of jobs in the Input / Output room and then read

    them onto a magnetic tape just to reduce the wasted time.

    1.2.3 Third Generation (1965-1980):- Integrated Chips

    and Multiprogramming In this generation, Integrated circuits were

    used, providing a major price/performance advantage over second

    generation machines, which were built up from individual transistors.

    Concept of Multiprogramming was introduced. When the current job was

    to wait for a tape or other Input / Output operation to complete the

    Central Processing Unit simply sat idle until the Input / Output

    finished. As the Central Processing Unit time is very precious this

    wasted time is not significant.

  • 7/27/2019 Operating System Basic

    5/23

    1.2.4 Fourth Generation (1980-present):- Personal

    Computers With the development of LSI (Large Scale Integration)

    circuits, chips containing thousands of transistors in a square

    centimeter of silicon, the age of personal computers dawned. Personal

    Computers are not that different from mini computers. The most

    powerful Personal Computers used by business, universities and

    government installations are usually called Work Stations (Large

    Personal Computers). Usually they are connected together by hardware.

    1.3Basic Functions of an operating systemAt the simplest level, an operating system does two things. It manages the

    hardware and software resources of the system. In a desktop computer,

    these resources include such things as the processor, memory, disk space,

    etc. (On a cell phone, they include the keypad, the screen, the address

    book, the phone dialer, the battery and the network connection.)It

    provides a stable, consistent way for applications to deal with the

    hardware without having to know all the details of the hardware. The firsttask, managing the hardware and software resources, is very important, as

    various programs and input Methods compete for the attention of the

    central processing unit (CPU) and demand memory, storage and

    input/output (I/O) bandwidth for their own purposes. In this capacity, the

    operating system plays the role of the good parent, making sure that each

    application gets the necessary resources while playing nicely with all the

    other applications, as well as husbanding the limited capacity of the

    system to the greatest good of all the users and applications. The second

    task, providing a consistent application interface, is especially important if

    there is to be more than one of a particular type of computer using the

    operating system, or if the hardware making up the computer is ever open

    to change. A computer, without any software, is essentially of no use. If it

    is with its software that it can store, process and retrieve information. An

  • 7/27/2019 Operating System Basic

    6/23

    operating system is the program that controls all the other parts of a

    computer system both the hardware and the software. There are many

    important reasons for studying operating systems. User interacts with the

    computer through operating system in order to accomplish his task since it

    is his primary interface with a computer. It helps user to understand theinner function of a computer very closely. Many concepts and techniques

    found in operating system have general applicability in other applications.

    1.4 Feature of Operating System

    Multi-User: Allows two or more users to run programs at the sametime. Some operating systems permit hundreds or even thousands

    of concurrent users.

    Multi Processing: Supports running a program on more than oneCPU.

    Multi Tasking: Allows more than one program to run concurrently. Multithreading: Allows different parts of a single program to run

    concurrently.

    Real time: Responds to input instantly. General-purpose operatingsystems, such as DOS and UNIX, are not real-time.

    The operating system is also responsible for security, ensuring thatunauthorized users do not access the system.

    Performs many low-level tasks on behalf of users and applicationprograms.

  • 7/27/2019 Operating System Basic

    7/23

    Provides a way for users to interact with the computer.

    1.5 Qualities of Operating System

    Usability Robustness: -accept all valid input without error, and gracefully

    handles all invalid inputs.

    Consistency Proportionality: - Simple, cheap and frequent things are easy. Forgiving: -Errors can be recovered from. Reasonable error messages. Convenient: - Not necessary to repeat things, or do awkward

    procedures to accomplish things.

    Powerful: - Has high-level facilities.1.6 Utilities of operating system

    1.6.1 Resource Management/Allocation

    CPU - determine which process the CPU works on. Main memory - determine which processes can utilize which

    memory locations.

    1.6.2 Types of resource management allocation

    Extended Machine

  • 7/27/2019 Operating System Basic

    8/23

    Resource Manager1.6.2.1 Extended Machine: - The program that hides the truth

    about the hardware from the programmer and presented a nice, simple

    view of named files that can be read and written is, of course, theoperating system. The function of the operating system is to present the

    user with the equivalent of an extended machine or virtual machine

    that is easier to program than the underlying hardware.

    1.6.2.2 Resource Manager: - Operating systems as primarily

    providing its users with a convenient interface are a top-down view. In

    short, this view of the operating system holds that its primary task is tokeep track of who is using which resource, to grant resource requests,

    to record for usage, and to solve conflicting requests from different

    programs and users.

    1.7 Operating system services

    Program Creation: Operating system services editors anddebuggers, to assist programmer in creating programs. These

    services are in the form of utility programs that are accessible

    through the Operating System.

    Program Execution: Program execution needs instructions anddata to be loaded in to main menu, Input/output devices and files to

    be initialized and other resources to be prepared. The operating

    system handles all these Tasks for the user.

    Access to Input/output devices: Each Input/output devicerequires its own peculiar set of instructions of control signals for

  • 7/27/2019 Operating System Basic

    9/23

    operation. Operating system takes care of details so, the

    programmers can think in terms of simple read and writes.

    System Access: Operating System controls access to the system asa whole and to specific system resources.

    Error detection and response: Variety of errors can occur whicha computer system is running, i.e., internal and external hardware

    errors, such as memory error, device failure error, various software

    errors, inability of Operating System to grant request of an

    application errors and so on.

    Accounting: A good Operating System collects usage statisticsfor various resources and monitors performance parameters such

    as response time, which can be used for billing purposes on a multi-

    user system.

    1.8 Operating System Concepts:Operating Systems are among the most complex pieces of software. Five

    major achievements in the development of Operating System are

    Process Memory Management Information protection and security Scheduling and Resource Management

    1.8.1 Process: It is somewhat more general term than job.Process is a program that is in execution. Three major lines of computer

  • 7/27/2019 Operating System Basic

    10/23

    system development created problems in timing and synchronization

    that contributed to the development of the concept of the process.

    The design of system software to co-ordinate the various activities

    turned out to be difficult. With many jobs in progress at any one time,

    each of which involved numerous steps to be performed in sequence, itbecame impossible to analyze all the possible combination of sequences

    of events. So many errors were detected which were difficult to

    diagnose because they needed to be distinguished from application

    software errors and hardware errors. To tackle these problems, it is

    required to monitor and control the various programs executing on

    the Processor in a systematic way.

    The concept of process provides the foundation process consists ofthe following three components.

    An executable program

    The associated data needed by the program

    Execution context of program

    1.8.1.1 Execution : context includes the information that theOperating System needs to manage the process and that the processor

    needs to properly execute the process. If two processes A and B exist

    in a portion of the main memory, each process is Recorded in process

    list, which is maintained by Operating System. Process index register

    contain the index in to the process list of the process currently

    controlling the processor, Program counter points to the next

    instruction in that process to be executed. Base and limit register

    defines the region in memory occupied by the process. Thus process is

    realized as a data structure. A process can either be executing or Awaiting

    execution. The entire state of process is contained in its context.

    1.8.2 Memory Management: Users need a computingenvironment that supports the flexible use of data, efficient and orderly

  • 7/27/2019 Operating System Basic

    11/23

    control of storage allocation. An Operating System, to satisfy these

    Requirements has five principal storage management responsibilities as

    follows:

    Process Isolation: Operating System must prevent independentprocess from interfacing with data and memory of each other.

    Automatic Allocation and Management : Programs should bedynamically allocated memory across the memory is required.

    Operating System can achieve efficiency by assigning memory to jobs

    only as needed.

    Support of Modular Programming : Programmers should beable to define program modules and to create, destroy and alterthe size of modules dynamically.

    Protection and Access Control: Sharing of memory at any level ofmemory Hierarchy. Operating System must allow portions of

    memory to be accessible in various ways by various users.

    Long term storage: Many users and application require means forstoring information for extended periods. Operating Systems meet

    these requirements with the concept of Virtual Memory and filesystem facilities. Virtual Memory is a facility that allows program to

    address memory from a logical point of view without regard to

    the amount of main memory Physically available.

    1.8.3 Information protection and security

    Operating System must support a variety of protection and security

    mechanism to computer system and the information stored in them.Some overall protection policies are:

    No sharing : In this case, processes are completely isolatedfrom each other and each process has exclusive control over

    resources statically or dynamically assigned to it.

  • 7/27/2019 Operating System Basic

    12/23

    Controlled information dissemination : In some systems,security classes are defined to enforce a particular dissemination

    policy. Users and applications are given security clearances of a

    certain level, whereas data and other resources (e.g., I/O

    devices) are given security classifications.

    Access Control : Is concerned with regulating user access to thetotal system, sub systems, and data, and regulating process

    access to various resources and objects within the system.

    Information flow control: Regulates the flow of data within thesystem and its delivery to users.

    1.8.4 Scheduling and Resource Management

    A key task of the Operating system is manage the various resources

    available to it (main memory space, I/O devices, processors) and to

    schedule their use by the various active processes.

    Any resource allocation and scheduling policy must consider the Followingthree factors:

    Fairness : Typically, we would like all processes that arecompeting for the Use of a particular resource to be given

    approximately equal and fair access to That resource. This is

    especially so for jobs of the same class, that is, jobs of similar

    demands, which are charged the same rate.

    Differential responsiveness : On the other hand, the operatingsystem may need to discriminate between different classes of

    jobs with different service requirements. The operating system

    should attempt to make allocation and scheduling decisions to meet

    the total set of requirements. The operating system should also view

    these decisions dynamically. For example, if a process is waiting for

  • 7/27/2019 Operating System Basic

    13/23

    the use of an I/O device, the operating system may wish to schedule

    that process for execution as soon as possible to free up the device

    for later demands from other processes.

    Efficiency : Within the constraints of fairness and efficiency, theoperating system should attempt to maximize throughput,

    minimize response time, and in the case of time sharing,

    accommodate as many users as possible

    1.9 System Structure

    As more and more features have been added to operating systems

    and as the underlying hardware has become more complex and versatile,

    the size and complexity of operating systems has grown. The size of afull-featured operating system and the difficulty of the task it

    addresses have led to three unfortunate but all too common

    problems. First, operating systems are chronically late in being delivered.

    This goes for new operating systems and for upgrades of older

    systems. Second, the systems have latent bugs that show up in the

    field and must be fixed and reworked. And finally, performance is often

    not what was expected. To manage the complexity of operating Systems

    and to overcome these problems, much attention has been given over the

    years to the software structure of the operating system. Certain points

    seem obvious. The software must be modular. This helps to organize the

    software development process and limits the task of diagnosing and

    fixing errors. The modules must have well-defined interfaces to each

    other, and the interfaces must be as simple as possible. Again, this

    eases the Programming task. It also makes the task of system evolution

    easier. With clean, minimal interfaces between modules, one module

    can be changed with minimal impact on other modules.

    2.0 Classification of Operating Systems

  • 7/27/2019 Operating System Basic

    14/23

    2.1 Evolution of Operating Systems

    An operating system may processes its task serially (sequentially) or

    concurrently (several task simultaneously). It means that the resources of

    computer system may be dedicated to a single program until its

    completion or they may be allocated among several programs in different

    stages of execution. The feature of operating system to execute multiple

    programs in interleaved fashion or different time cycles is called as

    multiprogramming system.

    2.1.1 Serial processing:-

    The process of development and preparation of a program in such

    environment is slow and cumbersome due to serial processing and

    numerous manual processing. In a typical sequence first the editor is calledto create a source code of user program written in programming language,

    translator is called to covert a source code into binary code and then finally

    loader is called to load executable program into main memory for

    execution. If syntax errors are detected, the whole process must be

    restarted from the beginning.

    2.1.2 Batch Processing

    The next logical step in the evolution of operating system was to

    automate the sequencing of operations involved in program execution and

    in the mechanical aspects of program development. Jobs with similar

    requirement were batched together and run through the computer as a

    group. But there was one problem in making batch processing efficient

    that is during this transition from one job to the next, the CPU sat idle. To

  • 7/27/2019 Operating System Basic

    15/23

    overcome this idle time, a small program called a resident monitor was

    created which is always resident in the memory. It automatically

    sequenced one job to another job. Resident monitor acts according to the

    directives given by a programmer through control cards which contain

    information like marking of jobs beginning and endings, commands forloading and executing programs etc. These commands belong to job

    control language.

    2.1.3 Multiprogramming

    A single user cannot always keep CPU or I/O device busy at all.

    Multiprogramming offers a more efficient approach to increase systemperformance. System supporting multiprogramming approach allows more

    than utilization. More number of programs competing for system

    resources better will be resource utilization. Multiprogramming has been

    employed to increase the resource utilization of a computer system and to

    support multiple simultaneous interactive users (terminals).

    2.2 Types of operating system: -

    Operating system can be classified into following types based on number

    of users using the same system simultaneously.

    2.2.1 Single-user, single tasking

    As the name implies, this operating system is designed to manage the

    computer so that one user can effectively do one thing at a time. The PalmO.S. for Palm handheld computers is a good example of a modern Single-

    user, single-task operating system.

    2.2.2 Single-user, multi-tasking

  • 7/27/2019 Operating System Basic

    16/23

    This is the type of operating system most people use on their desktop

    and laptop computers today. Windows 98 and the Mac O.S. are both

    examples of an operating system that will let a single user have several

    programs in operation at the same time. For example, it's entirely possible

    for a Windows user to be writing a note in a word processor whiledownloading a file from the Internet while printing the text of an e-mail

    message.

    2.2.3 Multi-user, multi-tasking

    A multi-user operating system allows many different users to take

    advantage of the computer's resources simultaneously. The operatingsystem must make sure that the requirements of the various users are

    balanced, and that each of the programs they are using has sufficient and

    separate resources so that a problem with one user doesn't affect the

    entire community of users. It's important to differentiate here between

    multi-user operating systems and single-user operating systems that

    support networking. Windows 2000 and Novell Netware can each support

    hundreds or thousands of networked users, `but the operating systems

    themselves aren't true multi-user operating systems. The systemadministrator is the only user for Windows 2000 or Netware. The network

    support and the entire remote user logins the network enables are, in the

    overall plan of the operating system.

    2.2.4 Real-Time operating System

    Instruments and industrial systems need Real Time OperatingSystems (RTOS). An RTOS typically has very little user-interface capability,

    and no end-user utilities, since the 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 a particular operation executes in

    precisely the same amount of time every time it occurs. In a complex

    machine, having a part move more quickly just because system resources

  • 7/27/2019 Operating System Basic

    17/23

    are available may be just as catastrophic as having it not move at all

    because the system is busy.

    2.2.5 Batch

    This strategy involves reading a series of jobs (called a batch) into the

    machine and then executing the programs for each job in the batch. This

    approach does not allow users to interact with programs while they

    operate.

    2.2.6 Timesharing

    This strategy supports multiple interactive users. Rather than

    preparing a job for execution ahead of time, users establish an interactive

    session with the computer and then provide commands, programs and

    data, as they are needed during the session.

    2.2.7 Personal computing

    This strategy supports a single user running multiple programs on a

    dedicated machine. Since only one person is using the machine, more

    attention is given to establishing predictable response times from the

    system. This strategy is quite common today because of the popularity of

    personal computers.

    Dedicated:- This strategy supports real-time and process control systems.

    These are the types of systems, which control satellites, robots, and air

    traffic control. The dedicated strategy must guarantee certain response

    times for particular computing tasks or the application is useless.

  • 7/27/2019 Operating System Basic

    18/23

    3.0 Process Management

    3.1 Introduction

    An operating system executes a variety of programs, Batch system

    jobs, Time-shared systems, user programs or tasks. Textbook uses the

    terms job and process almost interchangeably. Process a program in

    execution; process execution must progress in sequential fashion. A

    process includes: program counter, stack, and data section etc.

    3.2 Definition and concept of Process

    Process Management concerns the control of programs within the

    system. We use the term process to refer to a program that is loaded into

    computer memory and is being executed i.e. is utilizing CPU time

    resources. Recall that only the operating system can allocate system

    resources, so the process will execute in either user mode or system mode

    (system mode has direct access to resources). In order for different user

    processes to exist, the operating system must be able to create and delete

    both user and system processes.

    3.3 Process StateAlthough each process is an independent entity, with its own

    program counter and internal state, process often need to interact with

    other process. One process may generate some output that another

    process uses as an input. A process is more than the program code. It also

    includes the current activity, as represent by the value of the program

  • 7/27/2019 Operating System Basic

    19/23

    counter and the processors registers. Two processes may be associated

    with same program. The operating system is responsible for managing all

    the processes that are running on a computer and allocated each process a

    certain amount of time to use the processor. To keep track of the state of

    all the processes, the operating system maintains a table known as theprocess table. Inside this table, every process is listed along with the

    resources the processes are using and the current state of the process.

    Processes can be in one of three states: running, ready, or waiting. The

    running state means that the process has all the resources it need for

    execution and it has been given permission by the operating system to use

    the processor. Only one process can be in the running state at any given

    time. The remaining processes are either in a waiting state (i.e., waiting for

    some external event to occur such as user input or a disk access) or a readystate (i.e., waiting for permission to use the processor). In a real operating

    system, the waiting and ready states are implemented as queues, which

    hold the processes in these states.

    Different states of a process

    3.4 Process Scheduling

  • 7/27/2019 Operating System Basic

    20/23

    CPU scheduling is the basis of multi-programmed operating systems. By

    switching the CPU among processes, the operating system can make the

    computer more productive. The main function of process scheduling is to

    schedule the process in such a way that none of the resource is wasted.

    3.5 Real-Time Scheduling

    3.5.1 Hardware real-time systems required completing a criticaltask within a guaranteed amount of time. Systems are required to

    complete a critical task within a guaranteed amount of time. A process is

    submitted along with a statement of the amount of time in which it needs

    to complete or perform I/O. the scheduler then either admits the process,guaranteeing that the process will complete on time. Hard real time

    systems are composed of special-purpose software running on hardware

    dedicated to their critical process, and lack the full functionality of modern

    computer and operating system.

    3.5.2 Software real-time computing requires that criticalprocesses receive Priority over less fortunate ones. It is less restrictive. It

    requires that critical processes receive priority over less fortunate ones.

    Although adding software real-time functionality to a time sharing system

    may cause an unfair allocation of resources and may result in longer

    delays. Soft real time systems acceptably in an environment require careful

    design of the scheduler and related aspect of the operating system. The

    system must have priority scheduling, and real time process must have the

    highest priority.

    4.0 VIRTUAL MEMORY

  • 7/27/2019 Operating System Basic

    21/23

    Memory management strategies like paging and segmentation help

    implement the concept of multiprogramming. But they have a few

    disadvantages. One problem with the above strategies is that they require

    the entire process to be in main memory before execution can begin.

    Another disadvantage is the limitation on the size of the process. Processes

    whose memory requirement is larger than the maximum size of the

    memory available will never be execute. Virtual memory is a technique

    that allows execution of processes that may not be entirely in memory.

    Also virtual memory allows mapping of a large virtual address space onto a

    smaller physical memory. It also raises the degree of multiprogramming

    and increases CPU utilization. Because of the above features, users arefreed from worrying about memory requirements and availability.

    4.1 Need for Virtual Memory Technique

    Every process needs to be loaded into physical memory for execution. One

    brute force approach to this is to map the entire logical space of the

    process to physical memory as in the case of paging and segmentation.Many a time the entire process need not be in memory during execution.

    Code used to handle error and exceptional cases is executed only in case

    errors and exceptional conditions occur which is usually a rare occurrence,

    may be one or no occurrence in an execution.

    Static declarations of arrays lists and tables declared with a largeupper bound but used with no greater than 10% of the limit.

    Certain features and options provided in the program as a futureenhancement, never used, as enhancements are never

    implemented.

    Even though entire program is needed, all its parts may not beneeded at the same time because of overlays.

  • 7/27/2019 Operating System Basic

    22/23

    All the examples show that a program can be executed even though it is

    partially in memory. This scheme also has the following benefits:

    Physical memory is no longer a constraint for programs andtherefore users can write large programs and execute them

    Physical memory required for a program is less. Hence degree ofmultiprogramming can be increased because of which utilization

    and throughput increase.

    I/O time needed for load / swap is less.

    5.0 CONCLUSION

    An operating system (OS) is software that runs on computers and manages

    the computer hardware and provides common services for efficient

    execution. It acts as an interface between hardware and software

    applications. Operating system is designed to provide an environment in

    which a user can easily interface with computer to execute programs.

    Operating system consists of graphical user interface (GUI). The operating

    system is also responsible for security, ensuring that unauthorized users do

    not access the system. Thus, some operating systems are designed to beconvenient, others to be efficient, and others combination of the two.

  • 7/27/2019 Operating System Basic

    23/23