Operating_Systems.pdf

41
raj 1. INTRODUCTION OF OPERATING SYSTEM Q - What is an Operating system? Operating system is a system software that is extremely important to activate and co- ordinate the activities of various hardware resources like the processor, input output devices etc. It also controls the movement of information in the computer system. It is the first program who loaded into the computer memory when we boot our computer system. It provides a standard to its application software so that application software can talk to operating system or each other easily. The main functions of an operating system are... (i) It assigns a processor to different tasks being performed by the computer system. (ii) It allocates the main memory and other storage areas to the system programs as well as user programs and data. (iii) It carries out the input-output management and co-ordinates different input-output devices while one or more program is being executed. (iv)It manages file on various storage devices and their transfer from one to another devices. It also allows modification through text editor or any other program. (v) It establishes and enforces the job priority. (vi)It automatically transfer control from one program to another as per control signal supply by user. (vii) It establishes and maintains data security and integrity. (viii) It also produces error messages and other debugging codes. (ix) It maintains log of users in multi-user operating system. (x) It facilitates easy communications between the computer system and the computer operator. Single-user Operating System Operating system, which allows only one user to work on a computer at a time, is known as single user operating system. Example included MS-DOS, Windows 9x etc. Multiuser Operating System A Multiuser operating system allows a number of users to work together on a single computer. UNIX is a multiuser operation system. It is not that all users will bump on a computer at the same time. Each user will be provided with a terminal and all such terminals will be connected to the single computer. Multiuser operating system running on a computer will manage the work of all users, without letting them know that they all are actually working on a single computer. Single - tasking Operating System Operating system which can execute a single job at a time is known as Single- tasking operating system. For example, MS-DOS is a single tasking operating system because you can open and run only one application in DOS, at one time. Multitasking Operating System Multitasking operating system allows the user to perform more than one job at the same time on a computer. Most of today's operating systems such as Windows 9x, OS/2, UNIX, LINUX etc. support multitasking. For example, when you open MS-Word and Internet Explorer at the same time, the Windows Operati9ng system is doing multitasking. The operating system is able to keep track of where yo are in each of these applications and switch from one to another without losing track. Real- time Operating System Real - time Operating Systems work towards providing immediate processing and also responding to user's commands in a very short time. Such an operating system is more 1 www.jntuworld.com www.jntuworld.com www.jwjobs.net

