Second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – The Process System Process and init.

Slides:



Advertisements
Similar presentations
Categories of I/O Devices
Advertisements

1 CS345 Operating Systems Φροντιστήριο Άσκησης 1.
Intermediate TCP/IP TCP Operation.
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.
CECS 474 Computer Network Interoperability Notes for Douglas E. Comer, Computer Networks and Internets (5 th Edition) Tracy Bradley Maples, Ph.D. Computer.
Zombie and orphan processes. Zombie process (from wikipedia) When a process ends, all of the memory and resources associated with it are deallocated.
Second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – The Process The Process A process is.
Lesson 10-Controlling User Processes. Overview Managing and processing processes. Managing jobs. Exiting/quitting when jobs have been stopped.
CS 497C – Introduction to UNIX Lecture 26: - The Process Chin-Chih Chang
UNIX Process Control Bach 7 Operating Systems Course Hebrew University Spring 2007.
Linux+ Guide to Linux Certification, Second Edition
Process Process: the UNIX abstraction of a stand-along computer that manages resources (memory, CPU, I/O resources) comprising a running program. Processes.
CS335 Networking & Network Administration Tuesday, May 11, 2010.
More Shell Basics CS465 - Unix. Unix shells User’s default shell - specified in /etc/passwd file To show which shell you are currently using: $ echo $SHELL.
CSSE Operating Systems
TCP: Software for Reliable Communication. Spring 2002Computer Networks Applications Internet: a Collection of Disparate Networks Different goals: Speed,
CS 497C – Introduction to UNIX Lecture 35: - TCP/IP Networking Tools Chin-Chih Chang
Ping and traceroute Lab/Homework exercise Assigned 9/12/2006 Due 9/19/2006 CSIT 220 Fall, 2006 Based on T. Blum Exercises.
Second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – Shell Programming The activities of.
5 UNIX Processes. Introduction  Processes  How to list them  How to terminate them  Process priorities  Scheduling jobs  Signals.
UNIX Processes. The UNIX Process A process is an instance of a program in execution. Created by another parent process as its child. One process can be.
Process-to-Process Delivery:
Server Design Discuss Design issues for Servers Review Server Creation in Linux.
TCP/IP Protocol Suite 1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 9 Internet Control Message.
NetworkProtocols. Objectives Identify characteristics of TCP/IP, IPX/SPX, NetBIOS, and AppleTalk Understand position of network protocols in OSI Model.
Lecture 2 TCP/IP Protocol Suite Reference: TCP/IP Protocol Suite, 4 th Edition (chapter 2) 1.
Second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – The Shell The Shell The agency that.
Networks – Network Architecture Network architecture is specification of design principles (including data formats and procedures) for creating a network.
Mukesh N. Tekwani Elphinstone College Mumbai
Chapter 4 UNIX Common Shells Commands By C. Shing ITEC Dept Radford University.
Linux+ Guide to Linux Certification Chapter Fifteen Linux Networking.
Linux+ Guide to Linux Certification, Third Edition
TCP/IP Transport and Application (Topic 6)
Creating and Executing Processes
Managing processes and services. 1. How Linux handles processes 2. Managing running processes 3. Scheduling processes.
Linux+ Guide to Linux Certification, Second Edition Chapter 10 Managing Linux Processes.
RH030 Linux Computing Essentials
Hands On UNIX II Dorcas Muthoni. Processes A running instance of a program is called a "process" Identified by a numeric process id (pid)‏  unique while.
Scis.regis.edu ● CS 468: Advanced UNIX Class 4 Dr. Jesús Borrego Regis University 1.
System calls for Process management
Linux Processes Travis Willey Jeff Mihalik. What is a process? A process is a program in execution A process includes: –program counter –stack –data section.
Processes Dr. Yingwu Zhu. Process Concept Process – a program in execution – What is not a process? -- program on a disk - a process is an active object,
Operating Systems Process Creation
IP addresses IPv4 and IPv6. IP addresses (IP=Internet Protocol) Each computer connected to the Internet must have a unique IP address.
Chapter 3 – Processes (Pgs 101 – 141). Processes  Pretty much identical to a “job”  A task that a computer is performing  Consists of: 1. Text Section.
Linux Operations and Administration Chapter Eight Network Communications.
Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.1 © Copyright IBM Corporation 2008 Unit 9 Working.
Zombie and orphan processes. Zombie process (from wikipedia) When a process ends, all of the memory and resources associated with it are deallocated so.
Firewalls A brief introduction to firewalls. What does a Firewall do? Firewalls are essential tools in managing and controlling network traffic Firewalls.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 2: The Linux System Part 2.
The Process CIS 370, Fall 2009 CIS UMassD. The notion of a process In UNIX a process is an instance of a program in execution A job or a task Each process.
System calls for Process management Process creation, termination, waiting.
CSC414 “Introduction to UNIX/ Linux” Lecture 3
1 Kyung Hee University Chapter 11 User Datagram Protocol.
PROCESSES We will learn more about: ¨ Multi-user processing and multi −tasking ¨ Multi-user processing and multi −tasking ¨ Process types ¨ Process types.
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.
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.
Process Related System Calls By Neha Hulkoti & Kavya Bhat.
Process Management Process Concept Why only the global variables?
Ping and traceroute.
Module 4 Remote Login.
UNIX PROCESSES.
I. Basic Network Concepts
Chapter 2: The Linux System Part 2
Internet Control Message Protocol Version 4 (ICMPv4)
Process-to-Process Delivery:
CGS 3763 Operating Systems Concepts Spring 2013
CSC 140: Introduction to IT
Net 323 D: Networks Protocols
Process-to-Process Delivery: UDP, TCP
Presentation transcript:

