Search This Blog

Wednesday, March 3, 2010

Operating System




INTRODUCTION

Operating system is a program that manages the computer hardware. It also provides a basis for application programs and acts as an intermediary between a user of a computer and the computer hardware. An operating system is an important part of almost every computer system. A computer system can be divided roughly into four components:
The hardware – the central processing unit (CPU), the memory, and the input/output (I/O) devices provides the basic computing resources.
The operating system - controls and coordinates the use of the hardware among the various application programs for the various users.
Application programs – such as word processors, spreadsheets, compilers, and web browsers define the way in which these resources are used to solve the computing problems of the users.
Users.

MAINFRAME SYSTEMS

Mainframe computer systems were the first computers used to tackle many commercial and scientific applications.

1.Batch Systems
The user did not interact directly with the computer systems. They prepared a job which consisted of the program, the data, and some control information about the nature of the job and submitted it to the computer operator. After some days the output appeared. The output consisted of the result of the program. The major task was to transfer control automatically from one job to next.
To speed up processing, operators batched together jobs with similar needs and ran them through the computer as a group. Thus the programmers leave their programs with the operator. The operator would sort programs into batches with similar requirements and, as the computer became available, would run each batch. The output from each job would be sent back to the appropriate programmer.

2.Multiprogrammed Systems

Multiprogramming increases CPU utilization by organizing jobs so that the CPU always has one to execute.The concept of multiprogramming is that the operating system keeps several jobs in memory simultaneously. This set of jobs are kept in the job pool. The OS picks up and execute one of the jobs in the memory.
· In non-multiprogramming system, the CPU would sit idle.
· In multiprogramming system, the OS simply switches to, and executes, another job. When that job needs to wait, the CPU is switched to another job, and so on. The first finishes waiting and gets the CPU back. As long a at least one job needs to execute, the CPU is never idle.
Multiprogramming operating systems are used for decisions for the users. All the jobs that enter the system are kept in the job pool. This pool consists of all processes residing on disk awaiting allocation of main memory. If several jobs are ready to be brought into memory, and if there is not enough room for all of them, then the system must choose among them. Making this decision is job scheduling. If several jobs are ready to run at the same time, the system must choose among them, this decision is CPU scheduling.

3.Time – Sharing Systems

Time sharing or multitasking is a logical extension of multiprogramming. The CPU executes multiple jobs by switching among them, but the switches occur so frequently that the users can interact with each program while it is running.
An interactive (or hands-on) computer system provides direct communication between the user and the system. The user gives instructions to the operating system or to a program directly, using a keyboard or a mouse, and waits for immediate results.
A time-shared operating system allows many users to share the computer simultaneously. Each action or command in a time –shared system tends to be short, only a little CPU time is needed for each user. As the system switches rapidly from one user to the next, each user is given the impression that the entire computer system is dedicated to her use, even though it is being shared among many users.
A time-shared operating system uses CPU scheduling and multiprogramming to provide each user with a small portion of a time-shared computer. Each user has atleast one separate program in memory. A program loaded into memory and executing is commonly referred to as a process. When a process executes, it typically executes for only a short time before it either finishes or needs to perform I/O.

DESKTOP SYSTEMS

Personal computers PCs appeared in the 1970s. During their first decade, the CPUs in PCs lacked the features needed to protect an operating system from user programs. PC operating systems therefore were neither multiuser nor multitasking. The MS-DOS operating system from Microsoft has been produced multiple flavors of Microsoft Windows, and IBM has upgraded MS-DOS to OS/2 multitasking system. UNIX is used for its scalability, performance, and features but retains the same rich GUI. Linux, a UNIX operating system available for PCs, has also become popular recently.
OS has developed for mainframes. Micro computers were able to adopt some of the technology developed for larger OS. On the other hand, the hardware costs for micro computers are sufficiently low that individuals have sole use of the computer, and the CPU utilization is no longer a prime concern.
Earlier file protection was not necessary on a personal machine. But these computers are now often tied into other computers over local-area networks or other Internet connections. When other computers and other users can access the files on a PC, file protection becomes essential feature of the operating system. The lack of such protection has made it easy for malicious programs to destroy data on the systems such as MS-DOS and the Macintosh operating system. These programs are self-replicating, and may spread rapidly via worm or virus mechanism.
MULTIPROCESSOR SYSTEMS

Multiprocessor systems have more than one processor or CPU. Multiprocessor systems also known as parallel systems. Such systems have more than one processor in close communication, sharing the computer bus, the clock, and sometimes memory and peripheral devices.

Advantages of the multiprocessor systems are:

1. Increased throughput: By increasing the number of processors, get more work done in less time. When multiple processors cooperate on a task, a certain amount of overhead is incurred in keeping all the parts working correctly.
2. Economy of scale: Multiprocessor systems can save more money than multiple singe-processor systems, because they can share peripherals, mass storage, and power supplies. If several programs operate on the same set of data, it is cheaper to store those data on one disk and to have all the processors share them, than to have many computers with local disks and many copies of the data.
3. Increased reliability: If functions can be distributed properly among several processors, then the failure of one processor will not halt the system, only slow it down.
The most common multiple-processor systems now use symmetric multiprocessing (SMP), in which each processor runs on identical copy of the OS, and these copies communicate with one another as needed. Some systems use asymmetric multiprocessing, in which each processor is assigned a specific task. A master processor controls the system, the other processors either look to the master for instruction or have predefined tasks. This scheme defines a master-slave relationship. The master processor schedules and allocates work to the slave processors.

Figure: Symmetric multiprocessing architecture



SMP means that all processors are peers, no master-slave relationship exists between processors. Each processor concurrently runs a copy of the operating system. The benefit of this model is that many processes can run simultaneously - N processes can run if there a N CPUs- without causing a significant performance. Since the CPU are separate, one may be sitting idle while another is overloaded, resulting in inefficiencies. A multiprocessor system will allow processors and resources-such s memory to be shared among the various processors.

DISTRIBUTED SYSTEMS

A network, in the simplest terms, is a communication path between two or more systems. Distributed systems depend on networking for their functionality. Distributed systems are able to share computational tasks, and provide a rich set of features to users. Networks are typecast based on the distance between their nodes.
Local area network: exists within a room, a floor, or a building.
Wide area network: exists between building, cities, or countries. A global company may have a WAN to connect its offices, world wide.
Metropolitan are network: could link buildings within a city.

1.Client – Server Systems:



Terminals connected to centralized systems are now being supplanted by CPU. Centralized systems today act as server systems to satisfy requests generated by client systems.
Server systems can be broadly categorized as compute servers and file servers.
Compute-server systems: provide an interface to which clients can send requests to perform an action, in response to which they execute the action and send back results to the clients.
File-server systems: provide a file-system interface where clients can create, update, read and delete files.

2.Peer-to-Peer Systems

The growth of computer networks especially the Internet and WWW has a profound influence on the recent development of OS. When PCs were introduced in 1970s they were developed as stand alone systems, but with the widespread public use of the Internet in 1980s for electronic mail, ftp, PCs became connected to computer networks.
Modern PCs and workstations are capable of running a web browser for accessing hypertext documents on the web. The PCs now include software that enables a computer to access the Internet via a local area network or telephone connection. These systems consist of collection of processors that do not share memory or a clock. Instead each processor has its own local memory. The processors communicate with another through various communication lines, such as high speed buses or telephone line.
OS has taken the concept of network and distributed systems for network connectivity. A network operating systems is an OS that provides features such as file sharing across the network, and that includes a communication scheme that allows different processes on different computers to exchange messages.

CLUSTERED SYSTEMS

Clustered systems gather together multiple CPUs to accomplish computational work. Clustered systems differ from parallel system, in that they are composed of two or more individual systems coupled together. Clustering is usually performed to provide high availability. A layer of cluster software runs on the cluster nodes. Each node can monitor one or more o the others. If the monitored machine fails, the monitoring machine can take ownership of its storage, and restart the application that were running on the failed machine. The failed machine can remain down, but the users and clients of the application would only see a brief interruption of service.
In asymmetric clustering, one machine is in hot standby mode when the other is running the applications. The hot standby machine does nothing but monitor the active server. If that server fails, the hot standby host becomes the active serer.
In symmetric clustering, two or more nodes are running applications, and they are monitoring each other. This mode is more efficient, as it uses all o the available hardware.
Parallel clusters allow multiple hosts to access the same data on the shared storage. Because most of the operating systems lack support for simultaneous data access by multiple hosts, parallel clusters are usually accomplished by special versions of software. Example Oracle parallel server is a version of Oracle’s database that has been designed to run on parallel clusters.

REAL-TIME SYSTEMS

A real time system is used when rigid time requirements have been placed on the operation of a processor or the flow of data; thus it is used as a control device in a dedicated application. Sensors bring data to the computer. Computer must analyze the data and possibly adjust controls to modify the sensor inputs. Systems that control scientific experiments, medical imaging systems, industrial control systems, some automobile-engine fuel-injection systems, home appliance controllers and weapon systems are also real time systems.
A real-time system has well-defined, fixed time constraints. Processing must be done within the defined constraints, or the system will fail. A real time systems functions correctly only if it returns the correct result within its time constraints.
Real time systems if of two types:
A hard real time system guarantees that critical tasks be completed on time. This goal requires that all delays in the system be bounded, from the retrieval of stored data to the time that it takes the operating system to finish any request made of it.
A soft real time system where a critical real time task gets priority over those tasks, and retains that priority until it completes. An in hard real-time systems, the OS kernel delays need to be bounded: A real-time task cannot be kept waiting indefinitely for the kernel to run it. They are useful in several areas, including multimedia, virtual reality, and advanced scientific projects such as undersea exploration and planetary rovers. These systems needs advanced operating systems.

HANDHELD SYSTEMS

Handheld systems include personal digital assistants(PDAs), such as Palm pilots or cellular telephones with connectivity to a network such as the Internet. The handheld systems are of limited size. Example, a PDA is typically 5 inches in height and 3 inches in width, and weighs less than one-half pound. Due to its limited size, handheld systems have a small amount of memory, include slow processors, and feature small display screens. They have between 512 KB and 8 MB of memory.
The next issue is the handheld devices is the speed of the processor used in the device. Processors of handheld devices often run at a fraction of the speed of a processor in a PC. Faster processors require more power. To include a faster processor in a handheld device would require a larger battery that would have to be replaced more frequently.
The last issue for the designers for handheld devices are handheld devices is the small display screens typically available. Whereas a monitor for a home computer may measure up to 21 inches, the display for a handheld device is often no more than 3 inches square. Tasks such as reading e-mail or browsing web pages, must be condensed onto the smaller displays. One approach for displaying the content in web pages is web clipping, where only a small subset of a web page is delivered and displayed on the handheld device.
Some handheld devices may use wireless technology, such as BlueTooth, allowing remote access to e-mail and web browsing. Cellular telephones with connectivity to Internet fall into this category. To download data to these devices, first the data is downloaded to a PC or workstation, and then downloads the data to the PDA. Some PDAs allow data to be directly copied from one device to another using an infrared link.

OPERATING SYSTEM STRUCTURES

An operating system may be viewed from several points.
1. By examining the services that it provides.
2. By looking at the interface that it makes available to users and programmers.
3. By disassembling, the system into its components and their interconnections.

OPERATING SYSTEM COMPONENTS:

The various system components are:
1. Process management
2. Main-memory management
3. File management
4. I/O-system management
5. Secondary-storage management
6. Networking
7. Protection system
8. Command-Interpreter system

1. Process Management
A Process is thought as a program in execution. A program does nothing unless its instructions are executed by a CPU. Example, a compiler is a process, a word processing program run by an individual user on a PC is a process, a system task, such as sending output to a printer is also a process.
A process needs certain resources including CPU time, memory, files and I/O devices to accomplish its task. These resources are either given to the process when it is created or allocated to it while it is running. A program is a passive entity, such as the contents of the file stored on disk, whereas a process is an active entity, with a program counter specifying the next instruction to be executed. The execution of the process must be sequential. The CPU executes one instruction of the process after another, until the process completes.
A process is the unit of work in a system. Such a system consists of collection of processes, some of which are operating system processes and the rest are user processes.

The OS is responsible for the following activities in process management:
· Creating and deleting both user and system processes
· Suspending and resuming processes
· Providing mechanisms for process synchronization
· Providing mechanisms for process communication
· Providing mechanisms for deadlock handling

2. Main-Memory Management

Main memory is a repository of quickly accessible data shared by the CPU and I/O devices. The central processor reads the instructions from main memory during the instruction fetch cycle, and it reads instructions from main memory during the data fetch cycle.
The main memory is the only larger storage device the CPU able to address and access directly. For a program to be executed, it must be mapped to absolute addresses and loaded into memory. As the program executes, it accesses program instructions and data from memory by generating theses absolute addresses. To improve the CPU utilization and the speed of the computer’s response to its users, we must keep several programs in memory.

The OS is responsible for the following activities in memory management:
· Keeping track of which parts of memory are currently being used and by whom
· Deciding which processes are to be loaded into memory when memory space becomes available.
· Allocating and deallocating memory space as needed.

3. File Management

A File is a collection of related information defined by its creator. Files define programs and data. Data files can be numeric, alphabetic and alphanumeric. Files may be of free form, or may be formatted rigidly. A file consists of sequence of bits, bytes, lines or records whose meanings are defined by their creators. Files are organized into directories to ease of their use. Files can be opened in different modes to be accessed, they are : read, write, append.

