Tuesday, July 14, 2009

Intterupt part II



SOFTWARE

INTERRUPTS:

The basic input/output system (BIOS) communicates directly with the hardware of the computer. It consists of set of programs, which interface with device such as keyboards, display, printer, serial port, Without BIOS the computer system will simply of bundle of wires and electronic device. There are two parts of BIOS the first part is permanently stored in non volatile memory called read only memory.(ROM)This parts starts the computer bootstrap. The second is loaded when the operating system is started.

An operating system allows the user to access the hardware in an easy to use manner. It accepts command from the keyboard and displays them to the monitor. The Disk operating system gained its name by from its original purpose of providing a controller for the computer to access its disk drive. The language of DOS consists of a set of command, which are entered directly by user and interpreted to perform file management task.

HARDWARE INTERRUPTS:

Computer systems either use poling or interrupt driven software to service external equipment. With poling the system continually monitors a status line and wait for it to become archive. An interrupt driven device sends an interrupt request to the computer, which is then serviced by Internet service routine

(ISR)

DISABLING INTERRUPT

HARDWARE SUPPORT:

A process runs until it invokes an operating system service or until it is interrupted. Here our attempt is to explain how to disabling interrupts. While one process is busy updating shared memory in its critical region, no other process will enter it critical region and cause trouble.

The simplest solution is to have each process disable all interrupts just after entering its critical region and re-enable them just before leaving it. With interrupts disenable, no clock interrupt can occur. The central processing unit is only switched from process to process as a result of clock or other interrupt. After all and with interrupt turned off, the CPU will not be switched to another process. Thus one process has disabled interrupts, it can then examine and update the shared memory before without fear that any other process will intervene. This approach is generally unattractive because it is unwise to give user processes the power to turn off interrupts. Also, if the computer has two or more CPUs disabling interrupts affect only the CPU that executed the disable instruction. The other ones will continue running and will continue running and access the shared memory.

On the other, it is frequently convenient for the kernel itself to disable interrupts for a few instructions while it is updating variable. If an interrupt occur while the list of ready processes is in an inconsistent state, race condition could occur. Thus disabling interrupt is sometimes a useful technique within the kernel.

Intterupt

INTERRUPT

This is a signal to a processor indicating that an asynchronous event has occurred. Here the current sequence of instructions is temporarily suspended, and a sequence appropriate to the interruption is started in its place. Its purpose is to alert the operating system when any special event occurs so that it can suspend its current activity and deal appropriately with the new situation.

Usually an interrupt gives a signal from a device attached to a computer or from a program within the computer that causes the main program that operates the computer (the operating system) to stop and figure out what to do next. Almost all personal (or larger) computers today are interrupt-driven - that is, they start down the list of computer instructions in one program (perhaps an application such as a word processor) and keep running the instructions until either (A) they can't go any further or (B) an interrupt signal is sensed. After the interrupt signal is sensed, the computer either resumes running the program it was running or begins running another program.

Basically, a single computer can perform only one computer instruction at a time. But, because it can be interrupted, it can take turns in which programs or sets of instructions that it performs. This is known as multitasking. It allows the user to do a number of different things at the same time. The computer simply takes turns managing the programs that the user effectively starts. Of course, the computer operates at speeds that make it seem as though all of the user's tasks are being performed at the same time. (The computer's operating system is good at using little pauses in operations and users think time to work on other programs.)

An operating system usually has some code that is called an interrupt handler. The interrupt handler prioritises the interrupts and saves them in a queue if more than one is waiting to be handled. The operating system has another little program, sometimes called a scheduler, which figures out which program to give control to next.

In general, there are hardware interrupts and software interrupts. A hardware interrupt occurs, for example, when an I/O operation is completed such as reading some data into the computer from a tape drive. A software interrupt occurs when an application program terminates or requests certain services from the operating system. In a personal computer, a hardware interrupt request (IRQ) has a value associated with it that associates it with a particular device. Interrupts can be broadly divided into the following.

Events occurring on peripherals devices:

A processor having initiated a control on a peripheral device on behalf of one process may start some other process. When the transfer terminates, the peripheral device will cause an interrupt.

Voluntary events within processes:

