Вы находитесь на странице: 1из 54

Introduction to Linux

Click to edit Master subtitle style

By Haris Masood.

History
n n

Linux is a modern, free operating system based on UNIX standards First developed as a small but self-contained kernel in 1991 by Linus Torvalds, with the major design goal of UNIX compatibility Its history has been one of collaboration by many users from all around the world, corresponding almost exclusively over the Internet It has been designed to run efficiently and reliably on common PC hardware, but also runs on a variety of other platforms The core Linux operating system kernel is entirely original, but it can run much existing free UNIX software, resulting in an entire UNIX-compatible operating system free from proprietary code Many, varying Linux Distributions including the kernel, applications, and management tools

The Linux Kernel


n

Version 0.01 (May 1991) had no networking, ran only on 80386-compatible Intel processors and on PC hardware, had extremely limited device-drive support, and supported only the Minix file system Linux 1.0 (March 1994) included these new features:
n n n n n n

Support for UNIXs standard TCP/IP networking protocols BSD-compatible socket interface for networking programming Device-driver support for running IP over an Ethernet Enhanced file system Support for a range of SCSI controllers for high-performance disk access Extra hardware support

Version 1.2 (March 1995) was the final PConly Linux kernel

Linux 2.0
n

Released in June 1996, 2.0 added two major new capabilities: n Support for multiple architectures, including a fully 64-bit native Alpha port n Support for multiprocessor architectures Other new features included: n Improved memory-management code n Improved TCP/IP performance n Support for internal kernel threads, for handling dependencies between loadable modules, and for automatic loading of modules on demand n Standardized configuration interface Available for Motorola 68000-series processors, Sun Sparc systems, and for PC and PowerMac systems 2.4 and 2.6 increased SMP support, added journaling file system, preemptive kernel, 64-bit memory support

The Linux System


n

Linux uses many tools developed as part of Berkeleys BSD operating system, MITs X Window System, and the Free Software Foundation's GNU project The min system libraries were started by the GNU project, with improvements provided by the Linux community Linux networking-administration tools were derived from 4.3BSD code; recent BSD derivatives such as Free BSD have borrowed code from Linux in return The Linux system is maintained by a loose network of developers collaborating over the Internet, with a small number of public ftp sites acting as de facto standard repositories

Design Principles
n n

Linux is a multiuser, multitasking system with a full set of UNIX-compatible tools Its file system adheres to traditional UNIX semantics, and it fully implements the standard UNIX networking model Main design goals are speed, efficiency, and standardization Linux is designed to be compliant with the relevant POSIX documents; at least two Linux distributions have achieved official POSIX certification The Linux programming interface adheres to the SVR4 UNIX semantics, rather than to BSD behavior

Components of a Linux System

Components of a Linux System (Cont.)


n

Like most UNIX implementations, Linux is composed of three main bodies of code; the most important distinction between the kernel and all other components The kernel is responsible for maintaining the important abstractions of the operating system n Kernel code executes in kernel mode with full access to all the physical resources of the computer n All kernel code and data structures are kept in the same single address space

Components of a Linux System (Cont.)


n

The system libraries define a standard set of functions through which applications interact with the kernel, and which implement much of the operating-system functionality that does not need the full privileges of kernel code The system utilities perform individual specialized management tasks

Kernel Modules
n n

Sections of kernel code that can be compiled, loaded, and unloaded independent of the rest of the kernel A kernel module may typically implement a device driver, a file system, or a networking protocol The module interface allows third parties to write and distribute, on their own terms, device drivers or file systems that could not be distributed under the GPL Kernel modules allow a Linux system to be set up with a standard, minimal kernel, without any extra device drivers built in Three components to Linux module support: n module management n driver registration n conflict resolution

Module Management
n n

Supports loading modules into memory and letting them talk to the rest of the kernel Module loading is split into two separate sections: n Managing sections of module code in kernel memory n Handling symbols that modules are allowed to reference The module requestor manages loading requested, but currently unloaded, modules; it also regularly queries the kernel to see whether a dynamically loaded module is still in use, and will unload it when it is no longer actively needed

Driver Registration
n n

Allows modules to tell the rest of the kernel that a new driver has become available The kernel maintains dynamic tables of all known drivers, and provides a set of routines to allow drivers to be added to or removed from these tables at any time Registration tables include the following items: n Device drivers n File systems
n n

Network protocols Binary format

Conflict Resolution
n

A mechanism that allows different device drivers to reserve hardware resources and to protect those resources from accidental use by another driver The conflict resolution module aims to: n Prevent modules from clashing over access to hardware resources n Prevent autoprobes from interfering with existing device drivers n Resolve conflicts with multiple drivers trying to access the same hardware

Process Management
n