The OS responsibilities for the following activities for file management :
· Creating and deleting files
· Creating and deleting directories
· Supporting primitives for manipulating files and directories
· Mapping files onto secondary storage
· Backing up files on stable, nonvolatile storage media

4. I/O System Management

One of the purposes of an operating system is to hide the attributes and characters of specific hardware devices for the user.

The I/O subsystem consists of:
· A memory-management component that includes buffering, caching, and spooling
· A general device-driver interface
· Drivers for specific hardware devices
The device drivers alone know the characteristics of the specific device to which it is assigned.

5. Secondary-Storage Management

The main purpose of the computer system is to execute the programs. These programs, with the data they access, must be in main memory, or primary memory, during execution. Because the main memory is too small to hold all the data and programs, and as the data it holds is lost when the power is lost, the computer must provide secondary storage to back up main memory. Programs such as compilers, assemblers, routines, editors and formatters are stored in the disk until loaded into main memory.

The OS responsibility for the following activities for disk management:
· Free-space management
· Storage allocation
· Disk scheduling

6. Networking

A distributed system is a collection of processors that do not share memory, peripheral devices, or a clock. Each processor has its own local memory and clock, and the processors communicate with one another through various communication lines, such as high-speed buses or networks. The processors in distributed system vary in size and function. They include small micro-processors, workstations, minicomputers and large, general purpose computer systems.
A distributed system collects physically separate, and many heterogeneous systems into a single coherent system, providing user with access to the various resources that the system maintains. The shared resources allows computation speedup, increased functionality, increased data availability, and reliability.
Different protocols are used in the network system, such as file-transfer protocol (FTP), Network file-system (NFS), hypertext transfer protocol (HTTP) , for use in communication between a web server and a web browser. A web browser then just needs to send a request for information to a remote machines web server. And the information is returned.

7. Protection System

If a computer system has multiple users and allows the concurrent execution of multiple processes, then the various processes must be protected from the other process.
Protection is any mechanism for controlling the access of programs, processes, or users to the resources defined by a computer system. This mechanism must provide means for specification of the controls to be imposed and means for enforcement.
Protection can improve reliability by detecting latent errors at the interfaces between component subsystems. Early detection of interface errors can often prevent contamination of a healthy subsystem by another subsystem. Unprotected system can be used by unauthorized users.

8. Command-Interpreter System

Command interpreter is an interface between the user and the operating system. Many commands are given to the operating system by control statements. When a new job is started in a batch system, or when a user logs on to a time-shared system, a program that reads and interprets control statement is executed automatically. This program is sometimes called the control card interpreter or command-Interpreter, and is often known as the shell. Its function is to get the next command statement and execute it.

OPERATING SYSTEM SERVICES

An operating system provides an environment for the execution of programs. It provides certain services to programs and to the users of those programs.
The various services offered by Operating system are:

· Program execution: The system may be able to load a program into memory and to run that program. The program must be able to end its execution, either normally or abnormally indicating the error.
· I/O operations: A running program may require I/O. This I/O may involve a file or an I/O device. For security and efficiency users usually cannot control I/O devices directly, operating system must be provided to do it.
· File-system manipulation: The files needs programs to read and write files. Programs also need to create and delete files by names.
· Communications: One process needs to communicate with another process. Such communication may occur in two ways:
o Communication takes place between processes that are executing on the same computer.
o Takes place between processes that are executing on different computer systems that are tied together by a computer network. Communications may be implemented via shared memory, or by the technique of message passing, in which packets of information are moved between processes by the operating system.

· Error detection: The operating system constantly needs to be aware of possible errors. Errors may occur in :
o the CPU and memory hardware-memory error or power failure.
o I/O devices-such as parity error on tape, a connection failure on network, or lack of paper in the printer.
o User program-an arithmetic overflow, an attempt to access an illegal memory location, or too great use of CPU time.

· Resource allocation: When multiple users are logged on the system, multiple jobs are running at the same time, resources must be allocated to all of them. Many different types of resources are managed by the operating system. Some are CPU cycles, main memory, and file storage may have special allocation code, and I/O devices may have general request and release code.
· Accounting: Os must keep track of which users use how many and which kinds of computer resources.
· Protection: The owners of the information stored in a multiuser computer system may want to control use of the information. When several processes are executed concurrently, one process should not interfere with the other process. Security of the system from outsiders is also important. Such security starts with each user having to authenticate himself to the system , usually by means of a password, to be allowed access to the resources.

System calls

System calls provide the interface between a process and the operating system. These calls are usually available as assembly-language instructions and they are listed in manuals for programmers. Several systems allow system calls to be available in high level languages. Several languages such as C, C++, Perl have replaced assembly language for system programming. Example, UNIX system calls may be invoked directly from a C or C++ program.

System calls can be grouped into five major categories:

1) Process Control:

A running program needs to be able to halt its execution either normally or abnormally. If a system call is made to terminate the currently running program abnormally. Either normal or abnormal , the operating system must transfer control to the command interpreter. The command interpreter then reads the next command. The command interpreter reads the next instruction.
A process or job executing one program may want to load and execute other program. An interesting question is where to return control when the loaded program terminates. Whether the existing program is lost, saved, or allowed to continue execution concurrently with the new program.
If control returns to the existing program when the new program terminates, we must save the memory image of the existing program. If both programs continue concurrently, we have created a new job or process to be multiprogrammed. System calls for this purpose is create process or submit job.
If a new job or process is created, we may need to wait for them for some time to finish their execution. We may want to wait for a certain amount of time (wait time), we may want to wait or a specific event to occur (wait event). The jobs or processes should then signal when that event has occurred (signal event).
If we create a new job or processes, we should be able to execute it. This control requires the ability to determine and reset the attributes of a job or process, including the job’s priority, its maximum allowable execution time, (get process attributes and set process attribute).
Another set of system calls is helpful in debugging a program. Many systems provide system calls to dump memory. This provision is useful for debugging. A program trace lists each instruction as it is executed; it is provided by fewer systems. The trap is usually caught by a debugger, which is a system program designed to aid the programmer in finding and correcting bugs.

2) File Management

The files must be created and deleted. Either system calls requires the name of the file and some of the attributes. Once the file is created, it must be open and used. It may also read, write and reposition (rewind or skip to the end of the file). Finally the file need to be closed.
File attributes include the file name, a file type, protection codes, accounting information and so on. The system calls for this purpose are get file attribute and set file attribute.

3) Device Management

A program running, may need additional resources to proceed. The resources may be more memory, tape drivers, access to files. If the resources are available, they can be granted and control can be returned to the user program; otherwise the program will have to wait until sufficient resource are available.
Once the device has been requested (an allocating to us), we can read, write, and reposition the device.

4) Information Maintenance

Many system calls exist simply for the purpose of transferring information between the user program and the operating system. For example, systems have a system call to return the current time and date. Other system calls may return information about the system, such as the number of current users, the version number of the operating system, the amount of free memory or disk space.
There are system calls to access these information. They are get process attributes and set process attributes.

5) Communication

There are two common models of communication. In message-passing model, information is exchanged through an interprocess communication. Before communication can take place, a connection must be opened. The name of the other communicator must be known, bit it another process on the same PU, or a process on another computer connected by networks. Each computer in the network has a host name, such as IP name. Similarly each process has a process name.
The get hosted and get processed system calls do this process. These identifiers are then passed to specific open connection and close connection system calls. The recipient process usually must give its permission for communication to take place with an accept connection call. Most processes that will be receiving connection are special purpose daemons. They execute a wait for connection call and are awakened when a connection is made. The source of the communication, known as the client, and the receiving daemon, known as server, then exchange messages by read message and write message system calls. The close connection terminates the communication.
In shared-memory model, processes may exchange information by reading and writing data in these processes and are not under the operating systems control.

SYSTEM PROGRAMS

System program provide a convenient environment for program development and execution. They can be divided into these categories:

· File Management
These programs create, delete, copy, rename, print, dump, list and generally manipulate files and directories.
· Status information
Some programs simply ask the system for the date, time, amount of available memory or disk space, number of users, or similar status information. That information is then formatted, and printed to the terminal or other output device or file.

· File modification
Several text editors may be available to create and modify the content of the files stored on disk or tape.

· Programming language support
Compilers, assemblers, and interpreters for common programming languages such a C, C++, java, Visual Basic are often provided to the user with the operating system. Some of these programs are now priced and provided separately.

· Program loading and execution
Once a program is assembled or compiled, it must be loaded into memory to be executed. Debugging systems for either higher-level languages or machine language are needed.

· Communications
These programs provide the mechanism for creating virtual connections among processes, users, and different computer systems. They allow users to send messages to one another’s screens, to browse web pages, to send e-mail messages, to log remotely, or to transfer data files from one machine to another.

SYSTEM DESIGN AND IMPLEMENTATION

1. Design Goals
The first problem in designing a system is to define the goals and specification of the system. The design of the system will be affected by the choice of hardware and type of system: batch, time shared, single user, multiuser, distributed, real time, or general purpose.

Requirement can be divided into two basic groups:
· User goals
· System goals
User desire certain properties in a system: The system should be convenient and easy to use, easy to learn, reliable, safe, and fast. Similarly a set of requirements can be defined by those people who must design, create, implement and maintain; it should be flexible, reliable, error free, and efficient.

2. Mechanisms and Policies
One important principle is the separation of policy from mechanism. Mechanism determines how to do something; policies determine what will be done. Example, the timer construct is a mechanism for ensuring CPU protection, but deciding how long the timer is to be set for a particular user is a policy decision.
Policies are likely to change across places or overtime. In worst case, each change in policy would require a change in the underlying mechanisms. A change in policy would require redefinition of only certain parameters of the system. For instance, if one computer system, a policy decision is made that I/O intensive programs should have priority over CPU intensive ones, then the opposite policy could be instituted easily on some other computer systems if the mechanism were properly separated and were policy independent.

3. Implementation
Once an operating system is designed, it must be implemented. Traditionally, OS were written in assembly language. Now they are often written in higher-level languages as C, C++.
The various operating systems not written in assembly language are:

· The Master Control Program (MCP), it was written in ALGOL.
· MULTICS, developed at MIT, was written in PL/1.
· The Primos operating system for Prime computers is written in Fortran.
· The UNIX operating system, OS/2, and Windows NT are written in C.
The advantages of writing OS in higher-level language are the code can be written faster, is more compact, and is easier to understand and debug. The OS is far easier to port to move to some other hardware if it is written in high-level language.
The disadvantage of writing OS in high-level language is the reduced speed and increased storage requirements.
OS are large, only a small amount of the code is critical to high performance, the memory manager and the CPU schedulers are probably the most critical routines.







PROCESS MANAGEMENT

A process is a program which is in execution. A batch system executes jobs, whereas a timeshared system has user programs, or tasks. The jobs and the process are used almost interchangeably. A process is more than a program code, which is sometimes known as the text section. It also includes the current activity, represented by the value of the program counter and the contents of the processor’s registers.
A program is a passive entity, such as the contents of a file stored on disk. A process is a active entity, with the program counter specifying the next instruction to execute and a set of associated resources.

Process State

As a process executes, it changes state. The state of a process is defined in part by the current activity of that process. Each process may be in one of the following states:

New: The process is being created.
Running: Instructions are being executed.
Waiting: The process is waiting for some event to occur (such as an I/O completion or reception of a signal).
Ready: The process is waiting to be assigned to a processor.
Terminated: The process has finished execution.













Process Control Block

Each process is represented in the operating system by a process control block (PCB) also called as task control block. It contains many pieces of information associated with a specific process, including these:












Figure: Process control block

Process state: The state may be new, ready, running, waiting, halted and so on.
Program counter: The counter indicates the address of the next instruction to be executed.
CPU registers: The registers vary in number and type, depending upon the computer. The registers are accumulators, index register, stack pointers, and general purpose registers.
CPU scheduling information: This information includes a process priority, pointers to scheduling queues, and any other scheduling parameters.
Memory-Management information: This information includes such as information as the value of the base and limit registers, the page tables, or the segment tables, depending on the memory system used by the operating system.
Accounting information: This information includes the amount of CPU and real time used, time limits, account numbers, job or process numbers, and so on.
I/O status information: The information includes the list of I/O devices allocated to this process, a list of open files, and so on.

PROCESS SCHEDULING

Scheduling Queues:
As process enter the system, they are put into a job queue. This queue consists of all processes in system. The processes that are residing in main memory and are ready and waiting to execute are kept on a list called ready queue. This queue is generally stored as linked list. A ready-queue header contains pointers to the first and final PCBs in the list.
The OS also has other queues. When a process is allocated the CPU, it executes for a while and quits, is interrupted or waits for the occurrence of a particular event, such as the completion of an I/O request. Since the system has many process it may be busy with the I/O request of some other process. The process therefore may have to wait for the disk. The list of processes waiting for a particular I/O device is called a device queue. Each device has its own device queue.
A common representation of process scheduling is a queuing diagram. Each rectangular box represents a queue. Two types are queues are present: the ready queue and a set of device queues. The circle represent the resources that serve the queues, and the arrows indicate the flow of processes in the system.
A new process is put in the ready queue. It waits in the ready queue until it is selected for execution. Once the process is assigned to the CPU and is executing, one of the several events could occur:
· The process could issue an I/O request, and then be placed in an I/O queue.
· The process could create a new subprocess and wait for its termination.
· The process could be removed forcibly from the CPU, as a result of an interrupt, and be put back in the ready queue.











Schedulers

