Lecture 10: Processes II-A Process States Process vs. Thread Background/Foreground.

Slides:



Advertisements
Similar presentations
Scheduling. Main Points Scheduling policy: what to do next, when there are multiple threads ready to run – Or multiple packets to send, or web requests.
Advertisements

Essential System Administration 3rd Edition Chapter 2 The Unix Way(Cont.) University Of Palestine.
Introduction to Unix – CS 21 Lecture 10. Lecture Overview Midterm questions Jobs and processes description The foreground and background Controlling jobs.
A Practical Guide to Red Hat ® Linux ®, Third Edition. © 2007 Mark G. Sobell, Prentice Hall,
Chapter 13 Processes. What is a process? A process is a program in execution A process is created whenever an external command is executed Whenever the.
Shells and Processes Bryce Boe 2012/08/08 CS32, Summer 2012 B.
1 Threads, SMP, and Microkernels Chapter 4. 2 Process: Some Info. Motivation for threads! Two fundamental aspects of a “process”: Resource ownership Scheduling.
1 Processes and Pipes COS 217 Professor Jennifer Rexford.
Ceng Operating Systems Chapter 2.1 : Processes Process concept Process scheduling Interprocess communication Deadlocks Threads.
Processes & Daemons Chapter IV / Part III. Commands Internal commands: alias, cd, echo, pwd, time External commands, code is in a file: grep, ls, more.
CS 497C – Introduction to UNIX Lecture 27: - The Process Chin-Chih Chang
1 Chapter 4 Threads Threads: Resource ownership and execution.
Threads, SMP, and Microkernels
RESOURCE MANAGEMENT System Resources. What resources are managed in a computer system?
5 UNIX Processes. Introduction  Processes  How to list them  How to terminate them  Process priorities  Scheduling jobs  Signals.
Chapter 51 Threads Chapter 5. 2 Process Characteristics  Concept of Process has two facets.  A Process is: A Unit of resource ownership:  a virtual.
Linux in More Detail Shirley Moore CPS5401 August 29,
Operating Systems Yasir Kiani. 22-Sep Agenda for Today Review of previous lecture Process management commands: bg, fg, ^Z, jobs, ^C, kill Thread.
 Introduction to Operating System Introduction to Operating System  Types Of An Operating System Types Of An Operating System  Single User Single User.