Transcript of Operating_Systems.pdf

  • raj

    1. INTRODUCTION OF OPERATING SYSTEMQ - What is an Operating system?

    Operating system is a system software that is extremely important to activate and co-ordinate the activities of various hardware resources like the processor, input output devices etc. It also controls the movement of information in the computer system.

    It is the first program who loaded into the computer memory when we boot our computer system. It provides a standard to its application software so that application software can talk to operating system or each other easily.

    The main functions of an operating system are...(i) It assigns a processor to different tasks being performed by the computer system.(ii) It allocates the main memory and other storage areas to the system programs as well as

    user programs and data.(iii) It carries out the input-output management and co-ordinates different input-output devices while one or more program is being executed.(iv)It manages file on various storage devices and their transfer from one to another devices. It also allows modification through text editor or any other program.(v) It establishes and enforces the job priority.(vi)It automatically transfer control from one program to another as per control signal supply by user.(vii) It establishes and maintains data security and integrity. (viii) It also produces error messages and other debugging codes.(ix) It maintains log of users in multi-user operating system.(x) It facilitates easy communications between the computer system and the computer operator.

    Single-user Operating SystemOperating system, which allows only one user to work on a computer at a time, is known

    as single user operating system. Example included MS-DOS, Windows 9x etc.Multiuser Operating System

    A Multiuser operating system allows a number of users to work together on a single computer. UNIX is a multiuser operation system. It is not that all users will bump on a computer at the same time. Each user will be provided with a terminal and all such terminals will be connected to the single computer.

    Multiuser operating system running on a computer will manage the work of all users, without letting them know that they all are actually working on a single computer.Single - tasking Operating System

    Operating system which can execute a single job at a time is known as Single- tasking operating system. For example, MS-DOS is a single tasking operating system because you can open and run only one application in DOS, at one time.Multitasking Operating System

    Multitasking operating system allows the user to perform more than one job at the same time on a computer. Most of today's operating systems such as Windows 9x, OS/2, UNIX, LINUX etc. support multitasking. For example, when you open MS-Word and Internet Explorer at the same time, the Windows Operati9ng system is doing multitasking. The operating system is able to keep track of where yo are in each of these applications and switch from one to another without losing track.Real- time Operating System

    Real - time Operating Systems work towards providing immediate processing and also responding to user's commands in a very short time. Such an operating system is more

    1

    www.jntuworld.com

    www.jntuworld.com

    www.jwjobs.net

  • rajcommonly used in chemical industry for process control and scientific processing like airplane control and space vehicle control operations. Success of a real time system does not depend only on the correctness of the result, but also on the timeliness of the result. A correct answer obtained after the expiration of time limit is as bad as a wrong answer. Some examples of real time operating systems are HP-RT and VT- works.Network Operating System (NOS)

    Network Operating System (NOS) is an operating system specifically designed to support interconnection of several computers. NOS provide support for multiuser operations as well as administrative, security and network management functions. Some examples of NOSs are Novell's Netware, Microsoft's Windows NT, Artisoft's LAN tactic etc.A network operating system has to acknowledge and respond to requests from many workstations, managing network access, resource allocation and sharing, data protection as well as error control. It provides for printer, file system, database and application sharing.Distributed Operating system

    A Distributed Operating System hides the existence of multiple computers (interconnected by a network) from the user. That is, the user remains unaware of the fact that many computers and being used to process the data. These computers may be located at many places around the globe. Distributed Operating System provides single- system image to its users. Each computer in a distributed computing system processes a part of the global distributed operating system. All these computers work in close coordination with each other. Processes and system resources are managed globally, and controlled from specific locations.

    User views the complete system as a "virtual uni-processor" and not as a collection of machines. The distributed operation system works towards generating this illusion.

    Degree of autonomy of individual computers in an environment that uses network operation system is very high whereas the degree of autonomy of individual computers in an environment that uses distributed operation system is considerably low.

    How is it Compulsory to function a computer system?Operating system works like a coordinator and mediator between users and computer

    hardware as well as software. It is the main system software that controls all the hardware and software of the computer. It manages the memory, devices, processors etc. As soon as computer system boots, the control automatically transferred into hand of Operating System. Without an OS, the computer is just like a Buddhu Baksa, who cant do anything.

    Operating System Processing MethodsVarious types of OS processing methods are:

    a) Serial Processingb) Batch processingc) MultiprogrammingSerial ProcessingIn the serial processing, programs are executed one by one, in the order in which they are supplied to the computer. That is, the different computer jobs are executed one after the other.Batch processing

    In batch processing systems, a number of jobs are put together and executed as a group. Many users.Multiprogramming In a Batch Multiprogramming system, a series of jobs was loaded into the memory at the same time, if sufficient memory space were available. While one job was held up waiting for an I/O transfer, another job was started. A job was selected (from those ready to run), on the basis of an

    2

    www.jntuworld.com

    www.jntuworld.com

    www.jwjobs.net

  • rajoperator assigned priority number. It was found advantageous to mix jobs which differed in the balance of processor to I/O activity.Some systems only handled two jobs at a time, which were referred to as the foreground and the background jobs. The foreground job had the higher priority and was allowed to run if it was able. The background job could only run if the foreground was awaiting an I/O transfer or was otherwise inactive. Background running is inherently more suited to jobs requiring little processor time, but with relatively more I/O activity. A specific example of such a job is referred to as spooling.SpoolingThis acronym stands for Simultaneous Peripheral Operations On-Line. Essentially, this technique absorbs surplus processor time by performing I/O transfers for other jobs. Input and output data were routed via disk files, so that these jobs were only required to communicate with disk systems with disk systems which are, of course, much faster.Spooling was one of the earliest applications of multiprogramming. Jobs are read in via a card reader and copied into a disk file. The operating system reads this file as if it were the card reader. Printable output generated by the running programs is written to another disk file, while a printing program constantly prints the data in this file (if any).Another benefit of spooling is that access to the slow peripherals is restricted to the one program, namely the spool print program. This facilitates the sharing of devices such as printers between several running programs, avoiding the need for these programs to compete for possession of the printer.Memory Management, Process Management, Device Management, File ManagementOPERATING SYSTEM SOFTWARE - Operating System is a set of programs that is extremely important to activate and Co-Ordinate the activities of various hardware resources like the processor and Input/Output devices. In other words, Operating System controls the movement of information on in the Computer.

    OS is the first program loaded into the computer's memory after the computer is switched on. The operating system is an important component of the computer system, because it sets the standards for application programs that run in it. All programs must be written to "talk to" Operating System. The main functions of an OS are: -(a) It assigns a processor to different tasks being performed by the computer system.(b) It allocates the main memory and other storage areas to the system programs as well as

    user programs and data.(c) It carries out the input/output management and coordinates and assigns different input and

    output devices while one or more programs are being executed.(d) It manages files on various storages devices and the transfer of these files from one storage

    device to another. It also allows all files to be easily changed and modified through the use of text editors or other file manipulation software packages.

    (e) It establishes and enforces the job priority. That is, it determines and maintains the order in which jobs are to be executed in the computer system.

    (f) It automatically transits from job to job as directed by special control statements.(g) It is able to interpret commands and instructions.(h) It co-ordinates and assigns compilers, assemblers, utility programs, and other software

    packages to various users working on the computer system.(i) It establishes data security and integrity. That is, it keeps different programs and data in

    such a manner that they do not interfere with each other. Moreover, it also protects data from being destroyed by and other user.

    (j) It also produces traces, error messages, and other debugging and error detecting codes.(k) It maintains internal time clock and log of system usage for all users.(l) It facilitates easy communication between the computer system and the computer operator

    (human).

    3

    www.jntuworld.com

    www.jntuworld.com

    www.jwjobs.net

  • raj2.DISTRIBUTED OPERATING SYSTEM: ALGORITHM

    A distributed computer system is a collection of autonomous computer systems capable of communication and cooperation via their hardware and software interconnection. Distributed computer systems are generally characterized by the absence of shared memory, by unpredictable internodes communication delays, and by practically no global system state observable by component machines.

    A distributed operating system governs the operation of a distributed computer system and provides a virtual-machine system abstraction to its users.

    Computer system environments and operating systems usually support intersite communication and supply protocols for bulk data exchanges. A network operating system may provide remote operations and remote file access, but the user is almost invariably required to be aware that the resource being operated on is remote. A distributed operating system provides a virtual-machine abstraction of the system and offers a unified interface for resource access and manipulation regardless of its location. Network and distributed operating systems have a common hardware base; the differences between them lie almost exclusively in software.Rational For Distributed System

    Why DistributedThe evolution of computer communication technology let to the implementation of a

    major computer network called ARPANET in the late sixties. It was funded by the Defense Advance Projects Agency (DARPA) of the U.S. Department of Defense provided a large scale operational experience and stimulated a lot of early research on computer networks. Ever since, researchers and practitioners alike have liberated at realizing the promise of distributed processing. It major potential benefits include:

    Resource sharing and load balancing Communication and information sharing Incremental growth Reliability, availability, fault tolerance Performance

    Resource sharing is one of the major potential advantages of distributed systems. Temporary surpluses and shortages of resources such as processing power, storage capacity, and information from databases may be balanced to improve cost-effectiveness and performance of a distributed system.

    On a greater scale, a distributed system effectively merges a number of previously autonomous user populations, such as several different time-sharing systems and/or LANs, into a larger union.

    Similar savings have been realized in other industries, such as load sharing in power utility systems. A large common distribution system makes it possible to pool the power and meet the demand wherever it occurs.

    Communication and information sharing are forms of resources sharing. In our classification they are presented as a separated category in order to emphasize their special importance. Personnel computers, which were initially heralded as providing the ultimate freedom and self-sufficiently, are increasingly abandoning isolation and being connected via networks in order to enable their users to communicate and share information.

    Distributed systems generally serve much larger, possibility geographically dispersed, user communicates and thus represent an attractive opportunity for communication and information sharing. Electronic mail has a number of appealing characteristics, such as fast delivery and the possibility of instant reply, as well as store-and- forward capability that allows interested parties to converse at their convenience.

    4

    www.jntuworld.com

    www.jntuworld.com

    www.jwjobs.net

  • rajDue to the economy of scale, the point of cost effectiveness for connecting to information

    databases, such as large depositories of technical abstracts and indexed references, is more easily reached in a distributed system than in a time sharing system. Bulletin boards and electronic forums are a relatively novel form of teleconferencing and topical information exchange. User benefits include the possibility of focusing only on the specific areas of interest and the ability to offer or solicit peer opinions on any given topic therein.

    Incremental growth may be accomplished in a distributed system by gradually augmenting the equipment as the needs of applications and user requirements change.

    Reliability, availability and fault tolerance are quite different issues, but there common thread is that they have significant potential advantages in distributed system over the centralized environment. Increased reliability comes from duplication of equipment and the possibility of storing replicated data at different locations.

    Performance improvements come mostly from the potential for parallel operation when multiple nodes cooperate on solving a single problem. Response time, a measure of performance, may be improved in a distributed system by virtue of the ability to place frequently used data closed to there users.

    Other potential advantages of distributed systems include reduced costs, greater capacity than a single processor can deliver, and better ability to parallel real world organizational structure due to local control of local data.

    Major drawbacks of distributed processing are: Reduced ability to pool memory and processor resources among distinct nodes Increased dependence on network performance and reliability Security weaknesses More complex system administration and maintenance

    What Is DistributedDistribution basically spans three dimensions:

    Hardware Control Data

    System resources generally fall into one of the two categories (1) physical resources, such as processors and devices, and (2) logical resources, such as files and processes. Distributed algorithm and processing often involve multiple processes that execute on different nodes. Control includes resource management and coordination of activities that takes place on individual nodes.

    Centralization control requires delegation of an arbiter node that manages a set of system resources. The central arbiter has complete information about the state of resources under its jurisdiction and of pending requests for their use. The single-point failure problem may be alleviated by implementing algorithm for election of the successor node, at the cost of added complexity, logging of outstanding requests, and potentially long transition delays.

    Distribution of data may be partitioning, replication, or both. In some applications judicious partitioning of data can contribute to performance and availability by placing frequently used items close to their points of processing.

    Computer NetworksAutonomous machines that execute application programs and constitute the

    computational resource of a distributed system are usually called hosts. They are connected for purposes of communication by means of a communication network or sub network. Depending on the physical distance spanned by their communication sub-networks, computer networks are usually classified as

    5

    www.jntuworld.com

    www.jntuworld.com

    www.jwjobs.net

  • raj

    Wide-area networks (WANs) Local area networks (LANs)

    Wide Area Networks:-As indicated the communication subnet itself consists of a number of communication

    processors connected by physical communication lines. Dedicated communication processors act as switching elements between two or more communication lines. After the original ARPANET implementation, the communication processors are often called interface message processors, or IMPs for short.

    A host processor wishing to communicate with another host typically presents its request to the designated IMP. Usually each host is availed the services of a specific IMP, although a single IMP may serve several hosts. The IMP-to-IMP communication channel may be of one of the two board types:

    Point to point Broadcast

    Point-to-point links are dedicated physical lines used to connect a specific pair of IMPs. The actual number and topology of these links are determined by taking into consideration factors such as cost, communication delays, and reliability. Common topologies of physical circuits that connected IMPs are:

    Star Partially connected Fully connected Ring Hierarchical or tree-structured network

    The star has a fixed, two-hop host-to-host communication delay but suffers from the single point of failure. Fully connected systems are fast and reliable but expensive since the number of links grows as the square of the number of hosts. Partially connected and mesh networks have direct links between some but not all nodes.

    Single-link ring networks are low in cost but have variable and potentially long delays, especially when a host wants to communicate with its immediate neighbor in the direction opposite the ring flow. Rings are generally sensitive to link failures, especially in native implementations, where each node must act as an active repeater for all traffic.

    Hierarchical connections may be suitable for certain types of organizations and systems, such as process control, where communication naturally flows in a hierarchical manner. This configuration is poor in systems with frequent peer-to-peer interactions, since they must be routed up and down the hierarchy.Local Area Networks:-

    As indicated earlier, local area networks (LANs) are characterized by high bandwidth, low-delay communication links. They often rely on a relatively high-speed common access communication medium to carry the massage traffic. LAN communication speeds range from the order of several Mbps to the order of a Gbps with special cabling or optical fibers.

    The LAN communication medium itself is passive in the sense that it provides none of the processing power, routing, or storage functions found in the store and forward communication subnets. In LANs, communication functions and processing are provided by the nodes (host machines), either directly or by their integral dedicated communication processors.

    The network topology is usually a bus or a ring. A star topology may be found in special-purpose systems and in some early designs.

    In ring-based systems, messages circulate around the ring. They are then recognized and copied by their addresses. Depending on the acknowledgement scheme in use, either the

    6

    www.jntuworld.com

    www.jntuworld.com

    www.jwjobs.net

  • rajdestination or the source node may be charged with removing the consumed massage from the ring.

    Another common topology in local-area networks is the bus. In a typical bus technology, a commonly accessible passive conduit carries the message traffic. All nodes tap the bus, listen to all the traffic, and extract the massage addressed to them. Taps themselves are usually passive and do not physically break the bus. As a result, bus-oriented LANs are reliable and able to sustain communication between healthy parties in the presence of multiple node failures.

    A token-bus is a LAN that attempts to combine the benefits of bus topology with the bounded massage delays characteristic of rings. A token bus is a bus-based LAN whose nodes from a logical ring in order to use tokens for access control. A token bus is used in MAP (Manufacturing Automation Protocol) LAN.Algorithm for Distributed Processing

    In a distributed system, cooperating processing may reside on different nodes. Like their single-site counterparts, distributed cooperating processes rely on inter process synchronization and communication mechanisms to collectively and coherently accomplish a common mission. These complexities are largely due to he differences between distributed and centralized systems which include:

    Absence of shared, commonly accessible memory Internodes communication delays that can exceed internodes communication delays by

    orders of magnitude Global system states is not observable by component machines due to communication

    delays, component failures, and absence of shared memory A much richer set of failure modes and the desire to continue at least degraded operation

    in the presence of partial failuresIn certain respects, a centralized system may be viewed as a special case of a distributed system in which inter component propagation (communication) delays are practically negligible. As a result, algorithms and mechanism devised for the distributed case generally function correctly when applied to the centralized uniprocessor case, but the converse is not necessarily true.

    Lamports Algorithm:-Assuming the presence of the pipelining property and eventual delivery of all messages,

    the solution requires time-stamping of all message, and it also assumes that each process maintains a request queue, initially empty, that contains request message ordered by the relation

    . The algorithm is defined by the following five rules.1. (Initiator: i) When process Pi desires to acquire exclusive ownership of the resources, it

    sends the time-stamped message request (Ti, i), where Ti = Ci, to every other process and records the request in its own queue.

    2. (Other processes: j,ji) When process Pj receives the request (Ti, i) message, it places the request on its own queue and sends a time-stamped reply (Tj, j) to process Pi.

    3. Process Pi is allowed to access the resource when the following two conditions are satisfied:

    a) Pis request message is at the front of the queue, andb) Pi has received a message from every other process with a time stamp later than

    (Ti, i).2. Process Pi releases the resource by removing the request from its own queue and by

    sending a time-stamped release message to every other process.3. Upon receipt of Pis release message, process Pj removes Pis request from its request

    queue.Ricart and Agrawalas Algorithm:-

    7

    www.jntuworld.com

    www.jntuworld.com

    www.jwjobs.net

  • rajRicart and Agrawalas (1981) algorithm is a more efficient version of Lamports

    algorithm. It is based on identical communication assumptions and on the total ordering of events as provided by the relatin.

    1. (Initiator: i) When process Pi requests the resource, it sends the time-stamped message request (Ti, i), where Ti = Ci , to every other process and records the request in its own queue.

    2. (Other processes: j,j i) When process Pj receives the request message , it acts as follows:

    a) If Pj is not currently requesting the resources, it returns a time-stamped reply.b) If Pj is currently requesting the resources, and the stamp of its request (Tj , j)

    precedes (Ti , i), process pis request is retained; otherwise, a time-stamped reply message is returned.

    2. Process Pi is allowed to access the resources when the following two conditions are satisfied:

    a) Pis request message is at the front of the queue.b) Pi has received a message from every other process with a time stamp later than

    (Ti , i).3. When process Pi releases the resource, it sends a reply message for each pending request

    message.Distributed Concurrency Control and Deadlocks:-

    In a distributed system, a single transaction can span files residing at several different sites. Resource acquisition by concurrent transactions originating at different sites can lead to deadlocks.

    Necessary conditions for a deadlock are the same in centralized and in distributed systems. They are: (1) mutual exclusion, (2) hold-and-wait, (3) no preemption, and (4) circular waiting.

    Techniques for dealing with deadlocks include deadlock prevention, deadlock avoidance, and deadlock detection and recovery. Deadlocks can be prevented by ordering and honoring requests according to their time stamps.

    In principle, the familiar centralized algorithms for deadlock avoidance can be applied in distributed system with centralized control. In addition to requiring proclaiming of resources, such approaches tend to be slowing, susceptible to a single-node failure, and prone to congestion.

    Several decentralized algorithms for concurrency control that avoid deadlocks have been devised for use in distributed systems. In this session we describe two such protocols, called wait-die and wound-wait due to Rosencrantz et al. (1978). Both protocols are essentially database concurrency control algorithms that avoid deadlocks. Each transaction is time-stamped at its creation by the originating site. Each site maintains a lock queue for each of its publicity available resources. Lock queues are ordered according to the time stamps of participating transactions. A transaction at the head of a queue owns the resources. In case of conflicts, a node where lock requests collide applies locally one of two rules:

    Wait-die: If the requestor is older, than the transaction that owns the desired lock-the requestor-waits. Otherwise, the requestor dies.

    Wound-wait: If the requestor is older than the owner of the lock, the requestor wounds the owner. Otherwise, the requestor waits.

    Dying means that the affected process or transaction is aborted. For transactions, aborting implies the undoing of all partial effects and the releasing of all locks acquired by the transaction thus far. The aborted transaction is usually restarted at a later time. Wounding means that an older transaction instructs the younger, conflicting one to die-that is, to abort, undo its partial effects, and release the locks.

    8

    www.jntuworld.com

    www.jntuworld.com

    www.jwjobs.net

  • rajIn the wait-die scheme, an older transaction is permitted to wait. This is safe because

    circular waiting chains cannot be formed, since a younger transaction never waits for an older one.

    In the wound-wait scheme, an older transaction does not wait for younger ones. After wounding, the transaction has to wait for the wound to take effect and for the younger transaction to die and release the lock.

    In a wait-die system, a transactions that dies and is restarted may again cause a conflict with the same transaction and be forced to die again. On the positive side, wait-die systems have the desirable property that a transaction is guaranteed not to restart ones it has accessed all its required database entities for the first time. This property is not enjoyed by wound-wait systems.Coping With Failures

    One of the major potential benefits of distributed processing is resilience to failures and increased system availability. Mere distribution of hardware and data does not automatically yield an inherently more reliable system. In fact, due to its dependence on multiple nodes and communication links, a distributed system may be less reliable than a single-site centralized system. The promise of distributed systems can only be realized when the proper hardware foundation is augmented with fault mechanisms and data redundancy provided and managed by the systems software.Failures in Distributed Systems:-

    Common failures in distributed systems include: Communication-link failures Node failures Lost messages

    In order to function properly, the rest of the system must (1) detect failures; (2) determine the cause, such as identifying the type of failure and the failed component; (3) reconfigure the system so that it can continue to operate; and (4) recover when the failed component is repaired.

    A node engaged in a handshaking protocol of some kind usually experiences a failure as the lack of expected response from its partner within a prescribed time limit.

    The use of time-outs is a common technique for detecting missing responses or acknowledgements. Too long time-out results on sloe detection of missing messages. On the other hand, too short a time-out may trigger false alarms by declaring as missing messages that are just delayed.

    Given the possibility of lost messages, it is common to go through a few retries before declaring a failure to communicate. After a predetermined number of retries fails to be acknowledged within the time-out limit, it is reasonable to conclude that a failure has occurred. In general, in a distributed system there is no direct way for a node to determine the cause of the failure, such as a link or a node, on the basis of the missing response alone. Thus some system component must engage in detection of the type of failure so that the appropriate action may be taken.

    Failure of a node can result in simple stoppage, called fail-stop, or in erratic malfunctioning behaviors. The latter is much more difficult to deal with, as the malfunctioning node may continue to exchange messages but may violate the protocol and thus confuse other nodes, withhold answers intermittently, or disseminate corrupt or forged messages.

    Reconfiguration in the case of link failures consists of choosing and alternate path and updating the corresponding routing information by all affected nodes.

    Recovery from link failures consists of relatively simple updating of the routing information. Node recovery is more complex since it requires updating of state

    9

    www.jntuworld.com

    www.jntuworld.com

    www.jwjobs.net

  • rajinformation and possibly replaying of missed messages by some of the active nodes, in addition to updating of system topological maps.

    MEMORY MANAGEMENTThe memory is divided into two parts:-(1) Contiguous part: - Contiguous part for operating system program also called monitor. Second section: - Second section is for user program.SINGLE PROCESS MONITOR

    In single process monitor operating system only keep the track of the first last location available for allocation of user programs. In order to provide a contiguous area of free storage for user program operating system is loaded at one extreme end, either at the bottom or at the top.

    This important factor affecting only interrupts vector case. Since the interrupt vector is often in low memory, operating system program is kept in low memory Anew program [user program] is loaded only when the operating system passes a control to it. After receiving a control it starts running until its completion or termination due to I/O or some error. When this program is completed or terminated. The operating system may load another program for execution. This type of memory management scheme was commonly use in single process operating system such as op/m.

    Two important issues such as protection and sharing of code must be addressed while design any memory management scheme sharing of code and data in a single process environment does not make mush sense because only one process resides in memory at a time. Protection is also hardly supported by a single process monitor because only one process is memory resident at a time. However, protection of operating system program from user code is must otherwise it may crash. Operating system code usually resides in low memory area. A register also called fence register is set to the highest address occupied by operating system code. A memory address generated by user program to access certain memory location is first compared with fence register content. If the address generated is below the fence, it will be trapped and denied permission. Since modification of fence register is considered as a privileged operation there fore, only operating system is allowed to make any changed to it.Partitioned memory allocation static : Static partitioning implies that the division of memory into no. of portions and its size is made. In the banging and remain fixed there after. The basic approach here is to divide memory into several fixed size partitions where each partition will accommodate only one program for execution. The no. of programs residing in memory will be bound by the number of partitions. Where a program terminates, that partition is free for another program waiting in a queue.

    In the fig. Memory is partitioned into 6 regions. The first region is revered for o.s and P1, P2 and P3 is reserved for program and two partitions are free and available for allocation.

    Wherever a new process is ready to be loaded into memory and if no portion is free, swapping of processes between main memory and secondary is alone. Swapping helps in cup utilization by replacing suspend able process but residing into main memory with ready to execute processes

    from secondary storages. When the scheduler admits a new process for which no part ion is free, a memory manager is invoked to make a partition free to accommodate the process.

    The memory manager performs this task by swapping out low priority processes suspended for a comparatively long time in order to load and execute the huger priority process. When the higher priority the higher process is terminated, the lower priority process can be swapped back and continued.

    Swapping requires secondary storage. Device such as fast disk to store the suspended processes from main memory .one problem with swapping process is that it takes lengthy time to

    10

    www.jntuworld.com

    www.jntuworld.com

    www.jwjobs.net

  • rajaccess process from secondary storage device. For example, to get an idea of total swap time, assume that user program is 100k words and secondary storage device is access time 8m sec. And a transfer rate of 250000word/sec. Then a transfer of 100k words to or from memory tasks:-

    =8msec+ (100k words/250000 words sec)=8 m sec + 100000 words/250000 words/sec=8+2/5sec8+2*1000/5=8+400=408m sec (approximately)Since we must both swap in and swap out the total swap time is about 408+408=816 m

    sec. This is a very long time for computer. Static partition methods take more time to execute any task if any partition is not free. And main memory problem with fixed size partition is the wastage of memory by programs that are smaller than their partitions.Dynamic partitions:-> The size and the no. of portions are decided during the run time by the operating system. Dynamic partitions (also called variable partition) which creates partitions dynamically to meet the requirements of each requesting process, when a process terminates or becomes swapped out the memory manager can return the vacated space to the pool of free memory are areas from which partition allocation are made. In dynamic partition neither the size nor no. of dynamically allocated partition need be limited at any other time. Assume that we have a 100 to main memory 40k is occupied by o.s program there are 84jobs waiting for memory allocation in a job were. And size of job 1 is

    10k job is 30k job is 8k and job is 16k. Applying fifes scheduling policy.Process a, process b, process c can be allocated in memory. Process d cannot be accommodated because. Only {60-(30+15+10)} =15k memory rest. Show in fig.

    Let us assume process after some time process a is terminated, releasing 10k memory space. This is shown in below fig.

    After that the

    control is returned to process d process queue and next process is swapped.. This is shown in fig.

    Let us assume

    after some time process d is terminated the control is retuned again

    the process queue and next process (process e) is swapped this is shown

    in below fig.

    11

    www.jntuworld.com

    www.jntuworld.com

    www.jwjobs.net

  • rajWith dynamic portion the main problem is fragmentation. Its solution is combine the all-

    free space after that the control is returned to the process queue and then next process is swapped. One advantage with variable portion is that memory is generously better then fixed size partitions, since portion are created according to the size of process. Paging: - paging is a memory management technique that permits a programs memory to be non-contiguous into physical memory thus allowing a program to be allocated physical memory wherever it is possible.

    When programmer wants to transfer data from one memory to another, he might write for example: more R1 2000. Basically the physical memory is conceptually divided into a no. of fixed size slots called page forms. The virtual address space of a process is also split into fixed size blocks of the same size called pages. Different page forms allocated to a single process need not occupy contiguous area of physical memory.Segmentation: - segmentation is a memory management scheme which supports programmers view of memory. Programmers never think of their programs as linear array of words. Rather, they think of their program as a collection of logically entities such as subroutines or procedures, function global or logical data areas, stack etc.

    Segments are formed at program translation time by grouping together logically related entities. Formation of these segments

    ray from one compiler to another. A Pascal compiler might create separate segments for (1) code of each procedure (2) Global data (3) local data or variable (4) stack

    In segmented systems, components belonging to a single segment reside in on contiguous area but different segments belonging to the same process occupy non contiguous are of physical memory because each segment is individually relocated. Virtual memory management policies:- the collection of only the part of a program of certain policies into the virtual memory management scheme.

    (1) Allocation policy: - how much real memory to allocate to each active process.(ii) Replacement (swap-out) policy: - if there is no. Space for a new page in physical

    memory, which page is to be selected for swapping out to secondary memory in order to mark room for a new page.

    3.FILE MANAGEMENTLogically related data items on the secondary storage are usually organization into named collection called files. User can rely on a single, uniform set of file-manipulation system services for both file and I/O device management. Thus sometimes referred to as device-independent I/O.

    The common responsibility of the file management system includes the following:-- Mapping of access request from logical to physical file address space. Transmission of the file element between main and secondary storage .

    12

    www.jntuworld.com

    www.jntuworld.com

    www.jwjobs.net

  • raj

    Management of the secondary storage, such as keeping track of the status allocation, and deletion of space.

    Support for protection and sharing of file and the recovery and possible restoration of file after system crash.

    File of a computer installation can be stored on a number of physical devices, such as disk drive, magnetic tapes, or semiconductor memory.

    Command language uses view of file system

    According to the method of invocated of the service, users of file may be broadly divided into two categories:

    I. Command language user II. System programmers

    The formal category includes user who invoke file management service by means of the operating system command language. In most system, such user can LIST content of a file directory COPY file between volumes or devices CREATE, DELETE, and RENAME file. File creation may be done by invoking the text editor, which in turn time CREATE_FILE service to pass on the users request to the file management system.

    File directory in computer in computer system usually belong to one of two categories: - single level or hierarchical. A single level directory, often called a flag directory, contens all file in the system or on a given volume .these problem can be alleviated by using hierarchical directories. In a hierarchical directory system, user can group the related file into subdirectories. All system file are then cataloged in a hierarchy of directories whose structure is similar to that of a rooted tree. Access to files in a hierarchical system in principle requires user to indicate all directories that must be searched in order to locate a given entry. Such a specification is often called an access path or a path name.Edit report

    13

    www.jntuworld.com

    www.jntuworld.com

    www.jwjobs.net

  • raj

    As perceived by users , advantage of hierarchical directory include :- Facilitated unique naming of files Support for select for select for selective sharing and protection Convenient directory manipulation.

    Disk controller and driverDisk are electromechanical device, they are capable of carrying out only rather primitive command. Controller is usually capable of handling several drives with similar characteristics. A few control lines are needed to select the drive designate to participate in a given operation .these are indicate as DRIVE SELECT line in shown in the figure.

    Root

    Jones

    New work

    Smith

    kmos

    14

    www.jntuworld.com

    www.jntuworld.com

    www.jwjobs.net

  • rajdisk

    controller /drive single

    The primary functions of a basic disk controller are to:-1) Convert higher level command, such as seek or read a sector ,into sequence of properly

    timed drive specific command .2) Provide serial to parral conversion and single condition necessary to convert from byte or

    word format, required for DMA communication with main memory. Into the analog bit serial stream expected and produced by disk drives.

    3) Perform error checking and control

    A typical disk driver basically allows reading and writing of disk sector specified by means of the three component physical disk addresses of the form:

    Some implementation requires READ and WRITE request to be preceded by head position SEEK command. Some disk drive and controller are capable of transferring multiple sector or even track, in response to a single command. An advantage of this mode of operation is that head are positioned once, so that the overhead of average access time may be amortized over many sectors.

    Drive select

    Head select

    Direction (in/out )

    Step

    Read

    Write

    Data out

    Data in

    Reset faultclear

    Track00

    Index ready

    Faulty

    Volume

    miscellaneous

    15

    www.jntuworld.com

    www.jntuworld.com

    www.jwjobs.net

  • raj

    OPERATING SYSTEMS VIEW OF FILE MANAGEMENT The file system must support the users abstraction at the outer layer and convert it into the command understood by the disk driver at the inner layer. From the range of service provided to user and the description of disk organization ,it follows that the basic function of the file system include:-

    1. Keeping track of all file in the system.2. control sharing and enforcing of file protection3. Management of disk space; allocation and deallocation.4. Mapping of logical file addresses to physical disk addresses.

    The file system keeps track of file by means of directory. File protection requires separation of distinct files. Dynamic changes in both number and size of file necessitate frequent allocation and deallocation of disk space. The file system usually keeps track of unused disk space by means of a pool of free blocks.While the detail may vary the following three level of device abstraction and disk storage addressing are commonly identification in implementations of the file management system:

    1. File relative logical addressing: - at the highest level of abstraction, the storage system is viewed as a collection of namedfilemost application and file related system calls use this form of addressing.

    2. Volume relative logical addressing:- many disk driver provide an abstraction of disk as a linear array of sectors. Small computer system interface (scsi) device provide this form of disk abstraction directly by means of hardware controller integrated in the drive themselves.

    3. drive relative physical addressing:- this level user the three component physical addresses of the form .

    DISK CACHES AND UNIX BUFFER CACHE

    Disk access time, and consequently the speed of many operations of the file system that depend on it, may be caching certain disk blocks in memory. This is similar to a memory cache. In UNIX, cached disks blocks are managed more recently by software vendors for personal computers, where it was initially implemented as an add or utility. A disk cache operates by maintaining a pool of recently used disk blocks is main memory. The request result in a cache hit , and it is satisfied from memory. If the requested disk block is not in the cache, a disk-cache miss occurs, and the request is satisfied by accessing the disk.

    Disk caching may be applied to both reads and writes. Some disk caches retain only blocks that are read, and direct all writes to the disk. This approach is known as write-through caching. It is generally less efficient than read/write caching. But not necessarily by a wide margin, since a large majority of disk accesses are generally believe to be reads. The buffer caches are a pool of blocks used to store a collection of recently used disk blocks. The size of the buffer cache is typically determined during system configuration.

    When a running process request a disk block, the operating system translate the reqesr into the device and block number and applied the hash function to those in order to search the buffer cache. The ensuring hash search may yield one of the following finding:-

    1. The target block is on the free list.2. The target block is in the buffer cache but is not free.3. The target block is not in the buffer cache.

    Advantage of disk caching include:- Improved effective disk access time by satisfying requests for the cache block

    from memory.

    16

    www.jntuworld.com

    www.jntuworld.com

    www.jwjobs.net

  • raj

    Improve response time to application for cached block on read and optionally, on delayed writes where the i/o requestor is not forced to wait for the completion of a disk write.

    Reduce server and networking loading with client disk caching in distributed system.

    Implement of the Berkley variety of UNIX claim elimination of 85% of disk accesses. The primary disadvantage of disk caching is the potential corruption of the file system due to loss of power or to system crashes if delayed write are allowed. Poorly implemented or parameterized disk caching systems were also found to under perform nonrated under certain condition.A GENERALIZATION OF FILE SERVICESDevice independent I/O provides both an ease of use and flexibility not attainable by most other approach. Device independent is essentially a form of delayed binding of user programs to i/o device. User programs are coded and prepared using an abstract of device, such as files, logical I/O port, or logical unit number. Much different type of I/O devices it is customary to regard all devices as files in the sense of having a name and allowing bytes to be read from or written into them. A major division between byte-serial and block-structure devices is usually made. Some systems refer to these as unstructured and structured I/O respectively. The formal class includes device capable only of byte-serial transfer, such as printers and terminals. Although creations and deletions are customary for file, devices are usually regarded as permanent object created at system startup time. Depending on the type of device exclusive or share access may be granted to requestor. This uniformity of treatment allows user to handle both file and device by means of a single set of system calls. Advantage of device independence is that it facility the portability of object code between system with different hardware configuration. Device specification can be changed without reprogramming.Some system uses an interposes communication mechanism call pipe. Which is similar to messages but ncan be programmed using the standard set of file and I/O services. A pipe is a virtual communication channel that can be used to connect two processes wishing to exchange a stem of data. The two processes communication via a pipe can be written into at one end and read from at the other. Implicit synchronization between the processes communicating via a pipe. The differences are that the pipe facility does not require explicit synchronization between communicating it is handled at the system call level in exactly the same way as file and device independent i/o. A pipe can be created or accessed if it already exists, by means of an OPEN call. A writer process normally produces streams of data that it writes into the pipe. A reader process consume data

    UNIX OPERATING SYSTEMIntroduction: - UNIX is popular multi-user time-sharing operating system primarily intended for program development and document preparation environments. It is written in a high level language, C. Versions of UNIX are available for personal computers, micro-processor based systems, mini-and super minicomputers, and large mainframes and super computers.

    The first version of UNIX was written by Ken Thompson, later joined by Dennis Ritchie, at Bell Labs in the late sixties. It was a single-user system for the PDP-7 computer written in assembly language. After a major rewriting in C and porting to the PDP-11 family of computers, UNIX was made available to users outside of AT&T. UNIX is now commercially available from AT&T, together with numerous variants of the system provided by the other vendors. Several specified versions of UNIX, such as the Programmers Workbench, UNIX/PWB, and Writers Workbench, UNIX/WWB, are also available.

    17

    www.jntuworld.com

    www.jntuworld.com

    www.jwjobs.net

  • rajSome of the major features of UNIX are:-

    Portability Multi-user operation Device independence Tools and tool-building utilities Hierarchical file system

    Silent feature of UNIX are:-(i) Multi-user capability in this system the same computer resources like hard-disk,

    memory, printer, floppy disk drive (FDD), optical disk are accessible to many user. There are lots of terminal connected to a main computer called Host computer or Server. All the terminals are called Clients. All terminals are connected to main computer whose resources are available by all users. So users at any of the terminal can use not only the computer but also any peripheral that may be attached safe for instance printer. One can easily how economical such as setup is then having as many computers as then are users and also how much more convenient when some data is to be shared by all. At the heart of UNIX installation is the host machine is known as Console/Server. The numbers of terminal that can be connected to the host machine dependent on the numbers of ports that are present in its controller card. For example part controller cards in host machine can support for terminal. There are several types of terminals:-

    (a) Dumb terminals: Consists of keyboard and VDU(Visual display unit) with no memory. It can never act independent machine.

    (b) Terminal emulation: Having its on microprocessor memory and disk drive. By attaching this PC to the host through capable and running software from this PC. We can emulate it to work as if it is a dump terminal. It can not be any processing own its. Its transmit its processing job to the host. The job software makes the PC work like dump terminal is called terminal emulation. Ex: VTERM, XTALLIC.

    (c) Dial in terminal: It is connected through telephone line with host using modem called Dial in terminal.(i) Multitasking capabilities: It is capable of carry of more than one job

    at the same time it allows due to type in a program in its editor. While its simultaneously execute some other command you might have given easily, say to surd and copy a use file.

    (ii) Communication: UNIX has extended provision for communicating with fellow user. The communication may be within the network of a single main computer or between two or more such computer networks. The user can be easily exchange mail, data, programs which such as networks.

    (iii) Security: Using allows sharing of data but not indiscriminately. UNIX has three inherent positions for processing data.

    The first is providing accessing password and login name to individual user in security that not anybody can come and have accesses to your work.At the file level there are read, write, and execute permission to each file which decide who excess a particular file.Lastly there is file inscription this utility encodes yours file into an unreadable format even it some one succeed in opening it your secrete is safe. If you want to see the instants of incrusted file than you have to descript it.

    18

    www.jntuworld.com

    www.jntuworld.com

    www.jwjobs.net

  • raj

    (d) Portability: One of the main reasons for the universal popularity of UNIX is that it can be parted to almost any computer system to minimum changed.

    Starting with UNIX: - When we log into a UNIX computer, the files we first see are located in our home directory. We can always return to our home directory by using the command > cd ~. To print the name of our working directory we use > pwd command. To see the list of our files at our hard disk we use > ls command.File In UNIX SystemUNIX treats every thing as files. Even a directory is treated as a file that contains entries for several other files. All devices, such as I/O devices, storage devices etc are all treated as file. There are three types of UNIX files:-

    (i) Ordinary Files: - these files include the plain documents, program source code, program data, executable binary files and computer programs. Each ordinary file has a filename, its size in bites, access permissions and an unique number called inode number. An inode is a data structure that contains information about a file such as file type, number of links a file has, file size, time when the file was last modified and the location of the file on the disk.

    (ii) Special Device Files: - These files include physical devices on the system, such as hard disks, floppy disks, terminals, printers, system memory etc.

    (iii) Directory Files: - These files are the files that contain the names and inode numbers of ordinary and/or directory files within it.

    Organization of UNIX Files: - The UNIX file system is organized as hierarchy that starts with the root directory. The root is represented by a forward slash (/). Under the root directory are several directories and the home directories shown in figure below:

    1. / bin: - This

    directory contains executable program files(binary files).2. /dev: - This directory contains the special device files.3. /etc: - This directory contains all the system-wide configuration information as text files.4. /lib: - This directory contains the library files. Library files contains the reusable

    functions and routines for the programmer to use.5. /tmp: - This directory contains all the temporary files, which will eventually be deleted

    from the system.6. /mnt: - This is the directory where the storage devices other than hard disks(floppy disks

    and disks) are mounted. This directory contains the sub-directories floppy and cdrom. When these devices are mounted, this directory shows the contents of the floppy disk and CD-ROM respectively.

    7. /usr: - This directory contains the home directories of the users, source text for the online manual pages, games and other directories. There is one home directory for each user.

    UNIX command ShellSHELL: - Shell is the integral pat of UNIX system. It is responsible for accepting commands for the user, interpreting them and then passing on to Kernel for processing. Thus it is the command processor of the UNIX operating system. Shell acts as an user interface. The three major type of Shell are:-

    (a) Bourne Shell: - It is developed by Steve Bourne. It is most popular shell properly thats why it is bounded with every UNIX system.

    (b) Korn Shell: - It is developed by David G. Korn. It has many more capabilities and is more powerful and efficient than Bourne Shell.

    19

    www.jntuworld.com

    www.jntuworld.com

    www.jwjobs.net

  • raj(c) C Shell: - This shell is a bit with those who are seriously into UNIX programming. It was

    created by Bill Joy. It has two advantages over the Bourne shell. Firstly it allows aliasing of commands that is you can decide what name you want to call a command by. This proves very useful when lengthy commands which are used time and again are removed by you.

    UNIX users invoke commands by interacting with a command language interpreter called the Shell. In addition to interpreting user requests and invoking the corresponding system services, the shell is also a programming language suitable for construction of elaborate command files, called shell scripts. The shell is written as a user process, as opposed to being built into the kernel. When a user logs in, the system invokes a copy of the shell to handle interactions with the related user. Although the shell is the standard system interface, it is possible to invoke any each particular user. This allows dedicated interfaces developed for users of specialized applications, such as clerical workers using text processing facilities, to coexist with the shell and thus provide quite different views and working environment for different users of the same system.

    Features of Shell: - Some important features and benefits of shell are:-(a) Communication between user and UNIX system takes place through the shell.(b) Shell allows background processing of time-consuming and non-interactive tasks.(c) A frequently used sequence of commands can be stored in a file called Shell script. The

    name of the file can then be used to execute the sequence of commands, automatically.(d) Shell includes features which allow it to act as a programming language.(e) A user can select a group file for processing with a single command.(f) Input of one command can be taken from the output of another command or output of

    one command can be diverted to the input of file or printer, using the input output redirection operators (>,>). Pipes (|) can be used to connect simple commands in order to perform complex functions.

    Pipes (Connecting Commands): -The pipe (|) operator is used to indicate to the shell to take input from another command or give output to another command. For this one method is to first list all the files using ls command and then manually count the number.

    Another method is to save the output of ls into a file (using

  • raj(iii) After writing the instruction save the file and exit to the prompt shell.

    Run Shell program: - Write he file name and run like:.sh Vi simple

    $ .sh simpleCommands:-

    (i) read:-purpose: - To accept value from standard input

    device (keyword).Syntax: read var1 var2.Example: read a b

    (ii) echo:-Purpose: - To display the contents on console.Syntax: echo string

    The System Kernel

    The Kernel is at the core of UNIX system. This is loaded into the main memory as soon as the system starts up. It manages memory, files and peripherals devices. It also maintains date and time, launches applications and allocates system resources.

    The different functions performed by the kernel are:(a) Managing memory, namely allocating and deallocating memory area including address

    space to each process.(b) Scheduling, enabling each user to work efficiently.(c) Organizing data transfer between I/O devices and memory.(d) Accepting instructions from the shell and carrying them out.(e) Enforcing security measures.

    Kernel provides the basic full-time software connection to the hardware. The structure of kernel is shown in the figure. The kernel handles memory management, input and output requests, process scheduling etc. To help it with its work, the kernel also executes daemon programs which stay alive as long as the machine is switched on and help perform tasks such as printing or serving web documents. The kernel, thus controls and provides access to memory, processor, input/output devices, disk files and provides special services to user programs.

    The basic UNIX kernel can be broken into four main subsystems:(a) process Management(b) Memory Management(c) I/O Management(d) File Management

    VI - EDITOREditor: It is a program that provides facility to read/write/modify/manipulation of data/document/text etc. is known as Editor. Ex- EDIT in DOS, VI-EDITOR(UNIX) etc.

    21

    www.jntuworld.com

    www.jntuworld.com

    www.jwjobs.net

  • raj

    There are two types of editor:(1) Document editor and (2) Non-document editor (it doesnt allow any formatting like in

    DOS) UNIX EDITOR: There are three editor available in UNIX i.e. ED, EX and VI. The ED-editor is the original program editor that has been a part of UNIX since very beginning. It is basically line editor which means ED assigns line no. to lines of the files. It is just like EDIT of DOS. Every time if we done something we must tell it to the ED-editor which function ate it line by line.

    An improved version of ED is called EX-editor. It is using friendlier and also understood all the command of the ED-editor.

    Compare to ED and EX both types of editor a new editor is now introduced which is fastest editor of world, known as VI-editor.VI-EDITOR: It is a full screen editor allows the user to view and edit the entire document at the same time. Thus creating and editing of file become easier and that is the reason it become an intent heat with the programs. Under this editor all the commands are under control of finger trips.Disadvantage of VI-editor:

    (i) The user is always kept guessing. There are no self explanatory error messages. If any thing goes round, only speakers keep to inform that something gets wrong.

    (ii) There are not any online help in VI-editor. (iii) There are three modes in which editor works. Under each mode same keys pressed to

    create different effect. Hence each mode should be memorized.(iv) VI-editor is functionally case-sensitive editor.

    Mode of operation: (i) Command Mode: - In this mode all the keys press by the user are interpreted to be

    editor command.Example: - Of hit h the cursor is move one position to left. In

    command mode the keys are hit are not display on he screen.

    22

    www.jntuworld.com

    www.jntuworld.com

    www.jwjobs.net

  • raj(ii) Insert mode: - This mode permits insertion of new editing or existing text or

    replacement existing text. Each of these operations can be performed only after changing over from the command mode to insertion mode using appropriate command. The insertion mode is also known as Input text mode.

    (iii) Ex- Command mode: - This mode permits us to give command at the command line. The button line of the VI-screen is called the command line. VI-User the command line to display message and commands. All command enter in the EX-command mode are display in command line. This mode is show cause the command given in this mode is comfortable for the commands of EX-editor.

    Purpose: To create file/edit files/modify files.Syntax: VI

    (1) Command for positioning the cursor:

    Command Functionh Moves the cursor one character to the left.Backspace Moves the cursor one character to the left.[ Moves the cursor one character to the right.Spacebar Moves the cursor one character to the right.$ Moves the cursor to end of current line.0 Moves the cursor to the beginning of current line.(2) Positioning by line:Command FunctionJ Moves the cursor down the line from the current position in the same

    column.K Moves the cursor up one line from its present position in the same

    column.+ Moves the cursor down to the beginning of the next line.- Moves the cursor up to the end of the current line.(3) Positioning the cursor by word:Command FunctionW Moves the cursor to the right, to the first character of the next line.B Moves the cursor back to the first character of the previous word.e Moves the cursor to the end of the current word.(4) Positioning in the window:Command FunctionH Moves the cursor to the first line on the screen.(home)M Moves the cursor to the middle line to the screen.L Moves the cursor to the last line on the screen.(5) Positioning in the file:

    (i) Scrolling:Command Function^ + f Scrolls the screen forward a full screen/window.^ + b Scrolls the screen backward a full screen/window.

    (ii) Positioning in the numbered line:Command FunctionG Moves the cursor to the beginning of the last line in the file.nG Moves the cursor to the beginning of the nth line in the file.(6) Command for inserting text:Command Function

    23

    www.jntuworld.com

    www.jntuworld.com

    www.jwjobs.net

  • raj

    a Inter text input mode and appends text after the cursor.i Inter text input mode and insert text at the cursor position.A Inters text input mode and append text at the end of current line.I Inter text input mode and insert text at the beginning of current line.o Inter text input mode by opening a new line and below the current line.O Inter text input mode by opening a new line immediately above the

    current line.R Inter text input mode and overwrites from current cursor position.(7) Command mode for deleting text:Command Functionx Deletes the character at the current cursor position.X Deletes the character to the left of the cursor.dw Deletes the word from the cursor to the next space.dd Deletes the current line.nx,ndw,ndd Delete n character, n word, n line respectively.d0 Deletes the current line from the cursor to the beginning of the line.$ Deletes the current line form the cursor to the end of the line.(8) Command for writing in VI-Editor:Command Functionzz Writes the buffer to the files and quit VI.{Save and exit}:wd Write the buffer to the file and quit VI.:w Write the buffer to the file (new file) and quit VI.:q Write the buffer to the file (new file) and quit VI.:w! Overwrites the existing file (new file) and quit VI.:q! Quit VI whether or not changes mode to the buffer where written to

    the file.Compiling a C Program (cc)C is the programming language that is most frequently associated with UNIX. In fact, bulk of the operating system and applications are written in C only.

    The development of a C program involves the following steps:(a) Write the code in a text file, using an editor(b) Compile the program(c) Execute the program(d) Debug the program

    Many UNIX tools are involved in the above process. The following is a simple C program that prints the message A Simple Program:# includeMain(){

    Printf(A Simple C Program);Return 0;

    }Let us nam the file as mess.c. This program can be compiled and executed as follows:$ cc mess.c$ a.outThe output is shown in the figure:-

    The program is compiled with the cc command, which creates a file a.out, if the programming code is correct. Just typing a.out will run the program.

    To get your program into a file other than a.out, you can do either of the following two things:

    24

    www.jntuworld.com

    www.jntuworld.com

    www.jwjobs.net

  • raj(a) rename a.out into any other filename you want.(b) Use o option with the cc command. For example, the following command runs the C

    compiler and places the executable code in a file called output: $ cc o output mess.cNow to run this program, you have to just give the filename output, as follows$ output

    Case studyWindows belongs to the category of software called a GUI (Graphical User Interface).

    The user interface determines how you interact with your computer. The hardware part of the interface consists of your screen monitor, the keyboard and the mouse. The software part of the interface determines what things look like on the screen and how you give commands to your therefore was quite cumbersome. With the advent o Windows environment many of every day computer tasks - such as running programs, opening files, choosing commands etc. are done using a graphical approach that is very intuitive to new users o computers. Further, Windows programs use the same command structure and graphical items on the screen, so if have mastered one Windows program, learning others becomes very easy.

    At the primary stage Windows was developed as a Operating Environment; a add on DOS when it had version 3.1 or 3.11. But later it developed as a Operating System. Windows'95, 98 or later versions of Windows is self Operating System.

    $$ vi mess.c$ cc mess.c$ ./a .out$ Simple C Program$ $ cc o output mess.c$ ./output$ Simple C Program$ $ cc c main.c$ cc c rect.c$ cc c circle.c tri.c$ $ cc o output main.o rect.o circle.o tri.o$ ./output

    This program calculates the area of the following shapes

    1: Rectangle2: Circle3: Triangle

    Select your choice:

    25

    www.jntuworld.com

    www.jntuworld.com

    www.jwjobs.net

  • rajWhen we switch on our PC, Windows 95 or 98's logo appears on the screen and after

    some time it become ready to accept our instruction. Windows 98 offers three views and you can work in any of these three views. These are: -1. Classic View - This is default view in which to select an icon or file, you have to click the object once and to run a program or open a file you have to double-click the icon or filename.2. Web Style View - This view is looks like a web page. To select an icon or a file you have to position the mouse pointer on the object. To run a program or open a file, you have to click the icon or file name once.3. Custom View - This view gives you the flexibility to control the appearance as per your convenience and the ease of working.

    WINDOWS TERMINOLOGYChoose : Executes a command.Select : Selects an item to activate it so that it can be changed. Selecting a command or option turns it on but does not complete it. Selected Text or menu names/items appear in reverse type or a different colour. Selected options show a dot (.) or an (x). Also the selected graphics appear enclosed by a dashed line or enclosed in boxes known as handles.Point : Move the mouse so that the arrow pointer is on the desired menu name, command name or graphic object.Pointer : Pointer is the on-screen symbol controlled by the mouse. The pointer changes shape to indicate the current status and the type of functions and selections available.I-beam : When the mouse pointer is in a text area that you can edit, the pointer appears as a vertical I-beam. Mouse Buttons : Microsoft mouse has two buttons and other makes may have three. Clicking the left button completes an action and clicking the right most button brings up the shortcut menu. Sometimes third button (if available) works as double-click of left button.

    Mouse and their ActionsThe mouse is a very convenient hand-held pointing device which is used to control the

    position of the on-screen pointer. As you move the mouse on your desk or mouse pad, the pointer moves on the screen corresponding to the mouse movement. Using the mouse, you can select menus, commands, text, graphic objects or windows.

    The Main actions of mouse are as follows :-Click - Press and release the left mouse button quickly as you point to an item. Clicking is used to reposition the insertion point in text, select a menu, choose a command from a menu, or select an option from a dialog box.Double-click - As you point to the pointed item on the screen, press and release the left mouse button twice quickly. By double-clicking an icon or file name, you can open an application or window related to that icon or filename.Right click - Position the tip of the mouse pointer in the desired location on a document or toolbar and then click the right mouse button.Dragging - Dragging is moving objects on the monitor's screen. To do so first position the mouse pointer on the object. Next, you "Pick up" the object by pressing and holding down the left mouse button. While you are still holding down the mouse button, move the mouse pointer to where you want to "Drop" the object, and then release the moue button.

    ELEMENTS OF WINDOWS SCREENThe opening screen of Windows 95/98 has following elements: -

    1. The Desktop - The Desktop is your work area while working in Windows. It is called Desktop because Windows uses your whole screen in a way that is similar to the way you use the top of a desk.2. Icons and their types - An icon is a graphic object that represents something on our computer screen. It has three types as follows :-

    26

    www.jntuworld.com

    www.jntuworld.com

    www.jwjobs.net

  • rajSystem Icon - System icons are displayed along left edge of the screen. These objects are

    created automatically by Windows 98 during its installation. Among them following five are generally shows :-

    My Computer This icon lets you browse through the resources connected to your computer.

    My Documents This icon represents a folder that is used by many programs as a default location for starting the documents.

    Internet Explorer This icon starts a Web Browser named Internet Explorer.Network Neighborhood This icon shows the names of each server or computer in

    your own work group.Recycle Bin This icon provides temporary storage for files and folders

    that you delete.Shortcut Icons - A shortcut provides easy access to some objects on your system, such as

    program, a document or a printer etc. The shortcut icon only contains information about the location o the object but not the object itself. Thus deleting a shortcut does not delete the program from the hard disk for that shortcut. These are the icons with small arrows in the lower left corner.

    Program, Folder and Document Icons - These are non-system icon without arrows and represent the actual objects they describe. Thus if you delete such an icon you are deleting the object itself, from the hard disk.3. The Taskbar - It situated at the bottom of the screen and it has generally following four parts :-Start Buttons - It is located at the left end of the taskbar. It invokes Start menu, the

    Gateway of Windows.Toolbars - Toolbars represent a set of related icons for easy mouse access.Task Buttons - Task buttons are displayed in the Centre portion of the Taskbar. A button

    Appears for each program you have started or each document you have Opened.

    Notification Area - The right corner of the Taskbar has the notification area in which Windows provides information about the status of your system including Clock.

    Types of WindowsThere are three types of Windows :-

    1. Application Window : It contains executing Windows programs, and are sized, moved, opened and closed on the desktop.2. Document Window: an application window generates Document windows. A document window cannot be sized or moved outside the confines of its parent application window. 3. Folder Windows : Opening My computer, or any of the folder you move to the desktop produces a folder window.

    Elements of a WindowBorders - The four edges that define the perimeter of a window are called borders. Borders also provide a way to change the size of the window.Title Bar - This bar shows the name of the open application, sometimes with open document name. It has generally three more buttons at the right side of it, i.e.

    a) Minimize Button - When we click on it, the application become minimize, i.e. a button appears in the taskbar and the screen become blank, or another window appears in front.

    27

    www.jntuworld.com

    www.jntuworld.com

    www.jwjobs.net

  • rajb) Maximize Button - After clicking on it the window spreads full of the screen. After maximizing the window, the maximize button converts into Restore button. When we click on it, the window comes back to its original size.c) Close Button - If we click on it, the window, either application or document, will be close.

    Control Box - It is a small icon located on the left side of the Title Bar. When we click on it, Control Menu appears with so many options.Scroll Bars, Scroll Boxes and Scroll Buttons - If a window is not long enough to display its contents completely, vertical scroll bar appears along the right edge. If the window is not wide enough, a horizontal scroll bars appears along the bottom of the window.

    Scroll Bars have some rectangular boxes called Scroll Box. Size of Scroll box is become proportional of the size of the whole file and displayed content on the screen.

    Scroll buttons appear along the top and bottom edges of the vertical scroll bar and along the left and right edges of the horizontal scroll bar.The Menu Bar - The row of words just below the Title bar constitute the Menu bar. Each word in the Menu bar represents a menu, which opens up when you click it. Generally it comes with an application window, not with a document window.Toolbar - It consists generally below of the Menu bar. A toolbar has so many small buttons who represents a command.Work Area - This is working area of the application. Depend upon the program it may be a drawing area, a typing area etc.

    STARTWhen we click on this button we get following options :-

    Shut Down This option is used to turn off the computer smoothly. While we work in Windows'9x or later, Windows automatically opens so many temporary files in background. If it will mot turn off through this option, then it is possible that some error may be appear in Harddisk. Here we get three options generally - Shut Down to turn off the computer, Restart to warm boot and Restart in MS-DOS mode to start the system in DOS mode, so we can work further in DOS environment.

    Run This option is used to run any program by simply typing its command line. We can also search Program through Browse button.

    Help This option provides help about Windows.Find This option is used to find any file or folder among different disks on our

    computer or on network. We can search any file or folder by its name, text containing by it, its size etc.

    Settings This options is used to configure the hardware of the computer system, taskbar etc.

    The Control Panel - Select it from Start->Settings->Control Panel. This option is used to configure the system. Here we get lot of icons. From them someone are :-

    Accessibility Options - The Accessibility Properties dialog box lets you configure Windows keyboard, sound, display, and mouse and other options for people with disabilities. This icon appears only if you installed Accessibility options when you installed Windows.

    Add New Hardware - This Wizard configures Windows when you add new hardware to your computer system.

    28

    www.jntuworld.com

    www.jntuworld.com

    www.jwjobs.net

  • rajAdd/Remove Programs - This Program's dialog box helps us to install new programs or

    uninstall programs, which was already installed and no longer use.

    Date & Time - This option provides two tabs - First one is Date & Time and second is Time Zone. Date & Time option is used to change the current date and time, and Time zone is used to select the place from world map from where user work.

    Display - The display Properties dialog box controls the appearance, resolution, screen saver and other settings for your display monitor.

    1. Background - Used to set the wallpaper and patterns.2. Screensaver - Used to set the screen saver. Screen saver is a memory resident program who automatically becomes active if we will not touch the keyboard or mouse for some time. We can also change this time from here.3. Appearance - This option is used to set the color of active title, inactive title, menu, window etc.

    4. Setting - This option is used to configure the hardware of the system.5. Effects - This option is used to apply extra effects on icons, menus etc.

    6. Web - This option is used to set the Desktop settings, i.e. whether the desktop will be shown as web page or normal.

    Fonts - When we click on it, a window will appear in which we can see name of all the fonts installed in our computer. We can see detail of any font by simply double-clicking on it. To install more fonts Choose Add New Fonts options from File Menu. Then give the path for fonts name. Windows will automatically install it.

    Game Controllers - This dialog box lets you install games.

    Internet - This dialog box contains settings for your web browser and Internet connection.

    Keyboard - This dialog box contains settings that control your keyboard and the cursor.

    Mouse - This dialog box lets you define the buttons on your mouse. It lets you choose how fast you need to double click, what your mouse pointer looks like on-screen, and whether moving the mouse leaves a trial.

    Multimedia - This dialog box contains settings for the audio, video, MIDI, and audio CD settings of your computer.

    Network - The network dialog box contains settings, you use when configuring a local area network. It also contains settings for connecting to the Internet.

    Passwords - This dialog box lets you set a password for using Windows on your computer, user profiles if more than one person will use the computer, and other security settings.

    29

    www.jntuworld.com

    www.jntuworld.com

    www.jwjobs.net

  • rajPower Management - This dialog box contains controls to be set when Windows 98 automatically turns off your monitor, hard disks, and other computer components to save electricity.

    Printer - This icon is used to open the Printer window from where we can Add, Remove or configure the printer.

    Regional Settings - It lets you tell Windows 98 the time zone, currency, number format, and date format you prefer to use.

    Sounds - It lets you assign a sound to each Windows event, or events in other programs. For example, you can set your computer to play a fanfare when your e-mail program receives new messages.

    System - It lets you use the Device manager to change advanced settings for each hardware component of your computer. You can also optimize the performance of your computer.

    Telephony - The Dialing Properties dialog box contains settings that control how Windows 98 dials the phone using your modem.

    Users - The Enable Multi-user Settings Wizard helps you set up user names and passwords so your computer can be used by more than one person. Each person's user name can store that person's desktop settings.

    Printer- this option is used to open the Printer window from where we can Add, Remove or configure the printer.

    Taskbar & Startmenu - This option is used to set the taskbar options, i.e. autohide, show clock, small icons in windows and also items which will be included or excluded in Start Menu or its Sub-menus.

    Folder Options - This options is used to set the options about folders, i.e. which types of filenames should be shown in different folder window or in explorer.

    Active Desktop - This option is used to set the Desktop settings, i.e. whether the desktop will be shown as web page or normal.

    Documents This option contains last used document's list, so user can open it again quickly from here.

    Programs This is the gateway to start any program in windows. There is lot of group or application icons can access through this option.

    Windows Accessories: We can choose Start -> Programs -> Accessories to work on elements of accessories.

    1. Entertainment: We can choose Accessories->Intertainmentto entertain ourselves. From the Multimedia we can hear song by CD Player or see movies through Media Player. The coming screen will show same button to do it as its physical device, i.e. CD player or a VCD player.

    30

    www.jntuworld.com

    www.jntuworld.com

    www.jwjobs.net

  • raj

    2. Games: When we slide our mouse at Accessories->Games then we get four games, i.e. Solitaire, Mine- sweeper, Heart and Free-cell.

    3. System Tools: There are two types of system tools - a) Scandisk - Used to check and repair the error of the disks.b) Disk Defragmenter - This option is used to defrag the disk. Defrag reorganizes the files on a disk to optimize disk performance. Due to it the speed of the programs increase.c) Backup - This option is used to take backup of selected file to destination drive. We can also restore files trough RESTORE tab.d) Disk Cleanup - Through this utility we can instruct Windows to automatically clears not required files from our Harddisk, i.e. files of Recycle Bin, Temp Directory's file, temporary internet files etc.e) Character Map: This program allows us to see the ASCII chart of a selected font. This is very useful while we will work on a font, other than Engl