A process migrates between the various scheduling queues throughout its lifetime. The operating system must select, for scheduling purposes, processes from these queues in some fashion. The selection process is carried out by the appropriate scheduler. There are two types of schedulers:
Long-term schedulers or job schedulers: which selects processes from job pool and loads them into memory for execution.
Short-term scheduler or CPU scheduler: which selects among the processes that are ready to execute and allocates the CPU to one of them.
The primary difference between these two schedulers is the frequency of their execution. The short-term scheduler must select a new processes for the CPU frequently. A process may execute for only a few milliseconds therefore waiting for an I/O request. This often executes once in every 100 milliseconds.
The long-term scheduler on the other hand, executes much less frequently. There may be minutes between the creation of a new processes in the system. The long-term schedulers are need to be invoked only when the process leaves the system.
On some systems, such as time sharing systems, may introduce an additional, intermediate level of scheduling. This medium-term scheduler removes processes from memory, and thus reduces the degree of multiprogramming. At some later time, the process can be reintroduced into memory and its execution can be continued where it left off. This scheme is called swapping. The process is swapped out, and is later swapped in, by the medium-term scheduler.

Context Switch

Switching the CPU to another process requires saving the state of the old process and loading the saved state for the new process. This task is known as a context switch. The context of a process is represented in the PCB of a process; it includes the value of the PU registers, the process state and memory management information. When a context switch occurs the Kernel saves the context of the old process in its PCB and loads the saved context of the new process scheduled to run. Context switch is pure overhead, because the system does no useful work while switching. Its speed varies from machine to machine, depending on the memory speed, the number of registers that must be copied, and the existence of special instructions. The speed ranges from 1 to 1000 milliseconds.

OPERATIONS ON PROCESSES

The processes in the system can execute concurrently, and they must be created and deleted dynamically. Thus the operating system must provide a mechanism for process creation and termination.

Process Creation
A process may create several new processes, via create-process system call during the execution. The creating process is called a parent process, whereas the new processes are called children of that process. Each of these new processes may in turn create other processes, forming a tree structure.
A process needs certain resources such as CPU time, memory, files, I/O devices to accomplish any task. When a process creates a sub process may be able to obtain its resources directly from the operating system, or the parent may have to partition its resources among its children.
Example consider a process whose function is to display the status of a file, say F1, on the screen of the terminal. When it is created, it will get as an input from its parent process, the name of the file F1, and it will execute using that datum to obtain the desired information. It may also get the name of the output device.
When a process creates new process, two possibilities exist in terms of execution:
The parent continues to execute concurrently with its children.
The parent waits until some or all of its children have terminated.

Process Termination

A process terminates when it finishes executing its final statement and asks the operating system to delete it by using the exit system call. At that point the process may return data output to its parent process via a wait system call.
A process can cause termination of another process via an appropriate system call. When a process is newly created, the identity of the newly created process is passed to its parent.
A parent may terminate the execution of one of its children for a variety of reasons, such as:
· The child has exceeded its usage of some of the resources that it has been allocated. This requires the parent to have a mechanism to inspect the state of its children.
· The task assigned to the child is no longer required.
· The parent is exiting, and the operating system does not allow a child to continue if its parent terminates. On such systems, if a process terminates then all its children must also be terminated. This phenomenon is called as cascading termination.

COOPERATING PROCESSES

The concurrent processes executing in the operating system may either be independent processes or cooperating processes. A process is independent if it cannot affect or be affected by other processes executing in the system. The process that does not share any data with any other process is independent. A process is cooperating if it can affect or be affected by the other processes is a cooperating process.

Process cooperation is provided for several reasons:
Information sharing: Since several users may be interested in the same piece of information, we must provide an environment to allow concurrent access to these types of resources.
Computation speedup: If we want a particular task to run faster, we must break it into subtasks, each of which will be executing in parallel with the others. Such speedup can be achieved only if the computer has multiple processing elements.
Modularity: We may want to construct the system in a modular fashion, dividing the system functions into separate processes or threads.
Convenience: Even an individual user may have many tasks on which to work at one time. For instance, a user may be editing, printing, and compiling in parallel.

To illustrate the concept of cooperating processes, consider the producer-consumed problem. A producer process produces information that is consumed by a consumer process. Example, a print program produces characters that are consumed by the printer device. A compiler may produce assembly code, which is consumed by an assembler. The assembler, in turn, may produce object modules, which are consumed by the loader.
To allow producer and consumer processes to run concurrently, we must have available a buffer of items that can be filled by producer and emptied by the consumer. A producer can produce one item while the consumer is consuming another item. The producer and the customer must be synchronized so that the consumer does not try consuming an item that has not yet produced.

INTERPROCESS COMMUNICATION
IPC provides a mechanism to allow processes to communicate and to synchronize their actions without sharing the same address space. IPC is particularly useful in a distributed environment where the communicating processes may reside on different computers connected with a network. An example is the chat program used on WWW.

1. Message Passing System

The function of a message system is to allow processes to communicate with one another without the need to resort to the shared data. Communication among the user processes is accomplished through the passing of message. An IPC facility provides at least the two operations: Send(message) and receive(message).
Messages sent by7 a process can be of either fixed size or variable size. If processes P and Q want to communicate they must send messages to and receive messages from each other; a communication link must exist between them. This link can be implemented in a variety of ways. We are concerned not with physical implementation(such as shared memory, hardware, bus or network) but rather with its logical implementation. Here are several methods for logically implementing a link and the send / receive operations:

Direct or indirect communication
Symmetric or asymmetric communication
Automatic or explicit buffering
Send by copy or send by reference
Fixed-sized or variable-sized messages.

Naming

1. Direct Communication:

With direct communication, each process that wants to communicate must explicitly name the recipient or sender of the communication. In this scheme the send and the receive primitives are :

· Send(P, message) – Send a message to process P.
· Receive(Q, message) – receive a message from process Q
A communication link in this scheme has the following properties:
A link is established automatically between every pair of processes that want to communicate. The processes need to know only each other’s identity to communicate.
A link is associated with exactly two processes.
Exactly one link exists between each pair of processes.

This scheme exhibits symmetry in addressing, that is both the sender and the receiver processes must name the other to communicate. A variant of this scheme employs asymmetric in addressing. Only the sender names the recipient; the recipient is not required to name the sender. In this scheme the send and receive primitives are defined as follows:
Send (P, message) – send a message to process P
Receive(id, message) – receive a message from any process, the variable id is set to the name of the process with which communication has taken place.

2. Indirect Communication:

With indirect communication, the messages are sent to and received from mailboxes, or ports. A mailbox can be viewed abstractly as an object into which message can be placed by processes and from which messages can be removed. Each mailbox has a unique identification. In this scheme a process can communicate with some other process via a number of different mailboxes. Two processes can communicate only if they share a mailbox. The send and receive primitives are defined as follows:

Send (A, mailbox) – send a message to mailbox A
Receive(A, message) – receive a message from mailbox A

In this scheme, a communication link has the following property:
A link may be associated with more than two processes.
A number of different links may exist between each pair of communicating processes, with each link corresponding to one mailbox.

Mailbox can be owned by either by a process or by the operating system. If the mailbox is owned by a process, then each owner is distinguished (who can receive the message) and the user( who send the messages). Since each mailbox has a unique owner, there can be no confusion about who should receive the message sent to the mailbox. When a process that owns a mailbox terminates, the mailbox disappears. Any process that subsequently sends a message to this mailbox must be notified that the mailbox no longer exists.
On the other hand, a mailbox owned by the operating system is independent and is not attached to any particular process. The operating system then must provide a mechanism that allows a process to do the following:
Create a new mailbox
Send and receive messages through the mailbox
Delete a mailbox.

3. Synchronization:

Communication between processes takes place by calls to send and receive primitives. Message passing may be either blocking or non blocking also known as synchronous and asynchronous.
Blocking send: The sending process is blocked until the message is received by the receiving process or by the mailbox.
Nonblocking send: The sending process sends the message and resumes operation.
Blocking receive: The receiver blocks until a message is available.
Nonblocking receive: The receiver retrieves either a valid message or a null.

4. Buffering:

Whether the communication is direct or indirect, message exchanged by communicating processes reside in a temporary queue.

Zero capacity: The queue has maximum length 0, thus the link cannot have any message waiting in it. In this case, the sender must block until the recipient receives the message.
Bounded capacity: The queue has finite length n; thus at most n message can reside in it. If the queue is not full when a new message is sent, the latter is placed in the queue, and the sender can continue execution without waiting. The link has finite capacity. If the link is full, the sender must block until space is available in the queue.
Unbounded capacity: The queue has potentially infinite length, thus any number of messages can wait in it. The sender never blocks.







SCHEDULING ALGORITHMS

First Come First Served Scheduling:

The simplest CPU scheduling algorithm is the first come first served (FCFS) scheduling algorithm. With this scheme the process that requests the CPU first is allocated the CPU first. This is managed by the FIFO queue. When the CPU is free, it is allocated to the process at the head of the queue. The running process is then removed from the queue.
The average waiting time under the FCFS policy, is often quite long. Consider the following set of processes that arrive at time 0, with the length of the CPU-burst time given in milliseconds:
Process Burst time
P1 24
P2 3
P3 3

If the processes arrive in the order P1, P2, P3 and are served in the FCFS order, we get the result shown in the following Gantt chart:













The waiting time is 0 milliseconds for process P1, 24 milliseconds for process p2, and 27 millisecond for process P3. Thus the average waiting time is (0+24+27)/3=17 milliseconds. If the processes arrive in the order P2, P3,P1 the results will be as shown in the following Gantt chart:














The average waiting time is now (6+0+3)/3=3 milliseconds. Thus the average waiting time under FCFS policy is generally not minimal and may vary if the process CPU-burst times vary greatly.
The FCFS scheduling algorithm is non preemptive. Once the CPU has been allocated to a process, that process keeps the CPU until it releases the CPU either by termination or by requesting I/O.

2. Shortest-Job First Scheduling:

A different approach to CPU scheduling is the shortest-job-first (SJF) scheduling algorithm. This algorithm associates with each process the length of the latter’s next CPU burst. When the CPU is available, it is assigned to the process that has the smallest next CPU burst. If two processes have same length next CPU burst, FCFS scheduling is used to break the tie. Consider the following set of processes, with the length of the CPU burst time given in milliseconds:



Process Burst time
P1 6
P2 8
P3 7
P4 3

Using SJF scheduling, we would schedule the process according to the following Gantt chart:





The waiting time is 3 milliseconds for process P1, 16 milliseconds for process P2, 9 milliseconds for process P3, and 0 milliseconds for process P4. Thus the average waiting time is (3+16+9+0)/4=7 milliseconds. If FCFS is used the average waiting time is 10.25 milliseconds.
The real difficulty with the SJF algorithm is knowing the length of the next CPU request. For long term or job scheduling in a batch system, the length of the process time limit is specified by the user when he submits the job. There is no way to know the length of the next CPU burst in short term or CPU scheduling. We may not know the length but can predict the length of the CPU burst. We expect that the next CPU burst will be similar in length to the previous ones.
The next CPU burst is generally predicted as an exponential average of the measured lengths of previous CPU bursts.
Let tn be the length of the nth CPU burst
Let Tn+1 be our predicted value for the next CPU burst.
Then for a, o£a£1, define

Tn+1 = a tn + (1 - a) Tn
This formula defines an exponential average.
The value of tn contains our most recent information;
Tn stores the past history
The parameter a controls the relative weight of recent and past history in our prediction.
If a=0 then Tn+1=Tn, recent history has no effect
If a=1 then Tn+1 = tn only the most recent CPU burst matters
If a=1/2 recent and past history are equally weighted.

SJF is preemptive or non preemptive. The choice arises when a new process arrives at the ready queue while previous process is executing. The new process may have a shorter next CPU burst than what is left of the currently executing process, whereas non preemptive SJF algorithm will preempt the currently running process to finish its CPU burst.
Consider an example, with four processes, with the length of the CPU burst time given in milliseconds:


Process Arrival time Burst time
P1 0 8
P2 1 4
P3 2 9
P4 3 5

If the processes arrive at the ready queue at the times as shown and need the indicated burst times, then the resulting preemptive SJF schedule is as depicted in the following Gantt chart:

Process P1 is started at time 0, since it is the only process in the queue. Process P2 arrives at time 1. The remaining time for process P1 (7 milliseconds) is larger than the time required by process P2 (4 milliseconds), so process P1 is preempted and process P2 is scheduled. The average waiting time for this example is 6.5 milliseconds.





















3. Priority Scheduling:

The SJF is a special case of the general priority-scheduling algorithm. A priority is associated with each process, and the CPU is allocated to the process with the highest priority. Equal priority processes are scheduled in FCFS order.
As an example, consider the following set of processes, assumed to have arrived at time 0, in the order P1, P2, P3,P4,P5, with the length of the CPU burst time given in milliseconds:

Process Burst time Priority
P1 10 3
P2 1 1
P3 2 4
P4 1 5
P5 5 2

