Linux in More Detail Shirley Moore CPS5401 August 29, 2013 1.

Slides:



Advertisements
Similar presentations
EEE 435 Principles of Operating Systems Operating System Concepts (Modern Operating Systems 1.5)
Advertisements

Using tcpdump. tcpdump is a powerful tool that allows us to sniff network packets and make some statistical analysis out of those dumps. tcpdump operates.
Introduction to UNIX Cornell University CS 316 – Fall 2006 Slides by Michael Siegenthaler.
CIS 118 – Intro to UNIX Shells 1. 2 What is a shell? Bourne shell – Developed by Steve Bourne at AT&T Korn shell – Developed by David Korn at AT&T C-shell.
Processes and Job Control. Foreground and Background (1)  Unix is a multi-tasking operating system –some of these tasks are being done by other users.
Process Relationships Terminal and Network Logins Process Groups and Sessions Job Control Relationships.
Lesson 10-Controlling User Processes. Overview Managing and processing processes. Managing jobs. Exiting/quitting when jobs have been stopped.
A Practical Guide to Red Hat ® Linux ®, Third Edition. © 2007 Mark G. Sobell, Prentice Hall,
1 The Shell and some useful administrative Unix Commands How Unix works along with some additional, useful administrative Unix commands you might need.
CHAPTER 2 THE UNIX SHELLS by U ğ ur Halıcı. layers in a unix system 1 Users Standard utility programs (shell, editors, compilers, etc.) Standard utility.
Enrique Blanco García © 2004 Introduction to the UNIX environment Enrique Blanco Cover from the book Modern operating systems. A. Tanenbaum.
Introduction to UNIX Cornell University CS 316 – Fall 2007 Slides by Jed Liu (Based on slides by Michael Siegenthaler)
Now, return to the Unix Unix shells: Subshells--- Variable---1. Local 2. Environmental.
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
Information Networking Security and Assurance Lab National Chung Cheng University 1 What Linux is? Free Unix Like Open Source Network operating system.
Processes & Daemons Chapter IV / Part III. Commands Internal commands: alias, cd, echo, pwd, time External commands, code is in a file: grep, ls, more.
Lecture 02CS311 – Operating Systems 1 1 CS311 – Lecture 02 Outline UNIX/Linux features – Redirection – pipes – Terminating a command – Running program.
UNIX chapter 03 Getting Started Mr. Mohammad Smirat.
Introduction to Linux/UNIX. History UNIX beginnings in 1969 (Linus Torvalds is born!) AT & T Bell Laboratories (Ken Thompson & Dennis Richie) Working.
1 The Shell and some useful administrative Unix Commands How Unix works along with some additional, useful administrative Unix commands you might need.
Chapter 3 Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access.
Lesson 1. PC vs. Multi-user System  Personal Computer – each user gets his/her own processor (or multicore processor).  Multi-user system – The processor,
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
– Introduction to the Shell 10/1/2015 Introduction to the Shell – Session Introduction to the Shell – Session 2 · Permissions · Users.
An Introduction to UNIX System --- Cosc513 Presentation n Instructor: Morteza Anvari n Author: Yonghong Pan n ID#: n Date: Jan.29, 2001.
CSC 322 Operating Systems Concepts Lecture - 4: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Introduction to Unix – CS 21 Lecture 9. Lecture Overview Shell description Shell choices History Aliases Topic review.
Linux+ Guide to Linux Certification, Third Edition
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 6 System Calls OS System.
The Structure of Processes (Chap 6 in the book “The Design of the UNIX Operating System”)
1 Pertemuan 3 Konsep Sistem Operasi Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5.
Linux+ Guide to Linux Certification, Second Edition Chapter 10 Managing Linux Processes.
Unix/Linux cs3353. The Shell The shell is a program that acts as the interface between the user and the kernel. –The shell is fully programmable and will.
Processes Introduction to Operating Systems: Module 3.
1 Lecture 6 Introduction to Process Management COP 3353 Introduction to UNIX.
(a) What is the output generated by this program? In fact the output is not uniquely defined, i.e., it is not necessarily the same in each execution. What.
UNIX Unit 1- Architecture of Unix - By Pratima.
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
Linux Commands C151 Multi-User Operating Systems.
Copyright © Curt Hill Operating Systems An Introductory Overview.
What is a Process ? A program in execution.
OS Labs 2/25/08 Frans Kaashoek MIT
Agenda Managing Processes (Jobs) Command Grouping Running jobs in background (bg) Bringing jobs to foreground (fg), Background job status (jobs) Suspending.
1 Lecture 19: Unix signals and Terminal management n what is a signal n signal handling u kernel u user n signal generation n signal example usage n terminal.
Agenda The Bourne Shell – Part I Redirection ( >, >>,
WHY AN OPERATING SYSTEM (OS) OS interacts with hardware and manages programs. Programs not expected to know which hardware they will run on. Must be possible.
An Introduction to processes R Bigelow. A Unix Process A process in Unix is simple a program The Unix system is made up of a group of processes all interacting.
Lesson 8-Specifying Instructions to the Shell. Overview An overview of shell. Execution of commands in a shell. Shell command-line expansion. Customizing.
Chapter 16 Advanced Bourne Shell Programming. Copyright © 2005 Pearson Addison-Wesley. All rights reserved. Objectives To discuss numeric data processing.
Process Relationships Chien-Chung Shen CIS/UD
Foreground and background processes
Lecture 3: Basic OS Concepts
Linux Commands Help HANDS ON TRAINING Author: Muhammad Laique
The UNIX Shell Learning Objectives:
UNIX System Overview.
Basic UNIX OLC Training.
An Introduction to UNIX System --- Cosc513 Presentation
Chapter 15, Exploring the Digital Domain
Introduction to Linux/UNIX
Mid Term review CSC345.
Threads Chapter 4.
Lecture 3: Basic OS Concepts
Operating Systems Lecture 3.
Linux Shell Script Programming
CSE 303 Concepts and Tools for Software Development
The Main Features of Operating Systems
Chapter 3 The UNIX Shells
Consult America Technology Consulting Services
Lecture 6 Introduction to Process Management
LPI Linux Certification
Presentation transcript:

Linux in More Detail Shirley Moore CPS5401 August 29,

The Kernel The software layer that manages and allocates system resources (e.g., CPU, RAM, devices) Services provided by the kernel – Process scheduling preemptive multitasking – Memory management virtual address spaces – Provision of a file system – Creation and termination of processes – Access to devices – Networking – Provision of a system call application programming interface (API) 2

Linux Kernel Versions kernelnewbies.org/LinuxChanges/ kernelnewbies.org/LinuxVersions/ Most recent version is 3.10, released on 30 June 2013 perf_events for accessing hardware counters merged into the Linux kernel starting with version To access hardware counters from within a KVM virtual machine, you need Linux version 3.3 or later. 3

Kernel mode vs. user mode Areas of virtual memory are marked as being part of user space or kernel space – When running in user mode, CPU can only access memory in user space – i.e., user processes cannot access kernel instructions and data structures directly – When running in kernel mode, CPU can access both user and kernel memory space Some operations can be performed only while the processor is operating in kernel mode – accessing memory management hardware – initiating device I/O operations e.g., “A process can write data to a file” should really be “A process can request that the kernel write data to a file”. The shell runs as a user process. 4

File Permissions Linux systems are multi-user environments where multiple users run programs and share data. Files and directories have three levels of permissions: User, Group, and Others. The types of permissions a file can have are Readable, Writeable, and Executable User (owner)GroupOthers (everyone else) rw-r-- Read permissionWrite permissionExecute permission rwx 5

Changing Permissions chmod – command to change permissions on a file or directory chgrp – command to change group ownership to another group chown – change ownership of a file (can only be done by the superuser Above commands all support –R for recursion. 6

Environment List Each process has an environment list, which is a set of environment variables maintained in the process’s user space memory. – Each list element consists of a name and an associated value – Type the printenv command to see the environment list for your login shell 7

Setting Environment Variables bash export MYVAR=‘Hello world’ tcsh setenv MYVAR ‘Hello world’ The environment list can be inherited by a child process from the parent. 8

Environment Variables used by the Shell HOME – pathname of the user’s login directory PATH – list of directories that the shell should search for programs corresponding to commands entered by the user To append or prepend to the PATH variable – bash: export PATH=$PATH:/path/to/dir1:/path/to/dir2 export PATH=/path/to/dir1:$PATH:/path/to/dir2 – tcsh: set PATH = ($PATH /path/to/dir1 /path/to/dir2) set PATH = (/path/to/dir1 $PATH /path/to/dir2) Type the which command to see the complete path the shell is using for a program 9

I/O Redirection Standard output – When you issue a Unix command like date, the output of the command goes to what is called standard output. $ date Thu Aug 29 17:10:31 EDT 2013 – In Unix, you can redirect standard output to go to a file. $ date >date.txt $ cat date.txt Thu Aug 29 17:12:25 EDT

I/O Redirection (2) The >> symbol appends what would go to standard output to a file. $ date >>date.txt $ cat date.txt Thu Aug 29 17:12:25 EDT 2013 Thu Aug 29 17:15:10 EDT 2013 Redirection of standard input works similarly – eg., mail -s "unix-lab1” < date.txt (This example may not work on all Unix systems). 11

Pipes The symbol | is the Unix pipe symbol. It means is that the standard output of the command to the left of the pipe gets sent as standard input of the command to the right of the pipe. $ cat date.txt | wc Quiz question: How many processes are involved in executing the above pipeline? 12

Job Control Available in all shells except Bourne shell Allows a user to simultaneously execute and manipulate multiple commands or pipelines. All the processes in a pipeline are placed into a new process group, or job. A session is a collection of jobs. The session leader is the process that created the session. All the jobs created by a job-control shell belong to the same session as the shell, which is the session leader. 13

Job Control (2) Sessions usually have a controlling terminal. At any point in time, one job in a session is the foreground job, which can read input from the terminal and send output to it. If the user types the interrupt character (usually Control-C), or the suspend character (usually Control-Z) on the controlling terminal, the terminal driver sends a signal that kills, or suspends, the foreground job. A session can have any number of background jobs, which are created by ending a command with &. Useful commands: ps, bg, fg 14

Time Real time is measured from some standard point (calendar time) or from the start of the life of a process (elapsed or wallclock time) Process time, also called CPU time, is the toal amount of CPU time that a process has used since starting. – CPU time is further divided into system time (the time spent in kernel mode) and user time (the time spent in user mode) 15