UNIX process management separates the creation of processes and the running of a new program into two distinct operations. n The fork system call creates a new process n A new program is run after a call to execve Under UNIX, a process encompasses all the information that the operating system must maintain t track the context of a single execution of a single program Under Linux, process properties fall into three groups: the processs identity, environment, and context

Process Identity
n

Process ID (PID). The unique identifier for the process; used to specify processes to the operating system when an application makes a system call to signal, modify, or wait for another process Credentials. Each process must have an associated user ID and one or more group IDs that determine the processs rights to access system resources and files Personality. Not traditionally found on UNIX systems, but under Linux each process has an associated personality identifier that can slightly modify the semantics of certain system calls n Used primarily by emulation libraries to request that system calls be compatible

Scheduling
n

The job of allocating CPU time to different tasks within an operating system While scheduling is normally thought of as the running and interrupting of processes, in Linux, scheduling also includes the running of the various kernel tasks Running kernel tasks encompasses both tasks that are requested by a running process and tasks that execute internally on behalf of a device driver As of 2.5, new scheduling algorithm preemptive, priority-based n Real-time range n nice value

Relationship Between Priorities and Time-slice Length

List of Tasks Indexed by Priority

Linux Modules
n n n n

Speed and efficiency Object file link/unlink to Kernel during run time Example SCSI standard device driver Portable written in C language

Single User

Multi-Programming with Two Programs

Multi-Programming with Three Programs

Linuxs sponsors and contributors


n

Sponsors
n n n

Contributors
n n n n n n

Hewlett Packard IBM Intel Caldera Inc. Corel Corporation Oracle SGI Turbolinux Inc. Red Hat Software

Fear, Uncertainty, and Doubt (FUD)


n n n n n

Can we trust production data to a free software program? Free software Linux is a Unix clone cut down to run on a PC Why compromise just to save a few bucks? Linux is insecure

Hardware Requirements
n n n

Linux hardware requirements Limitations Disadvantages

Memory Requirements
n n n n n

Linux requires very little memory to run You should have a minimum 2 MB of RAM The more memory, the faster it will run 8 MB is enough for personal use 16 MB or more for a power users

Hard Drive Controller Requirements


n

You can run a minimal system completely from floppy. You must have an AT-Standard (16bit) controller Rule for non-SCSI controllers

Hard Drive Space Requirements


n n n n n

A complete system requires 10-20MB of memory space A larger system requires 100-150MB Installing Linux on a system with so little disk space will omit useful applications Linux as a workstation: minimum of 600 MB Linux as a server: minimum 1.6 GB of free disk space needed

Monitor & Video Adaptor Requirements


n

Linux supports all Hercules, CGA, EGA, VGA, IBM monochrome, and super VGA video cards and monitors for the default text-based interface

n n n n

CD-ROM storage Soundboards Pointing Devices (Mouse, trackball) Printers

Other Supported Hardware

Linux Performance
n n

Key factors: features and performance It runs on a wider range of hardware platforms and run on less expensive and powerful systems. Linux exceeds other operating systems in its multiprocessing capabilities and its support of advanced TCP/IP networking facilities

Linux Performance
n

Linux does not restrict the number of clients connected at the same time It provides more reliable data storage than other operating systems Linux provides advanced disk management (RAID) which makes it possible to automatically duplicate stored data on several

Gnome

KDE

Command Line Interface


n

You also have access to some UNIX servers as well.


n

You can logon from virtually any computer that has internet access whether it be Windows, Mac, or UNIX itself.

In this case you are communicating through a local terminal to one of these remote servers.
n n

All of the commands actually execute on the remote server. It is also possible to open up graphical applications through this window, but that requires a good bit more setup and software.

The Terminal

Linux OS
n n

n n n n n

Developed in 1991 by Linus Torvalds Used in most of the computers, ranging from super computers to embedded system Multi user Multi tasking Time sharing Monolithic kernel Latest stable version of linux kernel 2.6.28, released on 24-Dec-2008

Linux OS

Linux distributions
n n n n n n n

Redhat Fedora Debian Novells SUSE Linux Ubuntu Mandrake Live CDs Knoppix and more

GNU/Linux
n n

Only the kernel is called by the name Linux The rest are the tools developed under GNU Project Hence the name GNU/Linux

Text editors
n n n n n n

Vi Emacs gEdit kWrite TextPad And more

File Management Commands


n n

mkdir - creating directory


n

mkdir dirname

rmdir removing directory and its contents


n

rmdir dirname cd dirpath cp file1 file2 mv oldfile newfile

n n n

cd Change directory
n

cp Copying files
n

mv Moving or renaming files


n

Shell Scripts
n

To Print a line
n

