Top Banner

of 17

Linux 301

Jun 04, 2018

Download

Documents

jamshed90
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 8/13/2019 Linux 301

    1/17

    16-02-2014Dr. Vaibhav Bansal 1

    MCA301 : LINUX PROGRAMMING

    OBJECTIVES:A comprehensive overview of the Linux operating system

    along withShell commands and shell scripting

    Implementation of Linux System programmes through GCC

    compiler.

    Understanding of basic concept of Socket programming

    (TCP and UDP)

    Tecnia Institute of Advanced

    Studies

  • 8/13/2019 Linux 301

    2/17

    Events leading to creation

    Unix : The Unixoperating system was conceivedand implemented by Ken Thompsonand DennisRitchie(both of AT&T Bell Laboratories) in 1969

    and first released in 1970. In 1983, Richard Stallman started the GNU

    projectwith the goal of creating a freeUNIX-likeoperating system (GNU: GNUis a recursive acronymfor"GNU's Not Unix!",chosen because GNU's design is Unix-like,but differs from Unix by being free software and containingno Unixcode)

    16-02-2014Dr. Vaibhav Bansal 2

    http://en.wikipedia.org/wiki/Unixhttp://en.wikipedia.org/wiki/Ken_Thompsonhttp://en.wikipedia.org/wiki/Dennis_Ritchiehttp://en.wikipedia.org/wiki/Dennis_Ritchiehttp://en.wikipedia.org/wiki/AT&T_Bell_Laboratorieshttp://en.wikipedia.org/wiki/Richard_Stallmanhttp://en.wikipedia.org/wiki/GNU_projecthttp://en.wikipedia.org/wiki/GNU_projecthttp://en.wikipedia.org/wiki/Free_softwarehttp://en.wikipedia.org/wiki/UNIX-likehttp://en.wikipedia.org/wiki/Recursive_acronymhttp://en.wikipedia.org/wiki/Unix-likehttp://en.wikipedia.org/wiki/Unixhttp://en.wikipedia.org/wiki/Unixhttp://en.wikipedia.org/wiki/Unix-likehttp://en.wikipedia.org/wiki/Unix-likehttp://en.wikipedia.org/wiki/Unix-likehttp://en.wikipedia.org/wiki/Recursive_acronymhttp://en.wikipedia.org/wiki/Recursive_acronymhttp://en.wikipedia.org/wiki/Recursive_acronymhttp://en.wikipedia.org/wiki/UNIX-likehttp://en.wikipedia.org/wiki/UNIX-likehttp://en.wikipedia.org/wiki/UNIX-likehttp://en.wikipedia.org/wiki/Free_softwarehttp://en.wikipedia.org/wiki/GNU_projecthttp://en.wikipedia.org/wiki/GNU_projecthttp://en.wikipedia.org/wiki/GNU_projecthttp://en.wikipedia.org/wiki/Richard_Stallmanhttp://en.wikipedia.org/wiki/Richard_Stallmanhttp://en.wikipedia.org/wiki/Richard_Stallmanhttp://en.wikipedia.org/wiki/AT&T_Bell_Laboratorieshttp://en.wikipedia.org/wiki/AT&T_Bell_Laboratorieshttp://en.wikipedia.org/wiki/AT&T_Bell_Laboratorieshttp://en.wikipedia.org/wiki/AT&T_Bell_Laboratorieshttp://en.wikipedia.org/wiki/AT&T_Bell_Laboratorieshttp://en.wikipedia.org/wiki/Dennis_Ritchiehttp://en.wikipedia.org/wiki/Dennis_Ritchiehttp://en.wikipedia.org/wiki/Dennis_Ritchiehttp://en.wikipedia.org/wiki/Ken_Thompsonhttp://en.wikipedia.org/wiki/Ken_Thompsonhttp://en.wikipedia.org/wiki/Ken_Thompsonhttp://en.wikipedia.org/wiki/Unix
  • 8/13/2019 Linux 301

    3/17

    Events leading to creation Another free operating system project, initially released

    in 1977, was the Berkeley Software Distribution (BSD).

    This was developed by UC Berkeleyfrom the 6th editionof Unixfrom AT&T.

    In 1991, in Helsinki (University), Linus Torvalds began a

    project that later became the Linux kernel. It was initially a terminal emulator(In computing, an emulatoris

    hardware or software or both that duplicates (or emulates) thefunctions of one computer system (the guest) in anothercomputer system (the host), different from the first one, so thatthe emulated behaviour closely resembles the behavior of the real

    system (the guest)). Development was done on MINIX using the GNU C compiler,

    which is still the main choice for compiling Linux today(although the code can be built with other compilers, such asthe Intel C Compiler).

    16-02-2014Dr. Vaibhav Bansal 3

    http://en.wikipedia.org/wiki/Berkeley_Software_Distributionhttp://en.wikipedia.org/wiki/Berkeley_Software_Distributionhttp://en.wikipedia.org/wiki/UC_Berkeleyhttp://en.wikipedia.org/wiki/Berkeley_Software_Distributionhttp://en.wikipedia.org/wiki/Version_6_Unixhttp://en.wikipedia.org/wiki/Version_6_Unixhttp://en.wikipedia.org/wiki/Version_6_Unixhttp://en.wikipedia.org/wiki/UC_Berkeleyhttp://en.wikipedia.org/wiki/Version_6_Unixhttp://en.wikipedia.org/wiki/Version_6_Unixhttp://en.wikipedia.org/wiki/Helsinkihttp://en.wikipedia.org/wiki/Linux_kernelhttp://en.wikipedia.org/wiki/Linux_kernelhttp://en.wikipedia.org/wiki/Linux_kernelhttp://en.wikipedia.org/wiki/Helsinkihttp://en.wikipedia.org/wiki/Linux_kernelhttp://en.wikipedia.org/wiki/Terminal_emulatorhttp://en.wikipedia.org/wiki/Computinghttp://en.wikipedia.org/wiki/MINIXhttp://en.wikipedia.org/wiki/GNU_Compiler_Collectionhttp://en.wikipedia.org/wiki/Intel_C_Compilerhttp://en.wikipedia.org/wiki/Intel_C_Compilerhttp://en.wikipedia.org/wiki/Intel_C_Compilerhttp://en.wikipedia.org/wiki/Intel_C_Compilerhttp://en.wikipedia.org/wiki/Intel_C_Compilerhttp://en.wikipedia.org/wiki/Intel_C_Compilerhttp://en.wikipedia.org/wiki/Intel_C_Compilerhttp://en.wikipedia.org/wiki/GNU_Compiler_Collectionhttp://en.wikipedia.org/wiki/GNU_Compiler_Collectionhttp://en.wikipedia.org/wiki/GNU_Compiler_Collectionhttp://en.wikipedia.org/wiki/GNU_Compiler_Collectionhttp://en.wikipedia.org/wiki/GNU_Compiler_Collectionhttp://en.wikipedia.org/wiki/MINIXhttp://en.wikipedia.org/wiki/Computinghttp://en.wikipedia.org/wiki/Terminal_emulatorhttp://en.wikipedia.org/wiki/Terminal_emulatorhttp://en.wikipedia.org/wiki/Terminal_emulatorhttp://en.wikipedia.org/wiki/Linux_kernelhttp://en.wikipedia.org/wiki/Linux_kernelhttp://en.wikipedia.org/wiki/Linux_kernelhttp://en.wikipedia.org/wiki/Helsinkihttp://en.wikipedia.org/wiki/Helsinkihttp://en.wikipedia.org/wiki/Helsinkihttp://en.wikipedia.org/wiki/Helsinkihttp://en.wikipedia.org/wiki/Helsinkihttp://en.wikipedia.org/wiki/Version_6_Unixhttp://en.wikipedia.org/wiki/Version_6_Unixhttp://en.wikipedia.org/wiki/Version_6_Unixhttp://en.wikipedia.org/wiki/Version_6_Unixhttp://en.wikipedia.org/wiki/Version_6_Unixhttp://en.wikipedia.org/wiki/Version_6_Unixhttp://en.wikipedia.org/wiki/Version_6_Unixhttp://en.wikipedia.org/wiki/Version_6_Unixhttp://en.wikipedia.org/wiki/UC_Berkeleyhttp://en.wikipedia.org/wiki/UC_Berkeleyhttp://en.wikipedia.org/wiki/UC_Berkeleyhttp://en.wikipedia.org/wiki/Berkeley_Software_Distributionhttp://en.wikipedia.org/wiki/Berkeley_Software_Distributionhttp://en.wikipedia.org/wiki/Berkeley_Software_Distributionhttp://en.wikipedia.org/wiki/Berkeley_Software_Distributionhttp://en.wikipedia.org/wiki/Berkeley_Software_Distribution
  • 8/13/2019 Linux 301

    4/17

    What is Linux?

    History The History of Linux began in 1991 with the

    commencement of a personal project by a Finnishstudent,Linus Torvalds, to create a new free operating systemkernel.

    Torvalds first published the Linux kernel under itsown licence, which had a restriction on commercialactivity. The software to use with the kernelwas software

    developed as part of the GNU projectlicensed under the

    GNU General Public License, a free softwarelicense. Thefirst release of the Linux kernel, Linux 0.01, included abinary of GNU's Bash shell.

    16-02-2014Dr. Vaibhav Bansal 4

    http://en.wikipedia.org/wiki/Finlandhttp://en.wikipedia.org/wiki/Linus_Torvaldshttp://en.wikipedia.org/wiki/Finlandhttp://en.wikipedia.org/wiki/Linus_Torvaldshttp://en.wikipedia.org/wiki/Kernel_(computing)http://en.wikipedia.org/wiki/GNU_projecthttp://en.wikipedia.org/wiki/GNU_General_Public_Licensehttp://en.wikipedia.org/wiki/Free_softwarehttp://en.wikipedia.org/wiki/Bash_(Unix_shell)http://en.wikipedia.org/wiki/Bash_(Unix_shell)http://en.wikipedia.org/wiki/Bash_(Unix_shell)http://en.wikipedia.org/wiki/Free_softwarehttp://en.wikipedia.org/wiki/GNU_General_Public_Licensehttp://en.wikipedia.org/wiki/GNU_projecthttp://en.wikipedia.org/wiki/Kernel_(computing)http://en.wikipedia.org/wiki/Linus_Torvaldshttp://en.wikipedia.org/wiki/Linus_Torvaldshttp://en.wikipedia.org/wiki/Linus_Torvaldshttp://en.wikipedia.org/wiki/Finland
  • 8/13/2019 Linux 301

    5/17

    Linux Linux is a Unix-like computer operating system

    assembled under the model of free and open sourcesoftwaredevelopment and distribution.

    The defining component of Linux is the Linux kernelan operating system kernel first released on 5

    October 1991, by Linus Torvalds.

    Since the C compiler that builds Linux and the mainsupporting user space system tools and librariesoriginated in the GNU Project, initiated in 1983 byRichard Stallman, the Free Software Foundationprefers the name GNU/Linux.

    16-02-2014Dr. Vaibhav Bansal 5

    http://en.wikipedia.org/wiki/Unix-likehttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Free_and_open_source_softwarehttp://en.wikipedia.org/wiki/Free_and_open_source_softwarehttp://en.wikipedia.org/wiki/Linux_kernelhttp://en.wikipedia.org/wiki/Operating_system_kernelhttp://en.wikipedia.org/wiki/Linus_Torvaldshttp://en.wikipedia.org/wiki/Compilerhttp://en.wikipedia.org/wiki/User_spacehttp://en.wikipedia.org/wiki/GNU_Projecthttp://en.wikipedia.org/wiki/Richard_Stallmanhttp://en.wikipedia.org/wiki/Free_Software_Foundationhttp://en.wikipedia.org/wiki/GNU/Linux_naming_controversyhttp://en.wikipedia.org/wiki/GNU/Linux_naming_controversyhttp://en.wikipedia.org/wiki/Free_Software_Foundationhttp://en.wikipedia.org/wiki/Free_Software_Foundationhttp://en.wikipedia.org/wiki/Free_Software_Foundationhttp://en.wikipedia.org/wiki/Free_Software_Foundationhttp://en.wikipedia.org/wiki/Free_Software_Foundationhttp://en.wikipedia.org/wiki/Richard_Stallmanhttp://en.wikipedia.org/wiki/Richard_Stallmanhttp://en.wikipedia.org/wiki/Richard_Stallmanhttp://en.wikipedia.org/wiki/GNU_Projecthttp://en.wikipedia.org/wiki/GNU_Projecthttp://en.wikipedia.org/wiki/GNU_Projecthttp://en.wikipedia.org/wiki/User_spacehttp://en.wikipedia.org/wiki/User_spacehttp://en.wikipedia.org/wiki/User_spacehttp://en.wikipedia.org/wiki/Compilerhttp://en.wikipedia.org/wiki/Linus_Torvaldshttp://en.wikipedia.org/wiki/Linus_Torvaldshttp://en.wikipedia.org/wiki/Linus_Torvaldshttp://en.wikipedia.org/wiki/Operating_system_kernelhttp://en.wikipedia.org/wiki/Operating_system_kernelhttp://en.wikipedia.org/wiki/Operating_system_kernelhttp://en.wikipedia.org/wiki/Operating_system_kernelhttp://en.wikipedia.org/wiki/Operating_system_kernelhttp://en.wikipedia.org/wiki/Linux_kernelhttp://en.wikipedia.org/wiki/Linux_kernelhttp://en.wikipedia.org/wiki/Linux_kernelhttp://en.wikipedia.org/wiki/Free_and_open_source_softwarehttp://en.wikipedia.org/wiki/Free_and_open_source_softwarehttp://en.wikipedia.org/wiki/Free_and_open_source_softwarehttp://en.wikipedia.org/wiki/Free_and_open_source_softwarehttp://en.wikipedia.org/wiki/Free_and_open_source_softwarehttp://en.wikipedia.org/wiki/Free_and_open_source_softwarehttp://en.wikipedia.org/wiki/Free_and_open_source_softwarehttp://en.wikipedia.org/wiki/Free_and_open_source_softwarehttp://en.wikipedia.org/wiki/Free_and_open_source_softwarehttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Operating_systemhttp://en.wikipedia.org/wiki/Unix-likehttp://en.wikipedia.org/wiki/Unix-likehttp://en.wikipedia.org/wiki/Unix-like
  • 8/13/2019 Linux 301

    6/17

    Where is Linux Used?

    75% of respondents were already using Linuxand another 14% were evaluating it

    43% of all web sites use Linux servers runningthe Apache Web server

    16-02-2014Dr. Vaibhav Bansal 6

  • 8/13/2019 Linux 301

    7/17

    How is Linux Used?

    Personal Workstation

    File and Print Server

    Internet Service Provider Three-tier Client/Server

    Turnkey System

    16-02-2014Dr. Vaibhav Bansal 7

  • 8/13/2019 Linux 301

    8/17

    Linux Features

    Multitasking:several programs running at the same time. Multiuser: several users on the same machine at the same

    time (and no two-user licenses!).

    Multiplatform:runs on many different CPUs, not just Intel.

    Multiprocessor/Multithreading: it has native kernelsupport for multiple independent threads of control within asingle process memory space.

    It has memory protection between processes, so that oneprogram can't bring the whole system down.

    Demand loads executables: Linux only reads from disk thoseparts of a program that are actually used.

    16-02-2014Dr. Vaibhav Bansal 8

    http://en.wikipedia.org/wiki/Unix-likehttp://en.wikipedia.org/wiki/Unix-likehttp://en.wikipedia.org/wiki/Unix-likehttp://en.wikipedia.org/wiki/Unix-likehttp://en.wikipedia.org/wiki/Unix-likehttp://en.wikipedia.org/wiki/Unix-likehttp://en.wikipedia.org/wiki/Unix-likehttp://en.wikipedia.org/wiki/Unix-like
  • 8/13/2019 Linux 301

    9/17

    Linux Features Shared copy-on-write pages among executables. This means

    that multiple process can use the same memory to run in.When one tries to write to that memory, that page (4KBpiece of memory) is copied somewhere else. Copy-on-writehas two benefits: increasing speed and decreasing memoryuse.

    Virtual memory using paging (not swapping wholeprocesses) to disk: to a separate partition or a file in the filesystem, or both, with the possibility of adding moreswapping areas during runtime (yes, they're still called

    swapping areas). A total of 16 of these 128 MB (2GB in recentkernels) swapping areas can be used at the same time, for atheoretical total of 2 GB of useable swap space. It is simpleto increase this if necessary, by changing a few lines of

    source code. 16-02-2014Dr. Vaibhav Bansal 9

  • 8/13/2019 Linux 301

    10/17

    Linux Features

    A unified memory pool for user programs and disk cache, so that all freememory can be used for caching, and the cache can be reduced when runninglarge programs.

    All source code is available, including the whole kernel and all drivers, thedevelopment tools and all user programs; also, all of it is freely distributable.Plenty of commercial programs are being provided for Linux without source, but

    everything that has been free, including the entire base operating system, is stillfree.

    Multiple virtual consoles: several independent login sessions through theconsole, you switch by pressing a hot-key combination (not dependent on videohardware). These are dynamically allocated; you can use up to 64.

    Supports several common file systems, including minix, Xenix, and all thecommon system V file systems, and has an advanced file system of its own,which offers file systems of up to 4 TB, and names up to 255 characters long.

    Many networking protocols: the base protocols available in the latestdevelopment kernels include TCP, IPv4, IPv6, AX.25, X.25, IPX, DDP (AppleTalk),Netrom, and others. Stable network protocols included in the stable kernelscurrently include TCP, IPv4, IPX, DDP, and AX.25.

    16-02-2014Dr. Vaibhav Bansal 10

  • 8/13/2019 Linux 301

    11/17

    Using Linux on Personal Computers

    Linux kernel for free

    Kernel is central component

    Kernel can be customized to users needs

    16-02-2014Dr. Vaibhav Bansal 11

  • 8/13/2019 Linux 301

    12/17

    Linux Distributions

    Corel Linux

    Debian GNU/Linux

    OpenLinux (Caldera) Red Hat

    Slackware

    SuSE TurboLinux

    16-02-2014Dr. Vaibhav Bansal 12

  • 8/13/2019 Linux 301

    13/17

    13

    API

    AUI

    Kernel

    Computer Hardware

    System call interface

    Applications: Compilers, word processors, X-based GUI

    BIOS

    LINUX Shell: Bourne Again (bash), TC, Z, etc.

    Language libraries

    Device Drives

    File managementMemorymanagement

    ProcessManagement

    Architecture

    16-02-2014Dr. Vaibhav Bansal

  • 8/13/2019 Linux 301

    14/17

    14

    Kernel The part of an OS where the real work is done

    System call interface

    Comprise a set of functions (often known as API) that can be used bythe applications and library routines to use the services provided by the

    kernel

    Application Users Interface Interface between the kernel and user Allow user to make commands to the system

    Divided into text based and graphical based

    Architecture

    16-02-2014Dr. Vaibhav Bansal

  • 8/13/2019 Linux 301

    15/17

    15

    File Management Control the creation, removal of files and provide directory

    maintenance For a multiuser system, every user have its own right to access

    files and directories

    Process Management For a multitask system, multiple programs can be executed

    simultaneously in the system

    When a program starts to execute, it becomes a process

    The same program executing at two different times will become

    two different processes

    Kernel manages processes in terms of creating, suspending,

    and terminating them.

    A process is protected from other processes and can

    communicate with the others

    Architecture

    16-02-2014Dr. Vaibhav Bansal

  • 8/13/2019 Linux 301

    16/17

    16

    Memory management Memory in a computer is divided into main memory(RAM) and secondarystorage(usually refer to hard disk)

    Memory is small in capacity but fast in speed, and hard disk is vice versa

    Data that are not currently used should be saved to hard disk first, while data

    that are urgently needed should be retrieved and stored in RAM

    The mechanism is referred as memory management

    Device drivers Interfaces between the kernel and the BIOS

    Different device has different driver

    Architecture

    16-02-2014Dr. Vaibhav Bansal

  • 8/13/2019 Linux 301

    17/17

    16-02-2014Dr. Vaibhav Bansal 17