55

Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Embed Size (px)

Citation preview

Page 1: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac
Page 2: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Why Linux?

• Linux’ market share for computers is minor, why learn it?–Windows: 90%+–Mac OS X: 8%– Linux/Unix: < 2%

• Linux/Unix is the basis for Mac OS X• Linux/Unix used in many handheld devices

(e.g., Android, Apple iOS-based products)

Page 3: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Why Linux?

• Linux/Unix is used extensively in other types of computing and related devices– Network routers–Wifi access points– Firewalls

• Most notably, Linux/Unix is used on most Internet servers– Nearly 2/3s of the top web servers run on

Linux/Unix

Page 4: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Why Linux

• Open source–Most versions of Linux are freely available–Most Linux application software is also freely

available– Open source community regularly updates Linux

operating system and application software so that security issues are fixed in a timely manner

– Applications are updated regularly to include more features that users will find appealing

Page 5: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Why Linux

• Greater control– Through the command line, Linux offers the user

the ability to precisely control their commands– This is not true of Windows or Mac OS X where

control is removed from the users hands

• Learning about operating systems– Through the command line interaction of Linux,

you are able to learn more about what an operating system is, what it does and how it functions

• Linux is cool!

Page 6: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

What is an Operating System?

• Earliest computers had no operating system (OS)

• Programmers were responsible for handling all of the details of compiling and running their programs (see next slide)

• As the process became more complicated, programs called resident monitors were created to save the programmer some effort

Page 7: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac
Page 8: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

What is an Operating System?• The OS is a program• It is comprised of many parts– Some of these parts are loaded into memory, some are

loaded only when needed– The core component is the kernel which stays resident

in memory

• The OS handles such tasks as– Process management– Resource management– Memory management– Input/output– User interface

Page 9: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

What is an Operating System

• The user does not control the computer• The user initiates requests– The OS decides if the user has adequate access rights

to perform the requested actions and how to carry out those actions

– The kernel handles most of the significant operations– The user interface can be tailored, known as a shell– Communication with devices is handled through

device drivers

Page 10: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

What is an Operating System

• The computer is segmented into layers– User at the top– Hardware at the bottom– Application software

and operating system components make up intermediate layers

Page 11: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Linux: The GUI

• Although we will primarily interact with Linux through the command line, there are different desktops available

• We explore two here– Gnome – KDE

• Both are based on an older interface system called X-Windows

Page 12: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Linux: The GUI• Logging in– Select user name

from list – Enter password– or – Click other– Enter username– Enter password

Page 13: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Linux: The GUI• If both Gnome and KDE are available, you can

switch between GUI desktops at the login window before logging in

Page 14: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Linux: The GUI

Gnomedesktop

Page 15: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Linux: The GUI

• Gnome top-level menu selections– Applications– Places– System

• Accessories submenu of Applications shown to right– Notice “K” software are

primarily for KDE but available in Gnome

Page 16: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Linux: The GUI

• System Tools submenu

Page 17: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Linux: The GUI• Places menu opens file browser windows• Here, we see the Computer (all mounted

devices) window open

Page 18: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Linux: The GUI• Opening up the Filesystem folder, we see the

Linux top-level directories (starting at /)– Notice some directories have an X by them– These are not accessible to the current user

Double click on any icon opens a new window for that directory

Page 19: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Linux: The GUI

• Preferences submenu of System

• These selections are available to non-root users

Page 20: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Linux: The GUI

• The Administration submenu

• Most of these selections require authentication a root

Page 21: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Linux: The GUI

• Right clicking in the desktop brings up this pop-up window

• Select Open in Terminal to open a terminal window

Page 22: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Linux: The GUI• KDE Desktop

Page 23: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Linux: The GUI

• KDE Program Button Applications Menu

Page 24: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Linux: The Command Line

• The command line is part of a shell• The shell includes– The command line interface (CLI) which is the

command line and prompt– Any previously defined entities• functions• aliases• variables• previous instructions as part of a history list

– The shell’s interpreter

Page 25: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Linux: The Command Line

• The interpreter is a program– Its responsibility is to interpret instructions– By interpreting, it translates each instruction on the

command line into an executable statement– Interpreters are found in many programming

languages (e.g., Python, Ruby, LISP)– Interpreters are used in most CLIs–We explore the interpreter in more detail in chapter

2

Page 26: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Linux: The Shell

• The shell is a tailorable environment– The environment consists of previously defined

terms and instructions– The shell allows you to define shortcuts in

executing future instructions– Different Linux shells have different features• We will concentrate on the BASH shell• We explore the BASH shell in chapter 2

Page 27: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Linux: The Shell

A view of what theshell offers

Editing support includeskeystrokes to repositionthe cursor and cut/copyand paste characters

Page 28: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Linux: The Command Line

• Advantages of the GUI:– Less to learn and easier

to control– Intuitive– Visual– Fun– Allows for easy

multitasking

