CSC 360- Instructor: K. Wu Processes. CSC 360- Instructor: K. Wu Agenda 1.What is a process? 2.Process states 3. PCB 4.Context switching 5.Process scheduling.

Slides:



Advertisements
Similar presentations
CSC 501 Lecture 2: Processes. Von Neumann Model Both program and data reside in memory Execution stages in CPU: Fetch instruction Decode instruction Execute.
Advertisements

Introduction to Processes
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Objectives Understand Process concept Process scheduling Creating.
Processes CSCI 444/544 Operating Systems Fall 2008.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
CMPT 300: Operating Systems I Ch 3: Processes Dr. Mohamed Hefeeda
Ceng Operating Systems Chapter 2.1 : Processes Process concept Process scheduling Interprocess communication Deadlocks Threads.
CS-502 Fall 2006Processes in Unix, Linux, & Windows 1 Processes in Unix, Linux, and Windows CS502 Operating Systems.
Chapter 3: Processes. Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication in Client-Server.
CSSE Operating Systems
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 7, 2006 Chapter 3: Processes Process Concept.
Unix & Windows Processes 1 CS502 Spring 2006 Unix/Windows Processes.
Processes April 5, 2000 Instructor: Gary Kimura Slides courtesy of Hank Levy.
Operating Systems (CSCI2413) Lecture 3 Processes phones off (please)
Processes in Unix, Linux, and Windows CS-502 Fall Processes in Unix, Linux, and Windows CS502 Operating Systems (Slides include materials from Operating.
CE Operating Systems Lecture 5 Processes. Overview of lecture In this lecture we will be looking at What is a process? Structure of a process Process.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations.
Process Management. Processes Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication.
Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication in Client-Server.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 7, 2006 Process Concept Process – a program.
Multiprogramming CSE451 Andrew Whitaker. Overview Multiprogramming: Running multiple programs “at the same time”  Requires multiplexing (sharing) the.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-1 Process Concepts Department of Computer Science and Software.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Processes: program + execution state
1 Chapter 2.1 : Processes Process concept Process concept Process scheduling Process scheduling Interprocess communication Interprocess communication Threads.
Chapter 3 Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Jan 19, 2005 Chapter 3: Processes Process Concept.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes Revised and updated by David Sarne.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 2-1: Process Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
Chapter 3: Processes. 3.2CSCI 380 Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication.
8-Sep Operating Systems Yasir Kiani. 8-Sep Agenda for Today Review of previous lecture Process scheduling concepts Process creation and termination.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Cooperating.
Computer Studies (AL) Operating System Process Management - Process.
Processes – Part I Processes – Part I. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Review on OSs Upon brief introduction of OSs,
CS212: OPERATING SYSTEM Lecture 2: Process 1. Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Process-Concept.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 3 Operating Systems.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating.
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,
Concurrency & Context Switching Process Control Block What's in it and why? How is it used? Who sees it? 5 State Process Model State Labels. Causes of.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Process-Concept.
1  process  process creation/termination  context  process control block (PCB)  context switch  5-state process model  process scheduling short/medium/long.
Operating Systems Lecture Notes Processes Matthew Dailey Some material © Silberschatz, Galvin, and Gagne, 2002.
Lecture 4: Processes & Threads. Lecture 4 / Page 2AE4B33OSS Silberschatz, Galvin and Gagne ©2005 Contents The concept of Process Process states and life-cycle.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 7, 2006 Chapter 3: Processes Process Concept.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations.
1 Module 3: Processes Reading: Chapter Next Module: –Inter-process Communication –Process Scheduling –Reading: Chapter 4.5, 6.1 – 6.3.
Lecture 3 Process.
Chapter 3: Processes.
Chapter 3: Process Concept
Topic 3 (Textbook - Chapter 3) Processes
Lecture Topics: 11/1 Processes Process Management
Chapter 3: Process Concept
Chapter 3: Processes.
Processes A process is a running program.
Chapter 3: Processes.
Chapter 3 Process Management.
CGS 3763 Operating Systems Concepts Spring 2013
Lecture 2: Processes Part 1
Process & its States Lecture 5.
Chapter 3: Processes.
Processes Hank Levy 1.
Processes in Unix and Windows
Outline Chapter 2 (cont) Chapter 3: Processes Virtual machines
Processes Hank Levy 1.
Chapter 3: Process Concept
Presentation transcript:

CSC 360- Instructor: K. Wu Processes

CSC 360- Instructor: K. Wu Agenda 1.What is a process? 2.Process states 3. PCB 4.Context switching 5.Process scheduling 6.Process creation 7.Process termination 8.Process communication

CSC 360- Instructor: K. Wu CSc 360Overview 2 1. What is a Process? Process: a program in execution Program: passive entity static binary file on storage –e.g., gcc -o hello hello.c; ls -l hello -rwxrwxr-x 1 user group size date/time hello Process: active entity; resource allocated!./hello –text (code); data (static), stack, heap –process control block free mem

CSC 360- Instructor: K. Wu CSc 360Overview 3 2. Process states E.g., one CPU one running process at any time maybe many ready/waiting processes

CSC 360- Instructor: K. Wu CSc 360Overview 4 3. Process control blocks (PCB) PCB: keep track processes state: ready/running, etc CPU –PC, registers, priority, etc memory –memory control information I/O –e.g., opened files accounting

CSC 360- Instructor: K. Wu CSc 360Overview 5 4. Context switching Context switch save states restore states When timer I/O, memory trap system call

CSC 360- Instructor: K. Wu CSc 360Overview 6 5. Process scheduling (1) Multiprogramming utilization Timesharing interactive Scheduling queues linked list ready queue I/O queue

CSC 360- Instructor: K. Wu CSc 360Overview 7 5. Process Scheduling (2): Queuing system

CSC 360- Instructor: K. Wu CSc 360Overview 8 5. Process Scheduling (3): Queuing scheduler Who’s the next? Long-term scheduler job scheduler (spooling) get to ready queue CPU-intensive vs I/O intensive Short-term scheduler CPU scheduler frequency vs overhead

CSC 360- Instructor: K. Wu CSc 360Overview 9 5. Process Scheduling (4): More on scheduling Medium-term scheduler who is NOT the next –reduce the degree of multiprogramming swap-in/out Scheduling algorithms first-come-first-server, shortest-job-first, priority, round- robin, fair and weighted fair, … more in Chapter 5

CSC 360- Instructor: K. Wu CSc 360Overview Process creation (1) Creating processes parent process: create child processes child process: created by its parent process Process tree recursive parent-child relationship; why tree? –/usr/bin/pstree Process ID (PID) and Parent PID (PPID) usually nonnegative integer

CSC 360- Instructor: K. Wu CSc 360Overview Process creation (2): Process tree sched (0) init (1) –all user processes pageout –memory fsflush –file system pstree on linux.csc.uvic.ca

CSC 360- Instructor: K. Wu CSc 360Overview Process creation (3): Parent vs child processes Process: running program + resources Resource sharing: possible approaches all shared some shared (e.g., read-only code) nothing shared* Process execution: possible approaches parent waits until child finishes parent and child run concurrently*

CSC 360- Instructor: K. Wu CSc 360Overview Process creation (4): fork(), exec*(), wait() Create a child process: fork() return code < 0: error (in “parent” process) return code = 0: you’re in child process return code > 0: you’re in parent process –return code = child’s PID Child process: load a new program exec*(): front-end for execve(file, arg, environ) Parent process: wait() and waitpid()

CSC 360- Instructor: K. Wu CSc 360Overview 14 int main() { Pid_t pid; /* fork another process */ pid = fork(); if (pid < 0) { /* error occurred */ fprintf(stderr, "Fork Failed"); exit(-1); } else if (pid == 0) { /* child process */ execlp("/bin/ls", "ls", NULL); } else { /* parent process */ /* parent will wait for the child to complete */ wait (NULL); printf ("Child Complete"); exit(0); } Example

CSC 360- Instructor: K. Wu CSc 360Overview Process termination Terminate itself: exit() report status to parent process release allocated resources Terminate child processes: kill(pid, signal) child resource exceeded child process no long needed parent is exiting –cascading termination –find another parent

CSC 360- Instructor: K. Wu CSc 360Overview Process communication (1) Independent process standalone process Cooperating process affected by or affecting other processes –sharing, parallel, modularity, convenience Process communication shared memory message passing

CSC 360- Instructor: K. Wu CSc 360Overview Process communication (2): Message passing vs shared memory Overhead Protection

CSC 360- Instructor: K. Wu CSc 360Overview 18 More Info. Explore further –/bin/ps, /usr/bin/top, /usr/bin/pstree how does a child process find its parent’s PID?