The process concept (section 3.1, 3.3 and demos)  Process: An entity capable of requesting and using computer resources (memory, CPU cycles, files, etc).
Chapter 41 Processes Chapter 4. 2 Processes  Multiprogramming operating systems are built around the concept of process (also called task).  A process.
Chapter 2 (PART 1) Light-Weight Process (Threads) Department of Computer Science Southern Illinois University Edwardsville Summer, 2004 Dr. Hiroshi Fujinoki.
Quick overview of threads in Java Babak Esfandiari (extracted from Qusay Mahmoud’s slides)
Win32 Programming Lesson 10: Thread Scheduling and Priorities.
Processes and Threads CS550 Operating Systems. Processes and Threads These exist only at execution time They have fast state changes -> in memory and.
Processes and Threads Processes have two characteristics: – Resource ownership - process includes a virtual address space to hold the process image – Scheduling/execution.
Process Control. Module 11 Process Control ♦ Introduction ► A process is a running occurrence of a program, including all variables and other conditions.
Dr. R R DOCSIT, Dr BAMU. Basic Java : Multi Threading 2 Objectives of This Session State what is Multithreading. Describe the life cycle of Thread.
1 Chapter 2.1 : Processes Process concept Process concept Process scheduling Process scheduling Interprocess communication Interprocess communication Threads.
Chapter 7 Operating Systems. Define the purpose and functions of an operating system. Understand the components of an operating system. Understand the.
Process by Dr. Amin Danial Asham. References Operating System Concepts ABRAHAM SILBERSCHATZ, PETER BAER GALVIN, and GREG GAGNE.
Managing processes and services. 1. How Linux handles processes 2. Managing running processes 3. Scheduling processes.
Hank Childs, University of Oregon May 13th, 2015 CIS 330: _ _ _ _ ______ _ _____ / / / /___ (_) __ ____ _____ ____/ / / ____/ _/_/ ____/__ __ / / / / __.
Copyright ©: University of Illinois CS 241 Staff1 Threads Systems Concepts.
Concurrent Programming and Threads Threads Blocking a User Interface.
CS 153 Design of Operating Systems Spring 2015 Lecture 5: Processes and Threads.
Linux+ Guide to Linux Certification Chapter Eleven Managing Linux Processes.
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,
1 Lecture 6 Introduction to Process Management COP 3353 Introduction to UNIX.
Operating Systems CSE 411 CPU Management Sept Lecture 10 Instructor: Bhuvan Urgaonkar.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Processes and Threads.
Thread basics. A computer process Every time a program is executed a process is created It is managed via a data structure that keeps all things memory.
Lecture on Central Process Unit (CPU)
Chapter 2 Process Management. 2 Objectives After finish this chapter, you will understand: the concept of a process. the process life cycle. process states.
PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Workshop VI Scheduling & Process Management Professional.
Agenda The Bourne Shell – Part I Redirection ( >, >>,
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.
Operating System Examples - Scheduling. References r er/ch10.html r bangalore.org/blug/meetings/200401/scheduler-
Lecture 5 Page 1 CS 111 Online Process Creation Processes get created (and destroyed) all the time in a typical computer Some by explicit user command.
Processes and threads.
Chapter 3: Process Concept
Threads and Scheduling
Process Creation Processes get created (and destroyed) all the time in a typical computer Some by explicit user command Some by invocation from other running.
Chapter 4 Threads.
Chapter 3: Processes Source & Copyright: Operating System Concepts, Silberschatz, Galvin and Gagne.
CPU Scheduling – Multiprocessor
Example questions… Can a shell kill itself? Can a shell within a shell kill the parent shell? What happens to background processes when you exit from.
Lecture 2: Processes Part 1
Processor Management Damian Gordon.
The Linux Command Line Chapter 10
Operating Systems Lecture 12.
Windows Development Dynadata Copyright, 2014 © DynaData S.A. 1/49.
Chapter 3: Processes.
Lab 6: Process Management
Linux Process State Scheduling information Identifiers
Process Management -Compiled for CSIT
Process Management -Compiled for CSIT
Processor Management Damian Gordon.
Lecture 6 Introduction to Process Management
Java Chapter 3 (Estifanos Tilahun Mihret--Tech with Estif)
Presentation transcript:

Lecture 10: Processes II-A Process States Process vs. Thread Background/Foreground

Process States We’ve mentioned these before: –Running –Idle/Sleeping –Waiting for I/O –Zombie Now a new one: –Swapped Out

“Swapped Out” State We only have so much CPU power –Can’t run everything at the same time The processes must share How do we decide who gets processor time? –Does this question sound familiar?

“Swapped Out” State We only have so much CPU power –Can’t run everything at the same time The processes must share How do we decide who gets processor time? –Does this question sound familiar? –Similar to memory management!

Process Priority Linux –“Niceness” level –-20 (greedy) to +20 (charitable) Windows –IDLE_PRIORITY_CLASS –BELOW_NORMAL_PRIORITY_CLASS –NORMAL_PRIORITY_CLASS –ABOVE_NORMAL_PRIORITY_CLASS –HIGH_PRIORITY_CLASS –REALTIME_PRIORITY_CLASS

Process Priority Setting high priorities can be bad Why?

Process Priority Setting high priorities can be bad Why? –Other processes get neglected –Those other processes may be system processes –Neglected system processes can degrade performance of your process

Process Management On modern computers, we want to run tasks “simultaneously”… –…by interweaving Single CPU Appears simultaneous to us –…in parallel Multiple CPUs Truly simultaneous! For upcoming slides, we’re interweaving

Process Created out of a program Communicates with peers via interprocess communication –Low level: pipes, shared memory, etc –High level: MPI, ZeroMQ, etc Lasts for “length of program”

Thread Created out of ________ Communicates with peers –? Lasts for _________

Thread Created out of a process Communicates with peers –? Lasts for _________

Thread Created out of a process Communicates with peers –Shared memory space* Lasts for ________ * Not generally referred to as “shared memory”

Thread Created out of a process Communicates with peers –Shared memory space* Lasts for length of code segment * Not generally referred to as “shared memory”

Process Management We want to run multiple processes simultaneously –Let’s restrict ourselves to single terminal So far, we can… –…suspend a process –…resume a process What else can I do? –Change background/foreground

Background/Foreground A terminal can run many jobs* –“Infinite” in the background –One in the foreground By default, the job launches in the foreground How do we get stuff in the background? * A “job” is a command we ran

Background/Foreground At process launch –Use the ampersand –find / -name “*.txt &” While process is running –ctrl+z to suspend –bg %n n is the job number Use jobs command to discover job #s bg executes/resumes job… –…but in background

Background/Foreground BG jobs –What happens to stdout/stderr? –What happens to stdin?

Background/Foreground BG jobs –What happens to stdout/stderr? Still goes to specified place Output can get mixed with BGs and FG –What happens to stdin?

Background/Foreground BG jobs –What happens to stdout/stderr? Still goes to specified place Output can get mixed with BGs and FG –What happens to stdin? It doesn’t have access to it –How do we return stdin access to job?

Background/Foreground BG jobs –What happens to stdout/stderr? Still goes to specified place Output can get mixed with BGs and FG –What happens to stdin? It doesn’t have access to it –How do we return stdin access to job? Return it to foreground fg %n