0% found this document useful (0 votes)
198 views

OS - Windows and UNIX-Linux

The document discusses the history and design goals of Windows operating systems. It describes how Windows achieves extensibility, portability, reliability, compatibility and performance. It also covers memory management in Windows through virtual memory and paging techniques.

Uploaded by

sam
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
198 views

OS - Windows and UNIX-Linux

The document discusses the history and design goals of Windows operating systems. It describes how Windows achieves extensibility, portability, reliability, compatibility and performance. It also covers memory management in Windows through virtual memory and paging techniques.

Uploaded by

sam
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 105

Understanding

Operating Systems
Windows Operating System
Learning Objectives

After completing this chapter, you should be able to


describe:
• Design goals for Windows operating systems designers
• The role of the Memory Manager and Virtual Memory
Manager in Windows
• Its use of the Device, Processor, and Network Managers
• System security challenges for Windows
• Windows user interfaces
Understanding Operating Systems 2
Brief History

• Windows products before 1995 release: Windows 95


operating system
• Graphical user interfaces requiring the MS-DOS operating
system
• Disadvantages:
• Multitasking not supported
• Little built-in security
• Lacked interprocess communication capability
• Required customization to work with each system hardware
component
Understanding Operating Systems 3
(table 14.1)
Select Microsoft Windows operating systems. For details about these and
other versions, refer to www.microsoft.com.
© Cengage Learning 2014
Understanding Operating Systems 4
Brief History (cont’d.)

• Windows products since 1995


• Abandoned MS-DOS reliance
• More powerful networking products
• Windows product version number
• Windows XP: version 5.1
• Windows 7: version 6.2
• Windows 8: version 6.2
• Display by pressing Windows logo key and the R key together
• Type winver
Understanding Operating Systems 5
Design Goals

• Windows networking operating systems


• Influenced by several operating system models
• Employed already-existing frameworks
• Introduced new features
• Object model: manage and allocate resources
• Symmetric multiprocessing (SMP): achieve maximum
multiprocessor performance

Understanding Operating Systems 6


