Lecture: - Operating System Concepts Lecturer: - Pooja Sharma Computer Science Department, Punjabi University, Patiala.

Slides:



Advertisements
Similar presentations
Dr. Kalpakis CMSC 421, Operating Systems. Fall Processes.
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.
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.
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.
Process Management. Processes Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication.
Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication in Client-Server Systems.
Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication in Client-Server.
Chapter 4: Processes 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 - 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.
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.
Chapter 3: Processes. 3.2CSCI 380 Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication.
1 11/1/2015 Chapter 4: Processes l Process Concept l Process Scheduling l Operations on Processes l Cooperating Processes l Interprocess Communication.
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.
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.
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.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations.
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.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating.
3.1 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Overview: Process Concept Process Scheduling Operations on Processes.
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.
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.
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 Chapter 3: Processes Process Concept Process Scheduling Operations.
Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication in Client-Server.
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.
Operating System Components) These components reflect the services made available by the O.S. Process Management Memory Management I/O Device Management.
Principles of Operating Systems
Chapter 3: Process Concept
Topic 3 (Textbook - Chapter 3) Processes
Operating System Concepts
Processes Overview: Process Concept Process Scheduling
Chapter 3: Process Concept
Applied Operating System Concepts
Chapter 3: Processes.
Chapter 4: Processes Process Concept Process Scheduling
Lecture 2: Processes Part 1
Recap OS manages and arbitrates resources
Process & its States Lecture 5.
Operating System Concepts
Presentation transcript:

Lecture: - Operating System Concepts Lecturer: - Pooja Sharma Computer Science Department, Punjabi University, Patiala.

 An operating system executes a variety of programs ▪ batch systems - jobs ▪ time-shared systems - user programs or tasks ▪ job and program used interchangeably  Process - a program in execution ▪ process execution proceeds in a sequential fashion  A process contains ▪ program counter, stack and data section

new admitted interrupt I/O or event complet ion Scheduler dispatch I/O or event wait exit ready running terminated waiting

 New - The process is being created.  Running - Instructions are being executed.  Waiting - Waiting for some event to occur.  Ready - Waiting to be assigned to a processor.  Terminated - Process has finished execution.

 Contains information associated with each process ▪ Process State - e.g. new, ready, running etc. ▪ Program Counter - address of next instruction to be executed ▪ CPU registers - general purpose registers, stack pointer etc. ▪ CPU scheduling information - process priority, pointer ▪ Memory Management information - base/limit information ▪ Accounting information - time limits, process number ▪ I/O Status information - list of I/O devices allocated

 Job Queue - set of all processes in the system  Ready Queue - set of all processes residing in main memory, ready and waiting to execute.  Device Queues - set of processes waiting for an I/O device.  Process migration between the various queues.  Queue Structures - typically linked list, circular list etc.

Device Queue Ready Queue

Queueing Diagram

 Long-term scheduler (or job scheduler) - ▪ selects which processes should be brought into the ready queue. ▪ invoked very infrequently (seconds, minutes); may be slow. ▪ controls the degree of multiprogramming  Short term scheduler (or CPU scheduler) - ▪ selects which process should execute next and allocates CPU. ▪ invoked very frequently (milliseconds) - must be very fast  Medium Term Scheduler ▪ swaps out process temporarily ▪ balances load for better throughput

 I/O bound process - ▪ spends more time in I/O, short CPU bursts, CPU underutilized.  CPU bound process - ▪ spends more time doing computations; few very long CPU bursts, I/O underutilized.  The right job mix: ▪ Long term scheduler - admits jobs to keep load balanced between I/O and CPU bound processes

 Task that switches CPU from one process to another process ▪ the CPU must save the PCB state of the old process and load the saved PCB state of the new process.  Context-switch time is overhead; ▪ system does no useful work while switching ▪ can become a bottleneck  Time for context switch is dependent on hardware support ( microseconds).

 Processes are created and deleted dynamically  Process which creates another process is called a parent process; the created process is called a child process.  Result is a tree of processes ▪ e.g. UNIX - processes have dependencies and form a hierarchy.  Resources required when creating process ▪ CPU time, files, memory, I/O devices etc.

 Resource sharing ▪ Parent and children share all resources. ▪ Children share subset of parent’s resources - prevents many processes from overloading the system. ▪ Parent and children share no resources.  Execution ▪ Parent and child execute concurrently. ▪ Parent waits until child has terminated.  Address Space ▪ Child process is duplicate of parent process. ▪ Child process has a program loaded into it.

 All 32-bit applications have a 4-gigabyte (GB) process address space (32-bit addresses can map a maximum of 4 GB of memory). Microsoft Windows operating systems provide applications with access to 2 GB of process address space, specifically known as user mode virtual address space. All threads owned by an application share the same user mode virtual address space. The remaining 2 GB are reserved for the operating system (also known as kernel mode address space). All operating system editions starting with Windows 2000 Server, including Windows Server 2003, have a boot.ini switch that can provide applications with access to 3 GB of process address space, limiting the kernel mode address space to 1 GB.  Address Windowing Extensions (AWE) extend the capabilities of 32-bit applications by allowing access to as much physical memory as the operating system supports. AWE accomplishes this by mapping a subset of up to 64 GB into the user address space. Mapping between the application buffer pool and AWE-mapped memory is handled through manipulation of the Windows virtual memory tables.  To enable support for 3 GB of user mode process space, you must add the /3gb parameter to the boot.ini file and reboot the computer, allowing the /3gb parameter to take effect. Setting this parameter allows user application threads to address 3 GB of process address space, and reserves 1 GB of process address space for the operating system.

 Process executes last statement and asks the operating system to delete it (exit). ▪ Output data from child to parent (via wait). ▪ Process’ resources are deallocated by operating system.  Parent may terminate execution of child processes. ▪ Child has exceeded allocated resources. ▪ Task assigned to child is no longer required. ▪ Parent is exiting  OS does not allow child to continue if parent terminates  Cascading termination

 Mechanism for processes to communicate and synchronize their actions. ▪ Via shared memory ▪ Via Messaging system - processes communicate without resorting to shared variables.  IPC facility provides two operations.  send(message) - message size can be fixed or variable  receive(message)