The average waiting time is 8.2 milliseconds. Priorities can be defined either internally or externally. Internally defined priorities use some measurable quantity to compute the priority of a process. For example, time limits, memory requirements, the number of open files etc. External priorities are set by criteria that are external to the operating system, such as importance of the process, the type and amount of funds being paid for computer use, the department sponsoring the work, and other often political factors.
Priority scheduling can be either preemptive or non-preemptive. When process arrives at the ready queue, its priority is compared with the priority of the currently running process. A preemptive priority-scheduling algorithm will preempt the CPU if the priority of the newly arrived process is higher than the priority of the currently running process. A non preemptive priority scheduling algorithm will simply put the new process at the head of the ready queue.
A major problem with priority-scheduling algorithms is indefinite blocking or starvation. A process that is ready to run but lacking the CPU is considered blocked – waiting for the CPU. A priority-scheduling algorithm can leave some low-priority processes waiting indefinitely for the CPU. Generally one of the two things will happen. Either the process will eventually be run, or the computer system will eventually crash and lose all unfinished low-priority processes.
A solution to the problem of indefinite blockage of low-priority processes is aging. Aging is a technique of gradually increasing the priority of processes that wait in the system for a long time.



4. Round-Robin Scheduling:

The round-robin (RR) scheduling algorithm is designed especially for time-sharing systems. It is similar to FCFS scheduling, but preemption is added to switch between processes. A small unit of time, called a time quantum is defined. The time quantum is generally from 10 to 100 milliseconds. The ready queue, allocating the CPU to each process for a time interval of up to 1 time quantum.
To implement RR scheduling, we keep the ready queue as a FIFO queue of processes. New processes are added to the tail of the ready queue. The CPU scheduler picks the first process from the ready queue, sets a timer to interrupt after 1 time quantum, and dispatches the process.
One of the two things will then happen. The process may have a CPU burst of less than 1 time quantum. In this case the process itself will release the CPU voluntarily. The scheduler will then proceed to the next process in the ready queue. Otherwise, if the CPU burst of the currently running process is longer than 1 time quantum, the timer will go off and will cause an interrupt to the operating system. A context switch will be executed, and the process will be put at the tail of the ready queue. The CPU scheduler will then select the next process in the ready queue.
Consider the following set of processes that arrive at time 0, with the length of the CPU burst time given in milliseconds:
Process Burst Time
P1 24
P2 3
P3 3If the time quantum is 4 milliseconds, then process P1 gets the first 4 milliseconds. Since it requires another 20 milliseconds, it is preempted after the first time quantum, and the CPU is given to the next process in the queue, process P2. Since process p2 does not need 4 milliseconds, it quits before its time quantum expires. The CPU is then given to the next process, process P3. Once each process has received 1 time quantum, the CPU is returned to process P1 for an additional time quantum


Internet Program

Connecting to the Internet
* Internet communication protocols
o Computers connected to the internet communicate by using Internet Protocol (IP).
o IP slices information into packets and routes them to their destination.
o IP uses dynamic routing, so that even if one part of the network is knocked out, packets can
be rerouted.
o Along with IP, most computers on the internet communicate with TCP.
* Internet hosts
o Each computer on the internet is called a host computer or host.
o Computers on the internet are connected by cables, phone lines and satellite connections.
o They include large mainframe, smaller mini computers and PCs.
* IP Address
o Each host computer on the internet has a unique number called its IP address.
o IP addresses identify the host computers, so that packets reach the correct computer.
o If we use dial-up account, ISP assigns your computer an IP address each time you connect.
o Computers on LAN usually have IP addresses that are reserved for use on LAN.
o The most common IP assignment server is called DHCP (Dynamic Host Configuration
Protocol).

* Internet Service Providers (ISPs)

o It is an organization that provides Internet accounts.
o The other features provided by the Internet account are Email mailboxes, Web server
space and Domain hosting.

* Types of Internet Connections
o To connect to the internet we have different types of connections. They are:
Dial-Up connections
o This works over an ordinary phone line.
o It uses the point-to-point protocol. A modem is needed.
Ø DSL connections
- Digital Subscriber Line is a digital, high-speed line that uses the normal phone wires with
special modems on either end.
- The line is asymmetric, because it has more capacity for data received by the computer than
for data sent from the computer.
- With DSL line we can connect the computer to the internet and talk on the phone at the same
time on the same phone line.
- DSL modems connect to the computer through an Ethernet or other network card in the
computer

Ø ISDN Connections
o Integrated Services Digital Network is an upgraded phone line that can be used for faster
internet access and for regular voice calls.
o Using one line, we can talk on the phone and surf the web.
o For residential use ISDN provides BRI. On one line, BRI provides two 64-Kbps channels, or
B channels, and one 16-Kbps channel, or D channel.
o D channel is used for signaling. The two B channels are combined for to use the internet.
o An ISDN adapter is needed to connect the computer to an ISDN line.

Ø Leased Lines
o If large amount of data is to be transferred we can go for leased line.
o Leased lines come in various speeds including T! and T3.

Ø Cable TV internet connections
o Cable modem service brings dozens of TV channels as well as web sites.
o The cable network was designed to move information in one direction, from
broadcaster to the user.
o Downstream speeds are much faster than the upstream speed.

Ø Satellite Internet Connections
· Digital satellite Systems or direct broadcast satellite lets to get internet information by
satellite.
· With early satellite systems, we can receive data from the internet at a high speed through
the satellite, but to send data we need a dial-up connection and an ISP.
· Later the companies StarBand and DirecPC offered two-way system connection that
doesn’t use a phone line at all, with uploads and downloads by satellite.

Ø Wireless Internet Connections
· In a few urban areas wireless internet access can be used.
· To set it up, a radio modem is attached to the laptop.
· Another way to connect to the internet via wireless is by using a digital cell phone.
· Some ISPs offer wireless connections to Personal Data Assistants (PDA) such as Blackberry, Compaq ipaq, or Palm. These small devices have tiny screens which can be used to read e-mail and browse the web.

* Domain Name System

· The name of each host computer consists of a series of words separated by dots.
· The last part of the domain name is called the top-level domain (TLD).
· The last two parts of a host computer name constitute the domain.
· The second to last part of the name (second-level-domain) is chosen by the organization
that owns the computer. Eg:yahoo.com
· Because most organizations own more than on computer on the internet, most host
computer names have at least one more part, preceding the domain name called third-
level-domain. Eg: www.yahoo.com, mail.yahoo.com.
· A domain name system (DNS) server translates between the numeric IP addresses that
identify each host computer on the internet and the corresponding domain names.

E-Mail Concepts

- E-mail messages are passed through the internet by using a protocol called simple mail
transfer protocol.
- The incoming messages are received in an e-mail mailbox that resides on a mail server.
- Mail servers receive and store e-mail messages in mailboxes by using a protocol called Post
office Protocol or IMAP.
- To read e-mail, a mail client is needed.
- We can write e-mail messages by using e-mail application,
- The messages are transferred to an SMTP server- a mail server that accepts e-mail.

* Ways Of accessing E-mail

· We may use a mail client. Eg: Eudora, Outlook, Outlook express, Netscape Messenger etc.
· We may use a web-based e-mail service.
· We may use an online service, such as America online, which has its own mail program.
· We may get e-mail through a LAN, a common system at large organizations. The e-mail
arrives in the company’s POP or IMAP server.

* E-mail Addressing

· Internet e-mail addresses consists of two parts joined by @ sign.
· User name – It contains characters other than letters-they can contain numbers,
underscores, periods, and some other special characters. They can’t contain commas or
parantheses.
· Host or domain name – It provides the internet location of the mailbox, usually the name of
a company or internet service.

* Formatted E-mail

· HTML – This is formatted with HTML tags, just like web pages. It includes text formatting, numbering, bullets, alignment, horizontal lines, backgrounds, hyperlinks. It is actually sent using the MIME protocol.
· Rich Text Format – This format can be read by most word processing applications. Documents in this format are also called RTF files.
· MIME (Multipurpose Internet Mail Extensions) – It is used for attachments. Formatting includes text formatting, pictures, video and sound.

Web-Based E-mail

· Using web based email we can access the web as well as read our mail.
· Most web-based e-mail is free.
· We can read two kinds of messages on the web :
o Messages sent to a web-only account
o Messages stored in the POP mailbox

Sending and Receiving Files by E-mail

* Attachments

· An attachment is a file that has been encoded as text so that it can be included in an e-mail message.
· The three common ways to encode e-mail attachments are :
o MIME - Multi purpose Internet Mail Extension is the standard method.
o Uencoding – This method is supported by some older e-mail applications.
o BinHex- Used by some Mac e-mail programs.

* Sending Attachments

· To send a file by e-mail, create a message to which the file is to be attached.
· Address the mail as usual and type the subject. If needed type the text in the body of the
message.
· Now attach the file by choosing a menu command or by clicking a toolbar button.
· Large files can be compressed, so that the sending and downloading time can be minimized.

* Receiving Attachments

· Most e-mail applications store the attachments in the mail message.
· First, open the message and then open or save the attachment.
· When the message with an attachment is deleted, the attachment is also deleted.
· To use the attachment later, it has to be saved.

* Attaching files to a Microsoft Outlook e-mail
· To attach files to a Microsoft Outlook, follow the below steps.
1. Open Microsoft Outlook.
2. Reply to an existing e-mail, or compose a new e-mail by clicking on the New icon in the top left portion of the window.
3. In the e-mail, click on the 'Insert file' icon that looks like a small paperclip, or click on Insert at the top of the window and choose file.
4. Browse to the location that contains your file and double-click it insert it.
If successfully attached you should see an icon of the attachment in your e-mail.
Below is an alternative method of attaching a file into an e-mail.
1. Open My computer or Windows explorer and browse to the location of where your pictures are located.
2. Highlight and copy the picture you wish to send in an e-mail.
3. Open a new e-mail or the e-mail you're replying to that you wish to attach the file into, right-click in the message portion of the e-mail and click paste.
Fighting Spam, Sorting Mail, and Avoiding Email Viruses

* Reducing Spam
· The term "spam" is Internet slang that refers to unsolicited commercial email (UCE) or unsolicited bulk email (UBE).
· Some people refer to this kind of communication as junk email to equate it with the paper junk mail that comes through the US Mail.
· Unsolicited email most often contains advertisements for services or products, but very few reputable marketers use UCE to advertise.
· The most commonly seen spam includes the following:
o Foreign bank scams or advance fee fraud schemes
o Phishing scams, a very popular and dangerous form of email fraud
o Pyramid schemes, including multilevel marketing (MLM)
o Other "Get Rich Quick" or "Make Money Fast" (MMF) schemes
o Quack health products and remedies
o Ads for pornographic web sites
o Offers of software for collecting email addresses and sending UCE
o Offers of bulk emailing services for sending UCE
o Chain letters (for more information, see About chain mail)
o Illegally pirated software
* Avoid receiving spam email
· Spam has increasingly become a problem on the Internet. While every Internet user receives some spam email, certain behaviors on the Internet will cause you to receive even more than average.
· In fact, the Federal Trade Commission and the Center for Democracy and Technology have performed studies to determine how spammers can obtain your email address.
· They found that email addresses posted to web sites or in newsgroups attract the most spam.
· Chat rooms are also fertile places for spammers to obtain email addresses.
· Some tips on Internet behavior that will help reduce the amount of spam you receive:
o On October 17, 2006, UITS implemented enhanced email filtering services at Indiana University. The spam quarantine service now analyzes all mail delivered to IU Cyrus/Webmail and Exchange accounts.
o Any spam messages you receive are quarantined for five days in a Spam (Cyrus/Webmail) or Junk E-mail (Exchange) folder in your account. After five days, the spam service deletes these messages automatically.
o Every time you communicate on the Internet or browse a web site, there are opportunities for spammers to intercept your communications to obtain your email address.
o In particular, if you post to a Usenet newsgroup, list your email address on a web site, or fill out insecure forms on the web, your address can be collected by spammers.
o They collect lists of email addresses and even share or sell these lists to other spammers. Even otherwise reputable companies may sell or exchange your email address with other companies, and this information may inadvertently find its way to a spammer.
o At worst, spammers will use automated programs to bombard these lists of email addresses with spam.
· Consider the following to reduce the amount of spam you receive:
Subscribe only to essential discussion lists, and ensure that they are moderated.
If you are thinking of filling out a form on a web site, check the site's privacy policy first to be sure it uses secure technology and the company does not share your email address with others. If the site doesn't have a privacy policy that describes this to your satisfaction, consider not using that service.
If you post to Usenet newsgroups or bulletin boards, or if you spend time in chat rooms or use an online service that displays your address, you may wish to consider opening an email account on a free service and using that address when performing these potentially spam-inducing activities. Then your primary account would not be as affected by spam.
If the email address is listed on a web page, you should also consider opening a free account. If the web site listing your contact information is for Indiana University business, you could also get a departmental account and list that address rather than your personal address.
If you reply to spam, the spammer or the automated program on the other end will then know that your address is connected to a live person, and the spammer will then bombard you with even more spam, and circulate your address to other spammers. Thus, it is imperative that you pause and think before replying to any spam.
* How to avoid viruses
· Do NOT open or view any attachment or file in email that you are not expecting. Even if you know the person sending you a file, it does not mean that the file is safe.
· Newer email viruses can make it look as if your friends/colleagues are sending you the file. In short, whenever you receive a file by email, CHECK with the sender directly that the file is legitimate and if it is not, contact your IT support area.
· Following this rule will keep you safe from the vast majority of viruses going around the internet.