A process wishing to use the services of operating system may use a specific type of interrupt, a supervisor call (SVC) as a means of notifying the supervisor.

Involuntary events within the processes:

A process that attempts an undefined or prohibited action will cause an interrupts that will notify the supervisor.

Action by operators:

An operation wishing to communicate with the supervisor may cause an interrupt.

Timer interrupts:

many systems incorporate a timer that causes a fixed interval of time as a means of guaranteeing that the supervisor will be entered periodically.

Memory Management part II

Swapping

The process of organising memory into fixed partitions on batch system is simple compared to time sharing systems or graphically oriented personal computers. On batch systems, each job is loaded into a partition when it gets to the head of the queue. It stays in memory until it has finished. As long as enough jobs can be kept in memory to keep the CPU busy all the time, there is no reason to use anything more complicated. On time-sharing machines, sometimes there is not enough main memory to hold all the currently active processes, therefore excess processes must be kept on disk and brought in to run dynamically.

Swapping as an approach to memory management consists of bringing each process in its entirety, running it for a while, then putting it back on the disk. For details and illustrations, see OS design and implementation, A.S. Tanenbaum & A.S. Woodhull, Prentice Hall 1997, pg.310.

Virtual Memory

Another strategy for managing memory is the virtual memory, which allows programs to run even when they are only partially in main memory. The basic idea behind this strategy is that the combine size of the program, data, and stack may exceed the amount of physical memory available for it. The operating system keeps those parts of the program currently in use in main memory, and the rest on the disk.

Virtual memory can also work in a multiprogramming system, with bits and pieces pf many programs in memory at once. While a program is waiting for a part of itself to be brought in, it is waiting for I/O and cannot run, so the CPU can be given to another process, the same way as for any other multiprogramming system. Most virtual memory systems use a technique called paging.

Diagram of memory management

Memory Management

MEMORY

Memory is the electronic holding place for instructions and data that the computer's microprocessor can reach quickly. When the computer is in normal operation, its memory usually contains the main parts of the operating system and some or all of the application programs and related data that are being used. Memory is often used as a shorter synonym for random access memory (RAM). This kind of memory is located on one or more microchips that are physically close to the microprocessor in the computer. Most desktop and notebook computers sold today include at least 16 megabytes of RAM, and are upgradeable to include more. The more RAM you have, the less frequently the computer has to access instructions and data from the more slowly accessed hard disk form of storage.

Memory is sometimes distinguished from storage, or the physical medium that holds the much larger amounts of data that won't fit into RAM and may not be immediately needed there. Storage devices include hard disks, floppy disks, CD-ROM, and tape backup systems. The terms auxiliary storage, auxiliary memory, and secondary memory have also been used for this kind of data repository.

Additional kinds of integrated and quickly accessible memory are read-only memory (ROM), programmable ROM (PROMO), erasable programmable ROM (EPROM). These are used to keep special programs and data, such as the basic input/output system, that need to be in the computer all the time.

The memory is a resource that needs to be managed carefully. Most computers have a memory hierarchy, with a small amount of very fast, expensive, volatile cache memory, some number of megabytes of medium-speed, medium-price, volatile main memory (RAM), and hundreds of thousands of megabytes of slow, cheap, non-volatile disk storage. It is the job of the operating system to coordinate how these memories are used.

The part of the operating system that manages the memory hierarchy is the memory manager. It keeps track of parts of memory that are in use and those that are not in use, to allocate memory to processes when they need it and de-allocate it when they are done, and to manage swapping between main memory and disk when main memory is too small to hold all the processes.

Systems for managing memory can be divided into two categories: the system of moving processes back and forth between main memory and disk during execution (known as swapping and paging) and the process that does not do so (that is, no swapping and ping).

Monoprogramming without Swapping or Paging

The most simple memory management scheme is to run one program at a time, sharing the memory between that program and the operating system. As shown in the diagram bellow, there are three variations of this type. The operating system may be at the bottom of the memory in TAM (random access memory), as shown in the diagram 1, or it may be in ROM (read-only memory) at the top of the memory, as shown in diagram 2, or the device drivers may be at the top of the memory in a ROM and the rest of the system in RAM down bellow

