4: Processes1 PROCESSES PROCESS CONCEPT: A program is passive; a process active. Attributes held by a process include hardware state, memory, CPU, progress.

Slides:



Advertisements
Similar presentations
OPERATING SYSTEMS PROCESSES
Advertisements

Ch4. Processes Process Concept (1) new waiting terminate readyrunning admitted interrupt exit scheduler dispatch I/O or event completion.
Abhinav Kamra Computer Science, Columbia University 4.1 Operating System Concepts Silberschatz, Galvin and Gagne  2002 Chapter 4: Processes Process Concept.
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,
Chapter 3: Processes.
Page 1 Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Silberschatz, Galvin and Gagne ©2007 Chapter 3: Processes.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
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.
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.
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)
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
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.
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.
11/13/20151 Processes ICS 240: Operating Systems –William Albritton Information and Computer Sciences Department at Leeward Community College –Original.
The act of Scheduling a process means changing the active PCB pointed to by the CPU. Also called a context switch. A context switch is essentially the.
CS212: OPERATING SYSTEM Lecture 2: Process 1. Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Process-Concept.
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.
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.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Process-Concept.
Processes & Threads Introduction to Operating Systems: Module 5.
Operating Systems (CS 340 D) Dr. Abeer Mahmoud Princess Nora University Faculty of Computer & Information Systems Computer science Department.
Processes. Process Concept Process Scheduling Operations on Processes Interprocess Communication Communication in Client-Server Systems.
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.
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
Threads, SMP, and Microkernels Chapter 4. Processes and Threads Operating systems use processes for two purposes - Resource allocation and resource ownership.
1 Module 3: Processes Reading: Chapter Next Module: –Inter-process Communication –Process Scheduling –Reading: Chapter 4.5, 6.1 – 6.3.
1 Răzvan Zota Operating systems - Processes.
Lecture 3 Process.
Chapter 3: Process Concept
Topic 3 (Textbook - Chapter 3) Processes
Operating System Concepts
Operating Systems (CS 340 D)
Operating systems - Processes
Process Management Presented By Aditya Gupta Assistant Professor
Processes Overview: Process Concept Process Scheduling
Chapter 3: Process Concept
Operating Systems (CS 340 D)
Applied Operating System Concepts
Chapter 3 Process Management.
Chapter 4: Processes Process Concept Process Scheduling
Lecture 2: Processes Part 1
Recap OS manages and arbitrates resources
OPERATING SYSTEMS PROCESSES
Operating systems - Processes
Process & its States Lecture 5.
Operating System Concepts
Threads Chapter 4.
Presentation transcript:

4: Processes1 PROCESSES PROCESS CONCEPT: A program is passive; a process active. Attributes held by a process include hardware state, memory, CPU, progress. WHY HAVE PROCESSES? Resource sharing ( logical (files) and physical(hardware) ). Computation speedup - taking advantage of multiprogramming – i.e. example of a customer/server database system. Modularity for protection. This lecture is about processes (threads of execution); what they are and how they cooperate.

4: Processes2 PROCESSES PROCESS STATE  New The process is just being put together.  Running Instructions being executed. This running process holds the CPU.  Waiting For an event (hardware, human, or another process.)  Ready The process has all needed resources - waiting for CPU only.  Suspended Another process has explicitly told this process to sleep. It will be awakened when a process explicitly awakens it.  Terminated The process is being torn apart.

4: Processes3 The act of Scheduling a process means changing the active PCB pointed to by the CPU. Also called a context switch. A context switch is essentially the same as a process switch - it means that the memory, as seen by one process is changed to the memory seen by another process. See Figure on Next Page (4.3) SCHEDULING QUEUES: (Process is driven by events that are triggered by needs and availability )  Ready queue = contains those processes that are ready to run.  I/O queue (waiting state ) = holds those processes waiting for I/O service. What do the queues look like? They can be implemented as single or double linked. See Figure Several Pages from Now (4.4) PROCESSES Scheduling Components

4: Processes4 Figure 4.3 PROCESSES Scheduling Components

4: Processes5 Figure 4.4 PROCESSES Scheduling Components

4: Processes6 PROCESS CONTROL BLOCK: CONTAINS INFORMATION ASSOCIATED WITH EACH PROCESS: It's a data structure holding:  PC, CPU registers,  memory management information,  accounting ( time used, ID,... )  I/O status ( such as file resources ),  scheduling data ( relative priority, etc. )  Process State (so running, suspended, etc. is simply a field in the PCB ). PROCESSES Scheduling Components

4: Processes7 LONG TERM SCHEDULER  Run seldom ( when job comes into memory )  Controls degree of multiprogramming  Tries to balance arrival and departure rate through an appropriate job mix. SHORT TERM SCHEDULER Contains three functions:  Code to remove a process from the processor at the end of its run. a)Process may go to ready queue or to a wait state.  Code to put a process on the ready queue – a)Process must be ready to run. b)Process placed on queue based on priority. PROCESSES Scheduling Components

4: Processes8 SHORT TERM SCHEDULER (cont.)  Code to take a process off the ready queue and run that process (also called dispatcher). a) Always takes the first process on the queue (no intelligence required) b) Places the process on the processor. This code runs frequently and so should be as short as possible. MEDIUM TERM SCHEDULER Mixture of CPU and memory resource management. Swap out/in jobs to improve mix and to get memory. Controls change of priority. PROCESSES Scheduling Components