* General guidelines for avoiding computer viruses
Do not run, download or forward any unsolicited executables, documents, spreadsheets, etc. Anything that runs on your PC should be virus checked and approved first.
Any email you weren't expecting should be treated with suspicion, even if it comes from someone you know. It is worth calling whoever sent it to you to check that they intended to send you the email.
NEVER open any files with a double file extension, (e.g. iamavirus.txt.vbs). Under normal circumstances you should never need to receive or use these.
Avoid downloading executables or documents from the internet. These are often used to spread computer viruses.
Although JPG, GIF and MP3 files are not normally infected with viruses, some viruses can be disguised as these file types, also some recent software problems with image viewers and/or mp3 players have allowed them to contain viruses. Some caution is recommended when opening these file types. Jokes, pictures, graphics, screensavers and movie files should be treated with the same amount of suspicion as other file types.
If in doubt, contact the ITS Service Desk for advice, do not open the file or email.
If you think you have been infected with a virus inform the ITS Service Desk immediately. Do not panic or interrupt other users.
Any virus warnings or hoaxes should be sent to the ITS Service Desk who can help confirm whether or not it is genuine. Do not forward these warnings to anyone else; unless you are signed up to an official virus alert service it is unlikely to be a genuine warning.
Ensure that you follow the same procedures at home and elsewhere. Viruses can easily be spread from one location to another.
Bank Scams: Ignore emails from banks, unless you have explicitly asked the bank to communicate with you via e-mail.
Even if you have explicitly asked a bank to communicate with you via e-mail, be cautious if you choose to enter your account details such as your account number or pin into a website supplied via e-mail, as it may be forged.
Online chatting, Messaging, and Conferencing Concepts
· Online Chatting or online conferencing enables Internet users to exchange text or to have discussions with groups of people in real time.
· The groups of people involved may be anywhere in the world.
· This group communication can take the form of text, voice, or video, and messages and responses can be exchanged.
* Forms of Chat, Messaging and Conferencing
· Real –time chat
Each participant sees each message with seconds of when it is sent, and the reply is given quickly. However, all the participants need to be online at the same time.
· Asynchronous chat
Messages are stored so that participants can read them when they have a chance, which allow participants to consider their responses, gather information, and formulate a response carefully. It also allows people from different time zones or with different schedules to participate.
* Types of online chat and conferencing
· E-mail Mailing Lists - E-mail messages are sent to one or more people who are selected by the sender. An e-mail mailing list allows messages to be distributed to a list of preselected people, called subscribers.
· Usenet Newsgroups - Usenet is a system that allows messages to be distributed throughout the Internet. Due to the volume of messages, the messages are divided into newsgroups, or topics.
· Internet Relay Chat (IRC) - It allows thousands of internet users to participate in real-time text-based chat.
· Web-Based Chat - Many people are daunted by the programs and commands required by IRC. Hence, many web sites now provide a web-based way to participate in real-time text-based chat.
· AOL and Compuserve Chat Rooms - AOL services allow real-time chat on a wide variety of subjects.
· Instant Messaging - Instant messaging (IM) is a form of online communication that allows real-time interaction through computers or mobile devices.
· Online conferencing - An online conference uses the Internet as a conference venue. This means that participants can access the conference from anywhere in the world and can do this at any time, using standard browser software.
* How does Chat work?The user's web browser is used as the client software. Java Application is often downloaded into the web browser to enable this function. We will only be able to chat with users who are connecting to the same server. There are chat sections on all kinds of web





· In mailing lists and newsgroups, a person is identified by the name and e-mail address.
· Thousands of people can simultaneously participate in the various available forms of Internet chat and conferencing.
· Discussions are categorized by topic, enabling people who are interested in a particular topic to find and communicate with each other.
· Depending on the system, topic groups may be called newsgroups (in Usenet), Channels (in IRC), forums, boards, groups, or rooms.
* Online Conferencing
Advantages...
· Traditional conferences mean participants have to travel and stay in a particular place. This takes time and is expensive.
· But an online conference uses the Internet as a conference venue. This means that participants can access the conference from anywhere in the world and can do this at any time, using standard browser software. Participants will be able to log on as little or as much as they wish - before, after or during office hours.
· They are given a password to access the various conference and seminar groups as well as closed discussion groups. Anyone with access to the Internet can participate.
· Cheaper - because there is no travel, and no accommodation is required;
· More convenient - you can access it at any time you want, from anywhere with an Internet connection;
· High level of participation - typically, more people will actively participate in an online conference than in a face to face conference, and the standard of the discussions is often higher;
· Wider spread of participants - our second Supporting Deaf People conference had delegates from nineteen countries and five continents; and there is a permanent record of proceedings.
· Online conferences are synchronous, asynchronous, or a combination of both. An example of asynchronous conferencing is the discussion forum types of conference, where people post messages, which the system stores, and which other people can respond to when they log on.

* Safety While Chatting
1. Never give out your personal information in a chat room.
2. Never agree to meet a stranger in person whom you met in a chat room.
3. When you're asked to enter or sign up for a chat nickname, choose a name that doesn't give away your personal information.
4. Be wary of other chatters who ask you to meet in private chat rooms.
5. Check the terms and conditions, code of conduct, and privacy statement at the chat site before you begin to chat.
Usenet Newsgroup Concepts
· Usenet newsgroups are electronic discussion groups in which you can share information and opinions with people all over the world.
· In Usenet newsgroups, you can reply to articles you have read and publish ("post") your own articles for others to read.
· Newsgroups differ widely in subject and style, ranging from casual chat to serious discourse.
* Accessing newsgroups
If the Internet service provider (ISP) offers access to a news server, we can read newsgroups with newsreaders such as trn or tin, or we can use a desktop newsreader such as Netscape or Outlook Express.
* Reading newsgroups
· Articles posted on newsgroups are distributed over the internet by news servers.
· These servers store and forward Usenet articles, and provide articles to users running news clients or newsreaders.
· News servers and newsreaders communicate by using an Internet protocol called the Network News Transfer Protocol (NNTP).
· Some of the popular newsreader software are Netscape messenger, outlook express, Netscape mail& newsgroups.
· One of the most popular and reliable way to read Usenet newsgroups on the web is through Google.
· Once you have a news reader set up on your computer, reading and posting to newsgroups is relatively simple.
Step1
Get your news server name from your ISP or network administrator.
Step2
Determine whether your current ISP software, e-mail program or Web browser includes a news-reading utility (many do). If not, download and install one.
Step3
Configure your news reader by inputting your news server address and any other information it requests (it might ask for an e-mail address and mail server as well).
Step4
Use your reader to call up a list of available newsgroups. This list will probably pop up during setup the first time you use your reader.
Step5
Look through the hierarchical list of newsgroups to find any that sound interesting. Let the prefixes of each group (such as 'comp' for computer-related topics and 'rec' for recreational topics) guide your search. The other words in the name go from general to more specific keywords.
Step6
Subscribe to whichever newsgroups you want to read or post to. (Note that some readers allow you to read newsgroup messages without your having to subscribe.)
Step7
Select the newsgroup you want to read.
Step8
Select a message by double-clicking on the subject. (Note that different readers may have different ways of reading messages.)
* Newsgroup hierarchies
Newsgroups are organized and grouped by title using hierarchical compound names such as rec.sport.basketball.college. Here, rec specifies recreational topics, sport specifies a subgroup of recreation, and so on. The Big Eight mainstream hierarchies are:
· comp: Anything related to computers (e.g., programming languages, operating systems, hardware)
· humanities: Art, music, literature, philosophy, classical studies, etc.
· misc: An assortment of topics that don't fit in any of the other Big Eight hierarchies
· news: Pertaining to the administration and discussion of Usenet software, protocols, policies, etc.
· rec: Recreation and hobbies of all kinds
· sci: Academic discussions of science and, to a lesser extent, technology
· soc: History, culture, religion, politics, lifestyle, and other topics of social interest
· talk: Debate and extended discussion, often heated
Alternative hierarchies have smaller distributions than their mainstream cousins; each has its own rules and focus. These hierarchies include:
· alt: This is by far the largest and most diverse hierarchy; all manner of topics can be found here. As there is no formal newsgroup creation procedure, anyone may create an alt group at any time. For this reason, many news servers either do not carry alt, or subscribe to only a small portion of its groups.
· biz: Almost as well established as the mainstream groups, biz caters to a variety of business interests.
· k12: This hierarchy contains groups designed for K-12 educators.
Numerous national, regional, local, and organizational hierarchies also exist, some of which are available globally.
* Newsgroup etiquette
· If you decide to participate in a newsgroup, it's best first to read a representative selection of articles over several days or even weeks before posting. (In the jargon of some newsgroups, this is known as lurking.) Each newsgroup may have its own set of guidelines for what constitutes an appropriate posting, and becoming familiar with the group before posting will help you show good manners (netiquette) and avoid offending others.
· If you are new to Usenet, consult the newsgroups news.newusers.questions and news.announce.newusers to learn about technique and netiquette before posting.
· You can also find a large repository of Usenet FAQ (Frequently Asked Question) files for a wide variety of newsgroups and subjects at the Usenet FAQ Files site. It's best to read any existing FAQ for a newsgroup before posting so that you'll avoid irritating other readers by asking questions that have already been answered many times.
* Creating a newsgroup
1) A request for discussion on creation of a new newsgroup should be posted to news.announce.newgroups, news.groups, and any other groups or mailing lists at all related to the proposed topic if desired. news.announce.newgroups is moderated, and the Followup-to: header will be set so that the actual discussion takes place only in news.groups. Users on sites which have difficulty posting to moderated groups may mail submissions intended for news.announce.newgroups to newgroups@isc.org. The proposal must be in the format defined in "How to Format and Submit a New Group Proposal", a pointer to which is at the end of this message. The article should be cross-posted among the newsgroups, including news.announce.newgroups, rather than posted as separate articles. Note that standard behaviour for posting software is to not present the articles in any groups when cross-posted to a moderated group; the moderator will handle that for you. 2) The name and charter of the proposed group and whether it will be moderated or unmoderated (and if the former, who the moderator(s) will be) should be determined during the discussion period. If there is no general agreement on these points among the proponents of a new group at the end of 30 days of discussion, the discussion should be taken offline (into mail instead of news.groups) and the proponents should iron out the details among themselves. Once that is done, a new, more specific proposal may be made, going back to step 1) above. 3) Group advocates seeking help in choosing a name to suit the proposed charter, or looking for any other guidance in the creation procedure, can send a message to group-advice@isc.org; a few seasoned news administrators are available through this address.
Internet Relay Chat
Internet Relay Chat is defined by networks of servers which communicate to each other. Users connecting to any of the servers should able to chat with everyone else on that entire "network".
ü What is IRC?
IRC (Internet Relay Chat) is a multi-user, multi-channel chatting system. We can use the computer and talk through typed messages with either one person or many other people from all over the Internet, all in real time.

ü Networks, Servers, and Channels
· Once you are set up with a provider and a client, you are in control. Choose a nickname you wish to be known by, then connect to one of the many different IRC networks catering to different geographical locations, interests, or philosophies.
· The largest networks have tens of thousands of people online at any given moment, drawn from an order of magnitude or more of regular visitors. These people create thousands of channels (sometimes incorrectly called "chat rooms") where people may meet and mingle.
· You may join these channels and participate in the group discussion, or you may elect to chat privately with individuals.
· Conversations on a channel are like those at a party: everybody who is present hears everything that everybody else is saying. If somebody is late to the party or leaves early, however, they will not hear what is said in their absence.
· All channels on IRC have names starting with #, such as #irchelp where you can get technical IRC help, or #new2irc where new users are welcome to join and chat.
· Usually, the name of the channel shows what it's for, but not always.

ü Basic IRC Commands
· Every IRC client has an input area where you can type what you want to say or issue IRC commands. You issue IRC commands by typing on a new line something beginning with a / (forward slash) character.
· Anything that does not begin with a / is assumed to be a message you are typing to someone or some channel.
· Commands you are supposed to type will be shown in red, while text which you will see in response will be shown in blue.
· In addition, the graphical clients such as mIRC or Ircle allow you to use a mouse to point and click your way around IRC, so that you don't have to type many of these commands manually.
· You should still learn the commands properly, because often they are the only way to specify precisely what you want done, and also they are often faster and easier than navigating through the labyrinth of buttons, menus, and dialogs that are supposed to make your life easier.
ü File Transfer
In addition to talking, IRC has also become a popular and convenient way to exchange a wide variety of files. Be forewarned, however, that many people are getting into serious trouble by downloading files that seem interesting or enticing, only to find out they are attacks. These hacks allow strangers to take over your channels, force you to disconnect, erase your hard disk, or worse.

ü Channel Operators
· Channel operators or "ops" have absolute power over their channel, including the right to decide who gets to come in, who must leave, who may talk, etc.
· When you first start out, it's best to chat on other people's channels and heed their rules, or else you may find yourself kicked out.
· If that happens and you cannot settle your differences with the ops, just go to another channel.
· At some point you will probably want to try your hand at being a channel op, either by creating your own new channel or by gaining the trust of the ops on an existing channel.
· You need to know a whole different set of commands. With this power comes the sometimes frustrating responsibility of maintaining the channel against intentional abuse as well as the usual IRC mishaps.
· Some networks such as Undernet and DALnet support channel registration, whereby you can "reserve" a channel.
· The advantage is that you are assured control over the channel as long as you show up once in a while, the disadvantage is that many popular channel names are probably already registered by others.
· Two of the largest nets EFnet and IRCnet do not support channel registration (or any other services).
· On these nets, there is no way to ensure you will always control a channel. Some channels try hard with all sorts of bots (which are explicitly banned by most servers) and protective scripts, but it's really just a matter of time before somebody with the right combination of lameness and knowledge comes along and takes over the channel.

