Documente Academic
Documente Profesional
Documente Cultură
UNIT-I
2/18/2013
Web services
Database Servers and RDBMSs
UNIT-I
2/18/2013
any party be restricted from making modifications or making derivative works based on the source code.
UNIT-I
2/18/2013
UNIT-I
2/18/2013
UNIT-I
2/18/2013
Distribution of License
No need for execution of an additional license.
UNIT-I
2/18/2013
Open Source Software (OSS) is an example of a second order Internet effect. The first order was commercialization through buying and selling (e.g., Amazon
and eBay).
The second order is based on collaboration and information sharing (e.g.,
Facebook)
Programmers throughout the world can be engaged in software development.
UNIT-I
2/18/2013
CSS
Developed by Companies and developers work for economic purposes.
OSS
Developed By Volunteers work for peer recognition. People know that recognition as a good developer have great advantage Decentralized, distributed, multi-site development
Users may suggest requirements but they may or may not be implemented
Release is not too often. There may 2/18/2013only yearly be UNIT-I releases.
CSS
Market believes commercial CSS is highly secure because it is developed by a group of professionals confined to one geographical area under a strict time schedule. But quite often this is not the case, hiding information does not make it secure, it only hides its weaknesses Security cannot be enhanced by modifying the source code
2/18/2013 UNIT-I
OSS
OSS is not market driven; it is quality driven. Community reaction to bug reports is much faster compared to CSSD which makes it easier to fix bugs and make the component highly secure
The ability to modify the source code could be a great advantage if you want to deploy a highly secure system 10
Open Source is a certification standard issued by the Open Source Initiative (OSI)
indicates that the source code of a computer program is made available free of charge to the general
OSI
public.
of the program.
The distributed program must make the source code accessible to the user. The author must allow modifications and derivations of the work under the program's original
name.
No person, group or field of endeavor can be denied access to the program
11
UNIT-I
2/18/2013
Web.
Languages:
Perl Python Ruby Tcl/Tk
12
UNIT-I
2/18/2013
13
UNIT-I
2/18/2013
o GCC - The compiler for C, C++, Fortran, Java, that comes standard with all the major OSS
o JBOSS - A popular open-source implementation of J2EE http://www.jboss.org o Perl - A very popular language widely used in scripts to drive `live content on the World
http://www.php.net
o Python - A popular object-oriented scripting language for web and desktop development
http://www.python.org
14
UNIT-I
2/18/2013
Linux :The most popular OSS operating system on the planet http://www.linux.org
Internet/intranet Services and Applications
Apache web server - Accounts for over 60% of the web servers on the Internet http://www.apache.org
o BIND name server - The software that provides the DNS (domain name service). Many of
the root name servers as well as the Internet backbone network ISPs use BIND http://www.isc.org/products/BIND/
o Sendmail (Mail Exchange server) - The most widely used email transport software on the
Internet http://www.sendmail.org
UNIT-I
15
2/18/2013
Database Systems
o MySQL - A very popular open-source RDBMS http://www.mysql.com o PostgreSQL - A popular open-source RDBMS with many advanced features
http://www.postgresql.org
Desktop Applications o OpenOffice.org - An integrated office suite featuring word-processing, spreadsheet, drawing and
http://www.mozilla.org
16
UNIT-I
2/18/2013
and Red Hat Linux is supported and maintained by Red Hat Corporation
17
UNIT-I
2/18/2013
Apple
released core layers of Mac OS X Server as an open source BSD operating system
called Darwin; open sourcing the QuickTime Streaming Server and the OpenPlay network gaming toolkit HP uses and releases products running Linux Sun uses Linux; supports some open source development efforts (Eclipse IDE for Java and the Mozilla web browser)
18
UNIT-I
2/18/2013
ActiveState
develops and sells professional tools for Perl, Python, and Tcl/tk developers.
19
UNIT-I
2/18/2013
Hat for Linux, Zend for PHP, and recently Sun Microsystems for MySQL)
The Internet is another great source of informal support that is efficient (Newsgroups, FAQs and
HOW-TO documents).
20
UNIT-I
2/18/2013
21
UNIT-I
2/18/2013
TWO ORGANIZATIONS
Free Software Foundation (FSF)
Open Source Initiative (OSI)
22
UNIT-I
2/18/2013
(www.opensource.org)
The Open Source Initiative approves open source licenses after they have
successfully gone through the approval process and comply with the Open Source
Definition (above).
All approved licences meet their Open Source Definition
(www.opensource.org/docs/definition.php)
Approved licences >50 and include the GPL, LGPL, MPL and BSD.
23
UNIT-I 2/18/2013
Copyright
Software is protected by copyright law By default only the owner of software may copy, adapt or distribute it. The owner of software can agree to let another person copy, adapt or distribute the
24
UNIT-I 2/18/2013
Academic Free License Apache Software License Apple Public Source License Artistic license BSD license GNU GPL .
GNU LGPL IBM Public License Intel Open Source License MIT license Sun Public License
25
UNIT-I
2/18/2013
open-source software and redistribute it with or without modifications as proprietary software. (e.g. Apache, BIND )
o GNU General Public License(GPL) : It is a license that requires that the product
derived from the original open-source software must also be distributed under the same licensing regime as the original. Thus it cannot be turned into a closed-source product.
26
UNIT-I
2/18/2013
is being distributed under a license that conforms to the Open Source Definition.
2/18/2013
UNIT-I
27
BSD license
no restriction on derivative work The only restrictions placed on users of software released under a typical BSD license are
that if they redistribute such software in any form, with or without modification, they
must include in the redistribution
(1) the original copyright notice, (2) a list of two simple restrictions and (3) a disclaimer of liability.
28
UNIT-I
2/18/2013
1.Open Source part 2. anything added by user Things added by user can be proprietary, if he does not modify the Open Source part Everything is Open Source if he modifies the Open Source part
29
UNIT-I
2/18/2013
Apache license
BSD + condition: OK to distribute code if under the Apache name, but not for resale
30
UNIT-I
2/18/2013
Proprietary: the use, redistribution or modification of the software is prohibited, or requires you to ask for permission, or is restricted so much that you effectively can't do it freely.
2.
Semi-free: not free, but comes with permission for individuals to use, copy, distribute, and modify (including distribution of modified versions) for non-profit purposes. e.g. PGP
3.
Free
A. Copylefted: redistribution cannot add additional restriction B. Non-Copylefted:
31
UNIT-I
2/18/2013
distribution terms, which are a legal instrument that gives everyone the rights to
use, modify, and redistribute the program's code or any program derived from it but only if the distribution terms are unchanged.
Thus, the code and the freedoms become legally inseparable.
32
UNIT-I
2/18/2013
33
UNIT-I
2/18/2013
BSD vs GPL
The biggest difference between the GPL and BSD licenses is the fact that the
derivative works but requiring that such works be redistributable under the same terms (i.e., the same license) as the original work.
34
UNIT-I
2/18/2013
Bug Reports
User
2/18/2013
36
UNIT-I
2/18/2013
1.
The availability of the source code and the right to modify it is very important.
It enables the unlimited tuning and improvement of a software product. It also makes it possible to port the code to new hardware, to adapt it to changing conditions, and to reach a detailed understanding of how the system works.
2.
The right to redistribute modifications and improvements to the code, and to reuse other open source code, permits all the advantages due to the modifiability of the software to be shared by large communities.
3.
No exclusive rights to the software Open source software is open to everyone. Because of this no individual programmer or company can specify the direction that the development should take.
37
UNIT-I
2/18/2013
4.
population of users, which helps in turn to build up a market for support and customization of the software, which can only attract more and more developers to work in the project.
This in turn helps to improve the quality of the product, and to improve its functionality.
5. The biggest advantage of open source for users is that most projects are free to
38
UNIT-I
2/18/2013
Cons
is that the focus is often on backend processing of information and not on user
interfaces. Microsoft Windows has arguably one of the easiest interfaces with which to work. Often, open source software such as Linux requires the user to have specialized knowledge that cannot be configured with just clicks of a mouse. In addition, open source projects often do not have good documentation to walk the user through the learning and using of the technologies.
39
UNIT-I
2/18/2013
40
UNIT-I
2/18/2013
Users
Single User,Multi User
Processing
Uni processing,Multi processing
Timesharing
is the sharing of a computing resource among many users by means of
41
UNIT-I
2/18/2013
History
Multics 1964
Unics 1969 Minix 1990 Linux 1991
42
UNIT-I
2/18/2013
Multics
Multiplexed Information and Computing Service Written in 1964 Mainframe Timesharing OS Last version was shut down on October 30, 2008 Monolithic kernel
43
UNIT-I
2/18/2013
Unics
Uniplexed Information and Computing System
Later renamed as UNIX Written in 1969
44
UNIT-I
2/18/2013
Minix
Minimal Unix
Tanenbaum developed this OS Mainly for educational purpose
Unix like OS, implemented with Micro kernel. So the name Minix
45
UNIT-I
2/18/2013
What is Linux?
Developed in 1991 by a University of Finland student Linus Torvalds. Basically a kernel, it was combined with the various software and compilers from GNU
more
46
UNIT-I
2/18/2013
Linux
Used in most of the computers, ranging from super computers to embedded
system
Multi user Multi tasking Time sharing Monolithic kernel Stable version of linux kernel 2.6.28, released on 24-Dec-2008
47
UNIT-I
2/18/2013
History of Linux
Inspired by the UNIX OS, the Linux kernel was developed as a clone of UNIX GNU was started in 1984 with a mission to develop a free UNIX-like OS Linux was the best fit as the kernel for the GNU Project Linux kernel was passed onto many interested developers throughout the Internet Linux today is a result of efforts of thousands of individuals, apart from Torvalds
48
UNIT-I
2/18/2013
of GNU and Linux is the GNU/Linux operating system, now used by millions.
www.gnu.org
49
UNIT-I
2/18/2013
53
UNIT-I
2/18/2013
54
UNIT-I
2/18/2013
55
UNIT-I
2/18/2013
FOSS
Free Open Source Software
Free Means Liberty and not related to Price or cost Open Source code is available and any body can contribute to the
58
UNIT-I
2/18/2013
59
UNIT-I
2/18/2013
Kernel
Core or nucleus of an operating system Interacts with the hardware
First program to get loaded when the system starts and runs till the
60
UNIT-I
2/18/2013
Monolithic
Kernel types
All OS related code are stuffed in a single module Available as a single file Advantage : Faster functioning Micro OS components are isolated and run in their own address space Device drivers, programs and system services run outside kernel memory space.Only
a few functions such as process scheduling, and interprocess communication are included into the microkernel
Supports modularity & Lesser in size
61 UNIT-I
2/18/2013
Shell
Program that interacts with kernel
Bridge between kernel and the user Command interpreter
User can type command and the command is conveyed to the kernel and it
will be executed
62
UNIT-I
2/18/2013
Types of Shell
Sh simple shell BASH Bourne Again Shell KSH Korne Shell CSH C Shell SSH Secure Shell To use a particular shell type the shell name at the command prompt. Eg $csh will switch the current shell to c shell To view the current shell that is being used, type echo $SHELL at the command
prompt
63
UNIT-I
2/18/2013
Linux Distributions
Today there are hundreds of different distributions available popular Linux distributions
include SUSE Linux Fedora Linux Red Hat Enterprise Linux Debian Linux ALT Linux TurboLinux Mandrake Linux Lycoris Linux Linspire Gentoo Linux
Ubuntu
UNIT-I
2/18/2013
LINUX DISTRIBUTIONS
Red Hat Linux : One of the original Linux distribution. The commercial, nonfree version is Red Hat Enterprise Linux, which is aimed at big companies
mind.
SuSE Linux : SuSE was recently purchased by Novell. This distribution is primarily for pay because it contains many commercial programs, although free version that you can download. Mandrake Linux : Mandrake is perhaps strongest on the desktop. Originally based off of Red Hat Linux. Gentoo Linux : Gentoo is a specialty distribution meant for programmers. there's a available stripped-down
Linux OS
66
UNIT-I
2/18/2013
Operating System
User 1
User 2
67
UNIT-I
2/18/2013
OPERATING MODES
68
UNIT-I
2/18/2013
USER MODE
User mode is the normal mode of operating for programs. Web browsers, calculators, etc.
recoverable.
Most of the code running on your computer will execute in user mode. When in User Mode, some parts of RAM cant be addressed, some instructions cant
69
UNIT-I
2/18/2013
Kernel mode, on the other hand, is where programs communicate directly with the kernel. The kernel-mode programs run in the background, making sure everything runs smoothly
KERNEL MODE
- things like printer drivers, display drivers, drivers that interface with the monitor,
keyboard, mouse, etc.
The executing code has complete and unrestricted access to the underlying hardware. It can execute any CPU instruction and reference any memory address.
Kernel mode is generally reserved for the lowest-level, most trusted functions of the
operating system.
Crashes in kernel mode are catastrophic; they will halt the entire PC.
70
UNIT-I
2/18/2013
KERNEL MODE
A good example of this would be device drivers.
A device driver must tell the kernel exactly how to interact with a piece of
vulnerable to programs running in this mode, so it becomes highly crucial that drivers are properly debugged before being released to the public.
71
UNIT-I
2/18/2013
normal operation is by making an system call such as open, read, write etc.
Whenever a user application calls these system call APIs with appropriate parameters, a software
interrupt/exception(SWI) is triggered.
As a result of this SWI, the control of the code execution jumps from the user application to a
predefined location in the Interrupt Vector Table [IVT] provided by the OS.
This IVT contains an address for the SWI exception handler routine, which performs all the
necessary steps required to switch the user application to kernel mode and start executing kernel instructions on behalf of user process.
72
UNIT-I
2/18/2013
73
UNIT-I
2/18/2013
74
UNIT-I
2/18/2013
User Applications
At the top is the user, or application, space.
This is where the user applications are executed. Below the user space is the kernel space where the Linux
kernel exists.
75
UNIT-I
2/18/2013
and the kernel. This is important because the kernel and user application occupy different protected address spaces.
And while each user-space process occupies its own virtual address space,
76
UNIT-I
2/18/2013
write.
Below the system call interface is the kernel code, which can be more accurately defined as the
77
UNIT-I
2/18/2013
File management
Directory Tree
(root)
When you log on the the Linux OS using your username you are automatically located in your home directory.
hardware.
/etc : System configuration files. /home : Every user except root gets her own folder in here, named for her login account. So, the
user who logs in with linda has the directory /home/linda, where all of her personal files are kept.
/lib : System libraries. Libraries are just bunches of programming code that the programs on your
: Mount points. When you temporarily load the contents of a CD-ROM or USB drive, you
Linux distributions (including Fedora) are set up to delete any file that's been in this directory
happening on your system, data on its way to the printer, and so on).
Home directory
You can see what your home directory is called by entering
THE KERNEL
Block diagram of Linux Kernel
request service from the operating system. API is a function definition that specifies how to obtain a given service(ex.calloc,malloc ,free etc.), while System call is an explicit request to the kernel made via a software interrupt Invoking a system call by user mode process
while ensuring that necessary hardware actions are performed by the kernel on time.
The Memory Manager (MM) permits multiple process to securely share the machine's
in when it is needed.
a larger region.
If a small memory request cannot be satisfied by allocating an existing small free
region, then a larger free region will be subdivided into two partners to satisfy the request.
Memory allocations in the Linux kernel occur either statically (drivers reserve a
contiguous area of memory during system boot time) or dynamically (via the page allocator).
Virtual Memory
The VM system maintains the address space visible to each process: It creates pages of
virtual memory on demand, and manages the loading of those pages from disk or their swapping back out to disk as required.
The VM manager maintains two separate views of a processs address space: A logical view describing instructions concerning the layout of the address space. The address space consists of a set of non overlapping regions, each representing a
File System
A file system is the methods and data structures that an operating system uses to
keep track of files on a disk or partition; that is, the way the files are organized on the disk.
A file is an ordered string of bytes Files are organized in directory. File information like size,owner,access permission etc. are stored in a separate data
Filesystem
The Virtual Filesystem (also known as Virtual Filesystem Switch or VFS)
is a kernel software layer that handles all system calls related to a standard Unix filesystem.
Its main strength is providing a common interface to several kinds of
Network stack
The network stack, by design, follows a layered architecture modeled after the
protocols themselves. Recall that the Internet Protocol is the core network layer protocol that sits below the transport protocol .
Above TCP is the sockets layer, which is invoked through the SCI. The sockets layer is the standard API to the networking subsystem and provides
Datagram Protocol (UDP), the sockets layer provides a standardized way to manage connections and move data between endpoints.
While much of Linux is independent of the architecture on which it runs, there are
Architecture-dependent code
elements that must consider the architecture for normal operation and for efficiency.
The ./linux/arch subdirectory defines the architecture-dependent portion of the
kernel source contained in a number of subdirectories that are specific to the architecture .
Each architecture subdirectory contains a number of other subdirectories that
focus on a particular aspect of the kernel, such as boot, kernel, memory management, and others.
Linux Kernel_Process
Process is a program in execution.
Process is represented in OS by Process
Control Block.
Interactive process
Interactive processes are those processes that are invoked by a user and can
and is using the terminal as its stdin (standard input) and stdout (standard
output).
A background process is not interacting with the user and can be in one of two
System Process
Daemon (day-mon). Daemon is the term used to refer to process' that are
running on the computer and provide services but do not interact with the
console.
Most server software is implemented as a daemon. Apache, Samba, are all
examples of daemons.
Any process can become a daemon as long as it is run in the background,
At times when the total system load is low enough to accept extra jobs:
Batch processes
In large environments, the system administrator may prefer batch
processing when large amounts of data have to be processed or when tasks demanding a lot of system resources have to be executed on an already loaded system.
Batch processing is also used for optimizing system performance.
104
UNIT-I
2/18/2013
105
UNIT-I
2/18/2013
106
UNIT-I
2/18/2013
107
UNIT-I
2/18/2013
108
UNIT-I
2/18/2013
109
UNIT-I
2/18/2013
110
UNIT-I
2/18/2013
Process State-FLAGS
Each process on the system is in exactly one of five different states. This value
TASK_RUNNING.
The process can awake and become runnable if it receives a signal.
FLAGS
TASK_UNINTERRUPTIBLE:
This state is identical to TASK_INTERRUPTIBLE except that it does not
TASK_ZOMBIE:
PROCESS STATES-FLAGS
The task has terminated, but its parent has not yet issued a wait() system
call.
The task's task structure must remain in case the parent wants to access it. If the parent calls wait(), the task structure is deallocated.
TASK_STOPPED:
Process execution has stopped; the task is not running nor is it eligible to
run.
This occurs if the task receives the SIGSTOP, SIGTSTP, SIGTTIN, or
Zombie process
A zombie process or defunct process is a process that has completed
status.
When a process ends, all of the memory and resources associated with it
are deallocated so they can be used by other processes. However, the process's entry in the process table remains.
The parent can read the child's exit status by executing the wait system
ZOMBIE PROCESS
When a child exits, the parent process will receive a SIGCHLD signal to
indicate that one of its children has finished executing; the parent process will typically call the wait() system call at this point.
That call will provide the parent with the childs exit status, and will
a zombie state to ensure that future children that it may create will not receive the same pid
usually immediately.
However, if the parent process isn't programmed properly or has a bug
and never calls "wait," the zombie process remains, eternally waiting for
process
Zombie: process terminated, but information is still there in the process
table.
getpid-
getpid
returns
the
PID
of
the
calling
process.
getppid- getppid returns the PID of the parent of the calling proces main() { pid_t pid, ppid; printf( "My PID is:%d\n\n",(pid = getpid()) ); printf( "Par PID is:%d\n\n",(ppid = getppid()) ); }
2. fork()
#include <sys/types.h>
exact duplicate.
Implicitly specifies code, registers, stack, data, files
fork() as a diagram
Parent
pid = fork() Child pid == 0 Shared Program Data Copied
Data
all files open to the parent are also open to the child.)
The return value from fork is -1 if failure (e.g., the process table is full) 0 (in the child) pid of the child (in the parent)
wait
wait is called by a parent process to await termination by one of its
zombie process), the child is removed from the process table, and the wait
Wait..
When the call returns, the return value is the pid of the terminated child
provide options to allow waiting on a specific child, and return without blocking.
126
UNIT-I
2/18/2013
wait() Actions
A process that calls wait() can: suspend (block) if all of its children are still running, or
or
processes.
another program.
When a program calls an exec function, that process immediately ceases
executing that program and begins executing a new program from the beginning, assuming that the exec call doesnt encounter an error.
Within the exec family, there are functions that vary slightly in their
a program name and search for a program by that name in the current execution path; functions that dont contain the p must be given the full path of the program to be executed.
Exec()
Functions that contain the letter v in their names (execv, execvp, and execve)
accept the argument list for the new program as a NULL-terminated array of
pointers to strings.
Functions that contain the letter l (execl, execlp, and execle) accept the
SCHEDULING IN LINUX
scheduling policy
Linux has several, conflicting objectives Fast process response time Good throughput for background jobs Avoidance of process starvation
goodness ranking
Linux uses dynamic priorities, i.e., priorities are adjusted over time to
eliminate starvation
Processes that have not received the CPU for a long time get
their priorities increased, processes that have received the CPU often get their priorities decreased
computation before performing IO. Such programs typically do not use up their entire CPU quantum.
CPU-bound programs, on the other hand, use their entire quantum without performing
priority to I/O-bound programs and allow them to execute ahead of the CPU-bound
programs.
Interactive versus batch versus real-time These classifications are somewhat independent, e.g., a batch process can be either I/O-
bound or CPU-bound.
Linux recognizes real-time programs and assigns them high priority,
the CPU
compiler
The text editor will be block often since it is waiting for I/O When the I/O interrupt receives a key-press for the editor, the editor is put on the
ready queue and the scheduler is called since the editors priority is higher than the
compiler. The editor gets the input and quickly blocks for more I/O
interactive processes because their dynamic priority remains high, thus they
quantum
This does not include processes that are blocking on some wait queue,
queue
value
When the process is running, decrease that value each timer tick The static priority of real-time process is always higher than the dynamic
processes to execute
over into the next epoch (the unused quantum is not directly used, but a bonus
is calculated)
Why? Process that block often will not use their quantum; this is used to favor
divided in half; half for the parent and half for the child
other processes
priority - the base time quantum (or base priority) of the process counter - the number of CPU ticks left in its quantum for the current
driver can invoke schedule() directly if it will be executing a long iterative task.
The current process is taken off of the ready queue and is placed on
current process
to the end of the queue for its static priority and a new thread gets to run.
process if a process is already in the kernel or if the kernel is in the middle of doing something else
If the current process is SCHED_RR and has used all of its quantum, then it
is given a new quantum and placed at the end of the ready queue
If the process is not SCHED_RR, then it is removed from the ready queue
ready queue have used up their quantum (i.e., all have a zero counter
field). In this case it must start a new epoch by assigned a new quantum to
all processes
If a higher priority process was found, then the scheduler performs a
process switch
network transfer)
Support for real-time processes is weak
Personalities in Linux
this is possible only if the files include machine code for the same computer architecture on which the kernel is running.
Two kinds of support are offered for these "foreign" programs: Emulated execution: necessary to execute programs that include system calls that
compliant
"Portable Operating System Interface", is a family of standards specified by
Microsoft MS-DOS and Windows programs are emulated: they cannot be natively
Personsa()
executed, because they include APIs that are not recognized by Linux
POSIX-compliant programs compiled on operating systems other than Linux can be
executed without too much trouble, because POSIX operating systems offer similar APIs.
A process specifies its execution domain by setting the personality field of its
descriptor. Each process has an associated personality identifier that can slightly modify the semantics of certain system calls. Used primarily by emulation libraries to request that system calls be compatible with certain specific flavors of OS.
A
named personality( )
Programmers are not expected to directly change the personality of their programs;
instead, the personality( ) system call should be issued by the glue code that sets up the execution context of the process
Personalities in LINUX
Personality PER_LINUX PER_BSD PER_SUNOS PER_RISCOS PER_SOLARIS Operating system Standard execution domain
Linux supports different execution domains, or personalities, for each process. Among other things, execution domains tell Linux how to map signal