1 Logging in to a UNIX System init ( Process ID 1 created by the kernel at bootstrap ) spawns getty for every terminal device invokes our login shell terminal.

Slides:



Advertisements
Similar presentations
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. Unix system calls (part 1) history and.
Advertisements

1 CS345 Operating Systems Φροντιστήριο Άσκησης 1.
Chapter 7 Process Environment Chien-Chung Shen CIS, UD
The Environment of a UNIX Process. Introduction How is main() called? How are arguments passed? Memory layout? Memory allocation? Environment variables.
Process Relationships Terminal and Network Logins Process Groups and Sessions Job Control Relationships.
Chapter One Introduction to Unix1 System Programming Introduction to Unix.
CSC 501 Lecture 2: Processes. Von Neumann Model Both program and data reside in memory Execution stages in CPU: Fetch instruction Decode instruction Execute.
Process Control Hua LiSystems ProgrammingCS2690Process Control Page 1 of 41.
CS 497C – Introduction to UNIX Lecture 26: - The Process Chin-Chih Chang
UNIX Process Control Bach 7 Operating Systems Course Hebrew University Spring 2007.
1 Processes and Pipes COS 217 Professor Jennifer Rexford.
Process Process: the UNIX abstraction of a stand-along computer that manages resources (memory, CPU, I/O resources) comprising a running program. Processes.
Introduction to Kernel
Advanced OS Chapter 3p2 Sections 3.4 / 3.5. Interrupts These enable software to respond to signals from hardware. The set of instructions to be executed.
Process in Unix, Linux and Windows CS-3013 C-term Processes in Unix, Linux, and Windows CS-3013 Operating Systems (Slides include materials from.
CS-502 Fall 2006Processes in Unix, Linux, & Windows 1 Processes in Unix, Linux, and Windows CS502 Operating Systems.
Unix Process Environment. main Function A C program starts execution with a function called main. The prototype for the main function is: int main (int.
Unix & Windows Processes 1 CS502 Spring 2006 Unix/Windows Processes.
Advanced Programming in the UNIX Environment Hop Lee.
University of Pennsylvania 9/12/00CSE 3801 Multiprogramming CSE 380 Lecture Note 3.
March 1, 2002Serguei A. Mokhov, 1 Brief Introduction to System Calls and Process Management COMP 229, 346, 444, 5201 Revision 1.3.
Process. Process Concept Process – a program in execution Textbook uses the terms job and process almost interchangeably A process includes: – program.
Introduction to UNIX / Linux - 11
Fundamentals CIS 552. Fundamentals Low-level I/O (read/write using system calls)  Opening/Creating files  Reading & Writing files  Moving around in.
Introduction to Processes CS Intoduction to Operating Systems.
March 1, 2002Serguei A. Mokhov, 1 Brief Introduction to System Calls and Process Management COMP229 - System Software Edition 1.1,
Chapter 4 UNIX Common Shells Commands By C. Shing ITEC Dept Radford University.
Exec Function calls Used to begin a processes execution. Accomplished by overwriting process imaged of caller with that of called. Several flavors, use.
Multiprogramming CSE451 Andrew Whitaker. Overview Multiprogramming: Running multiple programs “at the same time”  Requires multiplexing (sharing) the.
1 Week 2 The Crunchy Shell to the Soft and Chewy Kernel… Sarah Diesburg 8/3/2010 COP4610 / CGS5765.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Agenda  Working with Processes: Purpose Running Programs within same process (execl, execlp, execle, execv, execvp, execve) “Spawning” other process (fork,
Scis.regis.edu ● CS 468: Advanced UNIX Class 4 Dr. Jesús Borrego Regis University 1.
ICS 431 – Operating System. a command-line interpreter. a program that interprets commands and acts as an intermediary between the user and the inner.
Chapter 11 Process Management
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,
Process Management CS3320 Spring Process A process is an instance of a running program. –Not the same as “program” or “processor” Process provides.
Operating Systems Process Creation
UNIX Signals * POSIX-Defined Signals * Signaling Processes * Signal Mask * sigaction * kill and sigaction * alarm * Interval Timers * POSIX.1b Timers *
Advanced Programming in the UNIX Environment Hop Lee.
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
Compunet Corporation Introduction to Unix (CA263) Your Environment By Tariq Ibn Aziz Dammam Community College.
Process Management Azzam Mourad COEN 346.
S -1 Processes. S -2 wait and waitpid (11.2) Recall from a previous slide: pid_t wait( int *status ) wait() can: (a) block; (b) return with status; (c)
Direct memory access. IO Command includes: buffer address buffer length read or write dada position in disk When IO complete, DMA sends an interrupt request.
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.
Chapter 16 Advanced Bourne Shell Programming. Copyright © 2005 Pearson Addison-Wesley. All rights reserved. Objectives To discuss numeric data processing.
Chapter 7 Process Environment Chien-Chung Shen CIS/UD
Introduction to Kernel
Linux Processes & Threads
Using Processes.
Unix Process Management
Processes in Unix, Linux, and Windows
Structure of Processes
Processes in Unix, Linux, and Windows
Lecture 5: Process Creation
More examples How many processes does this piece of code create?
Processes in Unix, Linux, and Windows
System Structure and Process Model
CSCI The UNIX System Shell Startup and Variables
The Environment of Unix Process
Linux Shell Script Programming
Lecture 6: Multiprogramming and Context Switching
Unix Process Control B.Ramamurthy 4/11/2019 B.Ramamurthy.
Processes in Unix, Linux, and Windows
Processes in Unix and Windows
Processes – Part I.
CS510 Operating System Foundations
Chapter 3: The Shell.
System Programming: Process Management
Presentation transcript:

1 Logging in to a UNIX System init ( Process ID 1 created by the kernel at bootstrap ) spawns getty for every terminal device invokes our login shell terminal device driver user at a terminal fd 0, 1, 2 login reads password entry ( getpwnam() ), asks for user's password ( getpass() ) and validates it; changes ownership of our terminal device, changes to our UID and changes to our home directory. Sets additional environment variables ( HOME, SHELL, USER, LOGNAME, PATH ) fd 0, 1, 2 Login shell (bash) fd 0, 1, 2 getty open s terminal device, sets file descriptors 0, 1, 2 to it, waits for a user name, usually sets some environment variable ( TERM ) invokes login when user name entered

1 Command Execution current shell (bash) executes built-in commands (echo, kill, pwd,...) or shell scripts invoked by the. (dot) command:. shell-script sub-shell (bash) executes a shell script or calls exec() to execute a program variables defined in the parent are not passed (use the export command in parent to pass variables). Variables defined or changed in a sub-shell does not affect variables of the parent ! fork() (creates a new shell process) wait or continue if command is executed in the background sub-shell terminates after script or program execution

1 stack (caller info., return address, local variables) (read/write) Typical Memory Layout text (code & constants, read only) command-line arguments, environment variables initialized uninitialized Heap (dynamic memory allocation) data(read/write) char a, *p="string"; int v[10]; int f(char c) { int x, y; static long i=1;... return x; } } read from program file } initialized to 0 x, y, c p, i a, v "string", f Low address

1 User process Starting and Terminating a C Program UNIX kernel Program file C start-up routine main() call user functions call return exit() does not return standard I/O cleanup call return _exit() exec - the only way a program is executed by the kernel

1 current process sigprocmask() kernel user interrupt ( CTRL-C ) sigpending() kill() raise(), abort() process Signal Mask, Pending Signals Each process has a signal mask: set of signals currently blocked from delivery to the process signal mask can be manipulated by sigprocmask() if set is not NULL => signal mask is modified depending on the value of how if oset is not NULL => current signal mask is returned sigpending() returns the set of signals that are blocked and currently pending for the process sigset_t is a data type to represent a signal set. int sigprocmask(int how,sigset_t * set, sigset_t * oset ) int sigpending(sigset_t * set )