ü About mIRC
· mIRC is a full featured Internet Relay Chat client for Windows that can be used to communicate, share, play or work with others on IRC networks around the world, either in multi-user group conferences or in one-to-one private discussions.
· It has a clean, practical interface that is highly configurable and supports features such as buddy lists, file transfers, multi-server connections, SSL encryption, proxy support, UTF-8 display, customizable sounds, spoken messages, tray notifications, message logging, and more.
· mIRC also has a powerful scripting language that can be used both to automate mIRC and to create applications that perform a wide range of functions from network communications to playing games.
· mIRC has been in development for over a decade and is constantly being improved and updated with new technologies.

ü Instant messaging

· Instant messaging (IM) is a form of online communication that allows real-time interaction through computers or mobile devices.
· Although typed text remains the primary convention for IM, the technology now allows users to send images, audio and video files, and other attachments.
· Hundreds of millions of people use IM to stay connected. In many ways, it epitomizes the notion of the always-connected, multitasking student, sending and receiving messages at all hours, from a wide spectrum of devices, while doing several other things at the same time.
· IM has become such an integral part of students' lives that many colleges and universities are working to move it beyond the social sphere into teaching and learning.
· The Internet has revolutionized the way we communicate. E-mail has been the most rapidly adopted form of communication ever known. Less than two decades ago, not many people had heard of it. Now, many of us e-mail instead of writing letters or even calling people on the phone. People around the world send out billions of e-mail messages every day.

· But sometimes even e-mail isn't fast enough. You might not know if a person you want to e-mail is online at that moment. Also, if you're e-mailing back and forth with someone, you usually have to click through a few steps. This is why instant messaging (IM) has become so popular.
· With IM, you can keep a list of people you interact with. You can IM with anyone on your buddy list or contact list as long as that person is online. You type messages to each other into a small window that shows up on both of your screens.
Most IM programs provide these features:
· Instant messages - Send notes back and forth with a friend who is online
· Chat - Create a chat room with friends or co-workers
· Web links - Share links to your favorite Web sites
· Video - Send and view videos, and chat face to face with friends
· Images - Look at an image stored on your friend's computer
· Sounds - Play sounds for your friends
· Files - Share files by sending them directly to your friends
· Talk - Use the Internet instead of a phone to actually talk with friends
· Streaming content - Real-time or near-real-time stock quotes and news
· Mobile capabilities - Send instant messages from your cell phone
Voice and Video Conferencing
ü Internet Phone
· Internet phone programs are designed to simulate phone calls over the internet, avoiding long-distance phone charges.
· Each person on the internet phone call needs a computer with a microphone and speakers.
· Then, download and install an internet phone program and sign up for a user name on the system.
· Internet phone is one form of voice-over-IP – voice information transmitted over the internet.
· It is possible to call from a computer to someone’s telephone using VoIP programs.
· But these PC-to-phone programs need to use local phone lines to connect to the other person’s phone and the entire link is not over the internet.
ü Voice and Video Conferencing
· It can be PC-to-PC or PC-to-Phone, with two or more people in the conversation.
· It replaces conference calls, which get expensive when they include many people over long distances.
· Voice conferencing enables user to send image to one or more people through a camera attached to the computer and to receive pictures back.
· We can use voice or video conferencing (or both), depending on the peripherals connected to the computer and the conferencing software
· With voice and video conferencing we can talk to other people, see their faces, and transmit the video so that they can see us, too.
· A videoconference (also known as a videoteleconference) is a set of interactive telecommunication technologies which allow two or more locations to interact via two-way video and audio transmissions simultaneously.
· It has also been called visual collaboration and is a type of groupware. It differs from videophone in that it is designed to serve a conference rather than individuals

ü Technology
· The core technology used in a video teleconference (VTC) system is digital compression of audio and video streams in real time.
· The hardware or software that performs compression is called a codec (coder/decoder). Compression rates of up to 1:500 can be achieved.
· The resulting digital stream of 1's and 0's is subdivided into labelled packets, which are then transmitted through a digital network of some kind (usually ISDN or IP).
· The use of audio modems in the transmission line allow for the use of POTS, or the Plain Old Telephone System, in some low-speed applications, such as videotelephony, because they convert the digital pulses to/from analog waves in the audio spectrum range.
The other components required for a VTC system include:
· Video input : video camera or webcam
· Video output: computer monitor , television or projector
· Audio input: microphones
· Audio output: usually loudspeakers associated with the display device or telephone
· Data transfer: analog or digital telephone network, LAN or Internet
· There are basically two kinds of VTC systems:
1. Dedicated systems have all required components packaged into a single piece of equipment, usually a console with a high quality remote controlled video camera. These cameras can be controlled at a distance to pan left and right, tilt up and down, and zoom. They became known as PTZ cameras. The console contains all electrical interfaces, the control computer, and the software or hardware-based codec. Omnidirectional microphones are connected to the console, as well as a TV monitor with loudspeakers and/or a video projector. There are several types of dedicated VTC devices:
1. Large group VTC are non-portable, large, more expensive devices used for large rooms and auditoriums.
2. Small group VTC are non-portable or portable, smaller, less expensive devices used for small meeting rooms.
3. Individual VTC are usually portable devices, meant for single users, have fixed cameras, microphones and loudspeakers integrated into the console.
2. Desktop systems are add-ons (hardware boards, usually) to normal PC's, transforming them into VTC devices. A range of different cameras and microphones can be used with the board, which contains the necessary codec and transmission interfaces. Most of the desktops systems work with the H.323 standard. Video conferences carried out via dispersed PCs are also known as e-meetings.

World Wide Web Concepts

ü The Hypertext Concept
· The hypertext is a way of presenting information in such a way that the sequence of the information is left up to the reader.
· This sequence is usually non-linear, however readers can follow a linear sequence.
· The hypertext works by means of hyperlink, which are highlighted or underlined words (or graphics) that one can click to bring another document into view.

ü Web Browser
· A web browser displays a web document and enables users to access web documents.
· When the user clicks a hyperlink, the browser initiates a message to a web server.
· This message requests the server to retrieve the requested information and send it back to the web browser through the telecommunications network.
ü Web Server
· This is a program that waits patiently for the browser to request a web page.
· The server looks for the requested information, retrieves it and sends it to the browser or sends an error message if the file is not found.

ü Uniform Resource Locators (URL) and Transfer protocols
· These are the web addresses.
· The resource locator is an addressing system that precisely states where a resource is located.
· It is divided into four parts: protocol; server/ domain name; path and the resource name. eg: http://www.cites.uiuc.edu/101/url101.html
· The first portion of the URL (http) designates the protocol that is used to locate the file or resource on the Web.
· A protocol is a standardized means of communication among machines across a network. Protocols allow data to be taken apart for faster transmission, transmitted, and then reassembled at the destination in the correct order.
· Here, http represents the HyperText Transfer Protocol, which is used to transfer Web pages across the Internet to Web browsers such as Netscape Navigator, Internet Explorer, or Lynx.
· The portion of the URL following the protocol (www.cites.uiuc.edu) designates the host name of the computer you are accessing. The designator www, found in many URLs, is an acronym for World Wide Web. While using www is conventional, it is not necessary. Some Web servers omit the need to type www.
· A URL may have any number of directories following it. In this example, 101 is a directory under the root directory of the host you are accessing. The file url101.html is located in the 101 directory.
ü Web Languages
Ø HTML (HyperText Markup Language)
o It is the universal language understood by all WWW (World Wide Web) clients.
o An HTML document (program) is ASCII text with embedded instructions (markups) which affect the way the text is displayed.
o The basic model for HTML execution is to fetch a document by its name (e.g. URL), interpret the HTML and display the document, possibly fetching additional HTML documents in the process.
o It can accept user input and/or cause additional HTML documents to be fetched by URL.
o Providing safety, platform independence, and the ability to interact with a variety of formats, protocols, tools, and languages makes it a universal language.
Ø Java and Java Script
o Java is a language for sending applets over the web, so that the computer can execute them.
o JavaScript is a language that allows HTML to embed small programs called scripts in web pages.
o The main purpose of applets and scripts is to speed up web page interactivity.
Ø VBScript and ActiveX Controls
o VBscript resembles Microsoft’s Visual Basic and is used to add scripts to pages that are displayed by Internet explorer.
o ActiveX controls, like Java, are used to embed executable programs into a web page.
Ø XML
o XML stands for EXtensible Markup Language
o XML is a markup language much like HTML
o XML was designed to carry data, not to display data
o XML tags are not predefined. We must define our own tags
o XML is designed to be self-descriptive
o XML is a W3C Recommendation.
o XML is not a replacement for HTML. XML and HTML were designed with different goals. XML was designed to transport and store data, with focus on what data is.
o HTML was designed to display data, with focus on how data looks. HTML is about displaying information, while XML is about carrying information.
o With XML we invent our Own Tags. The tags in the example below (like and ) are not defined in any XML standard. o ToveJaniReminde>
o These tags are "invented" by the author of the XML document. That is because the XML language has no predefined tags.
o The tags used in HTML (and the structure of HTML) are predefined. HTML documents can only use tags defined in the HTML standard (like

, etc.). XML allows the author to define his own tags and his own document structure.
ü Portals
· A portal is a web site that wants to be the start page.
· A portal site includes web guides, search engines, chat rooms, e-mail accounts and news services.
· All portal services are free but some requires registering and choosing a password.
· Corporations are replacing their internal homepages with portals.

ü Web directories and Search Engines
· A web directory or link directory is a directory on the World Wide Web.
· It specializes in linking to other web sites and categorizing those links.
· A web directory is not a search engine, and does not display lists of web pages based on keywords, instead it lists web sites by category and subcategory. The categorization is usually based on the whole web site, rather than one page or a set of keywords, and sites are often limited to inclusion in only one or two categories.
· Web directories often allow site owners to directly submit their site for inclusion, and have editors review submissions for fitness.
· A Web search engine is a search engine designed to search for information on the World Wide Web.
· Information may consist of web pages, images and other types of files. Some search engines also mine data available in newsgroups, databases, or open directories.
· Unlike Web directories, which are maintained by human editors, search engines operate algorithmically or are a mixture of algorithmic and human input.
· A search engine operates, in the following order
1. Web crawling
2. Indexing
3. Searching
· Web search engines work by storing information about many web pages, which they retrieve from the WWW itself. These pages are retrieved by a Web crawler— an automated Web browser which follows every link it sees.
· When a user enters a query into a search engine (typically by using key words), the engine examines its index and provides a listing of best-matching web pages according to its criteria, usually with a short summary containing the document's title and sometimes parts of the text.
· Most search engines support the use of the boolean operators AND, OR and NOT to further specify the search query. Some search engines provide an advanced feature called proximity search which allows users to define the distance between keywords.

ü Home Pages
· The homepage or main page is the URL or local file that automatically loads when a web browser starts and when the browser's "home" button is pressed.
· The term is also used to refer to the front page, webserver directory index, or main web page of a website of a group, company, organization, or individual.
· In some countries, such as Germany, Japan, and South Korea, and formerly in the US, the term "homepage" commonly refers to a complete website (of a company or other organization) rather than to a single web page.
· Also, with more and more people knowing how to navigate the internet easily, the significance of choosing a homepage is almost non-existent.
· Many software companies now automatically set their company's website as the user's homepage.
Web Security, Privacy, and Site-Blocking
ü Web Security and Privacy Concepts
· Stand-alone computers have Security Policy associated with them that can be modified by users with the appropriate rights.
· When a computer joins a domain, the domain Security Policy is applied to the local computer.
· Domain Security Policy will override any changes made to Security Policy at the desktop level.
· Web security defines what the browser will allow web pages to run or store on the computer.
· Browsers have security policies, or systems that enable us to specify which web sites can take what types of actions on our computer.
· Another aspect of web security specifies what information web sites can store on the computer, to track our use of the web site.

ü Cookies
· Cookies are messages that web servers pass to the web browser when we visit Internet sites.
· The browser stores each message in a small file, called cookie.txt.
· When we request another page from the server, the browser sends the cookie back to the server.
· These files typically contain information about our visit to the web page, as well as any information we've volunteered, such as the name and interests.
· Cookies are most commonly used to track web site activity. When we visit some sites, the server gives a cookie that acts as the identification card. Upon each return visit to that site, the browser passes that cookie back to the server.
· In this way, a web server can gather information about which web pages are used the most, and which pages are gathering the most repeat hits.
· Cookies are also used for online shopping. Online stores often use cookies that record any personal information we enter, as well as any items in the electronic shopping cart, so that user don't need to re-enter this information each time we visit the site.
· Servers also use cookies to provide personalized web pages. When we select preferences at a site that uses this option, the server places the information in a cookie. When we return, the server uses the information in the cookie to create a customized page for us.
· Security concerns in cookies
Only the web site that creates a cookie can read it. Additionally, web servers can use only information that you provide or choices that you make while visiting the web site as content in cookies.
Accepting a cookie does not give a server access to the computer or any of the personal information (except for any information that we may have purposely given, as with online shopping). Servers can read only cookies that they have set, so other servers do not have access to the information. Also, it is not possible to execute code from a cookie, and not possible to use a cookie to deliver a virus.


