8-Sep-20061 Operating Systems Yasir Kiani. 8-Sep-20062 Agenda for Today Review of previous lecture Process scheduling concepts Process creation and termination.

Slides:



Advertisements
Similar presentations
A. Frank - P. Weisberg Operating Systems Process Scheduling and Switching.
Advertisements

The Process Model.
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.
Unix Processes.
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
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.
Process Concept An operating system executes a variety of programs
Operating Systems (CSCI2413) Lecture 3 Processes phones off (please)
1/26/2007CSCI 315 Operating Systems Design1 Processes Notice: The slides for this lecture have been largely based on those accompanying the textbook 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.
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.
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D.
Exec Function calls Used to begin a processes execution. Accomplished by overwriting process imaged of caller with that of called. Several flavors, use.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-1 Process Concepts Department of Computer Science and Software.
Processes: program + execution state
Chapter 3 Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Jan 19, 2005 Chapter 3: Processes Process Concept.
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 2 Processes Processes Topics Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Cooperating.
Processes. Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication.
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,
11/13/20151 Processes ICS 240: Operating Systems –William Albritton Information and Computer Sciences Department at Leeward Community College –Original.
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.
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,
3.1 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Overview: Process Concept Process Scheduling Operations on Processes.
1  process  process creation/termination  context  process control block (PCB)  context switch  5-state process model  process scheduling short/medium/long.
Lecture 4: Processes & Threads. Lecture 4 / Page 2AE4B33OSS Silberschatz, Galvin and Gagne ©2005 Contents The concept of Process Process states and life-cycle.
 Process Concept  Process Scheduling  Operations on Processes  Cooperating Processes  Interprocess Communication  Communication in Client-Server.
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.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 8 Processes II Read Ch.
1 Module 3: Processes Reading: Chapter Next Module: –Inter-process Communication –Process Scheduling –Reading: Chapter 4.5, 6.1 – 6.3.
Operating System Components) These components reflect the services made available by the O.S. Process Management Memory Management I/O Device Management.
Lecture 3 Process.
Chapter 3: Processes.
Chapter 3: Process Concept
Topic 3 (Textbook - Chapter 3) Processes
Operating System Concepts
Process Management Presented By Aditya Gupta Assistant Professor
Processes Overview: Process Concept Process Scheduling
Chapter 3: Process Concept
Chapter 3: Processes Source & Copyright: Operating System Concepts, Silberschatz, Galvin and Gagne.
Chapter 3: Processes.
System Structure and Process Model
Chapter 3: Processes.
Process Virtualization. Process Process is a program that has initiated its execution. A program is a passive entity; whereas a process is an active entity.
System Structure and Process Model
Operating Systems CPU Scheduling.
CGS 3763 Operating Systems Concepts Spring 2013
Lecture 2: Processes Part 1
System Structure B. Ramamurthy.
Recap OS manages and arbitrates resources
Operating Systems Lecture 6.
Process & its States Lecture 5.
Chapter 3: Processes.
Operating System Concepts
Chapter 3: Processes.
Processes – Part I.
Chapter 3: Processes Process Concept Process Scheduling
Presentation transcript:

8-Sep Operating Systems Yasir Kiani

8-Sep Agenda for Today Review of previous lecture Process scheduling concepts Process creation and termination Process management in UNIX/Linux— system calls: fork, exec, wait, exit Sample codes Recap of the lecture

8-Sep Review of Lecture 5 Browsing the UNIX/Linux directory structure Useful UNIX/Linux commands Process concept—attributes, states, types (CPU- and I/O-bound), PCB, OS queues, CPU scheduling, and context switch

8-Sep Schedulers  Long term scheduler  Short term scheduler  Medium term scheduler

8-Sep Queues in a Computer System

8-Sep Long Term Scheduler  Long-term scheduler (or job scheduler) – selects processes from the job pool to be brought into the ready queue.  Long-term scheduler is invoked very infrequently (seconds, minutes)  (may be slow).  The long-term scheduler controls the degree of multiprogramming.  More processes, smaller percentage of time each process is executed

8-Sep Short Term Scheduler  Short-term scheduler (or CPU scheduler) – selects which process should be executed next and allocates it the CPU through the dispatcher.  Short-term scheduler is invoked very frequently (milliseconds)  (must be fast).  Invoked when following events occur  CPU slice of the current process finishes  Current process needs to wait for an event  Clock interrupt  I/O interrupt  System call  Signal

8-Sep Medium Term Scheduler  Also known as swapper  Selects an in-memory process and swaps it out to the disk temporarily  Swapping decision is based on several factors  Arrival of a higher priority process but no memory available  Poor mix of jobs  Memory request of a process cannot be met

8-Sep Addition of Medium Term Scheduling

8-Sep Context Switch  When CPU switches to another process, the system must save the state (context) of the ‘current’ (old) process and load the saved state for the new process.  Context-switch time is overhead; the system does no useful work while switching.  Time dependent on hardware support; typically in microseconds

8-Sep Process Creation  Parent process create children processes, which, in turn create other processes, forming a tree of processes.  Resource sharing  Parent and children share all resources.  Children share a subset of parent’s resources.  Parent and child share no resources.  Execution  Parent and children execute concurrently.  Parent waits until children terminate.

8-Sep Process Creation …  Address space  Child duplicate of parent.  Child has a program loaded onto it.  UNIX examples  fork system call creates a new process  exec system call used after a fork to replace the process’ memory image with a new executable.

8-Sep Processes Tree on a UNIX System

8-Sep Process Termination  Process executes the last statement and requests the operating system to terminate it ( exit ).  Output data from child to parent (via wait ).  Process resources are deallocated by the operating system, to be recycled later.

8-Sep Process Termination …  Parent may terminate execution of children processes ( abort ).  Child has exceeded allocated resources (main memory, execution time, etc.).  Parent needs to create another child but has reached its maximum children limit  Task performed by the child is no longer required.  Parent exits.  Operating system does not allow child to continue if its parent terminates.  Cascaded termination

8-Sep Process Management in UNIX/Linux Important process-related UNIX/Linux system calls  fork  wait  exec  exit

8-Sep fork()  When the fork system call is executed, a new process is created which consists of a copy of the address space of the parent.  This mechanism allows the parent process to communicate easily with the child process. SYNOPSIS #include #include pid_t fork(void);

8-Sep fork()...  The return code for fork is zero for the child process and the process identifier of child is returned to the parent process.  On success, both processes continue execution at the instruction after the fork call.  On failure, -1 is returned to the parent process and errno is set appropriately to indicate the reason of failure; no child is created

8-Sep fork()—Sample Code main() { int pid;... pid = fork(); if (pid == 0) { /* Code for child */... } else { /* Code for parent */... }... }

8-Sep fork()—Inherits from the Parent The child process inherits the following attributes from the parent:  Environment  Open file descriptor table  Signal handling settings  Nice value  Current working directory  Root directory  File mode creation mask ( umask )  Etc.

8-Sep fork()—Child Differs from the Parent The child process differs from the parent process:  Different process ID (PID)  Different parent process ID (PPID)  Child has its own copy of parent’s file descriptors  Etc.

8-Sep fork()—Reasons for Failure  Maximum number of processes allowed to execute under one user has exceeded  Maximum number of processes allowed on the system has exceeded  Not enough swap space

8-Sep Recap of Lecture Review of previous lecture Process scheduling concepts Process creation and termination Process management in UNIX/Linux— system calls: fork, wait, exit Sample codes Recap of the lecture