Design Goals (cont'd.)
• Needs
• Accommodate user needs
• Optimize resources
• Response
• Five design goals
• Extensibility
• Portability
• Reliability
• Compatibility
• Performance
Understanding Operating Systems 7
Extensibility
• Easily enhancing operating system
• Ensuring code integrity: separate functions
• Privileged executive process
• Kernel mode
• Processor’s mode of operation
• All machine instructions allowed
• System memory accessible
• Nonprivileged processes protected subsystems
• User mode
• Certain instructions not allowed
• System memory not accessible
Understanding Operating Systems 8
Extensibility (cont'd.)

• Additional features
• Modular structure
• New components added to executive process
• Objects
• Abstract data types manipulated by special services
• System resources managed uniformly
• Remote procedure call
• Application calls remote services
• Regardless of location on network
Understanding Operating Systems 9
Portability
• Operates on different platforms
• Different processors or configurations
• Minimum amount of recoding
• System guidelines to achieve goal
• Written in a standardized, high-level language
• Available in all machines
• Accommodate ported hardware
• Minimize direct code interaction with hardware
• Reduce incompatibility errors
• Isolate hardware-dependent code into modules
• Easily modifiable when ported
Understanding Operating Systems 10
Portability (cont'd.)

• Windows features
• Modular code
• Written in C (most of code)
• Graphic component and some networking portions written in C++
• Code communicating directly with hardware written in Assembly
language
• Hardware abstraction layer (HAL)
• Dynamic-link library
• Provides isolation from vendors’ hardware dependencies

Understanding Operating Systems 11


Reliability
• System robustness: error response predictability
• Ability to protect itself and users
• Accidental or deliberate user programs’ damage
• Features strengthening system
• Structured exception handling
• Modular design
• NTFS file system (NT File System)
• Can recover from all error types
• Advanced security architecture
• Virtual memory strategy
Understanding Operating Systems 12
Compatibility

• Execute programs written for other operating systems (or


earlier system versions)
• Use protected subsystems
• Provide application execution different from primary programming
interface
• Provides source-level POSIX application compatibility
• Recent Windows versions
• Support existing file systems including MS-DOS FAT, CDFS, and NTFS
• Built-in verification
• Important hardware and software
Understanding Operating Systems 13
Performance

• Responds quickly to CPU-bound applications


• Windows features
• System calls, page faults, and other crucial processes:
respond in timely manner
• Incorporated local procedure call (LPC): guarantees fast
communication among protected subsystems
• Critical Windows networking software elements: built
into operating system privileged portion

Understanding Operating Systems 14


Memory Management

• Every operating system


• Has own physical memory view
• Makes application programs access memory in specified ways
• Full physical memory
• Virtual Memory Manager pages some memory contents to disk
• Challenge for all Windows operating systems
• Run application programs (Windows or POSIX)
• Without programs crashing into each other’s memory

Understanding Operating Systems 15


Memory Management (cont'd.)
• Memory layout (recent Windows versions)
• Operating system: high virtual memory
• User code and data: low virtual memory
• User process
• Cannot read or write system memory directly
• Memory paged to disk
• User-accessible memory
• System memory segment labeled paged pool
• Memory never paged to disk
• System memory segment labeled nonpaged pool
Understanding Operating Systems 16
(figure 14.3)
Layout of Windows memory. This is a virtual memory system based on 32-bit
addresses in a linear address space. The 64-bit versions use a similar model
but on a much larger scale with 8TB for the user and 8TB for the kernel.
© Cengage Learning 2014
Understanding Operating Systems 17
User-Mode Features

• VM Manager (virtual machine manager)


• User-mode subsystems share memory efficiently
• Provides native services: allows process to manage virtual memory
• Allocate memory in two stages
• Read and/or write protection for virtual memory
• Lock virtual pages in physical memory
• Retrieve information about virtual pages
• Protect virtual pages
• Rewrite virtual pages to disk

Understanding Operating Systems 18


Virtual Memory
Implementation
• VM manager reliance
• Address space management
• Paging techniques
• Address space management
• Upper half of virtual address space
• Accessible only to kernel-mode processes
• Code in lower part (kernel code and data)
• Never paged out of memory
Understanding Operating Systems 19
Virtual Memory Implementation
(cont'd.)
• Paging
• VM manager part: transfers pages
• Between memory page frames and disk storage
• Complex combination
• Software policies: when to bring a page into memory and where to
put it
• Hardware mechanisms: exact manner VM Manager translates virtual
addresses into physical addresses
• Pager not portable: modified for each new hardware platform
• Windows: small code and well-isolated
Understanding Operating Systems 20
Virtual Memory Implementation
(cont'd.)
• Paging (cont’d.)
• Processor chip translates program generated address into
a physical address
• Page with address not in memory: hardware generates a
page fault and calls the pager
• Processor uses translation look-aside buffer (TLB)
• Speeds memory access

Understanding Operating Systems 21


Virtual Memory Implementation
(cont'd.)
• Paging policies
• Dictate how and when paging is done
• Composition
• Fetch policy: determines when pager copies a page from
disk to memory
• Placement policy: determines where virtual page is
loaded in memory
• Replacement policy: determines which virtual page is
removed from memory to make room for a new page
Understanding Operating Systems 22
Processor Management

• Process:
• Combination of executable program, private memory
area, and operating system allocated resources as the
program executes
• Requires at least one execution thread
• Thread
• Process entity: roughly equated to a task

Understanding Operating Systems 23


Processor Management
(cont’d.)
• Windows
• Preemptive-multitasking, multithreaded operating system
• Process contains one thread composed of:
• A unique identifier
• Volatile set of registers: contents indicate processor’s state
• Two stacks used during thread’s execution
• Private storage area: used by subsystems and dynamic-link
libraries

Understanding Operating Systems 24


Processor Management (cont'd.)

• Threads
• Thread components called thread’s context
• Actual data forming context varies from one processor to another
• Kernel
• Schedules threads for execution on a processor
• Thread actually executes code
• Overhead incurred by thread is minimal
• Unitasking
• Process with single thread
Understanding Operating Systems 25
Processor Management (cont'd.)
(figure 14.4)
Unitasking in Windows. Here’s
how a process with a single
thread is scheduled for
execution on a system with a
single processor.
© Cengage Learning 2014

Understanding Operating Systems 26


Processor Management (cont'd.)

• Multithreading
• Systems with multiple processors
• Process has as many threads as CPUs available
• All threads belonging to one process: share global variables,
heap, and environment strings

• Windows operating systems


• Include some synchronization mechanisms
• Give exclusive access to global variables as multithreaded
processes execute
Understanding Operating Systems 27
(figure 14.5)
Multitasking using multithreading. Here’s how a process with four
threads can be scheduled for execution on a system with four
processors.
© Cengage Learning 2014
Understanding Operating Systems 28
Processor Management (cont'd.)

• Multithreading example: modifying a database application


• Entering records: one thread writes the last record to disk while
another thread accepts new data
• Database searching: several threads search an array
simultaneously
• Client/server applications: CPU-intensive for server
• Client makes query requests; server’s processor manages the
query
• Windows handles requests allocating additional CPU resources

Understanding Operating Systems 29


Device Management
• Windows I/O system provides:
• Multiple installable file systems (FAT, CDFS, and NTFS)
• Services making device-driver development easy
• Workable on multiprocessor systems
• Drivers: added to or removed from system dynamically
• System administrators
• Fast I/O processing
• Drivers written in high-level language
• Mapped file I/O capabilities
• Image activation, file caching, and application use
Understanding Operating Systems 30
Device Management (cont'd.)

• I/O system
• Packet driven
• I/O request represented by I/O request packet (IRP)
• IRP
• Data structure controlling how I/O operation processed at each step
• I/O manager:
• Creates an IRP representing each I/O operation
• Passes IRP to appropriate driver
• Disposes packet when operation complete
Understanding Operating Systems 31
Device Management (cont'd.)

• Driver IRP receipt


• Performs specified operation
• Passes it back to I/O manager or
• Passes it through I/O manager to another driver for
further processing

Understanding Operating Systems 32


Device Management (cont'd.)

• I/O manager tasks


• Supplies code, common to different drivers
• Manages buffers for I/O requests
• Provides time-out support for drivers
• Records installable file systems loaded into operating system
• Provides flexible I/O facilities
• Subsystems (POSIX) implement their respective I/O application
programming interfaces
• Allows dynamic loading: device drivers and file systems based on
users’ needs
Understanding Operating Systems 33
Device Management (cont'd.)
• Windows I/O services
• Device-independent model
• Multilayered device driver concept
• Device driver made up of standard set of routines
• Initialization routine
• Dispatch routine
• Start I/O routine
• Completion routine
• Unload routine
• Error logging routine
Understanding Operating Systems 34
Device Management (cont'd.)

• I/O manager
• Determines driver called to process request
• Based on file object’s name
• Driver object
• Represents individual driver in system
• Created by I/O manager when driver loaded into system
• May have multiple device objects connected to it
• Device object
• Physical, logical, or virtual device on the system
• Describes device characteristics
Understanding Operating Systems 35
Device Management (cont'd.)

(table 14.2)
Example showing how a device object is created from an instruction to
read a file, illustrated in Figure 14.6.
© Cengage Learning 2014

Understanding Operating Systems 36


(figure14.6)
The driver object from Table 14.2 is connected to several device
objects. The last device object points back to the driver object.
© Cengage Learning 2014

Understanding Operating Systems 37


Device Management (cont'd.)
• Device objects list
• Represents physical, logical, virtual devices
• Controlled by the driver
• Advantages of using different objects
• Portability
• Frees I/O manager from knowing details about drivers
• Follows pointer to locate driver
• Easy loading of new drivers
• Easy assigning drivers to control additional or different devices
• System configuration changes
Understanding Operating Systems 38
(figure14.7)
Details of the layering of a
file system driver and a disk
driver. The steps shown
here take place when the
I/O Manager needs to
access a secondary storage
device to satisfy the
command shown in Step 1.
© Cengage Learning 2014

Understanding Operating Systems 39


Device Management (cont'd.)

• I/O manager knows nothing about file system


• Overhead
• I/O manager passes information requests back and forth
• Uses single-layer device driver approach
• Simple devices (serial and parallel printer ports)
• Uses multilayered approach
• More complicated devices (hard drives)
• Asynchronous I/O operations
• Nearly all low-level operations
Understanding Operating Systems 40
File Management

• Windows current versions


• Designed to be independent of file system on which they
operate
• Virtual file
• Primary file handling concept (current Windows versions)
• Programs perform I/O on virtual files
• File handles manipulate them
• Executive file object representing all I/O sources and
destinations
Understanding Operating Systems 41
File Management (cont'd.)
• Processes call native file object services to read from or write to
file
• I/O manager directs virtual file requests
• Real files, file directories, physical devices, or other system-supported
destinations
• File objects
• Hierarchical names
• Protected by object-based security
• Support synchronization
• Handled by object services
Understanding Operating Systems 42
File Management (cont'd.)

• Opening file
• Process supplies file’s name and type of access required
• File objects bridge gap
• Between physical devices’ characteristics and directory
structures, file system structures, and data formats

Understanding Operating Systems 43


File Management (cont'd.)

• File object
• Memory-based representation of shareable physical resources
• Contains only data unique to an object handle
• File
• Contains data to be shared
• New file object created with new set of
handle-specific attributes
• Each time process opens a handle

Understanding Operating Systems 44


(figure14.8)
Illustrations of a file object,
its attributes, and the
services that operate on
them. The attributes are
explained in Table 14.3.
© Cengage Learning 2014

Understanding Operating Systems 45


File Management (cont'd.)

(table 14.3)
Description of the attributes shown in Figure 14.8.
© Cengage Learning 2014
Understanding Operating Systems 46
File Management (cont'd.)

• Mapped file I/O: important I/O system feature


• Achieved through cooperation between I/O system and VM Manager
• Memory-mapped files exploit VM capabilities
• Cache manager uses mapped I/O
• Manages its memory-based cache
• File management system
• Supports long filenames
• Include spaces and special characters
• Automatically shortens filenames when required
Understanding Operating Systems 47
Network Management

• Networking
• Integral part of Windows operating system executive
• Provides services: user accounts and resource security
• Implements communication between computers
• Named pipes: provide high-level interface for passing data
between two processes (regardless of locations)
• Mailslots: provide one-to-many and many-to-one
communication mechanisms

Understanding Operating Systems 48


Network Management (cont’d.)

• Microsoft Networks (MS-NET)


• Released in 1984
• Model for NT Network Manager
• Three components
• Redirector
• Server message block (SMB) protocol
• Network server
• MS-NET components
• Extensively refurbished and incorporated into later Windows versions
Understanding Operating Systems 49
Network Management (cont'd.)

• Redirector
• Coded in C programming language
• Implemented as loadable file system driver
• Not dependent on system’s hardware architecture
• Function
• Direct I/O request from user or application to remote
server with appropriate file or resource

• Network can incorporate multiple redirectors


Understanding Operating Systems 50
Network Management (cont'd.)

• SMB protocol
• High-level specification
• Formatting messages sent across network
• OSI model correlation
• Application layer (Layer 7); Presentation layer (Layer 6)
• API called NetBIOS interface
• Passes I/O requests structured in SMB format to remote computer
• SMB protocols and NetBIOS API
• Adopted in several networking products before appearing in Windows

Understanding Operating Systems 51


Network Management (cont'd.)

• Windows Server operating systems


• Written in C
• Complete compatibility with existing MS-NET and LAN
Manager SMB protocols
• Implemented as loadable file system drivers
• No dependency on hardware architecture
• Where operating system running

Understanding Operating Systems 52


Directory Services

• Active Directory
• Database storing many information types
• General-purpose directory service for heterogeneous network
• Built entirely around DNS and LDAP
• Groups machines into domains
• Each domain gets a DNS domain name (e.g., pitt.edu)
• Each domain must have at least one domain controller
• Domain can have more than one domain controller
• Active Directory clients use standard DNS and LDAP protocols: locate
objects on the network
Understanding Operating Systems 53
(figure 14.9)
Active Directory clients use standard DNS and LDAP protocols to locate
objects on the network.
© Cengage Learning 2014

Understanding Operating Systems 54


Security Management

• Windows network operating systems


• Provide object-based security model
• Security object
• Represents any resource in system (file, device, process, program, or user)
• Allows administrators to give precise security access
• Monitor and record how objects used
• Windows biggest concern
• Aggressive patch management needed
• Combat many viruses and worms

Understanding Operating Systems 55


Security Concerns

• U.S. Department of Defense


• Identified and categorized seven levels of security features
• Class C2 security level compliance
• Features in Windows
• A secure logon facility
• Discretionary access control
• Auditing ability
• Memory protection
Understanding Operating Systems 56
Security Concerns (cont'd.)

• Multilayered security system


• First security layer: password management
• Second security layer: file access security
• Distinguishes between owners and groups
• Users decide operation types person is allowed to perform
on a file
• Gives user auditing capabilities: automatically tracks who
uses files and how files used

Understanding Operating Systems 57


Security Terminology

• Built-in security
• Necessary element for managers of Web servers and networks
• Requires authentication mechanism allowing client to prove
identity to server
• Client supplies authorization information
• Server uses information: determines specific access rights given
to client
• Provides data integrity using various methods
• Windows operating systems feature Kerberos security
Understanding Operating Systems 58
Security Terminology (cont'd.)

• Kerberos security
• Authentication (mutual), data integrity, and data privacy
• Each domain has own Kerberos server
• Microsoft implemented standard Kerberos protocol
• Microsoft separates distributed security services users
from their providers
• Supports many options without unusable complexity

Understanding Operating Systems 59


Security Terminology (cont'd.)

(figure 14.10)
Requests from an application flow through these security stops on the
way to and from the network.
© Cengage Learning 2014

Understanding Operating Systems 60


User Interface

• Windows 8
• Offers same default screen
• All devices running the operating system
• Laptop or desktop users
• Can switch between tile-populated Start screen and
Desktop screen

• Windows Task Manager


• Open: press and hold Ctrl, Alt, and Delete keys together
Understanding Operating Systems 61
(figure 14.13)
Using the Task Manager, users can view the system status, assign
priorities, and more.
© Cengage Learning 2014
62
Understanding Operating Systems
(figure 14.14)
The resource monitor offers running statistics for this session.
© Cengage Learning 2014

Understanding Operating Systems 63


User Interface (cont’d.)

• Command-line interface
• Available from most Windows desktops
• Use Help feature: learn a command’s syntax

Understanding Operating Systems 64


(table 14.4)
Selected commands that can be used in the Command Prompt
Window. For a complete listing, see your technical documentation or
www.microsoft.com. © Cengage Learning 2014
Understanding Operating Systems 65
User Interface (cont'd.)

• Helpful Windows features


• Built-in input methods and fonts for many languages
• Accommodates users working in non-English languages
• Enhanced accessibility options
• On-screen keyboard
• Other tools: magnifier, a narrator, speech recognition,
etc.

Understanding Operating Systems 66


Conclusion
• Windows operating systems
• Started as a microcomputer operating system
• Now includes complex multiplatform software
• Run computing systems of all sizes
• Windows 8
• Singular interface
• Both touch screens and traditional computers
• Windows recognized as:
• Powerful operating system
• Significant market force
Understanding Operating Systems 67
Understanding
operating systems
Introduction to
UNIX / Linux
What is an Operating System?
• The operating system (OS) is the program which starts up when you turn
on your computer and runs underneath all other programs - without it
nothing would happen at all.
• In simple terms, an operating system is a manager. It manages all the
available resources on a computer, from the CPU, to memory, to hard
disk accesses.
• Tasks the operating system must perform:
• Control Hardware - The operating system controls all the parts of the computer
and attempts to get everything working together.
• Run Applications - Another job the OS does is run application software. This
would include word processors, web browsers, games, etc...
• Manage Data and Files - The OS makes it easy for you to organize your
computer. Through the OS you are able to do a number of things to data, including
copy, move, delete, and rename it. This makes it much easier to find and organize
what you have.
UNIX History
• The UNIX operating system was born in the late 1960s. It
originally began as a one man project led by Ken Thompson of Bell
Labs, and has since grown to become the most widely used
operating system.
• In the time since UNIX was first developed, it has gone through
many different generations and even mutations.
• Some differ substantially from the original version, like Berkeley Software
Distribution (BSD) or Linux.
• Others, still contain major portions that are based on the original source
code.
• An interesting and rather up-to-date timeline of these variations of
UNIX can be found at http://www.levenez.com/unix/history.html.
General Characteristics of UNIX as an Operating System (OS)
• Multi-user & Multi-tasking - most versions of UNIX are capable of allowing multiple users
to log onto the system, and have each run multiple tasks. This is standard for most modern
OSs.
• Over 30 Years Old - UNIX is over 30 years old and it's popularity and use is still high. Over
these years, many variations have spawned off and many have died off, but most modern
UNIX systems can be traced back to the original versions. It has endured the test of time. For
reference, Windows at best is half as old (Windows 1.0 was released in the mid 80s, but it
was not stable or very complete until the 3.x family, which was released in the early 90s).
• Large Number of Applications – there are an enormous amount of applications available for
UNIX operating systems. They range from commercial applications such as CAD, Maya,
WordPerfect, to many free applications.
• Free Applications and Even a Free Operating System - of all of the applications available
under UNIX, many of them are free. The compilers and interpreters that we use in most of the
programming courses here at UMBC can be downloaded free of charge. Most of the
development that we do in programming courses is done under the Linux OS.
• Less Resource Intensive - in general, most UNIX installations tend to be much less
demanding on system resources. In many cases, the old family computer that can barely run
Windows is more than sufficient to run the latest version of Linux.
• Internet Development - Much of the backbone of the Internet is run by UNIX servers. Many
of the more general web servers run UNIX with the Apache web server - another free
application.
Parts of the UNIX OS
• The Kernel - handles memory management, input and output requests, and
program scheduling. Technically speaking, the kernel is the OS. It provides
the basic software connection to the hardware. The kernel is very complex
and deals with the inner workings of these things, and is beyond the scope of
this course. The kernel is covered in detail in “Operating Systems.”
• The Shell and Graphical User Interfaces (GUIs) - basic UNIX shells
provides a “command line” interface which allows the user to type in
commands. These commands are translated by the shell into something the
kernel can comprehend, and then executed by the kernel.
• The Built-in System Utilities - are programs that allow a user to perform
tasks which involve complex actions. Utilities provide user interface
functions that are basic to an operating system, but which are too complex to
be built into the shell. Examples of utilities are programs that let us see the
contents of a directory, move & copy files, remove files, etc...
• Application Software & Utilities – these are not part of the operating
system, per se. They are additional programs that are bundled with the OS
distribution, or available separately. These can range from additional or
different versions of basic utilities, to full scale commercial applications.
Flavors of UNIX
• These can be grouped into two categories: Open Source and Proprietary
• Proprietary: (redistribution and modification prohibited or restricted; not free)
• Solaris - Access to a Solaris UNIX server (solaris.gl.umbc.edu) via SSH
access.
• IRIX - There are a couple of IRIX machines in the basement of the library,
as well as server access (irix.gl.umbc.edu) via SSH access.
• Mac OS X - no access currently available at UMBC. and many others...
• Open Source: (source code is readily available and free to modify)
• FreeBSD - no access currently available at UMBC.
• Linux Distributions - access is available in the form of dual-boot PCs
scattered throughout. There are also several Linux servers through which
access is available.
• RedHat (used by UMBC) and the Fedora Project (maintained by
RedHat) Mandrake ,Debian ,SuSE ,Slackware and many others...
• As a side note, Linux is a open source UNIX-based OS that was originally
developed in 1991 by Linus Torvalds, a Finnish undergraduate student.
UNIX Interfaces
• There are really 2 means of connecting to UNIX
computers :
• You can be sitting in front of a dual-bootable PC that you
have booted into Linux and logged onto. All of your
commands are then being run locally on that computer.
When you logon in this manner you have a full GUI
environment.
• You can connect remotely to one of the UNIX servers
(whether from home or at the labs). When you logon in this
manner you have a command line (or text based)
environment. You can also open up a command line on
local lab machines as well.
Graphical User Interfaces
(GUIs)
• When you logon locally, you are presented with
graphical environment.
• You start at a graphical login screen. You must enter
your username and password. You also the have the
option to choose from a couple session types. Mainly
you have the choice between Gnome and KDE.
• Once you enter in your username and password, you
are then presented with a graphical environment that
looks like one of the following...
Command Line Interface

• You also have access to some UNIX servers as well.


• 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.
• 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. (Time permitting, we may cover how to do this.)
The Terminal
Linux vs. Windows
• OS does not have to use a graphical interface.
• 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 text-based OS.
• File system differences.
• 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.
• 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.
Practical Tasks

• Rebooting the computer into Linux on a dual-boot PC.


• Logging in.
• Locking the screen.
• Logging out.
• The non-graphical terminal!
• Press Ctrl-Alt-F2 then login
• Be sure to logout with the command “logout”
• Press Ctrl-Alt-F7 to get the GUI back.
If all else fails in Gnome or
KDE
• If your session seems to have froze up, you can
press ctrl-alt-backspace 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?

• 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.
• 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.
• 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 that client.
What’s 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 a server and launch graphical
applications from one of the UNIX servers.
• 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. 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?
• Gnome and KDE are examples of desktop managers.
Both of these look a lot like Microsoft Windows.
• 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.
• 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.
What is a Window Manager?
• The Window Manager is a program that manages the placement of
Windows on your system. The Window Manager makes it possible to move,
resize, and minimize the various programs running on your computer
• KDE handles this functionality as well, whereas Gnome does not directly
provide this functionality, but rather relies on an independent window
manager to do it for us.
• Think of the Window Manager as the framing around the windows as well
as all of the associated functionality that they provide.
• For example, most all window managers can close, minimize, maximize &
resize.
• However most UNIX window managers add so much more in the way of
functionality. The decoration and customization of these windows under UNIX
tends to be much more flexible.
• Many Window Managers also provide other functionality such as shading,
sticky/nonsticky, window history, and desktop and workspace manipulations.
Some Notes on X window, Desktop
Managers & Window Managers
• 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.
• 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

• Text Editors • Debuggers


• Xemacs • C / C++ debugger - gdb
• Emacs • Interpreters
• Pico • Perl - perl
• Tcl/Tk - tcl & wish
• vi
• Miscellaneous
• Compilers
• Web Browsers - Mozilla,
• C compiler - gcc Netscape, Firefox, and Lynx (lynx
is text based)
• C++ compiler - g++
• Instant Messengers - Gaim
• Java compiler & Java Virtual
Machine - javac & java • Email - Netscape is there, but we
will learn Pine
Introduction to Linux/Unix environment
Operating systems
• operating system: Manages activities and resources of a
computer.
• software that acts as an interface between hardware and user
• provides a layer of abstraction for application developers
• features provided by an operating system:
• ability to execute programs (and multi-tasking)
• memory management (and virtual memory)
• file systems, disk and network access
• an interface to communicate with hardware
• a user interface (often graphical)
• kernel: The lowest-level core of an operating system.
• brief history:

Unix
Multics (1964) for mainframes
• Unix (1969)
• K&R
• Linus Torvalds and Linux (1992)
• key Unix ideas:
• written in a high-level language (C)
• virtual memory
• hierarchical file system; "everything" is a file
• lots of small programs that work together to solve larger problems
• security, users, access, and groups
• human-readable documentation included
On to Linux

Courtesy XKCD.com
Linux
• Linux: A kernel for a Unix-like operating system.
• commonly seen/used today in servers, mobile/embedded devices, ...
• GNU: A "free software" implementation of many Unix-like
tools
• many GNU tools are distributed with the Linux kernel
• distribution: A pre-packaged set of Linux software.
• examples: Ubuntu, Fedora
• key features of Linux:
• open source software: source can be downloaded
• free to use
• constantly being improved/updated by the community
Linux Desktop
• X-windows
• window managers
• desktop environments
• Gnome
• KDE
• How can I try out Linux?
• CSE Virtual machine
• CSE basement labs
• attu shared server
Things you can do in Linux
• Load the course web site in a browser
• Install and play games
• Play MP3s
• Edit photos
• IM, Skype
Shell
• shell: An interactive program that uses user input to manage the
execution of other programs.
• A command processor, typically runs in a text window.
• User types commands, the shell runs the commands
• Several different shell programs exist:
• bash : the default shell program on most Linux/Unix systems
• We will use bash
• Other shells: Bourne, csh, tsch
• Why should I learn to use a shell when GUIs exist?
Why use a shell?
• Why should I learn to use a shell when GUIs exist?
• faster
• work remotely
• programmable
• customizable
• repeatable
Shell commands
command description
exit logs out of the shell
ls lists files in a directory
pwd print the current working directory
cd changes the working directory
man brings up the manual for a command

$ pwd
/homes/iws/rea
$ cd CSE391
$ ls
file1.txt file2.txt
$ ls –l
-rw-r--r-- 1 rea fac_cs 0 2016-03-29 17:45 file1.txt
-rw-r--r-- 1 rea fac_cs 0 2016-03-29 17:45 file2.txt
$ cd ..
$ man ls
$ exit
Relative directories
directory description
. the directory you are in ("working directory")
.. the parent of the working directory
(../.. is grandparent, etc.)
~ your home directory
(on many systems, this is /home/username )
~username username's home directory
~/Desktop your desktop
Directory commands
command description
ls list files in a directory
pwd print the current working directory
cd changes the working directory
mkdir create a new directory
rmdir delete a directory (must be empty)
• some commands (cd, exit) are part of the shell ("builtins")
• others (ls, mkdir) are separate programs the shell runs
Shell commands
• many accept arguments or parameters
• example: cp (copy) accepts a source and destination file path
• a program uses 3 streams of information:
• stdin, stdout, stderr (standard in, out, error)
• input: comes from user's keyboard
• output: goes to console
• errors can also be printed (by default, sent to console like
output)
• parameters vs. input parameters: before Enter is pressed; sent
in by shell-input: after Enter is pressed; sent in by user
Command-line arguments
• most options are a - followed by a letter such as -c
• some are longer words preceded by two - signs, such as --count
• options can be combined: ls -l -a -r can be ls -
lar
• many programs accept a --help or -help option to give
more information about that command (in addition to man
pages)
• or if you run the program with no arguments, it may print help info
• for many commands that accept a file name argument, if
you omit the parameter, it will read from standard input
(your keyboard)
Shell/system commands
command description
man or info get help on a command
clear clears out the output from the console
exit exits and logs out of the shell
command description

date output the system date

cal output a text calendar

uname print information about the current system

• "man pages" are a very important way to learn new commands


man ls
man man
cp
command
File commands
description
copy a file
mv move or rename a file
rm delete a file
touch create a new empty file, or
update its last-modified time stamp

• caution: the above commands do not prompt for confirmation


• easy to overwrite/delete a file; this setting can be overridden (how?)
• Exercise : Given several albums of .mp3 files all in one
folder, move them into separate folders by artist.
• Exercise : Modify a .java file to make it seem as though
you finished writing it on Dec 28 at 4:56am.
Exercise Solutions
• caution: the cp, rm, mv commands do not prompt for confirmation
• easy to overwrite/delete a file; this setting can be overridden (how?)
• Use “-i” with the command, “interactive” to prompt before overwrite
• Exercise : Given several albums of .mp3 files all in one folder,
move them into separate folders by artist.
• mkdir U2
• mkdir PSY
• mkdir JustinBieber
• mv GangnamStyle.mp3 PSY/
• mv Pride.mp3 U2/
• Exercise : Modify a .java file to make it seem as though you
finished writing it on Dec 28 at 4:56am.
• touch –t 201412280456 Hello.java
Basic Emacs Commands
• C- = control key M- = meta/alt key
• read a file into Emacs: C-x C-f
• save a file back to disk: C-x C-s
• exit Emacs permanently: C-x C-c
• search forward: C-s search backward: C-r
• scroll to next screen: C-v scroll to previous screen: M-v
• Undo: C-x u
entity to move over backward forward
character C-b C-f
word M-b M-f
line C-p C-n
go to line beginning/end C-a C-e
go to buffer beginning/end M-< M->
https://courses.cs.washington.edu/courses/cse391/16au/handouts/emacs.pdf
Basic Vim Commands

• :w Write the current file


• :wq Write the current file and exit.
• :q! Quit without writing
• To change into insert mode: i or a
 Use escape to exit
• search forward /, repeat the search backwards: N
• Basic movement:
 hlkj character left, right; line up, down (also arrow keys)
 b w word/token left, right
 ge e end of word/token left, right
 0 $ jump to first/last character on the line
• x delete
• u undo

https://wiki.gentoo.org/wiki/Vim/Guide and http://tnerual.eriogerg.free.fr/vimqrc.pdf

You might also like