ü Platform for Internet Content Selection (PICS)
· The PICS specification enables labels (metadata) to be associated with Internet content.
· It was originally designed to help parents and teachers control what children access on the Internet, but it also facilitates other uses for labels, including code signing and privacy.
· The PICS platform is one on which other rating services and filtering software has been built.
· PICS is a cross-industry working group whose goal is to facilitate the development of technologies to give users of interactive media, such as the Internet, control over the kinds of material to which they and their children have access.
· PICS members believe that individuals, groups and businesses should have easy access to the widest possible range of content selection products, and a diversity of voluntary rating systems.
· In order to advance its goals, PICS will devise a set of standards that facilitate the following:
1. Self-rating:
Enable content providers to voluntarily label the content they create and distribute.
2. Third-party rating:
Enable multiple, independent labeling services to associate additional labels with content created and distributed by others. Services may devise their own labeling systems, and the same content may receive different labels from different services.
3. Ease-of-use:
Enable parents and teachers to use ratings and labels from a diversity of sources to control the information that children under their supervision receive.
ü Content-Rating Services: Safesurf and RSAC
· The two rating systems that are built into Netscape Netwatch are Safesurf and the Recreational Software Advisory.
· Microsoft’s Content Advisor includes only RSAC’s system.
· Safesurf is a parents’ group trying to make the internet a safe and useful tool for children.
· RSAC is a nonprofit corporation and its mission was to issue a rating system for computer games, and it later extended its game-rating system to the Internet.


Audio and video on the web
· With the increased popularity of broadband connections, many sites features music, movie, and television clips which can be viewed or download.
· However the audio or video files are large in size and take a long time to download.
· Since audio and video files are large, streaming was invented.
· Streaming enables the computer to play the beginning of an audio or video file while the rest of the file is still downloading.
· If the file arrives more slowly than the computer plays it, the playback has gaps while the computer waits for more data to play.

ü Popular Audio and Video players
· RealOne Player – plays most popular audio formats and video files, including streaming audio and video. Supports burning audio files on CDs, so we can create our own music CDs.
· Quick Time – plays audio and video files stored in the Quicktime format.
· Windows Media Player – plays both regular and streaming audio and video files, including most audio files and CDs. It supports burning to CDs or copying files to portable media players that support WMA format.
· WinAmp – plays MP3 and windows media files, as well as many other popular music formats, CDs, and streaming audio.
· MusicMatch – plays MP3s and CDs, copies and creates CDs, transfers MP3s to portable media players, and supports internet radio broadcasts.

ü Playing video on the Internet
· The video files are very large in size, meaning a video clip just a few seconds long could take ten minutes or more to download.
· Even using streaming media, where the content is played as it is downloaded, the images were often blocky and tiny.
· With improved video compression techniques and faster internet connections the rich multimedia content can be downloaded or played within seconds.
· Prerecorded video
o Several video formats are in use on the internet.
o Many videos play in windows media player, whereas other videos require RealOne player or Quicktime player.
o We can view the prerecorded video clips using the right player.

· Live video with webcams
o Another source for video broadcasts is the ever-popular webcam.
o These are digital video cameras broadcast from a specific location
o Webcam images are usually updated between every few seconds, although some sites use streaming video for their webcams.
Web site Creation Concepts
ü Basic steps in Creating a site
1. Plan the structure of the site, so that we have an idea what information will be on at least the home page and other key pages.
2. Using the text editor or web page editor, create the pages of the site and save them as HTML files. Use a graphics editor to create or view graphics for the pages.
3. Using browser, view the HTML files created. Check the contents and the links
4. Publish the web site by putting all of its files on a web server.
5. Using the browser, view the web pages as stored on the web server.
6. Publicize the site, get feedback, get new ideas, and repeat the steps.

ü Planning the Site
The planning process involves answering these questions.
1. Who is the audience for the site?
2. What can you put on the site that will interest people?
3. How can we make it easy for people to navigate the site?
4. How the pages are stored on the site?
5. What are the tools needed to develop the site?
Issues to be aware of when planning the web site:
1. Text size
2. Colors
3. Writing for an international audience
4. Privacy
5. Maintenance
6. Accessibility



ü Tools needed to develop the site
1. Text
2. Pictures
3. Animated graphics
4. Audio files
5. Video files
6. Animation files
7. Forma and database information
8. Text editor
9. Drawing programs
10. Clip art gallery
11. Sound or video equipment
Optimizing web graphics
ü Graphics File formats
1. Vector images consist if lines and various shapes outlined and filled with colors or shadings.
2. Bitmap images consist of colored dots, or pixels. Web documents commonly use bitmap images in two formats: Graphics Interchange Format (GIF) and Joint Photographic Experts Group (JPEG).

