Ch4. Processes 2015-04-15.. 4.1 Process Concept (1) new waiting terminate readyrunning admitted interrupt exit scheduler dispatch I/O or event completion.

Slides:



Advertisements
Similar presentations
Operating Systems Lecture 7.
Advertisements

Abhinav Kamra Computer Science, Columbia University 4.1 Operating System Concepts Silberschatz, Galvin and Gagne  2002 Chapter 4: Processes Process Concept.
Adapted from slides ©2005 Silberschatz, Galvin, and Gagne Lecture 4: Processes.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Objectives Understand Process concept Process scheduling Creating.
Chapter 3: Processes.
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.
CMPT 300: Operating Systems I Ch 3: Processes Dr. Mohamed Hefeeda
1/30/2004CSCI 315 Operating Systems Design1 Processes Notice: The slides for this lecture have been largely based on those accompanying the textbook Operating.
Process Concept n An operating system executes a variety of programs: –Batch system – jobs –Time-shared systems – user programs or tasks n Textbook uses.
Chapter 3: Processes. Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication in Client-Server.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 7, 2006 Chapter 3: Processes Process Concept.
Operating System Concepts
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.
Silberschatz and Galvin  Operating System Concepts Module 4: Processes Process Concept Process Scheduling Operation on Processes Cooperating.
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  Applied Operating System Concepts Chapter 4: Processes Process Concept Process Scheduling Operation on Processes.
Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Inter-process Communication Communication in Client-Server.
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.
Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication in Client-Server.
Operating Systems Part III: Process Management (Process States and Transitions)
Chapter 3 Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Jan 19, 2005 Chapter 3: Processes Process Concept.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 4 Process Slide 1 Chapter 4 Process.
OS, , Part II Processes Department of Computer Engineering, PSUWannarat Suntiamorntut.
AE4B33OSS Chapter 3: Processes. 3.2Silberschatz, Galvin and Gagne ©2005AE4B33OSS Chapter 3: Processes Process Concept Process Scheduling Operations on.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 7, 2006 Outline n Process Concept n Process.
Chapter 3: Processes (6 th edition chap 4). 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Process Concept Process.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations.
1 11/1/2015 Chapter 4: Processes l Process Concept l Process Scheduling l Operations on Processes l Cooperating Processes l Interprocess Communication.
Chapter 2 Processes Processes Topics Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication.
Processes. Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication.
CS212: OPERATING SYSTEM Lecture 2: Process 1. Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Process-Concept.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations.
Processes CSCI 4534 Chapter 4. Introduction Early computer systems allowed one program to be executed at a time –The program had complete control of the.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 3 Operating Systems.
PREPARED BY : MAZHAR JAVED AWAN BSCS-III Process Communication & Threads 4 December 2015.
Chapter 3: Process-Concept. Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication.
Lecture: - Operating System Concepts Lecturer: - Pooja Sharma Computer Science Department, Punjabi University, Patiala.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Jan 19, 2005 Chapter 3: Processes Process Concept.
Chapter 3: Processes-Concept. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes-Concept Overview Process Scheduling.
Processes. Process Concept Process Scheduling Operations on Processes Interprocess Communication Communication in Client-Server Systems.
 Process Concept  Process Scheduling  Operations on Processes  Cooperating Processes  Interprocess Communication  Communication in Client-Server.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations.
CSE Operating System Principles
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
Chapter 3: Process-Concept. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Chapter 3: Process-Concept Process Concept Process Scheduling.
4.1 Operating System Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 7, 2006 Chapter 3: Processes Process Concept.
1 Module 3: Processes Reading: Chapter Next Module: –Inter-process Communication –Process Scheduling –Reading: Chapter 4.5, 6.1 – 6.3.
XE33OSA Chapter 3: Processes. 3.2XE33OSASilberschatz, Galvin and Gagne ©2005 Chapter 3: Processes Process Concept Process Scheduling Operations on Processes.
Principles of Operating Systems
Chapter 3: Process Concept
Topic 3 (Textbook - Chapter 3) Processes
Operating System Concepts
Chapter 4: Processes Process Concept Process Scheduling
Processes Overview: Process Concept Process Scheduling
Chapter 3: Process Concept
Applied Operating System Concepts
Chapter 3 Process Management.
CGS 3763 Operating Systems Concepts Spring 2013
Chapter 4: Processes Process Concept Process Scheduling
Lecture 2: Processes Part 1
Recap OS manages and arbitrates resources
Operating System Concepts
Processes August 10, 2019 OS:Processes.
Presentation transcript:

Ch4. Processes

4.1 Process Concept (1) new waiting terminate readyrunning admitted interrupt exit scheduler dispatch I/O or event completion I/O or event wait Diagram of process state Process control block pointer process state process number program counter register Memory limits List of open files

4.1 Process Concept (2) Diagram showing CPU switch from process to process. process P 0 process P 1 Operating system Interrupt or system call Save state into PCB 0 reload state from PCB 1 Save state into PCB 1 reload state from PCB 0 executing idle executing idle Interrupt or system call

4.2 Process Scheduling (1) F CPU utilization and higher throughput  Two processes, A and B, for execution  Process execution with multiprogramming Idle; input start Process A Idle; input Idle; input stop Idle; input start Process B Idle; input Idle; input stop Idle; input start Process P 0 Idle; input Idle; input stop Idle; input start Process P 1 Idle; input Idle; input stop