• Advantages of the CLI– Control– Speed– Less resource intensive– Limits wrist strain– You learn more about the

OS through the CLI

Page 29: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Virtual Machines

• Software emulation– Computer emulates the another type of computer– Used to run software compiled for a different

platform

• Virtual machine– Software running on your computer emulating

another platform– The VM is a combination of the software and data

that captures the other platform’s operating system

Page 30: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Virtual Machines: Advantages

• Multi-platform experimentation• Cost savings and scalable – By using VMs, your organization will require

fewer physical computers

• Power consumption reduction– Follows on from having fewer computer resources

• Cross-platform software support• Security–Malware is not set up to attack the internal content

of a VM so that VM is protected

Page 31: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Virtual Machines: Advantages (cont)• Fault tolerance– Using 2 or more VMs you can balance workloads

among the VMs

• Administrative experience– For an educational setting, you can allow students

to become system administrators

• Controlling others’ environments– Through virtualization, you can access other VMs

remotely

• Collaboration• Remote access

Page 32: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Virtual Machines: The Cost• Obtaining the VM software– To take full advantage of virtualization, you need

virtual servers which are often expensive– VM client software is often free

• The OS’s– You will have to obtain installation copies for the OS’s

you wish to install, which might cost money

• The load on the computer– VM software is processor and memory intensive

• VM storage space– A typical VM might require between 8GB and 30GB of

storage space, a lot of VMs can take up TBs of storage

Page 33: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

History: Unix and Linux• Unix was first implemented in 1969 for the

DEC PDP-11 by Dennis Ritchie and Ken Thompson of AT&T Bell Labs

• They intended to have a platform independent OS but the first version, called Unics, was written in the PDP-11 assembly language

• They developed the C programming language and re-implemented the OS as Unix, truly platform independent– All you needed was a C compiler

Page 34: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

History: Unix and Linux• Numerous versions were released between 72

and 80– One version would run on Intel 8086 architectures

such as the IBM PC– Unix was not free

• 1983: Richard Stallman (MIT) began his GNU project– GNU = GNU not Unix– A project to develop a free and open source OS

that was Unix-like but not Unix

Page 35: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

History: Unix and Linux

• Mid 80s: Ken Thompson, on a sabbatical from AT&T went to the University of California Berkeley– There, he and others developed BSD Unix– This version contained networking features to

support TCP/IP– This version was made available for free to many

organizations, particularly universities– BSD 4.2 would become the most widely distributed

version of Unix at the time

Page 36: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

History: Unix and Linux

• 1990: Open software foundation formed• 1992: AT&T eventually filed a lawsuit against

UC Berkeley for using proprietary code from AT&T’s Unix to build UCB– This is sometimes referred to as the Unix Wars

• In between in 1991, Finish student Linus Torvalds begins developing his own OS–With help from people in the open source

community

Page 37: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

History: Unix and Linux

• Stallman developed the GPL (GNUs General Public License)

• Much of Linux has been published under the GPL

• The first versions of Linux were released in 1991 with developers helping to improve and add features every year

• The GNUs Project never released a working kernel

Page 38: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

History: Unix and Linux

• There are many versions of Unix and Linux now available– Most versions of Linux are free and open source (but

not all, for instance Red Hat Enterprise Linux)

• Among the most popular distributions of Linux are– Debian– Red Hat (including Fedora and CentOS)– SLS/Slackware (originated in Germany)– Ubuntu – started off as a Debian distro but has found its

own path)

Page 39: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Users: Accounts• There are two general types of user accounts

in Linux: normal users and superusers– Superusers, also called root, are system

administrators with access to all system commands and resources

– Normal users, usually humans, have limited access primarily to just their file space and publically accessible software and commands

– Normal user accounts can also be set up for software which will have even more restricted access

Page 40: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Users: System Administrators

• Every Linux system requires an administrator– The root account could be shared among several

although this may be deemed a security risk–Many activities cannot be handled by a normal

user such as• Creating new accounts• Installing software• Controlling services• Accessing certain files• Controlling the Firewall

Page 41: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Users: System Administrators• The following list is common to many system

administrators. – install the operating system, – update the operating system when needed, – configure the operating system to fit the needs of

the users in the organization, – secure the operating system, – configure and maintain network communication, – install, configure and maintain application

software, – create and manage user accounts and ensure the

use of strong passwords,

Page 42: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

Users: System Administrators (cont)– install and troubleshoot hardware connected to computers

directly or through a network, – manage the file system including partitioning the disk

drives and performing backups, – schedule operations as needed such as backing up file

systems, mounting and unmounting file systems, updating the operating system and other application software, examining log files for troubleshooting and suspicious activity,

– define (for your organization’s management) computer usage policies and disaster recovery plans,

– create documentation and training materials for users, – make recommendations for system upgrades to

management.

Page 43: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

What is a Computer? The IPOS Cycle• Input: obtaining raw data from the user• Processing: operating on the data to turn it into

information– Handled by the processor

• Output: displaying the information in a human readable format to the user