ü Common programs for creating GIF and JPEG files
Generally, Graphics programs are of three varieties:
1. Paint and photo programs – Enables to read different image files and customize them for web use. Eg: Adobe Photoshop and Macromedia fireworks
2. Illustration programs – focus on creating images, principally vector graphics and have features for optimizing the bitmap files. Eg: Adobe Illustrator and CorelDraw.
3. Graphics Utilities - small programs with simple features that focus on converting images from one format to another.
Graphics program that are widely available:
1. Microsoft Paint
2. Adobe PhotoShop
3. Adobe ImageReady
4. Macromedia Fireworks
5. Paint Shop Pro
6. Lview pro
ü Optimizing Images
The Best method to decrease file size for a WEB image is to decrease the quality. This does NOT mean the image will not look good on a computer monitor.
Digitized images are normally at a much higher quality (resolution / dots per inch) than a monitor can display.
This step alone will normally reduce the file size to 1/5 of the original. Physical size will not change (Avoid resize until final step).
The Second best method (optional) is to 'crop' off any 'dead' area. For example, center the subject in the picture by cropping the borders.
Using 'resize' to reduce file size is NOT very effective. (usually no more than 1/2 of the original size - even if we take the viewing size below 320 x 240 :( Resize should be used to obtain the 'physical' size you desire i.e resizing - Used alone results in an image that is not really optimized very well.
Minimize the image dimensions by using the smallest practical image height and width.
Minimizing or avoiding certail types of Image content.
Minimizing and flattening colors.

FTP and Peer-to-peer
File Transfer Protocol (FTP) is a network protocol used to transfer data from one computer to another through a network, such as the Internet.
FTP is a file transfer protocol for exchanging and manipulating files over any TCP-based computer network. A FTP client may connect to a FTP server to manipulate files on that server. As there are many FTP client and server programs available for different operating systems, FTP is a popular choice for exchanging files independent of the operating systems involved.
ü Connection methods
FTP runs exclusively over TCP. FTP servers by default listen on port 21 for incoming connections from FTP clients. A connection to this port from the FTP Client forms the control stream on which commands are passed to the FTP server from the FTP client and on occasion from the FTP server to the FTP client. FTP uses out-of-band control, which means it uses a separate connection for control and data. Thus, for the actual file transfer to take place, a different connection is required which is called the data stream. Depending on the transfer mode, the process of setting up the data stream is different.
In active mode, the FTP client opens a dynamic port (49152–65535), sends the FTP server the dynamic port number on which it is listening over the control stream and waits for a connection from the FTP server. When the FTP server initiates the data connection to the FTP client it binds the source port to port 20 on the FTP server.
In order to use active mode, the client sends a PORT command, with the IP and port as argument. The format for the IP and port is "h1,h2,h3,h4,p1,p2". Each field is a decimal representation of 8 bits of the host IP, followed by the chosen data port. For example, a client with an IP of 192.168.0.1, listening on port 49154 for the data connection will send the command "PORT 192,168,0,1,192,2". The port fields should be interpreted as p1×256 + p2 = port, or, in this example, 192×256 + 2 = 49154.
In passive mode, the FTP server opens a dynamic port (49152–65535), sends the FTP client the server's IP address to connect to and the port on which it is listening (a 16 bit value broken into a high and low byte, like explained before) over the control stream and waits for a connection from the FTP client. In this case the FTP client binds the source port of the connection to a dynamic port between 49152 and 65535.
To use passive mode, the client sends the PASV command to which the server would reply with something similar to "227 Entering Passive Mode (127,0,0,1,192,52)". The syntax of the IP address and port are the same as for the argument to the PORT command.
In extended passive mode, the FTP server operates exactly the same as passive mode, however it only transmits the port number (not broken into high and low bytes) and the client is to assume that it connects to the same IP address that was originally connected to. Extended passive mode was added by RFC 2428 in September 1998.
While data is being transferred via the data stream, the control stream sits idle. This can cause problems with large data transfers through firewalls which time out sessions after lengthy periods of idleness. While the file may well be successfully transferred, the control session can be disconnected by the firewall, causing an error to be generated.
The FTP protocol supports resuming of interrupted downloads using the REST command. The client passes the number of bytes it has already received as argument to the REST command and restarts the transfer. In some commandline clients for example, there is an often-ignored but valuable command, "reget" (meaning "get again") that will cause an interrupted "get" command to be continued, hopefully to completion, after a communications interruption.
Resuming uploads is not as easy. Although the FTP protocol supports the APPE command to append data to a file on the server, the client does not know the exact position at which a transfer got interrupted. It has to obtain the size of the file some other way, for example over a directory listing or using the SIZE command.
The objectives of FTP,are:
1. To promote sharing of files (computer programs and/or data).
2. To encourage indirect or implicit use of remote computers.
3. To shield a user from variations in file storage systems among different hosts.
4. To transfer data reliably, and efficiently.
ü Data format
While transferring data over the network, several data representations can be used. The two most common transfer modes are:
1. ASCII mode
2. Binary mode: In "Binary mode", the sending machine sends each file byte for byte and as such the recipient stores the bytestream as it receives it. (The FTP standard calls this "IMAGE" or "I" mode)
In "ASCII mode", any form of data that is not plain text will be corrupted. When a file is sent using an ASCII-type transfer, the individual letters, numbers, and characters are sent using their ASCII character codes. The receiving machine saves these in a text file in the appropriate format (for example, a Unix machine saves it in a Unix format, a Windows machine saves it in a Windows format). Hence if an ASCII transfer is used it can be assumed plain text is sent, which is stored by the receiving computer in its own format. Translating between text formats might entail substituting the end of line and end of file characters used on the source platform with those on the destination platform, e.g. a Windows machine receiving a file from a Unix machine will replace the line feeds with carriage return-line feed pairs. It might also involve translating characters; for example, when transferring from an IBM mainframe to a system using ASCII, EBCDIC characters used on the mainframe will be translated to their ASCII equivalents, and when transferring from the system using ASCII to the mainframe, ASCII characters will be translated to their EBCDIC equivalents.
By default, most FTP clients use ASCII mode. Some clients try to determine the required transfer-mode by inspecting the file's name or contents, or by determining whether the server is running an operating system with the same text file format.
The FTP specifications also list the following transfer modes:
1. EBCDIC mode - this transfers bytes, except they are encoded in EBCDIC rather than ASCII. Thus, for example, the ASCII mode server
2. Local mode - this is designed for use with systems that are word-oriented rather than byte-oriented.

ü FTP and web browsers
Most recent web browsers and file managers can connect to FTP servers, although they may lack the support for protocol extensions such as FTPS. This allows manipulation of remote files over FTP through an interface similar to that used for local files. This is done via an FTP URL, which takes the form ftp(s):// (e.g., ftp://ftp.gimp.org/). A password can optionally be given in the URL, e.g.: ftp(s)://:@:. Most web-browsers require the use of passive mode FTP, which not all FTP servers are capable of handling. Some browsers allow only the downloading of files, but offer no way to upload files to the server.
ü List of FTP commands
Commands used by the FTP client software as opposed to the user are often described as raw FTP commands.
· ABOR - Abort an active file transfer.
· ACCT - Account information.
· ALLO - Allocate sufficient disk space to receive a file.
· APPE - Append.
· CDUP - Change to Parent Directory.
· CLNT - Send FTP Client Name to server.
· CWD - Change working directory.
· DELE - Delete file.
· EPSV - Enter extended passive mode
· EPRT - Specifies an extended address and port to which the server should connect.
· FEAT - Get the feature list implemented by the server. GET - Use to download a file from remote
· HELP - Returns usage documentation on a command if specified, else a general help document is returned.
· LIST - Returns information of a file or directory if specified, else information of the current working directory is returned.
· LPSV - Enter long passive mode.
· LPRT - Specifies a long address and port to which the server should connect
· MDTM - Return the last-modified time of a specified file.
· MGET - Use to download multiple files from remote.
· MKD - Make directory (folder).
· MNT - Mount File Structure.
· MODE - Sets the transfer mode (Stream, Block, or Compressed).
· MPUT - Use to upload multiple files to remote.
· NLST - Returns a list of filenames in a specified directory.
· NOOP - No operation (dummy packet; used mostly on keepalives).
· OPTS - Select options for a feature.
· PASS - Authentication password.
· PASV - Enter passive mode.
· PORT - Specifies an address and port to which the server should connect.
· PUT - Use to upload a file to remote.
· PWD - Print working directory. Returns the current directory of the host.
· QUIT - Disconnect.
· REIN - Re initializes the connection.
· REST - Restart transfer from the specified point.
· RETR - Retrieve (download) a remote file.
· RMD - Remove a directory.
· RNFR - Rename from.
· RNTO - Rename to.
· SITE - Sends site specific commands to remote server.
· SIZE - Return the size of a file.
· SMNT - Mount file structure.
· STAT - Returns the current status.
· STOR - Store (upload) a file.
· STOU - Store file uniquely.
· STRU - Set file transfer structure.
· SYST - Return system type.
· TYPE - Sets the transfer mode
· UMNT - Unmount file structure.
· USER - Authentication username
ü Peer-to-peer Architecture
Often referred to simply as peer-to-peer, or abbreviated P2P, peer-to-peer architecture is a type of network in which each workstation has equivalent capabilities and responsibilities. This differs from client/server architectures where some computers are dedicated to serving the others. Peer-to-peer networks are generally simpler but they usually do not offer the same performance under heavy loads. The P2P network itself relies on computing power at the ends of a connection rather than from within the network itself.
P2P is often mistakenly used as a term to describe one user linking with another user to transfer information and files through the use of a common P2P client to download MP3s, videos, images, games and other software. This, however, is only one type of P2P networking. Generally, P2P networks are used for sharing files, but a P2P network can also mean Grid Computing or Instant messaging.
ü Types of P2P NetworksPeer-to-peer networks come in three flavors. The category classification is based on the network and application.

Collaborative Computing
Also referred to as distributed computing, it combines the idle or unused CPU processing power and/or free disk space of many computers in the network. Collaborative computing is most popular with science and biotech organizations where intense computer processing is required. Examples of distributed computing can be found at GRID.ORG where United Devices is hosting virtual screening for cancer research on the Grid MP platform. This project has evolved into the largest computational chemistry project in history. United Devices has harnessed the power of more than 2,000,000 PCs around the world to generate more than 100 teraflops of power. Most distributed computing networks are created by users volunteering their unused computing resources to contribute to public interest research projects.
Instant Messaging
One very common form of P2P networking is Instant Messaging (IM) where software applications, such as MSN Messenger or AOL Instant Messenger, for example, allow users to chat via text messages in real-time. While most vendors offer a free version of their IM software others have begun to focus on enterprise versions of IM software as business and corporations have moved towards implementing IM as a standard communications tool for business.
Affinity Communities
Affinity communities is the group of P2P networks that is based around file-sharing and became widely known and talked about due to the public legal issues surrounding the direct file sharing group, Napster. Affinity Communities are based on users collaborating and searching other user's computers for information and files.
ü How Peer-to-peer File-sharing Clients WorkOnce you have downloaded and installed a P2P client, if you are connected to the Internet you can launch the utility and you are then logged into a central indexing server. This central server indexes all users who are currently online connected to the server. This server does not host any files for downloading. The P2P client will contain an area where you can search for a specific file. The utility queries the index server to find other connected users with the file you are looking for. When a match is found the central server will tell you where to find the requested file. You can then choose a result from the search query and your utility when then attempt to establish a connection with the computer hosting the file you have requested. If a successful connection is made, you will begin downloading the file. Once the file download is complete the connection will be broken.
A second model of P2P clients works in the same way but without a central indexing server. In this scenario the P2P software simply seeks out other Internet users using the same program and informs them of your presence online, building a large network of computers as more users install and use the software.
ü P2P Security ConcernsOne major concern of using P2P architecture in the workplace is, of course, network security. Security concerns stem from the architecture itself. Today we find most blocking and routing handles by a specific server within network, but the P2P architecture has no single fixed server responsible for routing and requests. The first step in securing your P2P network is to adopt a strict usage policy within the workplace. In securing your network against attacks and viruses there are two main strategies where focus is on controlling the network access or the focus is put on controlling the files. A protocol-based approach is where system administrators use a software or hardware solution to watch for and block intrusive network traffic being received through the P2P clients. A second method of protection is a software solution which would provide file surveillance to actively search for files based on their type, their name, their signature or even their content.

ü P2P at WorkP2P is not only popular with home users but many small business have come to rely on this cost-effective solution for sharing files with co-workers and clients. P2P promotes the ease of working together when you're not physically located in the same office. In just seconds updated files and data can be shared with peers and confidential files can be blocked for security. Additionally, companies can also block access to Internet music and video files to assist in maintaining a work-oriented P2P network. Not only does this keep the company free and clear from legal issues regarding music downloading and sharing but it also keeps the corporate bandwidth usage down.


Java Features:
The basic features that make Java a powerful and popular programming language are:
ü Platform Independence
o The Write-Once-Run-Anywhere ideal has not been achieved (tuning for different platforms usually required), but closer than with other languages.
ü Object Oriented
o Object oriented throughout - no coding outside of class definitions, including main().
o An extensive class library available in the core language packages.
ü Compiler/Interpreter Combo
o Code is compiled to bytecodes that are interpreted by Java virtual machines (JVM).
o This provides portability to any machine for which a virtual machine has been written.
o The two steps of compilation and interpretation allow for extensive code checking and improved security.
ü Robust
o Exception handling built-in, strong type checking (that is, all data must be declared an explicit type), local variables must be initialized.
ü Several dangerous features of C & C++ eliminated:
o No memory pointers
o No preprocessor
o Array index limit checking
ü Automatic Memory Management
o Automatic garbage collection - memory management handled by JVM.
ü Security
o No memory pointers
o Programs run inside the virtual machine sandbox.
o Array index limit checking
o Code pathologies reduced by
o bytecode verifier - checks classes after loading
o Class loader - confines objects to unique namespaces. Prevents loading a hacked "java.lang.SecurityManager" class, for example.
o Security manager - determines what resources a class can access such as reading and writing to the local disk.
ü Dynamic Binding
o The linking of data and methods to where they are located is done at run-time.
o New classes can be loaded while a program is running. Linking is done on the fly.
o Even if libraries are recompiled, there is no need to recompile code that uses classes in those libraries.
This differs from C++, which uses static binding. This can result in fragile classes for cases where linked code is changed and memory pointers then point to the wrong addresses.
ü Good Performance
o Interpretation of bytecodes slowed performance in early versions, but advanced virtual machines with adaptive and just-in-time compilation and other techniques now typically provide performance up to 50% to 100% the speed of C++ programs.
ü Threading
o Lightweight processes, called threads, can easily be spun off to perform multiprocessing.
o Can take advantage of multiprocessors where available
o Great for multimedia displays.
ü Built-in Networking
o Java was designed with networking in mind and comes with many classes to develop sophisticated Internet communications.
Java Platform:
The Java platform is the name for a bundle of related programs, or platform, from Sun which allow for developing and running programs written in the Java programming language. The platform is not specific to any one processor or operating system, but rather an execution engine (called a virtual machine) and a compiler with a set of standard libraries that are implemented for various hardware and operating systems so that Java programs can run identically on all of them. Different "editions" of the platform are available, including:
ü Java ME (Micro Edition): Specifies several different sets of libraries (known as profiles) for devices which are sufficiently limited that supplying the full set of Java libraries would take up unacceptably large amounts of storage.
ü Java SE (Standard Edition): For general purpose use on desktop PCs, servers and similar devices.
ü Java EE (Enterprise Edition): Java SE plus various APIs useful for multi-tier client-server enterprise applications.
Java Fundamentals:
ü Java is a Strongly Typed Language.
ü The Java Compiler checks all expressions and parameters to ensure that the types are compatible.
ü Data Types: It has Eight Simple Data types which can be put in four groups, they are:
Þ Integers: byte, short, int, and long for whole valued signed numbers.
Þ Floating-point numbers: float, and double for fractional precision.
Þ Characters: char for representing symbols in character set.
Þ Boolean: boolean a special type for representing true/false.
ü Variables: The basic unit of storage in Java Program. And is defined by the combination of an identifier, a type, and an optional initializer. The syntax for declaring a variable is:
type identifier [= value] [ ,identifier [ = value]…];
e.g.: int a = 5, b=6;
ü Type Conversions and Casting:
Þ Java’s Automatic Conversions:
§ The Two types are compatible.
§ The destination type is larger then the source type.
Þ Casting Incompatible Types:
§ Also called as narrowing conversions, since we are explicitly making the value narrower so that it will fit into the target type.
§ A cast is simply a explicit type conversion. The general form is (target type) value e.g. int a; byte b; b = (byte) a;
ü Arrays:
Þ An array is a group of variables of the same data type and referred to by a common name. An array is contiguous block of memory locations referred by a common name.
E.g. char[] s;
Class[] Obj;
Þ Like all objects we use the new keyword to create an array.
s = new char[10];
Þ Types of Arrays:
§ One Dimensional Array.
type array_name []; //type is the datatype of the array.
§ Multi – Dimensional Array.
type array_name = new type [rows] [cols];
Expressions:
In Java, arithmetic, boolean, and String expressions are written in conventional mathematical infix notation, adapted to the standard computer character set (called ASCII). For example, the Scheme expression (and (< (+ (* x x) (* y y)) 25) (> x 0)) is written in Java as (x*x + y*y > 25) && (x > 0.)
Operators:
ü Java provides a rich operator environment. And it can be classified into four groups as:
Þ Arithmetic: Used in mathematical expressions. They are: +, -, *, /.
Þ Bitwise: It operates on individual bits of integer values. They are: &, , ~,
Þ Relational: It compares two values and determines the relationship between them. They are: ==, !=, <, >, <=, and >=
Þ Logical: It is an easy way to handle multiple conditions. They are: &&, and, !.
Control Structures:
ü Statements that support repetition and conditional execution are called control statements or control structures.
ü They are of two type: They are:
o Branching Statements: - They are If and Switch Statements.
o Looping Statements: - They are for, while, and do-while loops.
Simple If Statement:
ü Syntax: if ( Expression ) Statement.
ü Semantics: The expression must be of type boolean. If it evaluates to true, the given statement is executed, otherwise not.
ü Note that there is only one statement. To execute more than one statement conditionally, a block statement is to be used.
ü Example:
int x=3;
if (x > 2)
{
System.out.println("The value of x is greater than 2.");
}
If – Else Statement:
ü Syntax: if ( Expression ) Statement1 else Statement2
ü Semantics: The expression must be of type boolean. If it evaluates to true, Statement1 is executed, otherwise Statement2.
ü Example:
// guess != secretNumber
if (guess <> secretNumber
System.out.println("Too large!");
}
Nested If – Else Statement:
ü The execution evaluates all conditional expressions beginning from Expression1 until the first expression is found that evaluates to true. Then the corresponding statement sequence is executed, or, if none of the expressions evaluated to true, the statement sequence of the final else part.
ü Example:
if (guess == secretNumber)
{
System.out.println("Congratulations!");
}
else if (guess <> secretNumber
System.out.println("Too large!");
}
Switch Statements:
ü Switch statements are shorthand’s for a certain kind of if statement.
ü It allows for any number of possible execution paths. It works with the byte, short, char, and int primitive data types. It also works with enumerated types (discussed in Classes and Inheritance) and a few special classes that "wrap" certain primitive types:
ü Example:
int month = 8;
switch (month)
{
case 1: System.out.println("January"); break;
case 2: System.out.println("February"); break;
case 3: System.out.println("March"); break;
case 4: System.out.println("April"); break;
case 5: System.out.println("May"); break;
case 6: System.out.println("June"); break;
case 7: System.out.println("July"); break;
case 8: System.out.println("August"); break;
case 9: System.out.println("September"); break;
case 10: System.out.println("October"); break;
case 11: System.out.println("November"); break;
case 12: System.out.println("December"); break;
default: System.out.println("Invalid month.");break;
}
For Loop:
ü The for is Java’s multipurpose loop controller.
ü Syntax: for ( InitStatement ; Expression1 ; Expression2 ) Statement
ü Semantics: The for loop comes close to a while construct:
ü Example:
int factorial = 1;
for (int count=1; count < count =" 1;" count =" 1;" c1 =" new" c2 =" new" name =" input;" p1 =" new" p2 =" new" ob =" new" i =" 88;" name =" n;" stunum =" sn;" stu =" new" radius =" radius;" length =" length;" mycircle =" new" mycylinder =" new" in =" new" content_pane =" getContentPane" flow_panel =" new" content_pane =" getContentPane" border_panel =" new" content_pane =" getContentPane" grid_panel =" new" content_pane =" getContentPane" grid_bag_panel =" new" constraints =" new" fill =" GridBagConstraints.BOTH;" weighty =" 1.0;" weightx =" 1.0;" gridx =" 0;" gridy =" 0;" weightx =" 0.5;" gridx =" 1;" gridy =" 0;" weightx =" 0.1;" gridx =" 2;" gridy =" 0;" weightx =" 1.0;" gridx =" 0;" gridy =" 1;" gridheight =" 2;" weightx =" 1.0;" gridx =" 1;" gridy =" 1;" gridheight =" 1;" gridwidth =" 2;" fill =" GridBagConstraints.NONE;" anchor =" GridBagConstraints.SOUTHEAST;" weightx =" 0.5;" gridx =" 1;" gridy =" 2;" gridheight =" 1;" gridwidth =" 1;" anchor =" GridBagConstraints.WEST;" weightx =" 0.1;" gridx =" 2;" gridy =" 2;" gridheight =" 1;" gridwidth =" 1;" mythread=" new" i="0;" length ="="" in =" System.in;" in =" new" total =" 0;" from =" (byte)" to =" (byte)" b =" System.in.read())" b ="="" length ="="" in =" new" in =" new" spaces =" 0;" total =" 0;" ch =" in.read())" conn =" null;" url = "jdbc:mysql://localhost:3306/" dbname = "jdbctutorial" driver = "com.mysql.jdbc.Driver" username = "root" password = "root" conn =" DriverManager.getConnection(url+dbName,userName,password);" out =" response.getWriter();" thisaddress=" (InetAddress.getLocalHost()).toString();" thisport="3232;" address="+thisAddress+" port="+thisPort); try{ // create the registry and bind the name and object. registry = LocateRegistry.createRegistry( thisPort ); registry.rebind(" s="new" serveraddress="args[0];" serverport="args[1];" text="args[2];" registry="LocateRegistry.getRegistry(" rmiserver=" (ReceiveMessageInterface)(registry.lookup(" name =" name;" deceased =" deceased;" person =" new">