With the system organised in this way, only one process at a time can be running. As soon as the user types a command, the operating system copies the request program from a disk to memory and executes it. When the process finishes, the operating system displays a prompt character and waits for a new command. When it receives the command, it loads a new program into memory overwriting the first one.

Monoprogramming with fixed partitions

It is often desirable to allow multiple processes to run at the same time, even on simple operating systems in which multiprogramming is sometimes used. On time-sharing systems, having multiple processes in memory at once means that when one process is blocked waiting for the I/O to finish, another one can use the CPU. This way, multiprogramming increases the CPU utilisation. It is however preferable to be able to run two or more programs at once even on personal computers.

Operating System Functions

What is an Operating System

The operating system is the core software component of your computer. It performs many functions and is, in very basic terms, an interface between your computer and the outside world. In the section about hardware, a computer is described as consisting of several component parts including your monitor, keyboard, mouse, and other parts. The operating system provides an interface to these parts using what is referred to as "drivers". This is why sometimes when you install a new printer or other piece of hardware, your system will ask you to install more software called a driver.

What does a driver do?

A driver is a specially written program which understands the operation of the device it interfaces to, such as a printer, video card, sound card or CD ROM drive. It translates commands from the operating system or user into commands understood by the the component computer part it interfaces with. It also translates responses from the component computer part back to responses that can be understood by the operating system, application program, or user. The below diagram gives a graphical depiction of the interfaces between the operating system and the computer component.

Operating System Interfaces

Other Operating System Functions

The operating system provides for several other functions including:

  • System tools (programs) used to monitor computer performance, debug problems, or maintain parts of the system.
  • A set of libraries or functions which programs may use to perform specific tasks especially relating to interfacing with computer system components.

The operating system makes these interfacing functions along with its other functions operate smoothly and these functions are mostly transparent to the user.

Operating System Concerns

As mentioned previously, an operating system is a computer program. Operating systems are written by human programmers who make mistakes. Therefore there can be errors in the code even though there may be some testing before the product is released. Some companies have better software quality control and testing than others so you may notice varying levels of quality from operating system to operating system. Errors in operating systems cause three main types of problems:

  • System crashes and instabilities - These can happen due to a software bug typically in the operating system, although computer programs being run on the operating system can make the system more unstable or may even crash the system by themselves. This varies depending on the type of operating system. A system crash is the act of a system freezing and becoming unresponsive which would cause the user to need to reboot.
  • Security flaws - Some software errors leave a door open for the system to be broken into by unauthorized intruders. As these flaws are discovered, unauthorized intruders may try to use these to gain illegal access to your system. Patching these flaws often will help keep your computer system secure. How this is done will be explained later.
  • Sometimes errors in the operating system will cause the computer not to work correctly with some peripheral devices such as printers.

Operating System Types

There are many types of operating systems. The most common is the Microsoft suite of operating systems. They include from most recent to the oldest:

  • Windows XP Professional Edition - A version used by many businesses on workstations. It has the ability to become a member of a corporate domain.
  • Windows XP Home Edition - A lower cost version of Windows XP which is for home use only and should not be used at a business.
  • Windows 2000 - A better version of the Windows NT operating system which works well both at home and as a workstation at a business. It includes technologies which allow hardware to be automatically detected and other enhancements over Windows NT.
  • Windows ME - A upgraded version from windows 98 but it has been historically plagued with programming errors which may be frustrating for home users.
  • Windows 98 - This was produced in two main versions. The first Windows 98 version was plagued with programming errors but the Windows 98 Second Edition which came out later was much better with many errors resolved.
  • Windows NT - A version of Windows made specifically for businesses offering better control over workstation capabilities to help network administrators.
  • Windows 95 - The first version of Windows after the older Windows 3.x versions offering a better interface and better library functions for programs.

There are other worthwhile types of operating systems not made by Microsoft. The greatest problem with these operating systems lies in the fact that not as many application programs are written for them. However if you can get the type of application programs you are looking for, one of the systems listed below may be a good choice.

  • Unix - A system that has been around for many years and it is very stable. It is primary used to be a server rather than a workstation and should not be used by anyone who does not understand the system. It can be difficult to learn. Unix must normally run an a computer made by the same company that produces the software.
  • Linux - Linux is similar to Unix in operation but it is free. It also should not be used by anyone who does not understand the system and can be difficult to learn.
  • Apple MacIntosh - Most recent versions are based on Unix but it has a good graphical interface so it is both stable (does not crash often or have as many software problems as other systems may have) and easy to learn. One drawback to this system is that it can only be run on Apple produced hardware.

