Scis.regis.edu ● CS 468: Advanced UNIX Class 4 Dr. Jesús Borrego Regis University 1.

Slides:



Advertisements
Similar presentations
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Advertisements

More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Chapter 3 Process Description and Control
Basic Unix system administration
Operating Systems COMP 4850/CISG 5550 Processes Introduction to Threads Dr. James Money.
Threads Irfan Khan Myo Thein What Are Threads ? a light, fine, string like length of material made up of two or more fibers or strands of spun cotton,
CS 311 – Lecture 14 Outline Process management system calls Introduction System calls  fork()  getpid()  getppid()  wait()  exit() Orphan process.
Linux+ Guide to Linux Certification, Second Edition
Page 1 Processes and Threads Chapter 2. Page 2 Processes The Process Model Multiprogramming of four programs Conceptual model of 4 independent, sequential.
Page 1 Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
Process Process: the UNIX abstraction of a stand-along computer that manages resources (memory, CPU, I/O resources) comprising a running program. Processes.
CSCE 351: Operating System Kernels
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.
CSSE Operating Systems
Unix & Windows Processes 1 CS502 Spring 2006 Unix/Windows Processes.
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
Linux Operating System
Process Description and Control A process is sometimes called a task, it is a program in execution.
Processes in Unix, Linux, and Windows CS-502 Fall Processes in Unix, Linux, and Windows CS502 Operating Systems (Slides include materials from Operating.
Phones OFF Please Processes Parminder Singh Kang Home:
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 Description and Control Chapter 3. Major Requirements of an OS Interleave the execution of several processes to maximize processor utilization.
Process in Unix, Linux, and Windows CS-3013 A-term Processes in Unix, Linux, and Windows CS-3013 Operating Systems (Slides include materials from.
Introduction to Processes CS Intoduction to Operating Systems.
Managing Processes CSCI N321 – System and Network Administration Copyright © 2000, 2011 by Scott Orr and the Trustees of Indiana University.
Chapter 3 Process Description and Control
Linux+ Guide to Linux Certification, Third Edition
The Structure of Processes (Chap 6 in the book “The Design of the UNIX Operating System”)
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
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
ITEC 502 컴퓨터 시스템 및 실습 Chapter 2-1: Process Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Threads G.Anuradha (Reference : William Stallings)
CE Operating Systems Lecture 10 Processes and process management in Linux.
Scis.regis.edu ● CS 468: Advanced UNIX Class 5 Dr. Jesús Borrego Regis University 1.
Linux+ Guide to Linux Certification Chapter Eleven Managing Linux Processes.
Processes CS 6560: Operating Systems Design. 2 Von Neuman Model Both text (program) and data reside in memory Execution cycle Fetch instruction Decode.
Operating Systems Process Creation
CS4315A. Berrached:CMS:UHD1 Process Management Chapter 6.
Process Description and Control Chapter 3. Source Modified slides from Missouri U. of Science and Tech.
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
ACCESS CONTROL. Components of a Process  Address space  Set of data structures within the kernel - process’s address space map - current status - execution.
What is a Process ? A program in execution.
CSC414 “Introduction to UNIX/ Linux” Lecture 3
Unix System Administration Controlling Processes Chapter 5.
Basic UNIX system administration CS 2204 Class meeting 14 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Process Management Process Concept Why only the global variables?
Chapter 9 Periodic Processes
Unix Process Management
UNIX System Overview.
Processes A process is a running program.
Processes in Unix, Linux, and Windows
Structure of Processes
Processes in Unix, Linux, and Windows
Processes in Unix, Linux, and Windows
CHAPTER 8 ( , ) John Carelli, Instructor Kutztown University
Process Control B.Ramamurthy 2/22/2019 B.Ramamurthy.
Controlling Processes
Unix Process Control B.Ramamurthy 4/11/2019 B.Ramamurthy.
Processes in Unix, Linux, and Windows
Processes in Unix and Windows
CS510 Operating System Foundations
Process Description and Control in Unix
Process Description and Control in Unix
Presentation transcript:

scis.regis.edu ● CS 468: Advanced UNIX Class 4 Dr. Jesús Borrego Regis University 1

Topics Controlling Processes Periodic Processes Process Management Q&A Midterm 2

Process A running program Used to control resource allocation by the OS When a process is created, a table is made in a Process Table Process consists of address space and memory pages allocated to the process Address space has code, variables, stacks, virtual memory pointers, and other data 4

Processes 5 A process can be defined as: a program in execution an instance of a running program the entity that can be assigned to, and executed on, a processor a unit of activity characterized by a single sequential thread of execution, a current state, and an associated set of system resources Source: Operating Systems: Internals and Design Principles (7 th. Ed.) by William Stallings

Process data structures Address space map for process Process state Execution priority Resources allocated and in use File descriptors and network ports used Process signal mask Process owner 6

Processes 7

Threads Created by a fork in a process Inherits from parent Can have multiple threads executing concurrently Multicore and multiprocessor systems benefit multithreading 8

Attributes PID – unique process ID PPID – parent PID UID – user ID; who created the process EUID – effective UID – reflects resources the process can have; same as UID in most cases GID – group ID EGID – effective GID Niceness – how the process interacts with others Control terminal – linkages to standard I/O 9

Process lifecycle Created with fork Process execution begins with exec Process terminates with a call to exit ▫Provides return code (0 is success) ▫Parent receives return code to acknowledge child’s death If parent dies first, child is “adopted” by init 10

Signals Interrupt request for processes Can be used to communicate among processes Can kill, interrupt, or suspend processes Can be originated by kernel when unhandled exceptions occur When received, a handler is called (if handler is defined); otherwise, kernel takes action 11

Kill signal Used to terminate a process Can be used by normal users to kill their own processes Root access is required for other processes Kill receives a signal, a numeric value (see previous slide) In some systems, killall terminates init – system shutdown 13

Monitoring processes To monitor processes: ps Shows PID, UID, priority, control terminal Can include memory used, CPU utilization, status See example of ps aux on page

Dynamic Monitoring ps captures a snapshot of the system ▫At that particular time top – top processes using the system every 10 seconds (default) topas – AIX version prstat – Solaris version 20

/proc File System The /proc directory contains information about the system state The kernel creates the directory Information is organized by subdirectories named by the PID ▫/proc 1 is the init process directory Predefined directories are shown in Table 5.7 (next slide) 21

Tracing signals and system calls Linux provides visibility into a process with strace ▫Shows every system call and every signal received Similar: truss (AIX, Solaris), and tusc (HPUX) Example of strace is shown on page

Scheduling Commands 26 To schedule scheduled processes: cron daemon Starts when system boots up and terminates when shutdown Receives configuration files (crontab) with commands and times to execute ▫User crontabs located /var/spool/cron ▫One for root, up to one per user Executes lines with sh

crontab File Format 27 #comments Six field line: ▫Minute, hour, day of month, month, weekday (separated by white space) ▫Command (passed to shell in entirety) % represent new lines ▫Command receives characters up to first %

Time Formats 29 * - wild card Single integers – matches exactly Two integers separated by dash – range Ranges followed by slash and step: ▫1-10/2  1 to 10, in 2 increments Comma separated list of values * * 1-3  10:35 am Monday to Wednesday

crontab Management 31 To create or replace your user’s crontab: crontab filename To check out crontab and edit: crontab -e To list contents of crontab: crontab -l To remove crontab: crontab –r Roots can add username to above

Applications of cron 32 Preinstalled: ▫Daily scripts in /etc/cron.daily ▫Weekly scripts in /etc/cron.weekly Reminders: periodic tasks Filesystem cleanup ▫Removing obsolete files Network file synchronization Log file cleanup

Process Management 33 Kernel controls process access to RAM and CPU: ▫Scheduler – allocates CPU time to a processes, based on scheduling algorithm ▫Memory Manager – allocates memory space to each process and protects it from external source access

CPU Utilization 34

Scheduling of processes 35 Source: Operating Systems: Internals and Design Principles (7 th. Ed.) by William Stallings

Executable file layout 36 Magic Number and Main Header Section One Header Section Two Header Section One Section Two

First Processes PID 0 (sched) – created at boot PID 0 executes fork and exec twice to create processes 1 (init) and 2 (pageout) 37 Process 1 fork/exec process 48 process 12 process 34 fork/exec

Process States 38 RunningZombiedRunnableIdle Sleeping Suspended Initialize Signal Exit Wait on Event Occurs Allocated CPU

Process Composition Code Area – executable portion of the process Data Area – static data used by process Stack Area – Temporary data User Area – Housekeeping process information Page Tables – Memory management system 39

User Area One per process Accessible by the kernel Fields included: ▫Signal handling record ▫File descriptor record ▫CPU access record 40

Process Table One entry for each process Created in kernel’s data region Contain: ▫PID and PPID ▫UID and GID ▫Process state ▫Location of code, data, stack, user area ▫Pending signal set 41

Midterm 2 hour Take home Due by Friday midnight in a Word document to 42

Questions? 43