second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – The Process System Process and init Even though no one may be using the system, a number of processes keep running all the time. These processes are spawned during system startup by init (PID 1), the parent of the login shell. The ps –e command lists them all. When running the ps –e command, the system processes that have no controlling terminal are easily identified by the ? in the TTY column (tty is a Unix command that prints to standard output the name of the file connected to standard input. The name of the program comes from teletypewriter, abbreviated "TTY".

second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – The Process System Process and init A process that is disassociated from the terminal can neither write to the terminal nor read from it. Such processes are known as daemons. Many of these daemons are actually sleeping (a process state) and wake up only when they receive input.

second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – The Process System Process and init Daemons do important work for the system. The lpsched daemon controls all printing activity. The sendmail handles both your incoming and outgoing mail The TCP/IP network won’t run FTP and TELNET without the inetd daemon. cron is a time-based scheduling service. cron is driven by a crontab, a configuration file that specifies shell commands to run periodically on a given schedule.

second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – The Process The Process Creation Mechanism How is the process created? A process can only be created by another process, and the creation mechanism involves three phases: Fork Exec Wait

second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – The Process The Process Creation Mechanism Fork Forking creates a process by creating a copy of the existing process. The new process has a different PID, and the process that created it becomes its parent. Otherwise the parent and the child have the same process image. If the child does not do an exec, both parent and child would continue to execute the same code from the point forking was invoked.

second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – The Process The Process Creation Mechanism Exec Forking creates a process, but it is not enough to run a new program. To do that, the fork child needs to overwrite its own image with the code and data of the new program. This mechanism is called exec, and the child process is said to exec a new program. No new process is created here; the PID and PPID of exec’d process remain unchanged.

second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – The Process The Process Creation Mechanism Wait while the child is executing a new program, the parent normally waits for the child to die. It then picks up the exit status of the child before it does something else.

second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – The Process The Process Creation Mechanism Example When we run cat from the shell, the shell first forks another shell process. The newly forked shell then overlays itself with the executable image of cat which then starts to run. The parent (original) shell waits for cat to terminate and then picks up the exit status of the child. This is a number returned by the child to the kernel, and has great significance in both shell programming and systems programming (aims to produce software which provides services to the computer hardware).

second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – The Process Inherited Process Attributes When a process is forked and exec’d, the new program has a different PID and PPID then its parent. However, it inherits most of the environment of its parent. The important attributes that are inherited are: The real UID and real GID of the process These represent the UID and GID of the user running the program The effective UID and effective GID of the process These are generally the same as the real ones, but some processes behave differently.

second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – The Process Inherited Process Attributes Why does every process have two UIDs and two GIDs (real and effective)? When running the cat command, a non-privileged user can not use cat to open a file that is readable only by root.

second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – The Process Inherited Process Attributes Why does every process have two UIDs and two GIDs (real and effective)? {apache:~} ls -l /bin/cat /usr/bin/passwd -r-xr-xr-x 1 root bin Jan /bin/cat -r-sr-sr-x 1 root sys Jan /usr/bin/passwd Notice the bit marked s in the permissions field of passwd; this bit is called the set-user-id (SUID), changes the normal ownership scheme. The passwd command must run as it’s executed by the superuser; otherwise file /etc/shadow will not be modified.

second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – The Process Inherited Process Attributes {apache:~} x=5 {apache:~} bash {apache:~} echo $x {apache:~} {apache:~} exit {apache:~} x=5; export x {apache:~} bash {apache:~} echo $x 5 {apache:~} x=10; echo $x 10 {apache:~} exit {apache:~} echo $x 5

second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – The Process When you Can’t Use a Separate Process ($echo “You have not keyed in 3 arguments” ; exit) this sequence meant to terminate the current shell; but it will not. Commands grouped in () are run in a sub-shell. { echo “You have not keyed in 3 arguments” ; sleep2; exit ;} Commands grouped within {} are executed in the current shell.

second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – The Process Process States and Zombies Running: At any instant of time, a process is in a particular state. A process after creation is in the runnable state before it actually runs (state running). Sleeping: While the process is running, it may invoke a disk I/O operation. The process then has nothing to do except wait for the I/O to complete. The process then moves to the sleeping state to be woken up when the I/O operation is over. Suspended: The process can also be suspended by pressing, usually, [Ctrl-z].

second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – The Process Process States and Zombies Zombie: Process whose parents don’t wait for their death move to zombie state. When the process dies, its parent picks up the child’s exit status (the reason for waiting) from the process table and frees up the process table entry. However, when the parent doesn’t wait (but is still alive), the child turns into a zombie. A zombie is a harmless dead child that reserves the process table slot. When the parent dies before the child, the child then becomes an orphan and kernel makes init the parent of all the orphans.

second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – The Process Process States and Zombies {apache:~} ps -l -u kkhan F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD 0 S ? 317 ? pts/120 0:00 bash 0 S ? 184 ? pts/120 0:00 ksh 0 S ? 1049 ? ? 0:00 sshd 0 O ? 170 pts/120 0:00 ps O – Running on the CPU S – Sleeping, process is waiting for an event R – Runnable. The process simply needs to be selected for running T – Suspended. User pressed [Ctrl-z] Z – Zombie. Parent didn’t wait for the death of the child

second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – Networking Tools TCP/IP It is a set of networking protocols built into the UNIX kernel. These protocols define a set of rules that each machine must comply with to communicate with another machine in the network. The term TCP/IP expands to Transmission Control Protocol/Internet Protocol, but is actually a collection of several protocols, which includes the TCP and IP protocols.

second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – Networking Tools TCP/IP It is independent of hardware and operating system. Key features include: Delivery of Data in multiple packets Complete reliability of transmission with full error control

second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – Networking Tools TCP/IP It is packet-switching system there is no dedicated connection between sender and receiver data is broken in packets, and each packet is provided with a header the header contains the sequence number and checksum determining the exact information in the packet. packets are put inside envelopes, the sender’s and recipient's addresses are written on them, and the packets are sent on their way.

second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – Networking Tools TCP/IP It is packet-switching system as the packets travel along a vast network like the Internet, they encounter routers everywhere Routers are special computers or intelligent devices that look at the envelope addresses and then determine the most efficient route each packet has to take to move closer to its destination. Because of the load on the network varies constantly, packets may move along different routes and arrive out of order. They are reassembled in the correct order from the information provided in them.

second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – Networking Tools TCP/IP It is packet-switching system before reassembly, the checksum of each packet is calculated and checked with the number that has been sent in the packet. If the checksums don’t match, the packet is corrupted and has to be resent. Hostname and IP address In a network, computers are known as hosts and identified by their hostnames. These names are unique throughout the network. $ hostname apache (host name) apache.utdallas.edu (FQDN – fully qualified domain name)

second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX – Networking Tools TCP/IP Every networked host is also assigned an IP address. This is a set of four dot-delimited numbers called (octets). The host apache might have this address: The maximum value of each octet is 255 The IP address of a host is also unique in that network. On the Internet, however, hosts have unique IP addresses and FQDNs. TCP/IP applications can address a host using either form as an identifier.