FUNCTIONS OF OPERATING SYSTEM

A Computer System is made up of Hardware, Operating System and user interface. Computer Software can be divided into System programs which manage the operation of the computer itself and the application programs, which solve problems for their users.

Operating System is the most fundamental of all the System programs. The Operating System controls the entire Computers’ resources and provides the base upon which the application programs can be written.

Operating System has been defined in different ways by different people. Some of the definitions are: An Operating System is program that makes the computing power available to users by controlling the hardware.

Another definition is that Operating System is a program that controls the execution of application programs. It masks the details of the hardware to application programs.

Operating System can be summarily defined as: a set of processes permanently or transitively resident within the Computer that makes the resources of the computer system available to the user in a consistent, reliable, friendly way. In essence it should be a Resource optimiser and operation

Operating System can be divided into the Kernel and the Operating System. The kernel is the essential centre of a computer operating system, the core that provides basic services for all other parts of the operating system. A synonym is nucleus. A kernel can be contrasted with a shell, the outermost part of an operating system that interacts with user commands. Kernel and shell are terms used more frequently in UNIX and some other operating systems than in IBM mainframe systems.

TYPES OF OPERATING SYSTEM

Single User

Single-user allows one single user to login at a time. There is no user account database which makes the level of security low and so users cannot protect their files from being viewed, copied or deleted. Examples of this type are DOS and Windows 98.

Multi-user

The Multi-user has a user database account which states the right that users have on certain resources. They are more secure than the single user since access is limited. Example of this is UNIX

Networked/Work alone/