4.2 Process Scheduling (2) F Process scheduling Job SubmitHOLD Ready Queue I/O Request time slice expired Fork a child Wait for an interrupt CPU I/OI/O Queue Child executes Interrupt occurs Child terminate High level scheduling Intermediate level scheduling Low-level scheduling

4.2 Process Scheduling (3) F Scheduling Algorithm  High Level Scheduling by Spooler  Intermediate Level Scheduling = job scheduling = Long-term scheduler  Low Level Scheduling = process scheduling =short-term scheduler ( CPU )

Addition of medium-term scheduling to the queuing diagram partially executed swapped-out processes swap inswap out Ready Queue CPUEND I/O waiting Queue I/O 4.2 Process Scheduling (4)

4.3 Operation on Process (1) F O.S. mechanism Process Creation Process Termination F Process Graph : Graph for the relation of several processes Example) P1P1 P3P3 P2P2 P4P4 P5P5 P6P6 P i -> P j : node P i is parent of P j P j is child of P i -> : edge means that “ P i create P j ”

4.3 Operation on Process (2) F Process Creation  Execution ① Parent runs concurrently with children ② Parent waits until some or all of its children have terminated  Sharing Parent shares all common resources with child F Process Termination  Parent terminate the execution of children if  child use allocated resource excessively  task that assigned to child is over  cascading termination : if parent terminated, children terminated

F Process creation (parent process  childern) Fork S 1 ; Fork L ; S 2 ; L : S 3 ; Join Fork L 1 ; S 1 ; ¦ Go To L 2 ; ¦ L 1 : S 2 ; L 2 : Join Count ; S1 S2S3 Fork S1S2 S3 Join 4.3 Operation on Process (3)

ex) Concurrent read(a) ; read(b) ; c := a+b ; write(c) ; Count := 2 Fork L 1 ; read(a) ; Go to L 2 ; L 1 : read(b) ; L 2 : Join count ; c := a+b ; write(c) ; s1s1 s2s2 s3s3 s4s4 s6s6 s5s5 s7s7 S 1 ; count := 3 ; Fork L 1 ; S 2 ; S 4 ; Fork L 2 ; S 5 ; Go To L 3 ; L 2 : S 6 ; Go To L 3 ; L 1 : S 3 ; L 3 : Join count ; S 7 ; 4.3 Operation on Process (4)

4.4 ~ 4.5. Cooperating Process / Threads F Cooperating Process: Process that shares data with other processes F Task >> Thread a basic unit of CPU utilization =Light weight process a group of thread =heavy weight process * T raditional process : a task with one thread. UNIX Kernel : Single Tasking. MACH Kernel : multithread. F Producer & Consumer Processes ex) Assembly code Object Modules F Bounded Buffer / Unbounded - Buffer Producer. CompilerAssembler Loader

4.4 Cooperating Process F Concurrent processes  Independent processes : cannot affect the other processes  Cooperating processes : share data with other processes F Why cooperating?  Information sharing  Computation speedup  Modularity  convenience

4.4 Cooperating Process F Represent program that copy file f  g with concurrent Stmt fork/join and parbegin/parend statement Var f, g : file of T; r, s : T; count : integer; begin reset(f); read(f,r); while not eof(f) do begin count:=2 s:=r fork L1; write(g,s); go to L2; L1:read(f,r); L2:join count; end write(g,r); end Var f, g : file of T; r, s : T; count : integer; begin reset(f); read(f,r); while not eof(f) do begin s:=r parbegin write(g,s); read(f,r); parend end write(g,r); end

4.4 Cooperating process Ex) parbegin read(a); read(b); parend c:=a+b; write(c); Problem) for i=1,5 x(i)=x(i-1)+y(i-1) y(i)=x(i-1)  y(i-1) s(i)=x(i)+y(i) if s(i)>100 then a=a+1 else b=b+1 end  execute P 1 (i) and P 2 (i-1) concurrently P 1 (i) P 2 (i) P1P1 P2P2

PQ Send MSG Receive MSG 4.6 InterProcess Communication F Communication of Cooperating process  Shared Memory  IPC(method of Message communication) F IPC operation : Send, Receive F Consideration Issues  How many links  buffer space  Message size  unidirectional / bidirectional

4.6 Interprocess Communication F Communication link F Naming  Direct Communication  Indirect Communication F direct Communication  send(P,message) : Send a message to process P  receive(Q,message) : Receive a message to process Q ex) Producer-Consumer Problem  The producer process Repeat ……. Produce an item in nextp ……. Until false;

4.6 Interprocess Communication  The consumer process Repeat receive(procedure,nextc); ……. Consume the item in nextc ……. Until false;  send(P.MSG) : send a MSG to process P  receive(id,MSG) : Receive a MSG from any process

4.6 Interprocess Communication F Indirect communication : by mailbox(ports)  Send(A,MSG) : send a MSG to mailbox A  Receive(A,MSG) : Receive a MSG from mailbox A F Buffering  by Queue Capacity for link  Zero Capacity : maximum length Zero  MSG system = Rendezvous

4.6 Interprocess Communication  Bounded Capacity : finite length if full, sender wait  Unbounded Capacity : Sender is never delayed ex) P -- (MSG) -->Q P Q Send(Q,MSG) Receive(P,MSG) Receive(Q,MSG) Send(P,”ACK”) Asynchrouously