▪ Producer repeat … produce an item in nextp; … send(consumer, nextp); until false; ▪ Consumer repeat receive(producer, nextc); … consume item from nextc; … until false;

 If processes P and Q wish to communicate, they need to: ▪ establish a communication link between them ▪ exchange messages via send/receive  Fixed vs. Variable size message ▪ Fixed message size - straightforward physical implementation, programming task is difficult due to fragmentation ▪ Variable message size - simpler programming, more complex physical implementation.

 Sender and Receiver processes must name each other explicitly: ▪ send(P, message) - send a message to process P ▪ receive(Q, message) - receive a message from process Q  Properties of communication link: ▪ Links are established automatically. ▪ A link is associated with exactly one pair of communicating processes. ▪ Exactly one link between each pair. ▪ Link may be unidirectional, usually bidirectional.

 Messages are directed to and received from mailboxes (also called ports)  Unique ID for every mailbox.  Processes can communicate only if they share a mailbox. Send(A, message) /* send message to mailbox A */ Receive(A, message) /* receive message from mailbox A */  Properties of communication link  Link established only if processes share a common mailbox.  Link can be associated with many processes.  Pair of processes may share several communication links  Links may be unidirectional or bidirectional

 Operations  create a new mailbox  send/receive messages through mailbox  destroy a mailbox  Issue: Mailbox sharing  P1, P2 and P3 share mailbox A.  P1 sends message, P2 and P3 receive… who gets message??  Possible Solutions  disallow links between more than 2 processes  allow only one process at a time to execute receive operation  allow system to arbitrarily select receiver and then notify sender.

 Link has some capacity - determine the number of messages that can reside temporarily in it.  Queue of messages attached to link ▪ Zero-capacity Queues: 0 messages  sender waits for receiver  Bounded capacity Queues: Finite length of n messages  sender waits if link is full ▪ Unbounded capacity Queues: Infinite queue length  sender never waits

 Process Termination ▪ Problem: P(sender) terminates, Q(receiver) blocks forever. ▪ Solutions:  System terminates Q.  System notifies Q that P has terminated.  Q has an internal mechanism(timer) that determines how long to wait for a message from P. ▪ Problem: P(sender) sends message, Q(receiver) terminates. In automatic buffering, P sends message until buffer is full or forever. In no-buffering scheme, P blocks forever. ▪ Solutions:  System notifies P  System terminates P  P and Q use acknowledgement with timeout

 Lost Messages  sender is responsible for detecting it using timeouts  Scrambled Messages ▪ Message arrives from sender P to receiver Q, but information in message is corrupted due to noise in communication channel. ▪ Solution  need error detection mechanism, e.g. CHECKSUM  need error correction mechanism, e.g. retransmission

 Concurrent Processes can be ▪ Independent processes  cannot affect or be affected by the execution of another process. ▪ Cooperating processes  can affect or be affected by the execution of another process.  Advantages of process cooperation:  Information sharing  Computation speedup  Modularity  Convenience(e.g. editing, printing, compiling)  Concurrent execution requires  process communication and process synchronization

 Paradigm for cooperating processes;  producer process produces information that is consumed by a consumer process.  We need buffer of items that can be filled by producer and emptied by consumer. ▪ Unbounded-buffer places no practical limit on the size of the buffer. Consumer may wait, producer never waits. ▪ Bounded-buffer assumes that there is a fixed buffer size. Consumer waits for new item, producer waits if buffer is full.  Producer and Consumer must synchronize.

 Shared data var n; Struct item = ….; var buffer: array[0..n-1] of item; in, out: 0..n-1; in :=0; out:= 0; /* shared buffer = circular array */ /* Buffer empty if in == out */ /* Buffer full if (in+1) mod n == out */ /* noop means ‘do nothing’ */

 Producer process - creates filled buffers repeat … produce an item in nextp … if in+1 mod n = out noop; buffer[in] := nextp; in := in+1; until false;

 Consumer process - Empties filled buffers repeat if in = out noop; nextc := buffer[out] ; out:= out+1; … consume the next item in nextc … until false;