Stand alone are usually not connected to a network and thus cannot access networked resources. They are usually more secured than and remote users cannot log into the computer. A network operating System uses a standard communication protocol for UNIX networks and over the internet( we have the TCP/IP). For Novell Netware internetwork Packet Exchange /Sequenced Packet Exchange (IPX/SPX). They are less secure than Standalone and should be protected (most times by creating user accounts. More examples are Windows NT 5.0, Windows 98,

MULTI-TASKING/SINGLE TASKING:

multitasking allows one or more programs to run, at time. Each process is given a prioritised amount of time on the processor. Single-user allows are programs to run at a time. It is usually faster than multi-tasking Systems +as some time is taken to in switching in multi-user. But multi-user is more efficient as they allow other tasks to run when a task is not performing any operation. Single-users are more robust, as multi-programs are require to communicate with each other which can cause synchronization problems (deadlock)

Multi Processor/Single Processor: Some Operating System allows for more than one processor to use on the system. This allows more than one task to be run, at a time, on different processors. Windows NT/2000 supports multi processors (up to 4).

Single Processor, Multitasking involves running each of the processor for a given time slice or a single processor where with multi processor, they can all run at the same.

FUNCTION OF OPERATING SYSTEM

Usually Operating system is there to manage all pieces of a complex system

Imagine what will happen if three programs running on a computer all try to print their output simultaneously on the same printer. The first few lines might be from program one and the next few lines might be from program two and so on with the result resulting in chaos. The operating system can bring order to potential chaos by buffering all the output destined for the printer on the disk.

The primary task of operating system is to keep track of who is using which resource, to grant resource request, to account for usage, and to meditate conflicting request from different programs and users.

When a computer has multiple users, the need for managing and protecting the memory, input/output devices and other resources are even more apparent. This need arises because it is usually necessary to share expensive resource such as tapes drives and phototypesetters.

Operating systems perform basic tasks, such as recognizing input from the keyboard, sending output to the display screen, keeping track of files and directories on the disk, and controlling peripheral devices such as disk drives and printers.

For large systems, the operating system has even greater responsibilities and powers. It is like a traffic cop -- it makes sure that different program 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.

The set of software products that jointly controls the system resource using these resources on a computer system is known as operating system. Examples are Unix, Windows.

Sunday, May 31, 2009

Examples of operating systems

Microsoft Windows



Microsoft Windows is a family of proprietary operating systems that originated as an add-on to the older MS-DOS operating system for the IBM PC. Modern versions are based on the newer Windows NT kernel that was originally intended for OS/2. Windows runs on x86, x86-64 and Itanium processors. Earlier versions also ran on the DEC Alpha, MIPS, Fairchild (later Intergraph) Clipper and PowerPC architectures (some work was done to port it to the SPARC architecture).

As of June 2008, Microsoft Windows holds a large amount of the worldwide desktop market share. Windows is also used on servers, supporting applications such as web servers and database servers. In recent years, Microsoft has spent significant marketing and research & development money to demonstrate that Windows is capable of running any enterprise application, which has resulted in consistent price/performance records (see the TPC) and significant acceptance in the enterprise market.

The most widely used version of the Microsoft Windows family is Windows XP, released on October 25, 2001.

In November 2006, after more than five years of development work, Microsoft released Windows Vista, a major new operating system version of Microsoft Windows family which contains a large number of new features and architectural changes. Chief amongst these are a new user interface and visual style called Windows Aero, a number of new security features such as User Account Control, and a few new multimedia applications such as Windows DVD Maker. A server variant based on the same kernel, Windows Server 2008, was released in early 2008.

Windows 7 is currently under development; Microsoft has stated that it intends to scope its development to a three-year timeline, placing its release sometime at the end of 2009.



Unix and Unix-like operating systems

Ken Thompson wrote B, mainly based on BCPL, which he used to write Unix, based on his experience in the MULTICS project. B was replaced by C, and Unix developed into a large, complex family of inter-related operating systems which have been influential in every modern operating system (see History).

The Unix-like family is a diverse group of operating systems, with several major sub-categories including System V, BSD, and Linux. The name "UNIX" is a trademark of The Open Group which licenses it for use with any operating system that has been shown to conform to their definitions. "Unix-like" is commonly used to refer to the large set of operating systems which resemble the original Unix.

Unix-like systems run on a wide variety of machine architectures. They are used heavily for servers in business, as well as workstations in academic and engineering environments. Free software Unix variants, such as GNU, Linux and BSD, are popular in these areas.

Market share statistics for freely available operating systems are usually inaccurate since most free operating systems are not purchased, making usage under-represented. On the other hand, market share statistics based on total downloads of free operating systems are often inflated, as there is no economic disincentive to acquire multiple operating systems so users can download multiple systems, test them, and decide which they like best.

Some Unix variants like HP's HP-UX and IBM's AIX are designed to run only on that vendor's hardware. Others, such as Solaris, can run on multiple types of hardware, including x86 servers and PCs. Apple's Mac OS X, a hybrid kernel-based BSD variant derived from NeXTSTEP, Mach, and FreeBSD, has replaced Apple's earlier (non-Unix) Mac OS.

Unix interoperability was sought by establishing the POSIX standard. The POSIX standard can be applied to any operating system, although it was originally created for various Unix variants.



Mac OS X

Mac OS X is a line of proprietary, graphical operating systems developed, marketed, and sold by Apple Inc., the latest of which is pre-loaded on all currently shipping Macintosh computers. Mac OS X is the successor to the original Mac OS, which had been Apple's primary operating system since 1984. Unlike its predecessor, Mac OS X is a UNIX operating system built on technology that had been developed at NeXT through the second half of the 1980s and up until Apple purchased the company in early 1997.

The operating system was first released in 1999 as Mac OS X Server 1.0, with a desktop-oriented version (Mac OS X v10.0) following in March 2001. Since then, five more distinct "end-user" and "server" editions of Mac OS X have been released, the most recent being Mac OS X v10.5, which was first made available in October 2007. Releases of Mac OS X are named after big cats; Mac OS X v10.5 is usually referred to by Apple and users as "Leopard".

The server edition, Mac OS X Server, is architecturally identical to its desktop counterpart but usually runs on Apple's line of Macintosh server hardware. Mac OS X Server includes work group management and administration software tools that provide simplified access to key network services, including a mail transfer agent, a Samba server, an LDAP server, a domain name server, and others.