• Storage: storing the data/information– This might be the raw data, the processed information

or some intermediate form– We also store program code– Storage typically means secondary storage such as disk

drive, not memory which is part of processing

Page 44: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

What is a Computer? The IPOS Cycle

Page 45: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

What is a Computer? CPU

• The processor (central processing unit, CPU)– Performs the fetch-execute cycle• Fetch next program instruction from memory• Decode the instruction into actions• Command the relevant part(s) of the computer to

operate to execute the instruction• Store the result somewhere (if necessary)

Page 46: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

What is a Computer? CPU• The CPU consists of– Control Unit

• Handles the fetch-execute cycle• Controls the other components of the computer through

signals• Contains registers (storage locations) for important pieces

of information like the memory location of the next instruction in the program and the current instruction

– Arithmetic Logic Unit (ALU)• Digital circuits to perform arithmetic and logic operations• Data registers to store data being used by the current set

of instructions

Page 47: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

What is a Computer? CPU

• Consider an example: –We write the instruction A = B * (C + D)– This is broken into several lesser instructions• Load C into a data register• Add D to the data register storing C• Multiply B to the data register storing C + D• Store result in A

Page 48: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

What is a Computer? CPU• Registers:– Data registers– Program Counter – store location of next program

instruction in memory– Instruction Register – store current instruction– Status Flags – store information about last

operation (was it negative, zero, positive, did it cause an overflow or carry, did the result have even or odd parity, did the instruction cause an error?)

– Stack Pointer – store location of the top of the run-time stack where we store information about the program’s currently executing function

Page 49: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

What is a Computer? Memory• Several forms– Registers (SRAM)– Cache (on-chip and off-chip) (SRAM)–Main memory (DRAM)• the above forms are volatile, require a constant power

supply to retain the contents• another form, ROM, is non-volatile but very limited in

its usage

– Secondary storage (hard disk, optical disk, flash memory)

Page 50: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

What is a Computer? Memory

• These forms of memory make up the memory hierarchy – Faster forms of memory are located higher in the

hierarchy• As they are more expensive, we have less of that form• But we want to use the faster forms• How do we keep the contents that we need in the

higher/faster forms when there is less

Page 51: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

What is a Computer? Other

• I/O – input and output devices– Keyboard, mouse, touch screen, microphone–Monitor, printer, speakers

• Storage – the lower portions of the memory hierarchy– The hard disk is the most common form–We also have optical disc, magnetic tape and flash

memory• these form permanent storage

Page 52: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

What is a Computer? Software• Software are the programs that the computer

runs–Without software, the computer does nothing

• A program is a step-by-step description of how to solve a problem written in a language the computer can execute–Machine language

• We write programs in easier languages like C++ or Java and convert them into machine language using a program called a compiler

Page 53: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

What is a Computer? Software

#include <stdio.h>

int main() { int a, b, c; printf(“Enter three numbers: “); scanf(“%d %d %d”, &a, &b, &c); if(a>b&&b>c)

printf(“%d is the greatest\n”, a); else if(b>a&&b>c)

printf(“%d is the greatest\n”, b); else

printf(“%d is the greatest\n”, c); return 0;

}

Example C program to determine the largestof 3 input numbers

Page 54: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

What is a Computer? Types

• Computers vary by– Size– Computing power• and other resources such as amount of main memory,

number of storage devices

– Expense

• Computers range from– Handheld devices like smart phone to tablets– To desktop units and laptop computers– To servers– To mainframe and super computers

Page 55: Why Linux? Linux’ market share for computers is minor, why learn it? – Windows: 90%+ – Mac OS X: 8% – Linux/Unix: < 2% Linux/Unix is the basis for Mac

What is a Computer? TypesType Number of

CPUs/Cores DRAM Storage Devices Typical Cost Operations per

secondSupercomputer Thousands to

hundreds of thousands

100s to 1000s GBytes

Storage area networks $ Tens of millions

TFLOP to PFLOP range

Mainframe Hundreds to thousands (or more)

Dozens to 100s of GBytes

Server storage or storage area network

$100,000 - $1 million

GFLOP to TFLOP range

Server 1-8 multicore (up to 8 cores)

Up to 32 GBytes Many hard disk drives (up to dozens)

$5,000 - 15,000 GFLOP range

Desktop 1-2 multicore (up to 8 cores)

4-16 GBytes 1-2 Hard disk drives Optical disk drive Numerous USB ports

Under $2,400, often around $1,200

GFLOP range

Laptop 1 multicore (up to 8 cores)

4-16 GBytes 1 Hard disk drive Optical disk drive  A few USB ports

Under $1,200, often around $900

GFLOP range

Tablet 1 4-8 GBytes USB port, small capacity hard disk drive

$300-$700 Up to GFLOP range

Smart phone 1 Up to 2 GByte USB port, internal storage (flash or disk) up to 64 GBytes

Under $500, often under $200

Hundreds of MFLOPs up to 1 GFLOP