4: Processes9 INTERRUPT HANDLER In addition to doing device work, it also readies processes, moving them, for instance, from waiting to ready. How do all these scheduling components fit together? Fig 4.5 PROCESSES Scheduling Components

4: Processes10 Creation Concurrent vs. sequential parent and child. All vs. partial resource sharing ( memory files, etc.) Resources given by parent to child. Termination Process completes code. Processes resources are exhausted. Process errors. Process resources must be cleaned up. Suspension Does the caller have the "privilege to do this? What is the current state of the target? Change PriorityDoes the caller have the "privilege to do this? What is the current state of the target? PROCESSES Operations On Processes

4: Processes11 There are tradeoffs for parent/child relationships. Parent can run concurrently with child or wait for completion. Child may share all (fork/join) or part ( as in UNIX ) of parent's variables. Parent may kill child (when not needed anymore, or when child has exceeded its allocated resources.) Death of parent usually forces death of child. Processes are static (never terminate) or dynamic ( can terminate ). Independent Execution is deterministic and reproducible. Execution can be stopped/ started without affecting other processes. Cooperating Execution depends on other processes or is time dependent. Here the same inputs won't always give the same outputs; the process depends on other external states. PROCESSES Process Relationships

4: Processes12 Also called light-weight processes. Each thread contains its own PC, registers, stacks ( State information ). Threads shared code, data, and files -- this entity is called a "task". A task contains one or more threads. Threads execute sequentially and can be running/blocked/terminated. Disadvantages: No protection since all threads see all data in task. Only one thread executing at any one instant. Useful for servers <-- give an example of this. Advantages: Easy ( and cheap ) to schedule. While one thread is blocked, others can run. Any thread has access to other thread's data. PROCESSES Threads

4: Processes13 Disadvantages: No protection since all threads see all data in task. Only one thread executing at any one instant. Useful for servers <-- give an example of this. Example of Threads in Solaris 2: User level threads (support is in user level library rather than in kernel.) These user level threads are associated with kernel based threads (Light weight process). User thread must have LWP in order to run. Also kernel threads are used for operations not mapped to a user process. Fig. 4.9 PROCESSES Threads

4: Processes14 This is how processes talk to each other. There are basically two methods: Shared memory (with a process "kick") -- fast/ no data transfer. Message Passing -- distributed/ better isolation. METHODS OF IMPLEMENTATION:  Direct or indirect - to process or mailbox.  Symmetric or asymmetric?  Buffering mechanism  Send by copy or by reference?  Fixed or variable size messages? FUNCTIONALITY OF COMMUNICATION LINKS:  How are the links formed?  How many processes on each link?  How many links per pair of processes?  Capacity - buffer space - can messages be enqueued.  Message formats and sizes  Uni- or bidirectional PROCESSES Interprocess Communication

4: Processes15 DIRECT COMMUNICATION: Need to know name of sender/receiver. Mechanism looks like this: send ( Process_P, message ) ; receive ( Process_Q, message ); receive ( id, message ) <-- from any sender The Producer/Consumer Problem is a standard mechanism. One process produces items that are handed off to the consumer where they are "used". repeat repeat produce item receive( producer, nextp ) send( consumer, nextp) consume item until false until false PROCESSES Interprocess Communication

4: Processes16 Other properties of Direct Communication:  Link established automatically (when send or receive requested.)  Only two processes in this form.  One link per pair of processes.  Generally Bi-directional  Receiver may not need ID of sender. Disadvantage of Direct Communication:  The names of processes must be known - they can't be easily changed since they are explicitly named in the send and receive. PROCESSES Interprocess Communication

4: Processes17 INDIRECT COMMUNICATION  Processes communicate via a named mailbox rather than via a process name. Mechanism looks like this: open( mailbox_name ); send ( mailbox_name, message ); receive ( mailbox_name, message);  Link is established if processes have a shared mailbox. So mailbox must be established before the send/receive.  More than two processes are allowed to use the same mailbox.  A process can open many mailboxes.  Used for both Uni- or bi-directional communication. PROCESSES Interprocess Communication

4: Processes18 INDIRECT COMMUNICATION  May cause confusion with multiple receivers - if several processes have outstanding receives on a mailbox, which one gets a message?  Solutions: Let link only have 2 processes. Let only one process do the receive. Let system choose, but do NOT let both processes get message  Mailboxes are User or System created. User ownership avoids confusion. When one process dies, how does the twin process "know"? If done by system, then must provide create/send/receive/destroy. PROCESSES Interprocess Communication

4: Processes19 BUFFERING: Options include:  Zero -- sender must wait for recipient to get message. Provides a rendezvous.  Bounded -- sender must wait for recipient if more than n messages in buffer.  Unbounded -- sender is never delayed. MESSAGE FORMAT:  Fixed, Variable, or Typed (as in language typing) size messages.  Send reference rather than copy (good for large messages).  Suspended vs. unsuspended sends. PROCESSES Interprocess Communication

4: Processes20 GIVEN AN EXCEPTION:  Process terminates ( sender or receiver ); system may terminate or notify other mailbox partner.  A lost message can have many options:  Left up to sender.  OS detects, resends itself.  OS detects, tells sender. PROCESSES Interprocess Communication

4: Processes21 WRAPUP PROCESSES We’ve looked in detail at how processes work. Specifically we’ve Seen how they get scheduled (and studied schedulers in doing so), Visited the actions that can be performed on objects, Examined the extension of processes called threads, Looked at how processes communicate with each other’