echo Hello World (Prints Hello World in the screen) read n (Stores the content entered by user in variable n # This is a comment Only single line comment is available. For multi line comment, we need to use # symbol in lines which we want to comment.
Softsmith Infotech

To read a line
n

To Comment a line
n n

Linux vs. Windows


n

OS does not have to use a graphical interface.


n n

The OS itself (the kernel) is incredibly small. The GUI just another application (or set of applications) that can be installed and run on top the existing textbased OS. Windows typically uses FAT32 or NTFS file systems. Linux typically uses the ext2 or ext3 file systems In much larger research and university environments, where file access is necessary across the network, something like Network File System (NFS) or the Andrew File System (AFS) is used. We use AFS here on GL at UMBC. Windows lists all drives separately (A:,C:,D:, etc), with My Computer at the highest level. UNIX starts its highest level at / and drives can be mounted anywhere underneath it.

File system differences.


n n n

n n

UMBCs Computing Environment


n

You need a GL account username and password!


n

Since almost all UNIX systems are multi-user systems you will need to have a logon name and password to authenticate yourself to the system. At UMBC, when you signup for a GL account, you are given a username and password, which is your means of logging on to any computer system, be it UNIX, Windows or Mac.

Where is UNIX / Linux available?


n

There are many labs in the Engineering (ENG) building where there are dual-bootable Windows and Linux PCs. You can simple reboot one of these machines and select Linux as the operating system. There are also a couple of other places across the campus where you can sit directly in front of a UNIX computer. UMBC's Office of Information Technology (OIT) maintains a list of the labs it maintains as well as descriptions about the operating systems in those labs. This list is online at http://www.umbc.edu/oit/classroomtechnology/labs/lablocation .

If all else fails in Gnome or KDE


n

If your session seems to have froze up, you can press ctrl-altbackspace to restart the X window server, in the process logging you out. Note that by doing it this way, you risk losing unsaved work.

What is X Window?
n

X window is the program that draws windows on the screen under most GUI-based versions of UNIX. It is important to note that the language that X windows speaks is completely different from that of Microsoft Windows or Mac OS X. Any X window system consists of 2 distinct parts the X server and 1 or more X clients.
n

The server controls the display directly, and is responsible for all input/output via the keyboard, mouse or display. The clients, on the other hand, do not access the screen directly - they communicate with the server, which handles all input and output.
n n

It is the clients which do the "real" computing work - running applications or whatever. The clients communicate with the server, causing the server to open one or more windows to handle input and output for

n n

Whats the deal about the X Window Server and Client?!

The X window server runs on the machine to which the monitor is connected. The clients may also run on this machine, communicating directly with the server. On most workstations, this is the normal situation. However, X is a networked window system, and it is possible for the client to run on a remote machine, communicating with the server via some form of network. It is possible to connect to one of the UMBC servers and launch graphical applications from one of the UNIX servers.
n

This does require that an X window server is installed on the machine from which you are connecting from. This is automatically running if you are running a GUI UNIX system. You can also install an X window server on top of Microsoft Windows, so that you can open up windows locally that are talking to the server at UMBC. Like I said earlier, this does require installing some software on the client side, and time permitting we may talk about this later in the course.

What is a Desktop Manager?


n

Gnome and KDE are examples of desktop managers. Both of these look a lot like Microsoft Windows.
n

They have the equivalent of a Start Menu, have an equivalent of Windows Explorer, and have some sort of control panel.

The roll of the Desktop Manager is to provide you with the ability to manage all of the details of your system that would otherwise require you to type in a bunch of commands in a terminal window.
n

These details include managing your files, launching programs, configuring various aspects of your system, etc.

It is also worthy to note that the desktop manager is optional. Many older systems did not have a desktop manger that sat in-between the X server and the Window manager.

Some Notes on X window, Desktop Managers & Window Managers


n n n

Most UNIX systems can be installed without the GUI. The GUI is just another application that runs on top of the operating system. There are many implementations of all three of these components.
n n

It is possible to mix and match implementation and versions of these. They need not be alike and need not be all by the same organization.

This is quite a shift in paradigm from Microsoft and Apple.

Programming Tools and Utilities Available under Linux


n

Text Editors
n n n n

Debuggers
n

Xemacs Emacs Pico vi C compiler - gcc C++ compiler - g++ Java compiler & Java Virtual Machine - javac & java

C / C++ debugger - gdb Perl - perl Tcl/Tk - tcl & wish Web Browsers - Mozilla, Netscape, Firefox, and Lynx (lynx is text based) Instant Messengers Gaim Email - Netscape is there, but we will learn Pine

Interpreters
n n

Compilers
n n n

Miscellaneous
n

Advantages of Linux

Advantages of Open Source Language

Growth of Linux OS